fuzz: Create fuzzers with default and custom crypto plugins

The pa_tnc fuzzer does not rely on any plugins and the pb_tnc fuzzer is
a bit special in that it does use code from the tnccs-20 plugin, but that
doesn't actually have to be loaded as such. The fuzzer directly calls
statically linked code from the plugin.
This commit is contained in:
Tobias Brunner
2026-04-08 15:56:42 +02:00
parent 521c6e05c5
commit 444a1dc0e3
6 changed files with 83 additions and 46 deletions
+1 -7
View File
@@ -20,7 +20,6 @@
#include <state_machine/pb_tnc_state_machine.h>
#include <utils/debug.h>
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
{
pb_tnc_batch_t *batch;
@@ -33,11 +32,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
dbg_default_set_level(-1);
library_init(NULL, "fuzz_pb_tnc");
plugin_loader_add_plugindirs(PLUGINDIR, PLUGINS);
if (!lib->plugins->load(lib->plugins, PLUGINS))
{
return 1;
}
chunk = chunk_create((u_char*)buf, len);
INIT(state,
@@ -73,7 +68,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
batch->destroy(batch);
free(state);
lib->plugins->unload(lib->plugins);
library_deinit();
return 0;
}