sync with OpenBSD -current

This commit is contained in:
purplerain 2024-08-29 19:02:09 +00:00
parent bf0d2e284c
commit c0feaae94d
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
70 changed files with 792 additions and 1025 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ec_ameth.c,v 1.68 2024/05/10 05:12:03 tb Exp $ */
/* $OpenBSD: ec_ameth.c,v 1.69 2024/08/29 16:58:19 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@ -689,41 +689,6 @@ ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
}
static int
ec_pkey_check(const EVP_PKEY *pkey)
{
EC_KEY *eckey = pkey->pkey.ec;
if (eckey->priv_key == NULL) {
ECerror(EC_R_MISSING_PRIVATE_KEY);
return 0;
}
return EC_KEY_check_key(eckey);
}
static int
ec_pkey_public_check(const EVP_PKEY *pkey)
{
EC_KEY *eckey = pkey->pkey.ec;
/* This also checks the private key, but oh, well... */
return EC_KEY_check_key(eckey);
}
static int
ec_pkey_param_check(const EVP_PKEY *pkey)
{
EC_KEY *eckey = pkey->pkey.ec;
if (eckey->group == NULL) {
ECerror(EC_R_MISSING_PARAMETERS);
return 0;
}
return EC_GROUP_check(eckey->group, NULL);
}
#ifndef OPENSSL_NO_CMS
static int
@ -1092,8 +1057,4 @@ const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
.pkey_ctrl = ec_pkey_ctrl,
.old_priv_decode = old_ec_priv_decode,
.old_priv_encode = old_ec_priv_encode,
.pkey_check = ec_pkey_check,
.pkey_public_check = ec_pkey_public_check,
.pkey_param_check = ec_pkey_param_check,
};

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ecx_methods.c,v 1.13 2024/04/02 04:04:07 tb Exp $ */
/* $OpenBSD: ecx_methods.c,v 1.14 2024/08/28 07:15:04 tb Exp $ */
/*
* Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
*
@ -509,6 +509,24 @@ ecx_security_bits(const EVP_PKEY *pkey)
return 0;
}
static int
ecx_signature_info(const X509_ALGOR *algor, int *md_nid, int *pkey_nid,
int *security_bits, uint32_t *flags)
{
const ASN1_OBJECT *aobj;
X509_ALGOR_get0(&aobj, NULL, NULL, algor);
if (OBJ_obj2nid(aobj) != EVP_PKEY_ED25519)
return 0;
*md_nid = NID_undef;
*pkey_nid = NID_ED25519;
*security_bits = ED25519_SECURITY_BITS;
*flags = X509_SIG_INFO_TLS | X509_SIG_INFO_VALID;
return 1;
}
static int
ecx_param_cmp(const EVP_PKEY *pkey1, const EVP_PKEY *pkey2)
{
@ -929,6 +947,8 @@ const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = {
.pkey_bits = ecx_bits,
.pkey_security_bits = ecx_security_bits,
.signature_info = ecx_signature_info,
.param_cmp = ecx_param_cmp,
.pkey_free = ecx_free,