diff options
| author | tb <> | 2025-07-31 02:10:55 +0000 |
|---|---|---|
| committer | tb <> | 2025-07-31 02:10:55 +0000 |
| commit | 4815d09a66fcc2a3ecabae72d77e841265da2451 (patch) | |
| tree | 2b9d24dccab9f399ba0fe4de30e65fdb6cd09f49 /src | |
| parent | 5c9cc2d0035cb59dfcacb47001ca9b8392b3732b (diff) | |
| download | openbsd-4815d09a66fcc2a3ecabae72d77e841265da2451.tar.gz openbsd-4815d09a66fcc2a3ecabae72d77e841265da2451.tar.bz2 openbsd-4815d09a66fcc2a3ecabae72d77e841265da2451.zip | |
Rewrite PKCS7_get_smimecap() to use d2i_X509_ALGORS()
Since we finally found a use for i2d_X509_ALGORS(), make use of its
sibling here. This avoids some ridiculous contortions in not quite
peak muppet code (obviously this was a first test run for the grand
finale in CMS).
ok kenjiro
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_attr.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_attr.c b/src/lib/libcrypto/pkcs7/pk7_attr.c index 9a822eaecd..ceaba9138d 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.19 2025/07/31 02:02:35 tb Exp $ */ | 1 | /* $OpenBSD: pk7_attr.c,v 1.20 2025/07/31 02:10: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 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -108,14 +108,17 @@ PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) | |||
| 108 | { | 108 | { |
| 109 | ASN1_TYPE *cap; | 109 | ASN1_TYPE *cap; |
| 110 | const unsigned char *p; | 110 | const unsigned char *p; |
| 111 | int len; | ||
| 111 | 112 | ||
| 112 | cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities); | 113 | if ((cap = PKCS7_get_signed_attribute(si, NID_SMIMECapabilities)) == NULL) |
| 113 | if (!cap || (cap->type != V_ASN1_SEQUENCE)) | ||
| 114 | return NULL; | 114 | return NULL; |
| 115 | if (cap->type != V_ASN1_SEQUENCE) | ||
| 116 | return NULL; | ||
| 117 | |||
| 115 | p = cap->value.sequence->data; | 118 | p = cap->value.sequence->data; |
| 116 | return (STACK_OF(X509_ALGOR) *) | 119 | len = cap->value.sequence->length; |
| 117 | ASN1_item_d2i(NULL, &p, cap->value.sequence->length, | 120 | |
| 118 | &X509_ALGORS_it); | 121 | return d2i_X509_ALGORS(NULL, &p, len); |
| 119 | } | 122 | } |
| 120 | LCRYPTO_ALIAS(PKCS7_get_smimecap); | 123 | LCRYPTO_ALIAS(PKCS7_get_smimecap); |
| 121 | 124 | ||
