summaryrefslogtreecommitdiff
path: root/usr.bin/openssl
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-01-10 15:14:28 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-01-10 15:14:28 +0000
commit395a5b5e3cf5c3c77b8c924165bd51f39553bef1 (patch)
tree1bffec2e66834c07c73b3a41d1826db3b6c55492 /usr.bin/openssl
parent534dd1a907e00129845c5cb96fb49308928332c0 (diff)
NULL out pointers after transferring them to the DSA object.
Diffstat (limited to 'usr.bin/openssl')
-rw-r--r--usr.bin/openssl/testdsa.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/openssl/testdsa.h b/usr.bin/openssl/testdsa.h
index 20cc97eeaa8..47560fd42cc 100644
--- a/usr.bin/openssl/testdsa.h
+++ b/usr.bin/openssl/testdsa.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: testdsa.h,v 1.3 2022/01/10 15:04:06 tb Exp $ */
+/* $OpenBSD: testdsa.h,v 1.4 2022/01/10 15:14:27 tb Exp $ */
DSA *get_dsa512(void);
DSA *get_dsa1024(void);
@@ -221,20 +221,28 @@ get_dsa(const unsigned char *priv, size_t priv_size,
if ((dsa = DSA_new()) == NULL)
return (NULL);
+
priv_key = BN_bin2bn(priv, priv_size, NULL);
pub_key = BN_bin2bn(pub, pub_size, NULL);
if (priv_key == NULL || pub_key == NULL)
goto err;
+
if (!DSA_set0_key(dsa, pub_key, priv_key))
goto err;
+ pub_key = NULL;
+ priv_key = NULL;
p = BN_bin2bn(p, p_size, NULL);
q = BN_bin2bn(q, q_size, NULL);
g = BN_bin2bn(g, g_size, NULL);
if (p == NULL || q == NULL || g == NULL)
goto err;
+
if (!DSA_set0_pqg(dsa, p, q, g))
goto err;
+ p = NULL;
+ q = NULL;
+ g = NULL;
return dsa;