diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_doit.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index d5edaedbd0..5050780206 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pk7_doit.c,v 1.52 2023/03/09 18:20:10 tb Exp $ */ | 1 | /* $OpenBSD: pk7_doit.c,v 1.53 2023/11/15 00:52:44 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -68,10 +68,6 @@ | |||
| 68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
| 69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
| 70 | 70 | ||
| 71 | static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, | ||
| 72 | void *value); | ||
| 73 | static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid); | ||
| 74 | |||
| 75 | static int | 71 | static int |
| 76 | PKCS7_type_is_other(PKCS7* p7) | 72 | PKCS7_type_is_other(PKCS7* p7) |
| 77 | { | 73 | { |
| @@ -1120,20 +1116,6 @@ PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx) | |||
| 1120 | } | 1116 | } |
| 1121 | LCRYPTO_ALIAS(PKCS7_get_issuer_and_serial); | 1117 | LCRYPTO_ALIAS(PKCS7_get_issuer_and_serial); |
| 1122 | 1118 | ||
| 1123 | ASN1_TYPE * | ||
| 1124 | PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid) | ||
| 1125 | { | ||
| 1126 | return (get_attribute(si->auth_attr, nid)); | ||
| 1127 | } | ||
| 1128 | LCRYPTO_ALIAS(PKCS7_get_signed_attribute); | ||
| 1129 | |||
| 1130 | ASN1_TYPE * | ||
| 1131 | PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid) | ||
| 1132 | { | ||
| 1133 | return (get_attribute(si->unauth_attr, nid)); | ||
| 1134 | } | ||
| 1135 | LCRYPTO_ALIAS(PKCS7_get_attribute); | ||
| 1136 | |||
| 1137 | static ASN1_TYPE * | 1119 | static ASN1_TYPE * |
| 1138 | get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid) | 1120 | get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid) |
| 1139 | { | 1121 | { |
| @@ -1152,6 +1134,20 @@ get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid) | |||
| 1152 | return (NULL); | 1134 | return (NULL); |
| 1153 | } | 1135 | } |
| 1154 | 1136 | ||
| 1137 | ASN1_TYPE * | ||
| 1138 | PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid) | ||
| 1139 | { | ||
| 1140 | return (get_attribute(si->auth_attr, nid)); | ||
| 1141 | } | ||
| 1142 | LCRYPTO_ALIAS(PKCS7_get_signed_attribute); | ||
| 1143 | |||
| 1144 | ASN1_TYPE * | ||
| 1145 | PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid) | ||
| 1146 | { | ||
| 1147 | return (get_attribute(si->unauth_attr, nid)); | ||
| 1148 | } | ||
| 1149 | LCRYPTO_ALIAS(PKCS7_get_attribute); | ||
| 1150 | |||
| 1155 | ASN1_OCTET_STRING * | 1151 | ASN1_OCTET_STRING * |
| 1156 | PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk) | 1152 | PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk) |
| 1157 | { | 1153 | { |
| @@ -1208,21 +1204,6 @@ PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk) | |||
| 1208 | } | 1204 | } |
| 1209 | LCRYPTO_ALIAS(PKCS7_set_attributes); | 1205 | LCRYPTO_ALIAS(PKCS7_set_attributes); |
| 1210 | 1206 | ||
| 1211 | int | ||
| 1212 | PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, | ||
| 1213 | void *value) | ||
| 1214 | { | ||
| 1215 | return (add_attribute(&(p7si->auth_attr), nid, atrtype, value)); | ||
| 1216 | } | ||
| 1217 | LCRYPTO_ALIAS(PKCS7_add_signed_attribute); | ||
| 1218 | |||
| 1219 | int | ||
| 1220 | PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, void *value) | ||
| 1221 | { | ||
| 1222 | return (add_attribute(&(p7si->unauth_attr), nid, atrtype, value)); | ||
| 1223 | } | ||
| 1224 | LCRYPTO_ALIAS(PKCS7_add_attribute); | ||
| 1225 | |||
| 1226 | static int | 1207 | static int |
| 1227 | add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) | 1208 | add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) |
| 1228 | { | 1209 | { |
| @@ -1262,3 +1243,18 @@ new_attrib: | |||
| 1262 | end: | 1243 | end: |
| 1263 | return (1); | 1244 | return (1); |
| 1264 | } | 1245 | } |
| 1246 | |||
| 1247 | int | ||
| 1248 | PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, | ||
| 1249 | void *value) | ||
| 1250 | { | ||
| 1251 | return (add_attribute(&(p7si->auth_attr), nid, atrtype, value)); | ||
| 1252 | } | ||
| 1253 | LCRYPTO_ALIAS(PKCS7_add_signed_attribute); | ||
| 1254 | |||
| 1255 | int | ||
| 1256 | PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, void *value) | ||
| 1257 | { | ||
| 1258 | return (add_attribute(&(p7si->unauth_attr), nid, atrtype, value)); | ||
| 1259 | } | ||
| 1260 | LCRYPTO_ALIAS(PKCS7_add_attribute); | ||
