diff options
Diffstat (limited to 'fuzz.h')
-rw-r--r-- | fuzz.h | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -15,6 +15,10 @@ void fuzz_common_setup(void); void fuzz_svr_setup(void); void fuzz_cli_setup(void); +// constructor attribute so it runs before main(), including +// in non-fuzzing mode. +void fuzz_early_setup(void) __attribute__((constructor)); + // must be called once per fuzz iteration. // returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE int fuzz_set_input(const uint8_t *Data, size_t Size); @@ -29,7 +33,7 @@ int fuzz_checkpubkey_line(buffer* line, int line_num, char* filename, const char* algo, unsigned int algolen, const unsigned char* keyblob, unsigned int keybloblen); extern const char * const * fuzz_signkey_names; -void fuzz_seed(void); +void fuzz_seed(const unsigned char* dat, unsigned int len); // helpers void fuzz_get_socket_address(int fd, char **local_host, char **local_port, @@ -68,10 +72,27 @@ struct dropbear_fuzz_options { int dumping; // the file descriptor int recv_dumpfd; + + // avoid filling fuzzing logs, this points to /dev/null + FILE *fake_stderr; }; extern struct dropbear_fuzz_options fuzz; +/* guard for when fuzz.h is included by fuzz-common.c */ +#ifndef FUZZ_NO_REPLACE_STDERR + +/* This is a bodge but seems to work. + glibc stdio.h has the comment + "C89/C99 say they're macros. Make them happy." */ +/* OS X has it as a macro */ +#ifdef stderr +#undef stderr +#endif +#define stderr (fuzz.fake_stderr) + +#endif /* FUZZ_NO_REPLACE_STDERR */ + #endif // DROPBEAR_FUZZ #endif /* DROPBEAR_FUZZ_H */ |