diff options
| author | tb <> | 2024-07-14 16:04:10 +0000 |
|---|---|---|
| committer | tb <> | 2024-07-14 16:04:10 +0000 |
| commit | 068d0f16a0c01c1282b13eee497c555ff6c37d01 (patch) | |
| tree | 62fa9cf1e7477aa6fe7f40cbacb593b07671ffd6 | |
| parent | 4bf572abb59e4c3165428ec5073f49c46fc75a79 (diff) | |
| download | openbsd-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
| -rw-r--r-- | src/lib/libcrypto/evp/evp_pkey.c | 31 |
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 | } |
| 142 | LCRYPTO_ALIAS(EVP_PKEY2PKCS8); | 142 | LCRYPTO_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 | ||
| 146 | int | 148 | int |
| 147 | EVP_PKEY_get_attr_count(const EVP_PKEY *key) | 149 | EVP_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 | } |
| 151 | LCRYPTO_ALIAS(EVP_PKEY_get_attr_count); | 154 | LCRYPTO_ALIAS(EVP_PKEY_get_attr_count); |
| 152 | 155 | ||
| 153 | int | 156 | int |
| 154 | EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos) | 157 | EVP_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 | } |
| 158 | LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_NID); | 162 | LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_NID); |
| 159 | 163 | ||
| @@ -161,29 +165,31 @@ int | |||
| 161 | EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, | 165 | EVP_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 | } |
| 166 | LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_OBJ); | 171 | LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_OBJ); |
| 167 | 172 | ||
| 168 | X509_ATTRIBUTE * | 173 | X509_ATTRIBUTE * |
| 169 | EVP_PKEY_get_attr(const EVP_PKEY *key, int loc) | 174 | EVP_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 | } |
| 173 | LCRYPTO_ALIAS(EVP_PKEY_get_attr); | 179 | LCRYPTO_ALIAS(EVP_PKEY_get_attr); |
| 174 | 180 | ||
| 175 | X509_ATTRIBUTE * | 181 | X509_ATTRIBUTE * |
| 176 | EVP_PKEY_delete_attr(EVP_PKEY *key, int loc) | 182 | EVP_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 | } |
| 180 | LCRYPTO_ALIAS(EVP_PKEY_delete_attr); | 187 | LCRYPTO_ALIAS(EVP_PKEY_delete_attr); |
| 181 | 188 | ||
| 182 | int | 189 | int |
| 183 | EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr) | 190 | EVP_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 | } |
| 189 | LCRYPTO_ALIAS(EVP_PKEY_add1_attr); | 195 | LCRYPTO_ALIAS(EVP_PKEY_add1_attr); |
| @@ -192,8 +198,7 @@ int | |||
| 192 | EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, const ASN1_OBJECT *obj, int type, | 198 | EVP_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 | } |
| 199 | LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_OBJ); | 204 | LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_OBJ); |
| @@ -212,9 +217,7 @@ int | |||
| 212 | EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, const char *attrname, int type, | 217 | EVP_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 | } |
| 220 | LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_txt); | 223 | LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_txt); |
