summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/testdsa.h
diff options
context:
space:
mode:
authortb <>2022-01-10 15:14:27 +0000
committertb <>2022-01-10 15:14:27 +0000
commit29cd8b95106cc91d742b2dc806a8e044c39fc9a1 (patch)
tree05a238fd8e1ed879a2fc1434ec3a520fe486e443 /src/usr.bin/openssl/testdsa.h
parent12f91e8ee67d412757442d6df12584cb814335db (diff)
downloadopenbsd-29cd8b95106cc91d742b2dc806a8e044c39fc9a1.tar.gz
openbsd-29cd8b95106cc91d742b2dc806a8e044c39fc9a1.tar.bz2
openbsd-29cd8b95106cc91d742b2dc806a8e044c39fc9a1.zip
NULL out pointers after transferring them to the DSA object.
Diffstat (limited to 'src/usr.bin/openssl/testdsa.h')
-rw-r--r--src/usr.bin/openssl/testdsa.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/usr.bin/openssl/testdsa.h b/src/usr.bin/openssl/testdsa.h
index 20cc97eeaa..47560fd42c 100644
--- a/src/usr.bin/openssl/testdsa.h
+++ b/src/usr.bin/openssl/testdsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: testdsa.h,v 1.3 2022/01/10 15:04:06 tb Exp $ */ 1/* $OpenBSD: testdsa.h,v 1.4 2022/01/10 15:14:27 tb Exp $ */
2 2
3DSA *get_dsa512(void); 3DSA *get_dsa512(void);
4DSA *get_dsa1024(void); 4DSA *get_dsa1024(void);
@@ -221,20 +221,28 @@ get_dsa(const unsigned char *priv, size_t priv_size,
221 221
222 if ((dsa = DSA_new()) == NULL) 222 if ((dsa = DSA_new()) == NULL)
223 return (NULL); 223 return (NULL);
224
224 priv_key = BN_bin2bn(priv, priv_size, NULL); 225 priv_key = BN_bin2bn(priv, priv_size, NULL);
225 pub_key = BN_bin2bn(pub, pub_size, NULL); 226 pub_key = BN_bin2bn(pub, pub_size, NULL);
226 if (priv_key == NULL || pub_key == NULL) 227 if (priv_key == NULL || pub_key == NULL)
227 goto err; 228 goto err;
229
228 if (!DSA_set0_key(dsa, pub_key, priv_key)) 230 if (!DSA_set0_key(dsa, pub_key, priv_key))
229 goto err; 231 goto err;
232 pub_key = NULL;
233 priv_key = NULL;
230 234
231 p = BN_bin2bn(p, p_size, NULL); 235 p = BN_bin2bn(p, p_size, NULL);
232 q = BN_bin2bn(q, q_size, NULL); 236 q = BN_bin2bn(q, q_size, NULL);
233 g = BN_bin2bn(g, g_size, NULL); 237 g = BN_bin2bn(g, g_size, NULL);
234 if (p == NULL || q == NULL || g == NULL) 238 if (p == NULL || q == NULL || g == NULL)
235 goto err; 239 goto err;
240
236 if (!DSA_set0_pqg(dsa, p, q, g)) 241 if (!DSA_set0_pqg(dsa, p, q, g))
237 goto err; 242 goto err;
243 p = NULL;
244 q = NULL;
245 g = NULL;
238 246
239 return dsa; 247 return dsa;
240 248