back-port of the bugfix done in #363

This commit is contained in:
Steffen Jaeckel 2018-04-04 19:31:36 +02:00
parent 24aab18d5b
commit 70ec9b3b35

View File

@ -288,7 +288,7 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state
} }
/* do we have to reseed? */ /* do we have to reseed? */
if (++prng->fortuna.wd == LTC_FORTUNA_WD || prng->fortuna.pool0_len >= 64) { if ((++prng->fortuna.wd == LTC_FORTUNA_WD) && (prng->fortuna.pool0_len >= 64)) {
if (_fortuna_reseed(prng) != CRYPT_OK) { if (_fortuna_reseed(prng) != CRYPT_OK) {
goto LBL_UNLOCK; goto LBL_UNLOCK;
} }