summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-05-10 04:53:55 +0000
committertb <>2024-05-10 04:53:55 +0000
commite187598b3af245fef99788faf28736cce0498577 (patch)
tree3646016a95b1ac8b883dc283b6105e19bf97adb9
parent5e9e413e2dc289b667689d675bd96d6801efa375 (diff)
downloadopenbsd-e187598b3af245fef99788faf28736cce0498577.tar.gz
openbsd-e187598b3af245fef99788faf28736cce0498577.tar.bz2
openbsd-e187598b3af245fef99788faf28736cce0498577.zip
Inline dsa_builtin_keygen() in DSA_generate_key()
ok djm
-rw-r--r--src/lib/libcrypto/dsa/dsa_key.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c
index 431748ab75..46ec9cfce9 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.35 2023/08/03 18:53:55 tb Exp $ */ 1/* $OpenBSD: dsa_key.c,v 1.36 2024/05/10 04:53:55 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 *
@@ -69,24 +69,16 @@
69#include "bn_local.h" 69#include "bn_local.h"
70#include "dsa_local.h" 70#include "dsa_local.h"
71 71
72static int dsa_builtin_keygen(DSA *dsa);
73
74int 72int
75DSA_generate_key(DSA *dsa) 73DSA_generate_key(DSA *dsa)
76{ 74{
77 if (dsa->meth->dsa_keygen)
78 return dsa->meth->dsa_keygen(dsa);
79 return dsa_builtin_keygen(dsa);
80}
81LCRYPTO_ALIAS(DSA_generate_key);
82
83static int
84dsa_builtin_keygen(DSA *dsa)
85{
86 BIGNUM *pub_key = NULL, *priv_key = NULL; 75 BIGNUM *pub_key = NULL, *priv_key = NULL;
87 BN_CTX *ctx = NULL; 76 BN_CTX *ctx = NULL;
88 int ok = 0; 77 int ok = 0;
89 78
79 if (dsa->meth->dsa_keygen != NULL)
80 return dsa->meth->dsa_keygen(dsa);
81
90 if ((priv_key = BN_new()) == NULL) 82 if ((priv_key = BN_new()) == NULL)
91 goto err; 83 goto err;
92 if ((pub_key = BN_new()) == NULL) 84 if ((pub_key = BN_new()) == NULL)
@@ -117,4 +109,6 @@ dsa_builtin_keygen(DSA *dsa)
117 109
118 return ok; 110 return ok;
119} 111}
112LCRYPTO_ALIAS(DSA_generate_key);
113
120#endif 114#endif