EVP_RAND_generate: fix return check
authorPeiwei Hu <jlu.hpw@foxmail.com>
Sun, 14 Nov 2021 15:16:57 +0000 (23:16 +0800)
committerTomas Mraz <tomas@openssl.org>
Mon, 22 Nov 2021 13:43:44 +0000 (14:43 +0100)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17028)

crypto/bn/bn_rand.c

index baac4ea7ed8328a7fc3f58a868d88f99abfee5fb..1b495969906fc5d16263f351ab5217b76a5a569f 100644 (file)
@@ -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)