comparison fuzz.h @ 1758:1365661f6be6

Disable stderr output for fuzzer by default
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Oct 2020 22:40:08 +0800
parents 517fb7b62438
children 096a66e45212
comparison
equal deleted inserted replaced
1757:517fb7b62438 1758:1365661f6be6
12 12
13 // once per process 13 // once per process
14 void fuzz_common_setup(void); 14 void fuzz_common_setup(void);
15 void fuzz_svr_setup(void); 15 void fuzz_svr_setup(void);
16 void fuzz_cli_setup(void); 16 void fuzz_cli_setup(void);
17
18 // constructor attribute so it runs before main(), including
19 // in non-fuzzing mode.
20 void fuzz_early_setup(void) __attribute__((constructor));
17 21
18 // must be called once per fuzz iteration. 22 // must be called once per fuzz iteration.
19 // returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE 23 // returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE
20 int fuzz_set_input(const uint8_t *Data, size_t Size); 24 int fuzz_set_input(const uint8_t *Data, size_t Size);
21 25
66 // write out decrypted session data to this FD if it's set 70 // write out decrypted session data to this FD if it's set
67 // flag - this needs to be set manually in cli-main.c etc 71 // flag - this needs to be set manually in cli-main.c etc
68 int dumping; 72 int dumping;
69 // the file descriptor 73 // the file descriptor
70 int recv_dumpfd; 74 int recv_dumpfd;
75
76 // avoid filling fuzzing logs, this points to /dev/null
77 FILE *stderr;
71 }; 78 };
72 79
73 extern struct dropbear_fuzz_options fuzz; 80 extern struct dropbear_fuzz_options fuzz;
74 81
82 /* This is a bodge but seems to work.
83 glibc stdio.h has the comment
84 "C89/C99 say they're macros. Make them happy." */
85 #ifdef stderr
86 #undef stderr
87 #endif
88 #define stderr (fuzz.stderr)
89
75 #endif // DROPBEAR_FUZZ 90 #endif // DROPBEAR_FUZZ
76 91
77 #endif /* DROPBEAR_FUZZ_H */ 92 #endif /* DROPBEAR_FUZZ_H */