Use BN_clear_free in DH_set0_key
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 6 Sep 2019 22:53:24 +0000 (00:53 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 9 Sep 2019 12:47:34 +0000 (14:47 +0200)
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9796)

(cherry picked from commit fa01370f7dc8f0a379483bbe74de11225857e5fe)

crypto/dh/dh_lib.c

index 2e727df8972e61d559559675e9892b1b5a63c981..cac831da0bfcda0fbc769e80c59ded15d0e0a1d4 100644 (file)
@@ -233,11 +233,11 @@ void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
 {
     if (pub_key != NULL) {
-        BN_free(dh->pub_key);
+        BN_clear_free(dh->pub_key);
         dh->pub_key = pub_key;
     }
     if (priv_key != NULL) {
-        BN_free(dh->priv_key);
+        BN_clear_free(dh->priv_key);
         dh->priv_key = priv_key;
     }