diff options
author | tb <> | 2024-08-22 12:22:42 +0000 |
---|---|---|
committer | tb <> | 2024-08-22 12:22:42 +0000 |
commit | 44a50157e270294ce6647668feb0e9b98553abbe (patch) | |
tree | f9c37b55be3503fde51717f8612898e4dfa40fc6 | |
parent | 77469fb35b36aec9b9fc2a3e1be2fbd0f80ca53f (diff) | |
download | openbsd-44a50157e270294ce6647668feb0e9b98553abbe.tar.gz openbsd-44a50157e270294ce6647668feb0e9b98553abbe.tar.bz2 openbsd-44a50157e270294ce6647668feb0e9b98553abbe.zip |
Remove copy_bag_attr()
It is no longer possible to set an attribute on an EVP_PKEY, so this
code is dead.
ok miod
-rw-r--r-- | src/lib/libcrypto/pkcs12/p12_crt.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c index 55fb7fd638..502ccecd25 100644 --- a/src/lib/libcrypto/pkcs12/p12_crt.c +++ b/src/lib/libcrypto/pkcs12/p12_crt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p12_crt.c,v 1.25 2024/07/15 15:43:25 tb Exp $ */ | 1 | /* $OpenBSD: p12_crt.c,v 1.26 2024/08/22 12:22:42 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -69,33 +69,6 @@ | |||
69 | static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags, | 69 | static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags, |
70 | PKCS12_SAFEBAG *bag); | 70 | PKCS12_SAFEBAG *bag); |
71 | 71 | ||
72 | static int | ||
73 | copy_bag_attr(PKCS12_SAFEBAG *bag, EVP_PKEY *pkey, int nid) | ||
74 | { | ||
75 | X509_ATTRIBUTE *attr = NULL; | ||
76 | const ASN1_OBJECT *obj; | ||
77 | int i; | ||
78 | |||
79 | if ((obj = OBJ_nid2obj(nid)) == NULL) { | ||
80 | /* XXX - this seems wrong but preserves behavior. */ | ||
81 | return 1; | ||
82 | } | ||
83 | |||
84 | for (i = 0; i < sk_X509_ATTRIBUTE_num(pkey->attributes); i++) { | ||
85 | attr = sk_X509_ATTRIBUTE_value(pkey->attributes, i); | ||
86 | if (OBJ_cmp(attr->object, obj) == 0) | ||
87 | break; | ||
88 | attr = NULL; | ||
89 | } | ||
90 | |||
91 | if (attr == NULL) | ||
92 | return 1; | ||
93 | |||
94 | if (!X509at_add1_attr(&bag->attrib, attr)) | ||
95 | return 0; | ||
96 | return 1; | ||
97 | } | ||
98 | |||
99 | PKCS12 * | 72 | PKCS12 * |
100 | PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, X509 *cert, | 73 | PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, X509 *cert, |
101 | STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, int mac_iter, | 74 | 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, | |||
158 | if (!bag) | 131 | if (!bag) |
159 | goto err; | 132 | goto err; |
160 | 133 | ||
161 | if (!copy_bag_attr(bag, pkey, NID_ms_csp_name)) | ||
162 | goto err; | ||
163 | if (!copy_bag_attr(bag, pkey, NID_LocalKeySet)) | ||
164 | goto err; | ||
165 | |||
166 | if (name && !PKCS12_add_friendlyname(bag, name, -1)) | 134 | if (name && !PKCS12_add_friendlyname(bag, name, -1)) |
167 | goto err; | 135 | goto err; |
168 | if (keyidlen && !PKCS12_add_localkeyid(bag, keyid, keyidlen)) | 136 | if (keyidlen && !PKCS12_add_localkeyid(bag, keyid, keyidlen)) |