Mercurial > dropbear
comparison dbrandom.c @ 1358:6b89eb92f872 fuzz
glaring wrapfd problems fixed
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 20 May 2017 22:47:19 +0800 |
parents | 08f4fa4dc6a0 |
children | ddfcadca3c4c |
comparison
equal
deleted
inserted
replaced
1357:08f4fa4dc6a0 | 1358:6b89eb92f872 |
---|---|
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 static void seedfuzz(void) { | 184 #ifdef DROPBEAR_FUZZ |
185 void seedfuzz(void) { | |
185 hash_state hs; | 186 hash_state hs; |
186 sha1_init(&hs); | 187 sha1_init(&hs); |
187 sha1_process(&hs, "fuzzfuzzfuzz", strlen("fuzzfuzzfuzz")); | 188 sha1_process(&hs, "fuzzfuzzfuzz", strlen("fuzzfuzzfuzz")); |
188 sha1_done(&hs, hashpool); | 189 sha1_done(&hs, hashpool); |
189 | 190 |
190 counter = 0; | 191 counter = 0; |
191 donerandinit = 1; | 192 donerandinit = 1; |
192 } | 193 } |
194 #endif | |
193 | 195 |
194 /* Initialise the prng from /dev/urandom or prngd. This function can | 196 /* Initialise the prng from /dev/urandom or prngd. This function can |
195 * be called multiple times */ | 197 * be called multiple times */ |
196 void seedrandom() { | 198 void seedrandom() { |
197 | 199 |
201 struct timeval tv; | 203 struct timeval tv; |
202 clock_t clockval; | 204 clock_t clockval; |
203 | 205 |
204 #ifdef DROPBEAR_FUZZ | 206 #ifdef DROPBEAR_FUZZ |
205 if (fuzz.fuzzing || fuzz.recordf) { | 207 if (fuzz.fuzzing || fuzz.recordf) { |
206 seedfuzz(); | |
207 return; | 208 return; |
208 } | 209 } |
209 #endif | 210 #endif |
210 | 211 |
211 /* hash in the new seed data */ | 212 /* hash in the new seed data */ |