summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/dsa/dsa_key.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c
index 54c6550fef..a0487e98b8 100644
--- a/src/lib/libcrypto/dsa/dsa_key.c
+++ b/src/lib/libcrypto/dsa/dsa_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_key.c,v 1.28 2018/11/06 07:02:33 tb Exp $ */ 1/* $OpenBSD: dsa_key.c,v 1.29 2018/11/09 23:45:19 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -82,12 +82,12 @@ dsa_builtin_keygen(DSA *dsa)
82{ 82{
83 int ok = 0; 83 int ok = 0;
84 BN_CTX *ctx = NULL; 84 BN_CTX *ctx = NULL;
85 BIGNUM *pub_key = dsa->pub_key, *priv_key = dsa->priv_key; 85 BIGNUM *pub_key = NULL, *priv_key = NULL;
86 86
87 if ((ctx = BN_CTX_new()) == NULL) 87 if ((ctx = BN_CTX_new()) == NULL)
88 goto err; 88 goto err;
89 89
90 if (priv_key == NULL) { 90 if ((priv_key = dsa->priv_key) == NULL) {
91 if ((priv_key = BN_new()) == NULL) 91 if ((priv_key = BN_new()) == NULL)
92 goto err; 92 goto err;
93 } 93 }
@@ -95,7 +95,7 @@ dsa_builtin_keygen(DSA *dsa)
95 if (!bn_rand_interval(priv_key, BN_value_one(), dsa->q)) 95 if (!bn_rand_interval(priv_key, BN_value_one(), dsa->q))
96 goto err; 96 goto err;
97 97
98 if (pub_key == NULL) { 98 if ((pub_key = dsa->pub_key) == NULL) {
99 if ((pub_key = BN_new()) == NULL) 99 if ((pub_key = BN_new()) == NULL)
100 goto err; 100 goto err;
101 } 101 }