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:08 +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 962f864deec6141535ab924fe5df5b4222ae9b4b..8d13b3c26245c0b33721e98e72d718e0de86a194 100644 (file)
@@ -234,11 +234,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;
     }