Mercurial > dropbear
annotate fuzz.h @ 1369:ddfcadca3c4c fuzz
fuzzer-pubkey
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 23 May 2017 22:43:34 +0800 |
parents | 6b89eb92f872 |
children | d4cc85e6c569 |
rev | line source |
---|---|
1348 | 1 #ifndef DROPBEAR_FUZZ_H |
2 #define DROPBEAR_FUZZ_H | |
3 | |
1357 | 4 #include "config.h" |
5 #ifdef DROPBEAR_FUZZ | |
6 | |
1348 | 7 #include "includes.h" |
8 #include "buffer.h" | |
1357 | 9 #include "algo.h" |
10 #include "fuzz-wrapfd.h" | |
1348 | 11 |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
12 // once per process |
1369 | 13 void common_setup_fuzzer(void); |
1348 | 14 void svr_setup_fuzzer(void); |
15 | |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
16 // once per input. returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE |
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
17 int fuzzer_set_input(const uint8_t *Data, size_t Size); |
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
18 |
1369 | 19 // fuzzer functions that intrude into general code |
1357 | 20 void fuzz_kex_fakealgos(void); |
1369 | 21 int fuzz_checkpubkey_line(buffer* line, int line_num, char* filename, |
22 const char* algo, unsigned int algolen, | |
23 const unsigned char* keyblob, unsigned int keybloblen); | |
24 extern const char * const * fuzz_signkey_names; | |
25 void fuzz_seed(void); | |
1357 | 26 |
27 // fake IO wrappers | |
28 #ifndef FUZZ_SKIP_WRAP | |
29 #define select(nfds, readfds, writefds, exceptfds, timeout) \ | |
30 wrapfd_select(nfds, readfds, writefds, exceptfds, timeout) | |
31 #define write(fd, buf, count) wrapfd_write(fd, buf, count) | |
32 #define read(fd, buf, count) wrapfd_read(fd, buf, count) | |
1358
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
33 #define close(fd) wrapfd_close(fd) |
1357 | 34 #endif // FUZZ_SKIP_WRAP |
35 | |
1348 | 36 struct dropbear_fuzz_options { |
37 int fuzzing; | |
38 | |
39 // to record an unencrypted stream | |
40 FILE* recordf; | |
41 | |
42 // fuzzing input | |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
43 buffer *input; |
1357 | 44 struct dropbear_cipher recv_cipher; |
45 struct dropbear_hash recv_mac; | |
46 int wrapfds; | |
1348 | 47 |
48 // dropbear_exit() jumps back | |
49 sigjmp_buf jmp; | |
50 | |
51 uid_t pw_uid; | |
52 gid_t pw_gid; | |
53 char* pw_name; | |
54 char* pw_dir; | |
55 char* pw_shell; | |
56 char* pw_passwd; | |
57 }; | |
58 | |
59 extern struct dropbear_fuzz_options fuzz; | |
60 | |
1357 | 61 #endif // DROPBEAR_FUZZ |
1348 | 62 |
63 #endif /* DROPBEAR_FUZZ_H */ |