Skip to content

Commit 0c12337

Browse files
committed
Reseed DRBG in RAND_poll()
1 parent 3ecc58c commit 0c12337

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
@@ -26041,11 +26041,25 @@ int wolfSSL_RAND_poll(void)
2604126041
return WOLFSSL_FAILURE;
2604226042
}
2604326043
ret = wc_GenerateSeed(&globalRNG.seed, entropy, entropy_sz);
26044-
if (ret != 0){
26044+
if (ret != 0) {
2604526045
WOLFSSL_MSG("Bad wc_RNG_GenerateBlock");
2604626046
ret = WOLFSSL_FAILURE;
26047-
}else
26048-
ret = WOLFSSL_SUCCESS;
26047+
}
26048+
else {
26049+
#ifdef HAVE_HASHDRBG
26050+
ret = wc_RNG_DRBG_Reseed(&globalRNG, entropy, entropy_sz);
26051+
if (ret != 0) {
26052+
WOLFSSL_MSG("Error reseeding DRBG");
26053+
ret = WOLFSSL_FAILURE;
26054+
}
26055+
else {
26056+
ret = WOLFSSL_SUCCESS;
26057+
}
26058+
#else
26059+
WOLFSSL_MSG("RAND_poll called with HAVE_HASHDRBG not set");
26060+
ret = WOLFSSL_FAILURE;
26061+
#endif
26062+
}
2604926063

2605026064
return ret;
2605126065
}

0 commit comments

Comments
 (0)