From a8f4cdd70c9d9ebe4553d7a72c67f73eaf0c169d Mon Sep 17 00:00:00 2001 From: Peiwei Hu Date: Sun, 14 Nov 2021 23:16:57 +0800 Subject: [PATCH] EVP_RAND_generate: fix return check Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17028) --- crypto/bn/bn_rand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.47.2