diff --git a/src/wp_drbg.c b/src/wp_drbg.c index daf4e56..95fdee3 100644 --- a/src/wp_drbg.c +++ b/src/wp_drbg.c @@ -303,6 +303,9 @@ static int wp_drbg_generate(wp_DrbgCtx* ctx, unsigned char* out, (void)addIn; (void)addInLen; #endif + if (ok && (outLen > 0xFFFFFFFFU)) { + ok = 0; + } if (ok) { rc = wc_RNG_GenerateBlock(ctx->rng, out, (word32)outLen); if (rc != 0) { @@ -595,6 +598,11 @@ static size_t wp_drbg_get_seed(wp_DrbgCtx* ctx, unsigned char** pSeed, goto end; } + if (minLen > 0xFFFFFFFFU) { + OPENSSL_secure_free(buffer); + goto end; + } + rc = wc_RNG_GenerateBlock(ctx->rng, buffer, (word32)minLen); if (rc != 0) { WOLFPROV_MSG_DEBUG_RETCODE(WP_LOG_COMP_RNG,