Fix a SCA leak in BN_generate_dsa_nonce
[oweals/openssl.git] / crypto / bn / bn_depr.c
index de54d5e8cb38cd1b7afe958d5cc3beb7e072effe..58bcf197a490eb9aa6b340cf2f4d0f4a46cee4f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -21,7 +21,6 @@ NON_EMPTY_TRANSLATION_UNIT
 # include <time.h>
 # include "internal/cryptlib.h"
 # include "bn_lcl.h"
-# include <openssl/rand.h>
 
 BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
                           const BIGNUM *add, const BIGNUM *rem,
@@ -41,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;