summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2018-11-09 23:45:20 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2018-11-09 23:45:20 +0000
commit5e224b438c66a72bd532a84f4ecf1fb9e4b57410 (patch)
treeff95ac2db1fc22cfa03d246a17787de8fb8907fe /lib/libcrypto
parenta2bd3ed455c00f8f665468aa9430f283665f41c0 (diff)
Initialize priv_key and pub_key on first use instead of at the top.
ok beck jsing mestre
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/dsa/dsa_key.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libcrypto/dsa/dsa_key.c b/lib/libcrypto/dsa/dsa_key.c
index 54c6550feff..a0487e98b8c 100644
--- a/lib/libcrypto/dsa/dsa_key.c
+++ b/lib/libcrypto/dsa/dsa_key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsa_key.c,v 1.28 2018/11/06 07:02:33 tb Exp $ */
+/* $OpenBSD: dsa_key.c,v 1.29 2018/11/09 23:45:19 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -82,12 +82,12 @@ dsa_builtin_keygen(DSA *dsa)
{
int ok = 0;
BN_CTX *ctx = NULL;
- BIGNUM *pub_key = dsa->pub_key, *priv_key = dsa->priv_key;
+ BIGNUM *pub_key = NULL, *priv_key = NULL;
if ((ctx = BN_CTX_new()) == NULL)
goto err;
- if (priv_key == NULL) {
+ if ((priv_key = dsa->priv_key) == NULL) {
if ((priv_key = BN_new()) == NULL)
goto err;
}
@@ -95,7 +95,7 @@ dsa_builtin_keygen(DSA *dsa)
if (!bn_rand_interval(priv_key, BN_value_one(), dsa->q))
goto err;
- if (pub_key == NULL) {
+ if ((pub_key = dsa->pub_key) == NULL) {
if ((pub_key = BN_new()) == NULL)
goto err;
}