From: tb Date: Thu, 22 Aug 2024 12:22:42 +0000 (+0000) Subject: Remove copy_bag_attr() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e12df184c62a3b12b340b666eb6fb8bc8cccad7e;p=openbsd Remove copy_bag_attr() It is no longer possible to set an attribute on an EVP_PKEY, so this code is dead. ok miod --- diff --git a/lib/libcrypto/pkcs12/p12_crt.c b/lib/libcrypto/pkcs12/p12_crt.c index 55fb7fd6380..502ccecd254 100644 --- a/lib/libcrypto/pkcs12/p12_crt.c +++ b/lib/libcrypto/pkcs12/p12_crt.c @@ -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))