comparison fuzzer-pubkey.c @ 1559:92c93b4a3646 fuzz

Fix to be able to compile normal(ish) binaries with --enable-fuzz
author Matt Johnston <matt@ucc.asn.au>
date Wed, 28 Feb 2018 22:02:12 +0800
parents a90fdd2d2ed8
children cdfab509c392
comparison
equal deleted inserted replaced
1558:2f64cb3d3007 1559:92c93b4a3646
18 return 0; 18 return 0;
19 } 19 }
20 20
21 m_malloc_set_epoch(1); 21 m_malloc_set_epoch(1);
22 22
23 // choose a keytype based on input 23 /* choose a keytype based on input */
24 uint8_t b = 0; 24 uint8_t b = 0;
25 size_t i; 25 size_t i;
26 for (i = 0; i < Size; i++) { 26 for (i = 0; i < Size; i++) {
27 b ^= Data[i]; 27 b ^= Data[i];
28 } 28 }
29 const char* algoname = fuzz_signkey_names[b%DROPBEAR_SIGNKEY_NUM_NAMED]; 29 const char* algoname = fuzz_signkey_names[b%DROPBEAR_SIGNKEY_NUM_NAMED];
30 const char* keyblob = "blob"; // keep short 30 const char* keyblob = "blob"; /* keep short */
31 31
32 if (setjmp(fuzz.jmp) == 0) { 32 if (setjmp(fuzz.jmp) == 0) {
33 fuzz_checkpubkey_line(fuzz.input, 5, "/home/me/authorized_keys", 33 fuzz_checkpubkey_line(fuzz.input, 5, "/home/me/authorized_keys",
34 algoname, strlen(algoname), 34 algoname, strlen(algoname),
35 (unsigned char*)keyblob, strlen(keyblob)); 35 (unsigned char*)keyblob, strlen(keyblob));
36 m_malloc_free_epoch(1, 0); 36 m_malloc_free_epoch(1, 0);
37 } else { 37 } else {
38 m_malloc_free_epoch(1, 1); 38 m_malloc_free_epoch(1, 1);
39 TRACE(("dropbear_exit longjmped")) 39 TRACE(("dropbear_exit longjmped"))
40 // dropbear_exit jumped here 40 /* dropbear_exit jumped here */
41 } 41 }
42 42
43 return 0; 43 return 0;
44 } 44 }