Mercurial > dropbear
comparison dbrandom.c @ 1558:2f64cb3d3007 fuzz
- #if not #ifdef for DROPBEAR_FUZZ
- fix some unused variables
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 28 Feb 2018 21:40:08 +0800 |
parents | 5916af64acd4 |
children | 02b226c2675e |
comparison
equal
deleted
inserted
replaced
1557:61a793b6e471 | 1558:2f64cb3d3007 |
---|---|
143 | 143 |
144 void addrandom(const unsigned char * buf, unsigned int len) | 144 void addrandom(const unsigned char * buf, unsigned int len) |
145 { | 145 { |
146 hash_state hs; | 146 hash_state hs; |
147 | 147 |
148 #ifdef DROPBEAR_FUZZ | 148 #if DROPBEAR_FUZZ |
149 if (fuzz.fuzzing || fuzz.recordf) { | 149 if (fuzz.fuzzing || fuzz.recordf) { |
150 return; | 150 return; |
151 } | 151 } |
152 #endif | 152 #endif |
153 | 153 |
161 sha1_done(&hs, hashpool); | 161 sha1_done(&hs, hashpool); |
162 } | 162 } |
163 | 163 |
164 static void write_urandom() | 164 static void write_urandom() |
165 { | 165 { |
166 #ifdef DROPBEAR_FUZZ | 166 #if DROPBEAR_FUZZ |
167 if (fuzz.fuzzing || fuzz.recordf) { | 167 if (fuzz.fuzzing || fuzz.recordf) { |
168 return; | 168 return; |
169 } | 169 } |
170 #endif | 170 #endif |
171 #if !DROPBEAR_USE_PRNGD | 171 #if !DROPBEAR_USE_PRNGD |
179 fwrite(buf, sizeof(buf), 1, f); | 179 fwrite(buf, sizeof(buf), 1, f); |
180 fclose(f); | 180 fclose(f); |
181 #endif | 181 #endif |
182 } | 182 } |
183 | 183 |
184 #ifdef DROPBEAR_FUZZ | 184 #if DROPBEAR_FUZZ |
185 void fuzz_seed(void) { | 185 void fuzz_seed(void) { |
186 hash_state hs; | 186 hash_state hs; |
187 sha1_init(&hs); | 187 sha1_init(&hs); |
188 sha1_process(&hs, "fuzzfuzzfuzz", strlen("fuzzfuzzfuzz")); | 188 sha1_process(&hs, "fuzzfuzzfuzz", strlen("fuzzfuzzfuzz")); |
189 sha1_done(&hs, hashpool); | 189 sha1_done(&hs, hashpool); |
201 | 201 |
202 pid_t pid; | 202 pid_t pid; |
203 struct timeval tv; | 203 struct timeval tv; |
204 clock_t clockval; | 204 clock_t clockval; |
205 | 205 |
206 #ifdef DROPBEAR_FUZZ | 206 #if DROPBEAR_FUZZ |
207 if (fuzz.fuzzing || fuzz.recordf) { | 207 if (fuzz.fuzzing || fuzz.recordf) { |
208 return; | 208 return; |
209 } | 209 } |
210 #endif | 210 #endif |
211 | 211 |