sync with OpenBSD -current
This commit is contained in:
parent
11b1e48835
commit
505632e9be
25 changed files with 37303 additions and 192 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dsa_pmeth.c,v 1.17 2023/04/25 15:48:48 tb Exp $ */
|
||||
/* $OpenBSD: dsa_pmeth.c,v 1.19 2023/12/28 22:11:26 tb Exp $ */
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 2006.
|
||||
*/
|
||||
|
@ -288,25 +288,30 @@ out_of_range:
|
|||
static int
|
||||
pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
|
||||
{
|
||||
DSA *dsa = NULL;
|
||||
DSA *dsa;
|
||||
DSA_PKEY_CTX *dctx = ctx->data;
|
||||
BN_GENCB *pcb, cb;
|
||||
int ret;
|
||||
BN_GENCB *pcb = NULL;
|
||||
BN_GENCB cb = {0};
|
||||
int ret = 0;
|
||||
|
||||
if (ctx->pkey_gencb) {
|
||||
if ((dsa = DSA_new()) == NULL)
|
||||
goto err;
|
||||
if (ctx->pkey_gencb != NULL) {
|
||||
pcb = &cb;
|
||||
evp_pkey_set_cb_translate(pcb, ctx);
|
||||
} else
|
||||
pcb = NULL;
|
||||
dsa = DSA_new();
|
||||
if (!dsa)
|
||||
return 0;
|
||||
ret = dsa_builtin_paramgen(dsa, dctx->nbits, dctx->qbits, dctx->pmd,
|
||||
NULL, 0, NULL, NULL, NULL, pcb);
|
||||
if (ret)
|
||||
EVP_PKEY_assign_DSA(pkey, dsa);
|
||||
else
|
||||
DSA_free(dsa);
|
||||
}
|
||||
if (!dsa_builtin_paramgen(dsa, dctx->nbits, dctx->qbits, dctx->pmd,
|
||||
NULL, 0, NULL, NULL, NULL, pcb))
|
||||
goto err;
|
||||
if (!EVP_PKEY_assign_DSA(pkey, dsa))
|
||||
goto err;
|
||||
dsa = NULL;
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
DSA_free(dsa);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -314,19 +319,28 @@ static int
|
|||
pkey_dsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
|
||||
{
|
||||
DSA *dsa = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (ctx->pkey == NULL) {
|
||||
DSAerror(DSA_R_NO_PARAMETERS_SET);
|
||||
return 0;
|
||||
goto err;
|
||||
}
|
||||
dsa = DSA_new();
|
||||
if (!dsa)
|
||||
return 0;
|
||||
EVP_PKEY_assign_DSA(pkey, dsa);
|
||||
/* Note: if error return, pkey is freed by parent routine */
|
||||
if ((dsa = DSA_new()) == NULL)
|
||||
goto err;
|
||||
if (!EVP_PKEY_set1_DSA(pkey, dsa))
|
||||
goto err;
|
||||
|
||||
if (!EVP_PKEY_copy_parameters(pkey, ctx->pkey))
|
||||
return 0;
|
||||
return DSA_generate_key(pkey->pkey.dsa);
|
||||
goto err;
|
||||
if (!DSA_generate_key(dsa))
|
||||
goto err;
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
DSA_free(dsa);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const EVP_PKEY_METHOD dsa_pkey_meth = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue