Make sure that not all RNG state variables are initialized to a zero value.

This commit is contained in:
LoRd_MuldeR 2021-03-20 20:41:35 +01:00
parent d8f446832b
commit 7a40d62b06
Signed by: mulder
GPG Key ID: 2B5913365F57E03F

View File

@ -199,13 +199,17 @@ static uint32_t random_next(rand_state_t *const state)
return (state->d += 0x000587C5) + state->v;
}
static void random_seed(rand_state_t* const state, const uint64_t salt, const uint16_t pepper, const uint8_t *const passwd, const size_t passwd_len)
static void random_seed(rand_state_t *const state, uint64_t salt, const uint16_t pepper, const uint8_t *const passwd, const size_t passwd_len)
{
key_data_t key;
size_t i;
generate_key(&key, salt, pepper, passwd, passwd_len);
key_data_t key;
do
{
generate_key(&key, salt++, pepper, passwd, passwd_len);
random_init(state, &key);
slunkcrypt_bzero(&key, sizeof(key_data_t));
}
while (!(state->x || state->y || state->z || state->w || state->v));
for (i = 0U; i < 97U; ++i)
{
UNUSED volatile uint32_t q = random_next(state);