diff options
| author | tb <> | 2022-01-10 15:14:27 +0000 |
|---|---|---|
| committer | tb <> | 2022-01-10 15:14:27 +0000 |
| commit | 8852b04bb7eb01774f7b76e33f8af878f41bbb46 (patch) | |
| tree | 05a238fd8e1ed879a2fc1434ec3a520fe486e443 /src | |
| parent | 6b8c94d80ca57bf4a0641925e342ed2bdd57c9e3 (diff) | |
| download | openbsd-8852b04bb7eb01774f7b76e33f8af878f41bbb46.tar.gz openbsd-8852b04bb7eb01774f7b76e33f8af878f41bbb46.tar.bz2 openbsd-8852b04bb7eb01774f7b76e33f8af878f41bbb46.zip | |
NULL out pointers after transferring them to the DSA object.
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/openssl/testdsa.h | 10 |
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 | ||
| 3 | DSA *get_dsa512(void); | 3 | DSA *get_dsa512(void); |
| 4 | DSA *get_dsa1024(void); | 4 | DSA *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 | ||
