summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-08-22 12:21:07 +0000
committertb <>2024-08-22 12:21:07 +0000
commit77469fb35b36aec9b9fc2a3e1be2fbd0f80ca53f (patch)
treeac884e8e470384fe2d552aabbfb2153dc7e1bf75
parent83775f003b674b8c33f402fb1136f08f63f865e6 (diff)
downloadopenbsd-77469fb35b36aec9b9fc2a3e1be2fbd0f80ca53f.tar.gz
openbsd-77469fb35b36aec9b9fc2a3e1be2fbd0f80ca53f.tar.bz2
openbsd-77469fb35b36aec9b9fc2a3e1be2fbd0f80ca53f.zip
Neuter EVP_PKEY_add1_attr_by_NID()
The last consumer in openssl(1) pkcs12 has been removed, so we no longer need this function. ok miod
-rw-r--r--src/lib/libcrypto/evp/evp_pkey.c41
1 files changed, 5 insertions, 36 deletions
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c
index f9100e2268..dcbd51f08d 100644
--- a/src/lib/libcrypto/evp/evp_pkey.c
+++ b/src/lib/libcrypto/evp/evp_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_pkey.c,v 1.30 2024/07/14 16:06:31 tb Exp $ */ 1/* $OpenBSD: evp_pkey.c,v 1.31 2024/08/22 12:21:07 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 1999. 3 * project 1999.
4 */ 4 */
@@ -142,49 +142,18 @@ error:
142LCRYPTO_ALIAS(EVP_PKEY2PKCS8); 142LCRYPTO_ALIAS(EVP_PKEY2PKCS8);
143 143
144/* 144/*
145 * XXX - This is only used by openssl(1) pkcs12 for the Microsoft-specific 145 * XXX - delete all the garbage below in the next bump.
146 * NID_ms_csp_name and NID_LocalKeySet. This turns out to be the only reason
147 * why attributes hangs off the EVP_PKEY struct.
148 */ 146 */
147
149int 148int
150EVP_PKEY_add1_attr_by_NID(EVP_PKEY *pkey, int nid, int type, 149EVP_PKEY_add1_attr_by_NID(EVP_PKEY *pkey, int nid, int type,
151 const unsigned char *bytes, int len) 150 const unsigned char *bytes, int len)
152{ 151{
153 STACK_OF(X509_ATTRIBUTE) *attrs = NULL; 152 EVPerror(ERR_R_DISABLED);
154 X509_ATTRIBUTE *attr = NULL; 153 return 0;
155 int ret = 0;
156
157 if ((attr = X509_ATTRIBUTE_create_by_NID(NULL, nid, type,
158 bytes, len)) == NULL)
159 goto err;
160
161 if ((attrs = pkey->attributes) == NULL)
162 attrs = sk_X509_ATTRIBUTE_new_null();
163 if (attrs == NULL)
164 goto err;
165
166 if (sk_X509_ATTRIBUTE_push(attrs, attr) <= 0)
167 goto err;
168 attr = NULL;
169
170 pkey->attributes = attrs;
171 attrs = NULL;
172
173 ret = 1;
174
175 err:
176 X509_ATTRIBUTE_free(attr);
177 if (attrs != pkey->attributes)
178 sk_X509_ATTRIBUTE_pop_free(attrs, X509_ATTRIBUTE_free);
179
180 return ret;
181} 154}
182LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_NID); 155LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_NID);
183 156
184/*
185 * XXX - delete all the garbage below in the next bump.
186 */
187
188int 157int
189EVP_PKEY_get_attr_count(const EVP_PKEY *key) 158EVP_PKEY_get_attr_count(const EVP_PKEY *key)
190{ 159{