summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-07-14 16:04:10 +0000
committertb <>2024-07-14 16:04:10 +0000
commit068d0f16a0c01c1282b13eee497c555ff6c37d01 (patch)
tree62fa9cf1e7477aa6fe7f40cbacb593b07671ffd6 /src
parent4bf572abb59e4c3165428ec5073f49c46fc75a79 (diff)
downloadopenbsd-068d0f16a0c01c1282b13eee497c555ff6c37d01.tar.gz
openbsd-068d0f16a0c01c1282b13eee497c555ff6c37d01.tar.bz2
openbsd-068d0f16a0c01c1282b13eee497c555ff6c37d01.zip
Disable most EVP_PKEY_*attr* API
There is a single consumer of this entire family of function, namely the openssl(1) pkcs12 command uses EVP_PKEY_add1_attr_by_NID, so leave that one intact for now. ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/evp_pkey.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c
index 591d066f4f..655ec107ff 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.28 2024/04/09 13:55:02 beck Exp $ */ 1/* $OpenBSD: evp_pkey.c,v 1.29 2024/07/14 16:04:10 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 */
@@ -141,19 +141,23 @@ error:
141} 141}
142LCRYPTO_ALIAS(EVP_PKEY2PKCS8); 142LCRYPTO_ALIAS(EVP_PKEY2PKCS8);
143 143
144/* EVP_PKEY attribute functions */ 144/*
145 * XXX - delete all the garbage below in the next bump.
146 */
145 147
146int 148int
147EVP_PKEY_get_attr_count(const EVP_PKEY *key) 149EVP_PKEY_get_attr_count(const EVP_PKEY *key)
148{ 150{
149 return X509at_get_attr_count(key->attributes); 151 EVPerror(ERR_R_DISABLED);
152 return 0;
150} 153}
151LCRYPTO_ALIAS(EVP_PKEY_get_attr_count); 154LCRYPTO_ALIAS(EVP_PKEY_get_attr_count);
152 155
153int 156int
154EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos) 157EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos)
155{ 158{
156 return X509at_get_attr_by_NID(key->attributes, nid, lastpos); 159 EVPerror(ERR_R_DISABLED);
160 return -1;
157} 161}
158LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_NID); 162LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_NID);
159 163
@@ -161,29 +165,31 @@ int
161EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, 165EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj,
162 int lastpos) 166 int lastpos)
163{ 167{
164 return X509at_get_attr_by_OBJ(key->attributes, obj, lastpos); 168 EVPerror(ERR_R_DISABLED);
169 return -1;
165} 170}
166LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_OBJ); 171LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_OBJ);
167 172
168X509_ATTRIBUTE * 173X509_ATTRIBUTE *
169EVP_PKEY_get_attr(const EVP_PKEY *key, int loc) 174EVP_PKEY_get_attr(const EVP_PKEY *key, int loc)
170{ 175{
171 return X509at_get_attr(key->attributes, loc); 176 EVPerror(ERR_R_DISABLED);
177 return NULL;
172} 178}
173LCRYPTO_ALIAS(EVP_PKEY_get_attr); 179LCRYPTO_ALIAS(EVP_PKEY_get_attr);
174 180
175X509_ATTRIBUTE * 181X509_ATTRIBUTE *
176EVP_PKEY_delete_attr(EVP_PKEY *key, int loc) 182EVP_PKEY_delete_attr(EVP_PKEY *key, int loc)
177{ 183{
178 return X509at_delete_attr(key->attributes, loc); 184 EVPerror(ERR_R_DISABLED);
185 return NULL;
179} 186}
180LCRYPTO_ALIAS(EVP_PKEY_delete_attr); 187LCRYPTO_ALIAS(EVP_PKEY_delete_attr);
181 188
182int 189int
183EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr) 190EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr)
184{ 191{
185 if (X509at_add1_attr(&key->attributes, attr)) 192 EVPerror(ERR_R_DISABLED);
186 return 1;
187 return 0; 193 return 0;
188} 194}
189LCRYPTO_ALIAS(EVP_PKEY_add1_attr); 195LCRYPTO_ALIAS(EVP_PKEY_add1_attr);
@@ -192,8 +198,7 @@ int
192EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, const ASN1_OBJECT *obj, int type, 198EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, const ASN1_OBJECT *obj, int type,
193 const unsigned char *bytes, int len) 199 const unsigned char *bytes, int len)
194{ 200{
195 if (X509at_add1_attr_by_OBJ(&key->attributes, obj, type, bytes, len)) 201 EVPerror(ERR_R_DISABLED);
196 return 1;
197 return 0; 202 return 0;
198} 203}
199LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_OBJ); 204LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_OBJ);
@@ -212,9 +217,7 @@ int
212EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, const char *attrname, int type, 217EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, const char *attrname, int type,
213 const unsigned char *bytes, int len) 218 const unsigned char *bytes, int len)
214{ 219{
215 if (X509at_add1_attr_by_txt(&key->attributes, attrname, type, 220 EVPerror(ERR_R_DISABLED);
216 bytes, len))
217 return 1;
218 return 0; 221 return 0;
219} 222}
220LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_txt); 223LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_txt);