sync with OpenBSD -current

This commit is contained in:
purplerain 2024-05-11 00:55:56 +00:00
parent 492219ffd1
commit 087a435dae
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
17 changed files with 98 additions and 184 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: dsa_key.c,v 1.35 2023/08/03 18:53:55 tb Exp $ */
/* $OpenBSD: dsa_key.c,v 1.36 2024/05/10 04:53:55 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -69,24 +69,16 @@
#include "bn_local.h"
#include "dsa_local.h"
static int dsa_builtin_keygen(DSA *dsa);
int
DSA_generate_key(DSA *dsa)
{
if (dsa->meth->dsa_keygen)
return dsa->meth->dsa_keygen(dsa);
return dsa_builtin_keygen(dsa);
}
LCRYPTO_ALIAS(DSA_generate_key);
static int
dsa_builtin_keygen(DSA *dsa)
{
BIGNUM *pub_key = NULL, *priv_key = NULL;
BN_CTX *ctx = NULL;
int ok = 0;
if (dsa->meth->dsa_keygen != NULL)
return dsa->meth->dsa_keygen(dsa);
if ((priv_key = BN_new()) == NULL)
goto err;
if ((pub_key = BN_new()) == NULL)
@ -117,4 +109,6 @@ dsa_builtin_keygen(DSA *dsa)
return ok;
}
LCRYPTO_ALIAS(DSA_generate_key);
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ec_ameth.c,v 1.67 2024/04/18 11:56:53 tb Exp $ */
/* $OpenBSD: ec_ameth.c,v 1.68 2024/05/10 05:12:03 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@ -173,6 +173,7 @@ eckey_from_object(const ASN1_OBJECT *aobj, EC_KEY **out_eckey)
{
int nid;
EC_KEY_free(*out_eckey);
*out_eckey = NULL;
if ((nid = OBJ_obj2nid(aobj)) == NID_undef)
@ -206,6 +207,7 @@ eckey_to_params(EC_KEY *eckey, int *out_type, void **out_val)
static int
eckey_from_params(int ptype, const void *pval, EC_KEY **out_eckey)
{
EC_KEY_free(*out_eckey);
*out_eckey = NULL;
if (ptype == V_ASN1_SEQUENCE)