From a0d65d8275a7b7c4b744e9a3479c781c47ab3937 Mon Sep 17 00:00:00 2001 From: pedbap Date: Tue, 29 Jun 2021 19:11:45 +0000 Subject: [PATCH] hexdigest_to_digest() isolated harness --- src/test/fuzz/fuzz_hexdigest.c | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/test/fuzz/fuzz_hexdigest.c diff --git a/src/test/fuzz/fuzz_hexdigest.c b/src/test/fuzz/fuzz_hexdigest.c new file mode 100644 index 0000000000..e4fd0a8c76 --- /dev/null +++ b/src/test/fuzz/fuzz_hexdigest.c @@ -0,0 +1,69 @@ +#include "core/or/or.h" + +#include "app/config/config.h" +#include "core/mainloop/connection.h" +#include "core/mainloop/mainloop.h" +#include "core/or/circuitlist.h" +#include "core/or/circuituse.h" +#include "core/or/extendinfo.h" +#include "core/or/policies.h" +#include "feature/client/bridges.h" +#include "feature/control/control_events.h" +#include "feature/dirauth/authmode.h" +#include "feature/dirauth/process_descs.h" +#include "feature/dirauth/reachability.h" +#include "feature/dircache/dirserv.h" +#include "feature/dirclient/dirclient.h" +#include "feature/dirclient/dirclient_modes.h" +#include "feature/dirclient/dlstatus.h" +#include "feature/dircommon/directory.h" +#include "feature/nodelist/authcert.h" +#include "feature/nodelist/describe.h" +#include "feature/nodelist/dirlist.h" +#include "feature/nodelist/microdesc.h" +#include "feature/nodelist/networkstatus.h" +#include "feature/nodelist/node_select.h" +#include "feature/nodelist/nodelist.h" +#include "feature/nodelist/routerinfo.h" +#include "feature/nodelist/routerlist.h" +#include "feature/dirparse/routerparse.h" +#include "feature/nodelist/routerset.h" +#include "feature/nodelist/torcert.h" +#include "feature/relay/routermode.h" +#include "feature/relay/relay_find_addr.h" +#include "feature/stats/rephist.h" +#include "lib/crypt_ops/crypto_format.h" +#include "lib/crypt_ops/crypto_rand.h" + +#include "feature/dircommon/dir_connection_st.h" +#include "feature/dirclient/dir_server_st.h" +#include "feature/nodelist/document_signature_st.h" +#include "feature/nodelist/extrainfo_st.h" +#include "feature/nodelist/networkstatus_st.h" +#include "feature/nodelist/networkstatus_voter_info_st.h" +#include "feature/nodelist/node_st.h" +#include "feature/nodelist/routerinfo_st.h" +#include "feature/nodelist/routerlist_st.h" +#include "feature/nodelist/vote_routerstatus_st.h" + +#include "lib/crypt_ops/digestset.h" + +int fuzz_init(void) +{ + return 0; +} + +int fuzz_cleanup(void) +{ + return 0; +} + +int fuzz_main(const uint8_t *data, size_t sz) +{ + char *fuzzing_data = tor_memdup_nulterm(data, sz); + char digest[20]; + + hexdigest_to_digest(fuzzing_data, digest); + tor_free(fuzzing_data); + return 0; +}