1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Add FUZZING build option that disables the random number generator.

Starting up the random number generator is by far the slowest part of
plink's startup, and randomness is bad for fuzzing, so disabling it
should make fuzzing more effective.
This commit is contained in:
Ben Harris
2015-10-17 16:26:51 +01:00
parent f6b81af006
commit 1d20c1b396
2 changed files with 23 additions and 1 deletions

View File

@ -45,8 +45,23 @@ struct RandPool {
int stir_pending;
};
static struct RandPool pool;
int random_active = 0;
#ifdef FUZZING
/*
* Special dummy version of the RNG for use when fuzzing.
*/
void random_add_noise(void *noise, int length) { }
void random_add_heavynoise(void *noise, int length) { }
void random_ref(void) { }
void random_unref(void) { }
int random_byte(void)
{
return 0x45; /* Chosen by eight fair coin tosses */
}
void random_get_savedata(void **data, int *len) { }
#else /* !FUZZING */
static struct RandPool pool;
long next_noise_collection;
#ifdef RANDOM_DIAGNOSTICS
@ -326,3 +341,4 @@ void random_get_savedata(void **data, int *len)
*data = buf;
random_stir();
}
#endif