diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_pmeth.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_pmeth.c b/src/lib/libcrypto/dsa/dsa_pmeth.c index dff47ed348..001bdec201 100644 --- a/src/lib/libcrypto/dsa/dsa_pmeth.c +++ b/src/lib/libcrypto/dsa/dsa_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_pmeth.c,v 1.18 2023/12/28 22:07:23 tb Exp $ */ | 1 | /* $OpenBSD: dsa_pmeth.c,v 1.19 2023/12/28 22:11:26 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -288,25 +288,30 @@ out_of_range: | |||
| 288 | static int | 288 | static int |
| 289 | pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | 289 | pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) |
| 290 | { | 290 | { |
| 291 | DSA *dsa = NULL; | 291 | DSA *dsa; |
| 292 | DSA_PKEY_CTX *dctx = ctx->data; | 292 | DSA_PKEY_CTX *dctx = ctx->data; |
| 293 | BN_GENCB *pcb, cb; | 293 | BN_GENCB *pcb = NULL; |
| 294 | int ret; | 294 | BN_GENCB cb = {0}; |
| 295 | int ret = 0; | ||
| 295 | 296 | ||
| 296 | if (ctx->pkey_gencb) { | 297 | if ((dsa = DSA_new()) == NULL) |
| 298 | goto err; | ||
| 299 | if (ctx->pkey_gencb != NULL) { | ||
| 297 | pcb = &cb; | 300 | pcb = &cb; |
| 298 | evp_pkey_set_cb_translate(pcb, ctx); | 301 | evp_pkey_set_cb_translate(pcb, ctx); |
| 299 | } else | 302 | } |
| 300 | pcb = NULL; | 303 | if (!dsa_builtin_paramgen(dsa, dctx->nbits, dctx->qbits, dctx->pmd, |
| 301 | dsa = DSA_new(); | 304 | NULL, 0, NULL, NULL, NULL, pcb)) |
| 302 | if (!dsa) | 305 | goto err; |
| 303 | return 0; | 306 | if (!EVP_PKEY_assign_DSA(pkey, dsa)) |
| 304 | ret = dsa_builtin_paramgen(dsa, dctx->nbits, dctx->qbits, dctx->pmd, | 307 | goto err; |
| 305 | NULL, 0, NULL, NULL, NULL, pcb); | 308 | dsa = NULL; |
| 306 | if (ret) | 309 | |
| 307 | EVP_PKEY_assign_DSA(pkey, dsa); | 310 | ret = 1; |
| 308 | else | 311 | |
| 309 | DSA_free(dsa); | 312 | err: |
| 313 | DSA_free(dsa); | ||
| 314 | |||
| 310 | return ret; | 315 | return ret; |
| 311 | } | 316 | } |
| 312 | 317 | ||
