Mercurial > dropbear
annotate fuzz.h @ 1456:a90fdd2d2ed8 fuzz
add fuzzer-preauth_nomaths
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 23 Jan 2018 23:05:47 +0800 |
parents | 6c92e97553f1 |
children | 2f64cb3d3007 |
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 |
1456
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
13 void fuzz_common_setup(void); |
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
14 void fuzz_svr_setup(void); |
1348 | 15 |
1377
d4cc85e6c569
rearrange, all fuzzers now call fuzzer_set_input()
Matt Johnston <matt@ucc.asn.au>
parents:
1369
diff
changeset
|
16 // must be called once per fuzz iteration. |
d4cc85e6c569
rearrange, all fuzzers now call fuzzer_set_input()
Matt Johnston <matt@ucc.asn.au>
parents:
1369
diff
changeset
|
17 // returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE |
1456
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
18 int fuzz_set_input(const uint8_t *Data, size_t Size); |
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
19 |
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
20 int fuzz_run_preauth(const uint8_t *Data, size_t Size, int skip_kexmaths); |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
21 |
1369 | 22 // fuzzer functions that intrude into general code |
1357 | 23 void fuzz_kex_fakealgos(void); |
1369 | 24 int fuzz_checkpubkey_line(buffer* line, int line_num, char* filename, |
25 const char* algo, unsigned int algolen, | |
26 const unsigned char* keyblob, unsigned int keybloblen); | |
27 extern const char * const * fuzz_signkey_names; | |
28 void fuzz_seed(void); | |
1383
f03cfe9c76ac
Disable setnonblocking(), get_socket_address(), set_sock_priority()
Matt Johnston <matt@ucc.asn.au>
parents:
1377
diff
changeset
|
29 void fuzz_get_socket_address(int fd, char **local_host, char **local_port, |
f03cfe9c76ac
Disable setnonblocking(), get_socket_address(), set_sock_priority()
Matt Johnston <matt@ucc.asn.au>
parents:
1377
diff
changeset
|
30 char **remote_host, char **remote_port, int host_lookup); |
1456
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
31 void fuzz_fake_send_kexdh_reply(void); |
1357 | 32 |
33 // fake IO wrappers | |
34 #ifndef FUZZ_SKIP_WRAP | |
35 #define select(nfds, readfds, writefds, exceptfds, timeout) \ | |
36 wrapfd_select(nfds, readfds, writefds, exceptfds, timeout) | |
37 #define write(fd, buf, count) wrapfd_write(fd, buf, count) | |
38 #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
|
39 #define close(fd) wrapfd_close(fd) |
1357 | 40 #endif // FUZZ_SKIP_WRAP |
41 | |
1348 | 42 struct dropbear_fuzz_options { |
43 int fuzzing; | |
44 | |
45 // to record an unencrypted stream | |
46 FILE* recordf; | |
47 | |
48 // fuzzing input | |
1356
3677a510f545
add wrapfd. improve fuzzer in makefile
Matt Johnston <matt@ucc.asn.au>
parents:
1348
diff
changeset
|
49 buffer *input; |
1357 | 50 struct dropbear_cipher recv_cipher; |
51 struct dropbear_hash recv_mac; | |
52 int wrapfds; | |
1348 | 53 |
1456
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
54 // whether to skip slow bignum maths |
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
55 int skip_kexmaths; |
a90fdd2d2ed8
add fuzzer-preauth_nomaths
Matt Johnston <matt@ucc.asn.au>
parents:
1385
diff
changeset
|
56 |
1348 | 57 // dropbear_exit() jumps back |
1385
6c92e97553f1
Add a flag whether to longjmp, missed that last commit
Matt Johnston <matt@ucc.asn.au>
parents:
1383
diff
changeset
|
58 int do_jmp; |
1348 | 59 sigjmp_buf jmp; |
60 | |
61 uid_t pw_uid; | |
62 gid_t pw_gid; | |
63 char* pw_name; | |
64 char* pw_dir; | |
65 char* pw_shell; | |
66 char* pw_passwd; | |
67 }; | |
68 | |
69 extern struct dropbear_fuzz_options fuzz; | |
70 | |
1357 | 71 #endif // DROPBEAR_FUZZ |
1348 | 72 |
73 #endif /* DROPBEAR_FUZZ_H */ |