diff --git a/libslunkcrypt/src/slunkcrypt.c b/libslunkcrypt/src/slunkcrypt.c index 50cc138..8f27c81 100644 --- a/libslunkcrypt/src/slunkcrypt.c +++ b/libslunkcrypt/src/slunkcrypt.c @@ -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); - random_init(state, &key); - slunkcrypt_bzero(&key, sizeof(key_data_t)); + 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);