From: Peiwei Hu Date: Sun, 14 Nov 2021 15:16:57 +0000 (+0800) Subject: EVP_RAND_generate: fix return check X-Git-Tag: openssl-3.2.0-alpha1~3307 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8f4cdd70c9d9ebe4553d7a72c67f73eaf0c169d;p=thirdparty%2Fopenssl.git EVP_RAND_generate: fix return check Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17028) --- diff --git a/crypto/bn/bn_rand.c b/crypto/bn/bn_rand.c index baac4ea7ed8..1b495969906 100644 --- a/crypto/bn/bn_rand.c +++ b/crypto/bn/bn_rand.c @@ -287,7 +287,7 @@ int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, goto err; } for (done = 0; done < num_k_bytes;) { - if (!RAND_priv_bytes_ex(libctx, random_bytes, sizeof(random_bytes), 0)) + if (RAND_priv_bytes_ex(libctx, random_bytes, sizeof(random_bytes), 0) <= 0) goto err; if (!EVP_DigestInit_ex(mdctx, md, NULL)