mirror of
https://github.com/clearml/dropbear
synced 2025-03-15 16:11:55 +00:00
fuzzing - avoid sha1 for random seed every iteration
This commit is contained in:
parent
b8352f8164
commit
1b6e16ae7c
17
dbrandom.c
17
dbrandom.c
@ -151,12 +151,17 @@ static void write_urandom()
|
|||||||
|
|
||||||
#if DROPBEAR_FUZZ
|
#if DROPBEAR_FUZZ
|
||||||
void fuzz_seed(const unsigned char* dat, unsigned int len) {
|
void fuzz_seed(const unsigned char* dat, unsigned int len) {
|
||||||
hash_state hs;
|
static unsigned char keep_pool[SHA1_HASH_SIZE];
|
||||||
sha1_init(&hs);
|
static int once = 0;
|
||||||
sha1_process(&hs, "fuzzfuzzfuzz", strlen("fuzzfuzzfuzz"));
|
if (!once) {
|
||||||
sha1_process(&hs, dat, len);
|
once = 1;
|
||||||
sha1_done(&hs, hashpool);
|
hash_state hs;
|
||||||
|
sha1_init(&hs);
|
||||||
|
sha1_process(&hs, "fuzzfuzzfuzz", strlen("fuzzfuzzfuzz"));
|
||||||
|
sha1_process(&hs, dat, len);
|
||||||
|
sha1_done(&hs, keep_pool);
|
||||||
|
}
|
||||||
|
memcpy(hashpool, keep_pool, sizeof(keep_pool));
|
||||||
counter = 0;
|
counter = 0;
|
||||||
donerandinit = 1;
|
donerandinit = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user