Skip to content

Commit 369f9f0

Browse files
Merge pull request #8849 from holtrop/reseed-drbg-in-rand-poll
Reseed DRBG in RAND_poll()
2 parents ae7509e + 0c12337 commit 369f9f0

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/ssl.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26053,11 +26053,25 @@ int wolfSSL_RAND_poll(void)
2605326053
return WOLFSSL_FAILURE;
2605426054
}
2605526055
ret = wc_GenerateSeed(&globalRNG.seed, entropy, entropy_sz);
26056-
if (ret != 0){
26056+
if (ret != 0) {
2605726057
WOLFSSL_MSG("Bad wc_RNG_GenerateBlock");
2605826058
ret = WOLFSSL_FAILURE;
26059-
}else
26060-
ret = WOLFSSL_SUCCESS;
26059+
}
26060+
else {
26061+
#ifdef HAVE_HASHDRBG
26062+
ret = wc_RNG_DRBG_Reseed(&globalRNG, entropy, entropy_sz);
26063+
if (ret != 0) {
26064+
WOLFSSL_MSG("Error reseeding DRBG");
26065+
ret = WOLFSSL_FAILURE;
26066+
}
26067+
else {
26068+
ret = WOLFSSL_SUCCESS;
26069+
}
26070+
#else
26071+
WOLFSSL_MSG("RAND_poll called with HAVE_HASHDRBG not set");
26072+
ret = WOLFSSL_FAILURE;
26073+
#endif
26074+
}
2606126075

2606226076
return ret;
2606326077
}

0 commit comments

Comments
 (0)