sync with OpenBSD -current

This commit is contained in:
purplerain 2024-08-23 05:18:42 +00:00
parent f7a17acf06
commit 5855eb553f
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
75 changed files with 286 additions and 284 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: evp_local.h,v 1.22 2024/04/12 09:41:39 tb Exp $ */
/* $OpenBSD: evp_local.h,v 1.23 2024/08/22 12:24:24 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
@ -175,7 +175,6 @@ struct evp_pkey_st {
#endif
} pkey;
int save_parameters;
STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
} /* EVP_PKEY */;
struct evp_md_st {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: evp_pkey.c,v 1.30 2024/07/14 16:06:31 tb Exp $ */
/* $OpenBSD: evp_pkey.c,v 1.31 2024/08/22 12:21:07 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@ -142,49 +142,18 @@ error:
LCRYPTO_ALIAS(EVP_PKEY2PKCS8);
/*
* XXX - This is only used by openssl(1) pkcs12 for the Microsoft-specific
* NID_ms_csp_name and NID_LocalKeySet. This turns out to be the only reason
* why attributes hangs off the EVP_PKEY struct.
* XXX - delete all the garbage below in the next bump.
*/
int
EVP_PKEY_add1_attr_by_NID(EVP_PKEY *pkey, int nid, int type,
const unsigned char *bytes, int len)
{
STACK_OF(X509_ATTRIBUTE) *attrs = NULL;
X509_ATTRIBUTE *attr = NULL;
int ret = 0;
if ((attr = X509_ATTRIBUTE_create_by_NID(NULL, nid, type,
bytes, len)) == NULL)
goto err;
if ((attrs = pkey->attributes) == NULL)
attrs = sk_X509_ATTRIBUTE_new_null();
if (attrs == NULL)
goto err;
if (sk_X509_ATTRIBUTE_push(attrs, attr) <= 0)
goto err;
attr = NULL;
pkey->attributes = attrs;
attrs = NULL;
ret = 1;
err:
X509_ATTRIBUTE_free(attr);
if (attrs != pkey->attributes)
sk_X509_ATTRIBUTE_pop_free(attrs, X509_ATTRIBUTE_free);
return ret;
EVPerror(ERR_R_DISABLED);
return 0;
}
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_NID);
/*
* XXX - delete all the garbage below in the next bump.
*/
int
EVP_PKEY_get_attr_count(const EVP_PKEY *key)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: p_lib.c,v 1.60 2024/04/09 13:52:41 beck Exp $ */
/* $OpenBSD: p_lib.c,v 1.61 2024/08/22 12:24:24 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -422,7 +422,6 @@ EVP_PKEY_free(EVP_PKEY *pkey)
return;
evp_pkey_free_pkey_ptr(pkey);
sk_X509_ATTRIBUTE_pop_free(pkey->attributes, X509_ATTRIBUTE_free);
freezero(pkey, sizeof(*pkey));
}
LCRYPTO_ALIAS(EVP_PKEY_free);

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: PKCS12_create.3,v 1.12 2022/03/31 17:27:17 naddy Exp $
.\" $OpenBSD: PKCS12_create.3,v 1.13 2024/08/22 12:26:01 tb Exp $
.\" full merge up to: OpenSSL 05ea606a May 20 20:52:46 2016 -0400
.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
.\"
@ -49,7 +49,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 31 2022 $
.Dd $Mdocdate: August 22 2024 $
.Dt PKCS12_CREATE 3
.Os
.Sh NAME
@ -165,7 +165,6 @@ if an error occurred.
.Sh SEE ALSO
.Xr crypto 3 ,
.Xr d2i_PKCS12 3 ,
.Xr EVP_PKEY_add1_attr 3 ,
.Xr PKCS12_new 3 ,
.Xr PKCS12_newpass 3 ,
.Xr PKCS12_parse 3 ,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: p12_crt.c,v 1.25 2024/07/15 15:43:25 tb Exp $ */
/* $OpenBSD: p12_crt.c,v 1.26 2024/08/22 12:22:42 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@ -69,33 +69,6 @@
static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags,
PKCS12_SAFEBAG *bag);
static int
copy_bag_attr(PKCS12_SAFEBAG *bag, EVP_PKEY *pkey, int nid)
{
X509_ATTRIBUTE *attr = NULL;
const ASN1_OBJECT *obj;
int i;
if ((obj = OBJ_nid2obj(nid)) == NULL) {
/* XXX - this seems wrong but preserves behavior. */
return 1;
}
for (i = 0; i < sk_X509_ATTRIBUTE_num(pkey->attributes); i++) {
attr = sk_X509_ATTRIBUTE_value(pkey->attributes, i);
if (OBJ_cmp(attr->object, obj) == 0)
break;
attr = NULL;
}
if (attr == NULL)
return 1;
if (!X509at_add1_attr(&bag->attrib, attr))
return 0;
return 1;
}
PKCS12 *
PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, X509 *cert,
STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, int mac_iter,
@ -158,11 +131,6 @@ PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, X509 *cert,
if (!bag)
goto err;
if (!copy_bag_attr(bag, pkey, NID_ms_csp_name))
goto err;
if (!copy_bag_attr(bag, pkey, NID_LocalKeySet))
goto err;
if (name && !PKCS12_add_friendlyname(bag, name, -1))
goto err;
if (keyidlen && !PKCS12_add_localkeyid(bag, keyid, keyidlen))