diff options
author | tb <> | 2018-11-09 23:45:19 +0000 |
---|---|---|
committer | tb <> | 2018-11-09 23:45:19 +0000 |
commit | b654209f551ca241f7057a6dd9cc71a79151eb43 (patch) | |
tree | aca4429a5b55a275cf176f1766112e71aaf1bfd0 | |
parent | 8c13793414132f06631c624139d17049217c7395 (diff) | |
download | openbsd-b654209f551ca241f7057a6dd9cc71a79151eb43.tar.gz openbsd-b654209f551ca241f7057a6dd9cc71a79151eb43.tar.bz2 openbsd-b654209f551ca241f7057a6dd9cc71a79151eb43.zip |
Initialize priv_key and pub_key on first use instead of at the top.
ok beck jsing mestre
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_key.c | 8 |
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 | } |