Skip to content

Commit 3e0184d

Browse files
committed
Fix fenrir issue and test PRB trigger
1 parent 19b69b5 commit 3e0184d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/wp_drbg.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,11 @@ static int wp_drbg_generate(wp_DrbgCtx* ctx, unsigned char* out,
303303
(void)addIn;
304304
(void)addInLen;
305305
#endif
306+
if (ok && (outLen > 0xFFFFFFFFU)) {
307+
ok = 0;
308+
}
306309
if (ok) {
307-
rc = wc_RNG_GenerateBlock(ctx->rng, out, (word32)outLen);
310+
rc = wc_RNG_GenerateBlock(ctx->rng, out, outLen);
308311
if (rc != 0) {
309312
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_COMP_RNG, "wc_RNG_GenerateBlock", rc);
310313
ok = 0;
@@ -595,6 +598,11 @@ static size_t wp_drbg_get_seed(wp_DrbgCtx* ctx, unsigned char** pSeed,
595598
goto end;
596599
}
597600

601+
if (minLen > 0xFFFFFFFFU) {
602+
OPENSSL_secure_free(buffer);
603+
goto end;
604+
}
605+
598606
rc = wc_RNG_GenerateBlock(ctx->rng, buffer, (word32)minLen);
599607
if (rc != 0) {
600608
WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_COMP_RNG,

0 commit comments

Comments
 (0)