crypto/bn: fix return value in BN_generate_prime
authorDavid Asraf <dasraf9@gmail.com>
Wed, 23 Jan 2019 11:10:11 +0000 (11:10 +0000)
committerMatt Caswell <matt@openssl.org>
Sun, 27 Jan 2019 12:12:50 +0000 (12:12 +0000)
When the ret parameter is NULL the generated prime
is in rnd variable and not in ret.

CLA: trivial

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8076)

crypto/bn/bn_depr.c

index 705ca1e0a965f34e5c0996bfcb0d62ab603042eb..2ff0eedd2294e65c182b6e91a73fc310552da901 100644 (file)
@@ -40,7 +40,7 @@ BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
         goto err;
 
     /* we have a prime :-) */
-    return ret;
+    return rnd;
  err:
     BN_free(rnd);
     return NULL;