diff options
Diffstat (limited to 'src/lib/libcrypto/pkcs7')
-rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_asn1.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_attr.c | 166 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_doit.c | 84 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_lib.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_smime.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/pkcs7/pkcs7.h | 8 |
6 files changed, 168 insertions, 106 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_asn1.c b/src/lib/libcrypto/pkcs7/pk7_asn1.c index 8a6ae487da..be1c4c1a1d 100644 --- a/src/lib/libcrypto/pkcs7/pk7_asn1.c +++ b/src/lib/libcrypto/pkcs7/pk7_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pk7_asn1.c,v 1.18 2024/07/08 16:23:27 beck Exp $ */ | 1 | /* $OpenBSD: pk7_asn1.c,v 1.19 2025/06/11 18:11:55 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 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -84,7 +84,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
84 | .field_name = "d.data", | 84 | .field_name = "d.data", |
85 | .item = &ASN1_OCTET_STRING_NDEF_it, | 85 | .item = &ASN1_OCTET_STRING_NDEF_it, |
86 | }, | 86 | }, |
87 | |||
88 | }, | 87 | }, |
89 | { | 88 | { |
90 | .value = NID_pkcs7_signed, | 89 | .value = NID_pkcs7_signed, |
@@ -95,7 +94,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
95 | .field_name = "d.sign", | 94 | .field_name = "d.sign", |
96 | .item = &PKCS7_SIGNED_it, | 95 | .item = &PKCS7_SIGNED_it, |
97 | }, | 96 | }, |
98 | |||
99 | }, | 97 | }, |
100 | { | 98 | { |
101 | .value = NID_pkcs7_enveloped, | 99 | .value = NID_pkcs7_enveloped, |
@@ -106,7 +104,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
106 | .field_name = "d.enveloped", | 104 | .field_name = "d.enveloped", |
107 | .item = &PKCS7_ENVELOPE_it, | 105 | .item = &PKCS7_ENVELOPE_it, |
108 | }, | 106 | }, |
109 | |||
110 | }, | 107 | }, |
111 | { | 108 | { |
112 | .value = NID_pkcs7_signedAndEnveloped, | 109 | .value = NID_pkcs7_signedAndEnveloped, |
@@ -117,7 +114,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
117 | .field_name = "d.signed_and_enveloped", | 114 | .field_name = "d.signed_and_enveloped", |
118 | .item = &PKCS7_SIGN_ENVELOPE_it, | 115 | .item = &PKCS7_SIGN_ENVELOPE_it, |
119 | }, | 116 | }, |
120 | |||
121 | }, | 117 | }, |
122 | { | 118 | { |
123 | .value = NID_pkcs7_digest, | 119 | .value = NID_pkcs7_digest, |
@@ -128,7 +124,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
128 | .field_name = "d.digest", | 124 | .field_name = "d.digest", |
129 | .item = &PKCS7_DIGEST_it, | 125 | .item = &PKCS7_DIGEST_it, |
130 | }, | 126 | }, |
131 | |||
132 | }, | 127 | }, |
133 | { | 128 | { |
134 | .value = NID_pkcs7_encrypted, | 129 | .value = NID_pkcs7_encrypted, |
@@ -139,7 +134,6 @@ static const ASN1_ADB_TABLE PKCS7_adbtbl[] = { | |||
139 | .field_name = "d.encrypted", | 134 | .field_name = "d.encrypted", |
140 | .item = &PKCS7_ENCRYPT_it, | 135 | .item = &PKCS7_ENCRYPT_it, |
141 | }, | 136 | }, |
142 | |||
143 | }, | 137 | }, |
144 | }; | 138 | }; |
145 | 139 | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_attr.c b/src/lib/libcrypto/pkcs7/pk7_attr.c index 52463aa3a3..f2e17806db 100644 --- a/src/lib/libcrypto/pkcs7/pk7_attr.c +++ b/src/lib/libcrypto/pkcs7/pk7_attr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pk7_attr.c,v 1.15 2024/02/19 15:37:44 tb Exp $ */ | 1 | /* $OpenBSD: pk7_attr.c,v 1.22 2025/07/31 02:24:21 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 2001. | 3 | * project 2001. |
4 | */ | 4 | */ |
@@ -59,23 +59,48 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | 60 | ||
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | #include <openssl/err.h> | ||
63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
64 | #include <openssl/pkcs7.h> | 63 | #include <openssl/pkcs7.h> |
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | 65 | ||
66 | #include "asn1_local.h" | ||
67 | #include "err_local.h" | ||
68 | #include "x509_local.h" | ||
69 | |||
67 | int | 70 | int |
68 | PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) | 71 | PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) |
69 | { | 72 | { |
70 | ASN1_STRING *seq; | 73 | ASN1_STRING *seq = NULL; |
71 | if (!(seq = ASN1_STRING_new())) { | 74 | unsigned char *data = NULL; |
75 | int len = 0; | ||
76 | int ret = 0; | ||
77 | |||
78 | if ((len = i2d_X509_ALGORS(cap, &data)) <= 0) { | ||
79 | len = 0; | ||
80 | goto err; | ||
81 | } | ||
82 | |||
83 | if ((seq = ASN1_STRING_new()) == NULL) { | ||
72 | PKCS7error(ERR_R_MALLOC_FAILURE); | 84 | PKCS7error(ERR_R_MALLOC_FAILURE); |
73 | return 0; | 85 | goto err; |
74 | } | 86 | } |
75 | seq->length = ASN1_item_i2d((ASN1_VALUE *)cap, &seq->data, | 87 | |
76 | &X509_ALGORS_it); | 88 | ASN1_STRING_set0(seq, data, len); |
77 | return PKCS7_add_signed_attribute(si, NID_SMIMECapabilities, | 89 | data = NULL; |
78 | V_ASN1_SEQUENCE, seq); | 90 | len = 0; |
91 | |||
92 | if (!PKCS7_add_signed_attribute(si, NID_SMIMECapabilities, | ||
93 | V_ASN1_SEQUENCE, seq)) | ||
94 | goto err; | ||
95 | seq = NULL; | ||
96 | |||
97 | ret = 1; | ||
98 | |||
99 | err: | ||
100 | ASN1_STRING_free(seq); | ||
101 | freezero(data, len); | ||
102 | |||
103 | return ret; | ||
79 | } | 104 | } |
80 | LCRYPTO_ALIAS(PKCS7_add_attrib_smimecap); | 105 | LCRYPTO_ALIAS(PKCS7_add_attrib_smimecap); |
81 | 106 | ||
@@ -84,51 +109,60 @@ PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) | |||
84 | { | 109 | { |
85 | ASN1_TYPE *cap; | 110 | ASN1_TYPE *cap; |
86 | const unsigned char *p; | 111 | const unsigned char *p; |
112 | int len; | ||
87 | 113 | ||
88 | cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); | 114 | if ((cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities)) == NULL) |
89 | if (!cap || (cap->type != V_ASN1_SEQUENCE)) | 115 | return NULL; |
116 | if (cap->type != V_ASN1_SEQUENCE) | ||
90 | return NULL; | 117 | return NULL; |
118 | |||
91 | p = cap->value.sequence->data; | 119 | p = cap->value.sequence->data; |
92 | return (STACK_OF(X509_ALGOR) *) | 120 | len = cap->value.sequence->length; |
93 | ASN1_item_d2i(NULL, &p, cap->value.sequence->length, | 121 | |
94 | &X509_ALGORS_it); | 122 | return d2i_X509_ALGORS(NULL, &p, len); |
95 | } | 123 | } |
96 | LCRYPTO_ALIAS(PKCS7_get_smimecap); | 124 | LCRYPTO_ALIAS(PKCS7_get_smimecap); |
97 | 125 | ||
98 | /* Basic smime-capabilities OID and optional integer arg */ | 126 | /* |
127 | * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute | ||
128 | * set |sk| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has an | ||
129 | * integer parameter of value |keysize|, otherwise parameters are omitted. | ||
130 | * | ||
131 | * See also CMS_add_simple_smimecap(). | ||
132 | */ | ||
99 | int | 133 | int |
100 | PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) | 134 | PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int keysize) |
101 | { | 135 | { |
102 | X509_ALGOR *alg; | 136 | X509_ALGOR *alg = NULL; |
137 | ASN1_INTEGER *parameter = NULL; | ||
138 | int parameter_type = V_ASN1_UNDEF; | ||
139 | int ret = 0; | ||
103 | 140 | ||
104 | if (!(alg = X509_ALGOR_new())) { | 141 | if (keysize > 0) { |
105 | PKCS7error(ERR_R_MALLOC_FAILURE); | 142 | if ((parameter = ASN1_INTEGER_new()) == NULL) |
106 | return 0; | ||
107 | } | ||
108 | ASN1_OBJECT_free(alg->algorithm); | ||
109 | alg->algorithm = OBJ_nid2obj(nid); | ||
110 | if (arg > 0) { | ||
111 | ASN1_INTEGER *nbit; | ||
112 | |||
113 | if (!(alg->parameter = ASN1_TYPE_new())) | ||
114 | goto err; | ||
115 | if (!(nbit = ASN1_INTEGER_new())) | ||
116 | goto err; | 143 | goto err; |
117 | if (!ASN1_INTEGER_set(nbit, arg)) { | 144 | if (!ASN1_INTEGER_set(parameter, keysize)) |
118 | ASN1_INTEGER_free(nbit); | ||
119 | goto err; | 145 | goto err; |
120 | } | 146 | parameter_type = V_ASN1_INTEGER; |
121 | alg->parameter->value.integer = nbit; | ||
122 | alg->parameter->type = V_ASN1_INTEGER; | ||
123 | } | 147 | } |
124 | if (sk_X509_ALGOR_push(sk, alg) == 0) | 148 | |
149 | if ((alg = X509_ALGOR_new()) == NULL) | ||
125 | goto err; | 150 | goto err; |
126 | return 1; | 151 | if (!X509_ALGOR_set0_by_nid(alg, nid, parameter_type, parameter)) |
152 | goto err; | ||
153 | parameter = NULL; | ||
154 | |||
155 | if (sk_X509_ALGOR_push(sk, alg) <= 0) | ||
156 | goto err; | ||
157 | alg = NULL; | ||
127 | 158 | ||
128 | err: | 159 | ret = 1; |
129 | PKCS7error(ERR_R_MALLOC_FAILURE); | 160 | |
161 | err: | ||
130 | X509_ALGOR_free(alg); | 162 | X509_ALGOR_free(alg); |
131 | return 0; | 163 | ASN1_INTEGER_free(parameter); |
164 | |||
165 | return ret; | ||
132 | } | 166 | } |
133 | LCRYPTO_ALIAS(PKCS7_simple_smimecap); | 167 | LCRYPTO_ALIAS(PKCS7_simple_smimecap); |
134 | 168 | ||
@@ -147,30 +181,54 @@ LCRYPTO_ALIAS(PKCS7_add_attrib_content_type); | |||
147 | int | 181 | int |
148 | PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t) | 182 | PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t) |
149 | { | 183 | { |
150 | if (!t && !(t = X509_gmtime_adj(NULL, 0))) { | 184 | ASN1_TIME *tm; |
185 | int ret = 0; | ||
186 | |||
187 | if ((tm = t) == NULL) | ||
188 | tm = X509_gmtime_adj(NULL, 0); | ||
189 | if (tm == NULL) { | ||
151 | PKCS7error(ERR_R_MALLOC_FAILURE); | 190 | PKCS7error(ERR_R_MALLOC_FAILURE); |
152 | return 0; | 191 | goto err; |
153 | } | 192 | } |
154 | return PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime, | 193 | |
155 | V_ASN1_UTCTIME, t); | 194 | /* RFC 5652, section 11.3 - UTCTime for the years 1950-2049. */ |
195 | if (ASN1_time_parse(tm->data, tm->length, NULL, tm->type) == -1) | ||
196 | goto err; | ||
197 | if (!PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime, tm->type, tm)) | ||
198 | goto err; | ||
199 | tm = NULL; | ||
200 | |||
201 | ret = 1; | ||
202 | |||
203 | err: | ||
204 | if (tm != t) | ||
205 | ASN1_TIME_free(tm); | ||
206 | |||
207 | return ret; | ||
156 | } | 208 | } |
157 | LCRYPTO_ALIAS(PKCS7_add0_attrib_signing_time); | 209 | LCRYPTO_ALIAS(PKCS7_add0_attrib_signing_time); |
158 | 210 | ||
159 | int | 211 | int |
160 | PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, | 212 | PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, |
161 | int mdlen) | 213 | int md_len) |
162 | { | 214 | { |
163 | ASN1_OCTET_STRING *os; | 215 | ASN1_OCTET_STRING *os; |
216 | int ret = 0; | ||
164 | 217 | ||
165 | os = ASN1_OCTET_STRING_new(); | 218 | if ((os = ASN1_OCTET_STRING_new()) == NULL) |
166 | if (!os) | 219 | goto err; |
167 | return 0; | 220 | if (!ASN1_STRING_set(os, md, md_len)) |
168 | if (!ASN1_STRING_set(os, md, mdlen) || | 221 | goto err; |
169 | !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, | 222 | if (!PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, |
170 | V_ASN1_OCTET_STRING, os)) { | 223 | V_ASN1_OCTET_STRING, os)) |
171 | ASN1_OCTET_STRING_free(os); | 224 | goto err; |
172 | return 0; | 225 | os = NULL; |
173 | } | 226 | |
174 | return 1; | 227 | ret = 1; |
228 | |||
229 | err: | ||
230 | ASN1_OCTET_STRING_free(os); | ||
231 | |||
232 | return ret; | ||
175 | } | 233 | } |
176 | LCRYPTO_ALIAS(PKCS7_add1_attrib_digest); | 234 | LCRYPTO_ALIAS(PKCS7_add1_attrib_digest); |
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index e1c075f15a..e39d960780 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.57 2024/11/30 10:01:31 tb Exp $ */ | 1 | /* $OpenBSD: pk7_doit.c,v 1.61 2025/07/27 07:06:41 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 | * |
@@ -60,11 +60,11 @@ | |||
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/err.h> | ||
64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
67 | 66 | ||
67 | #include "err_local.h" | ||
68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
69 | #include "x509_local.h" | 69 | #include "x509_local.h" |
70 | 70 | ||
@@ -981,8 +981,8 @@ PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio, | |||
981 | X509_STORE_CTX_cleanup(ctx); | 981 | X509_STORE_CTX_cleanup(ctx); |
982 | 982 | ||
983 | return PKCS7_signatureVerify(bio, p7, si, x509); | 983 | return PKCS7_signatureVerify(bio, p7, si, x509); |
984 | |||
984 | err: | 985 | err: |
985 | |||
986 | return ret; | 986 | return ret; |
987 | } | 987 | } |
988 | LCRYPTO_ALIAS(PKCS7_dataVerify); | 988 | LCRYPTO_ALIAS(PKCS7_dataVerify); |
@@ -1067,8 +1067,10 @@ PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, X509 *x509) | |||
1067 | ret = -1; | 1067 | ret = -1; |
1068 | goto err; | 1068 | goto err; |
1069 | } | 1069 | } |
1070 | if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen)) | 1070 | if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen)) { |
1071 | free(abuf); | ||
1071 | goto err; | 1072 | goto err; |
1073 | } | ||
1072 | 1074 | ||
1073 | free(abuf); | 1075 | free(abuf); |
1074 | } | 1076 | } |
@@ -1206,43 +1208,51 @@ PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk) | |||
1206 | LCRYPTO_ALIAS(PKCS7_set_attributes); | 1208 | LCRYPTO_ALIAS(PKCS7_set_attributes); |
1207 | 1209 | ||
1208 | static int | 1210 | static int |
1209 | add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) | 1211 | add_attribute(STACK_OF(X509_ATTRIBUTE) **in_sk, int nid, int atrtype, void *value) |
1210 | { | 1212 | { |
1211 | X509_ATTRIBUTE *attr = NULL; | 1213 | STACK_OF(X509_ATTRIBUTE) *sk; |
1214 | X509_ATTRIBUTE *old_attr = NULL, *new_attr = NULL; | ||
1215 | int need_pop = 0; | ||
1216 | int i; | ||
1212 | 1217 | ||
1213 | if (*sk == NULL) { | 1218 | if ((sk = *in_sk) == NULL) |
1214 | *sk = sk_X509_ATTRIBUTE_new_null(); | 1219 | sk = sk_X509_ATTRIBUTE_new_null(); |
1215 | if (*sk == NULL) | 1220 | if (sk == NULL) |
1216 | return 0; | 1221 | goto err; |
1217 | new_attrib: | 1222 | |
1218 | if (!(attr = X509_ATTRIBUTE_create(nid, atrtype, value))) | 1223 | /* Replace an already existing attribute with the given nid. */ |
1219 | return 0; | 1224 | for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) { |
1220 | if (!sk_X509_ATTRIBUTE_push(*sk, attr)) { | 1225 | old_attr = sk_X509_ATTRIBUTE_value(sk, i); |
1221 | X509_ATTRIBUTE_free(attr); | 1226 | if(OBJ_obj2nid(old_attr->object) == nid) |
1222 | return 0; | 1227 | break; |
1223 | } | ||
1224 | } else { | ||
1225 | int i; | ||
1226 | |||
1227 | for (i = 0; i < sk_X509_ATTRIBUTE_num(*sk); i++) { | ||
1228 | attr = sk_X509_ATTRIBUTE_value(*sk, i); | ||
1229 | if (OBJ_obj2nid(attr->object) == nid) { | ||
1230 | X509_ATTRIBUTE_free(attr); | ||
1231 | attr = X509_ATTRIBUTE_create(nid, atrtype, | ||
1232 | value); | ||
1233 | if (attr == NULL) | ||
1234 | return 0; | ||
1235 | if (!sk_X509_ATTRIBUTE_set(*sk, i, attr)) { | ||
1236 | X509_ATTRIBUTE_free(attr); | ||
1237 | return 0; | ||
1238 | } | ||
1239 | goto end; | ||
1240 | } | ||
1241 | } | ||
1242 | goto new_attrib; | ||
1243 | } | 1228 | } |
1244 | end: | 1229 | |
1230 | /* If there is none, make room for the new one, so _set() succeeds. */ | ||
1231 | if (i == sk_X509_ATTRIBUTE_num(sk)) { | ||
1232 | old_attr = NULL; | ||
1233 | if (sk_X509_ATTRIBUTE_push(sk, NULL) <= 0) | ||
1234 | goto err; | ||
1235 | need_pop = 1; | ||
1236 | } | ||
1237 | |||
1238 | /* On success, new_attr owns value. */ | ||
1239 | if ((new_attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL) | ||
1240 | goto err; | ||
1241 | |||
1242 | X509_ATTRIBUTE_free(old_attr); | ||
1243 | (void)sk_X509_ATTRIBUTE_set(sk, i, new_attr); | ||
1244 | |||
1245 | *in_sk = sk; | ||
1246 | |||
1245 | return 1; | 1247 | return 1; |
1248 | |||
1249 | err: | ||
1250 | if (need_pop) | ||
1251 | (void)sk_X509_ATTRIBUTE_pop(sk); | ||
1252 | if (*in_sk != sk) | ||
1253 | sk_X509_ATTRIBUTE_pop_free(sk, X509_ATTRIBUTE_free); | ||
1254 | |||
1255 | return 0; | ||
1246 | } | 1256 | } |
1247 | 1257 | ||
1248 | int | 1258 | int |
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c index a1c7d61cca..8712a2ecc1 100644 --- a/src/lib/libcrypto/pkcs7/pk7_lib.c +++ b/src/lib/libcrypto/pkcs7/pk7_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pk7_lib.c,v 1.30 2024/12/06 07:10:20 tb Exp $ */ | 1 | /* $OpenBSD: pk7_lib.c,v 1.31 2025/05/10 05:54:38 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 | * |
@@ -58,11 +58,11 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | 60 | ||
61 | #include <openssl/err.h> | ||
62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
64 | 63 | ||
65 | #include "asn1_local.h" | 64 | #include "asn1_local.h" |
65 | #include "err_local.h" | ||
66 | #include "evp_local.h" | 66 | #include "evp_local.h" |
67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
68 | 68 | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c index cff89c34e1..32f28f0505 100644 --- a/src/lib/libcrypto/pkcs7/pk7_smime.c +++ b/src/lib/libcrypto/pkcs7/pk7_smime.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pk7_smime.c,v 1.27 2024/04/20 10:11:55 tb Exp $ */ | 1 | /* $OpenBSD: pk7_smime.c,v 1.28 2025/05/10 05:54:38 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 | */ |
@@ -60,10 +60,10 @@ | |||
60 | 60 | ||
61 | #include <stdio.h> | 61 | #include <stdio.h> |
62 | 62 | ||
63 | #include <openssl/err.h> | ||
64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
65 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
66 | 65 | ||
66 | #include "err_local.h" | ||
67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
68 | 68 | ||
69 | static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si); | 69 | static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si); |
diff --git a/src/lib/libcrypto/pkcs7/pkcs7.h b/src/lib/libcrypto/pkcs7/pkcs7.h index 6fd5adf457..6f0ccc0dc8 100644 --- a/src/lib/libcrypto/pkcs7/pkcs7.h +++ b/src/lib/libcrypto/pkcs7/pkcs7.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkcs7.h,v 1.22 2024/10/23 01:57:19 jsg Exp $ */ | 1 | /* $OpenBSD: pkcs7.h,v 1.24 2025/07/02 10:24:17 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 | * |
@@ -82,7 +82,7 @@ typedef struct pkcs7_issuer_and_serial_st { | |||
82 | } PKCS7_ISSUER_AND_SERIAL; | 82 | } PKCS7_ISSUER_AND_SERIAL; |
83 | 83 | ||
84 | typedef struct pkcs7_signer_info_st { | 84 | typedef struct pkcs7_signer_info_st { |
85 | ASN1_INTEGER *version; /* version 1 */ | 85 | ASN1_INTEGER *version; /* version 1 */ |
86 | PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; | 86 | PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; |
87 | X509_ALGOR *digest_alg; | 87 | X509_ALGOR *digest_alg; |
88 | STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ | 88 | STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ |
@@ -145,7 +145,7 @@ typedef struct pkcs7_signedandenveloped_st { | |||
145 | typedef struct pkcs7_digest_st { | 145 | typedef struct pkcs7_digest_st { |
146 | ASN1_INTEGER *version; /* version 0 */ | 146 | ASN1_INTEGER *version; /* version 0 */ |
147 | X509_ALGOR *md; /* md used */ | 147 | X509_ALGOR *md; /* md used */ |
148 | struct pkcs7_st *contents; | 148 | struct pkcs7_st *contents; |
149 | ASN1_OCTET_STRING *digest; | 149 | ASN1_OCTET_STRING *digest; |
150 | } PKCS7_DIGEST; | 150 | } PKCS7_DIGEST; |
151 | 151 | ||
@@ -362,7 +362,7 @@ PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); | |||
362 | ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); | 362 | ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); |
363 | int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, | 363 | int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, |
364 | void *data); | 364 | void *data); |
365 | int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, | 365 | int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, |
366 | void *value); | 366 | void *value); |
367 | ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); | 367 | ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); |
368 | ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); | 368 | ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); |