comparison fuzz/fuzz-common.c @ 1757:517fb7b62438

Add some more variation to fuzzer random number generation
author Matt Johnston <matt@ucc.asn.au>
date Fri, 23 Oct 2020 23:32:44 +0800
parents d5680e12ac33
children 1365661f6be6
comparison
equal deleted inserted replaced
1756:d5680e12ac33 1757:517fb7b62438
23 fuzz.wrapfds = 1; 23 fuzz.wrapfds = 1;
24 fuzz.do_jmp = 1; 24 fuzz.do_jmp = 1;
25 fuzz.input = m_malloc(sizeof(buffer)); 25 fuzz.input = m_malloc(sizeof(buffer));
26 _dropbear_log = fuzz_dropbear_log; 26 _dropbear_log = fuzz_dropbear_log;
27 crypto_init(); 27 crypto_init();
28 fuzz_seed(); 28 fuzz_seed("start", 5);
29 /* let any messages get flushed */ 29 /* let any messages get flushed */
30 setlinebuf(stdout); 30 setlinebuf(stdout);
31 } 31 }
32 32
33 int fuzz_set_input(const uint8_t *Data, size_t Size) { 33 int fuzz_set_input(const uint8_t *Data, size_t Size) {
40 memset(&ses, 0x0, sizeof(ses)); 40 memset(&ses, 0x0, sizeof(ses));
41 memset(&svr_ses, 0x0, sizeof(svr_ses)); 41 memset(&svr_ses, 0x0, sizeof(svr_ses));
42 memset(&cli_ses, 0x0, sizeof(cli_ses)); 42 memset(&cli_ses, 0x0, sizeof(cli_ses));
43 wrapfd_setup(fuzz.input); 43 wrapfd_setup(fuzz.input);
44 44
45 fuzz_seed(); 45 fuzz_seed(fuzz.input->data, MIN(fuzz.input->len, 16));
46 46
47 return DROPBEAR_SUCCESS; 47 return DROPBEAR_SUCCESS;
48 } 48 }
49 49
50 #if DEBUG_TRACE 50 #if DEBUG_TRACE