diff options
Diffstat (limited to 'src/lib/libcrypto/cms')
-rw-r--r-- | src/lib/libcrypto/cms/cms_dd.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_enc.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_env.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_ess.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_io.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_kari.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_lib.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_pwri.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_sd.c | 44 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_smime.c | 4 |
10 files changed, 30 insertions, 50 deletions
diff --git a/src/lib/libcrypto/cms/cms_dd.c b/src/lib/libcrypto/cms/cms_dd.c index 0a357094c5..daccbcd988 100644 --- a/src/lib/libcrypto/cms/cms_dd.c +++ b/src/lib/libcrypto/cms/cms_dd.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_dd.c,v 1.17 2023/10/26 09:08:57 tb Exp $ */ | 1 | /* $OpenBSD: cms_dd.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -56,11 +56,11 @@ | |||
56 | 56 | ||
57 | #include <openssl/asn1.h> | 57 | #include <openssl/asn1.h> |
58 | #include <openssl/cms.h> | 58 | #include <openssl/cms.h> |
59 | #include <openssl/err.h> | ||
60 | #include <openssl/evp.h> | 59 | #include <openssl/evp.h> |
61 | #include <openssl/objects.h> | 60 | #include <openssl/objects.h> |
62 | 61 | ||
63 | #include "cms_local.h" | 62 | #include "cms_local.h" |
63 | #include "err_local.h" | ||
64 | #include "x509_local.h" | 64 | #include "x509_local.h" |
65 | 65 | ||
66 | /* CMS DigestedData Utilities */ | 66 | /* CMS DigestedData Utilities */ |
diff --git a/src/lib/libcrypto/cms/cms_enc.c b/src/lib/libcrypto/cms/cms_enc.c index ef6925dbd6..928b396815 100644 --- a/src/lib/libcrypto/cms/cms_enc.c +++ b/src/lib/libcrypto/cms/cms_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_enc.c,v 1.25 2024/11/01 18:34:06 tb Exp $ */ | 1 | /* $OpenBSD: cms_enc.c,v 1.26 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -58,12 +58,12 @@ | |||
58 | #include <openssl/asn1.h> | 58 | #include <openssl/asn1.h> |
59 | #include <openssl/bio.h> | 59 | #include <openssl/bio.h> |
60 | #include <openssl/cms.h> | 60 | #include <openssl/cms.h> |
61 | #include <openssl/err.h> | ||
62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
64 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
65 | 64 | ||
66 | #include "cms_local.h" | 65 | #include "cms_local.h" |
66 | #include "err_local.h" | ||
67 | #include "evp_local.h" | 67 | #include "evp_local.h" |
68 | 68 | ||
69 | /* CMS EncryptedData Utilities */ | 69 | /* CMS EncryptedData Utilities */ |
diff --git a/src/lib/libcrypto/cms/cms_env.c b/src/lib/libcrypto/cms/cms_env.c index 629d23215e..7fa578466d 100644 --- a/src/lib/libcrypto/cms/cms_env.c +++ b/src/lib/libcrypto/cms/cms_env.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_env.c,v 1.28 2024/11/01 18:42:10 tb Exp $ */ | 1 | /* $OpenBSD: cms_env.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -59,12 +59,12 @@ | |||
59 | #include <openssl/asn1.h> | 59 | #include <openssl/asn1.h> |
60 | #include <openssl/bio.h> | 60 | #include <openssl/bio.h> |
61 | #include <openssl/cms.h> | 61 | #include <openssl/cms.h> |
62 | #include <openssl/err.h> | ||
63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | 65 | ||
67 | #include "cms_local.h" | 66 | #include "cms_local.h" |
67 | #include "err_local.h" | ||
68 | #include "evp_local.h" | 68 | #include "evp_local.h" |
69 | 69 | ||
70 | /* CMS EnvelopedData Utilities */ | 70 | /* CMS EnvelopedData Utilities */ |
diff --git a/src/lib/libcrypto/cms/cms_ess.c b/src/lib/libcrypto/cms/cms_ess.c index f01dcf73ed..5435fa404c 100644 --- a/src/lib/libcrypto/cms/cms_ess.c +++ b/src/lib/libcrypto/cms/cms_ess.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_ess.c,v 1.26 2024/11/01 18:53:35 tb Exp $ */ | 1 | /* $OpenBSD: cms_ess.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -57,13 +57,13 @@ | |||
57 | 57 | ||
58 | #include <openssl/asn1.h> | 58 | #include <openssl/asn1.h> |
59 | #include <openssl/cms.h> | 59 | #include <openssl/cms.h> |
60 | #include <openssl/err.h> | ||
61 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
65 | 64 | ||
66 | #include "cms_local.h" | 65 | #include "cms_local.h" |
66 | #include "err_local.h" | ||
67 | 67 | ||
68 | CMS_ReceiptRequest * | 68 | CMS_ReceiptRequest * |
69 | d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **a, const unsigned char **in, long len) | 69 | d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **a, const unsigned char **in, long len) |
diff --git a/src/lib/libcrypto/cms/cms_io.c b/src/lib/libcrypto/cms/cms_io.c index 84ada47c49..a9be5461a3 100644 --- a/src/lib/libcrypto/cms/cms_io.c +++ b/src/lib/libcrypto/cms/cms_io.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_io.c,v 1.21 2024/03/30 01:53:05 joshua Exp $ */ | 1 | /* $OpenBSD: cms_io.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -54,12 +54,12 @@ | |||
54 | 54 | ||
55 | #include <openssl/asn1t.h> | 55 | #include <openssl/asn1t.h> |
56 | #include <openssl/cms.h> | 56 | #include <openssl/cms.h> |
57 | #include <openssl/err.h> | ||
58 | #include <openssl/pem.h> | 57 | #include <openssl/pem.h> |
59 | #include <openssl/x509.h> | 58 | #include <openssl/x509.h> |
60 | 59 | ||
61 | #include "asn1_local.h" | 60 | #include "asn1_local.h" |
62 | #include "cms_local.h" | 61 | #include "cms_local.h" |
62 | #include "err_local.h" | ||
63 | 63 | ||
64 | int | 64 | int |
65 | CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) | 65 | CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) |
diff --git a/src/lib/libcrypto/cms/cms_kari.c b/src/lib/libcrypto/cms/cms_kari.c index 86b1ad9e83..c23da18058 100644 --- a/src/lib/libcrypto/cms/cms_kari.c +++ b/src/lib/libcrypto/cms/cms_kari.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_kari.c,v 1.17 2024/11/01 18:34:06 tb Exp $ */ | 1 | /* $OpenBSD: cms_kari.c,v 1.18 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -57,10 +57,10 @@ | |||
57 | 57 | ||
58 | #include <openssl/asn1.h> | 58 | #include <openssl/asn1.h> |
59 | #include <openssl/cms.h> | 59 | #include <openssl/cms.h> |
60 | #include <openssl/err.h> | ||
61 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
62 | 61 | ||
63 | #include "cms_local.h" | 62 | #include "cms_local.h" |
63 | #include "err_local.h" | ||
64 | 64 | ||
65 | /* Key Agreement Recipient Info (KARI) routines */ | 65 | /* Key Agreement Recipient Info (KARI) routines */ |
66 | 66 | ||
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c index 2d7a8d9f21..b9fc5c21c7 100644 --- a/src/lib/libcrypto/cms/cms_lib.c +++ b/src/lib/libcrypto/cms/cms_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_lib.c,v 1.26 2024/11/01 18:53:35 tb Exp $ */ | 1 | /* $OpenBSD: cms_lib.c,v 1.27 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -57,13 +57,13 @@ | |||
57 | #include <openssl/asn1.h> | 57 | #include <openssl/asn1.h> |
58 | #include <openssl/bio.h> | 58 | #include <openssl/bio.h> |
59 | #include <openssl/cms.h> | 59 | #include <openssl/cms.h> |
60 | #include <openssl/err.h> | ||
61 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
62 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
63 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
64 | #include <openssl/x509v3.h> | 63 | #include <openssl/x509v3.h> |
65 | 64 | ||
66 | #include "cms_local.h" | 65 | #include "cms_local.h" |
66 | #include "err_local.h" | ||
67 | #include "x509_local.h" | 67 | #include "x509_local.h" |
68 | 68 | ||
69 | CMS_ContentInfo * | 69 | CMS_ContentInfo * |
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c index b6fe5df961..1f64fc71f7 100644 --- a/src/lib/libcrypto/cms/cms_pwri.c +++ b/src/lib/libcrypto/cms/cms_pwri.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_pwri.c,v 1.31 2024/01/14 18:40:24 tb Exp $ */ | 1 | /* $OpenBSD: cms_pwri.c,v 1.32 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -58,13 +58,13 @@ | |||
58 | #include <string.h> | 58 | #include <string.h> |
59 | 59 | ||
60 | #include <openssl/asn1.h> | 60 | #include <openssl/asn1.h> |
61 | #include <openssl/err.h> | ||
62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
63 | #include <openssl/cms.h> | 62 | #include <openssl/cms.h> |
64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
65 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
66 | 65 | ||
67 | #include "cms_local.h" | 66 | #include "cms_local.h" |
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 | ||
diff --git a/src/lib/libcrypto/cms/cms_sd.c b/src/lib/libcrypto/cms/cms_sd.c index 9cdd4ce143..abcac83e47 100644 --- a/src/lib/libcrypto/cms/cms_sd.c +++ b/src/lib/libcrypto/cms/cms_sd.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_sd.c,v 1.33 2024/04/20 10:11:55 tb Exp $ */ | 1 | /* $OpenBSD: cms_sd.c,v 1.36 2025/07/31 02:24:21 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -57,7 +57,6 @@ | |||
57 | 57 | ||
58 | #include <openssl/asn1.h> | 58 | #include <openssl/asn1.h> |
59 | #include <openssl/bio.h> | 59 | #include <openssl/bio.h> |
60 | #include <openssl/err.h> | ||
61 | #include <openssl/evp.h> | 60 | #include <openssl/evp.h> |
62 | #include <openssl/cms.h> | 61 | #include <openssl/cms.h> |
63 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
@@ -66,6 +65,7 @@ | |||
66 | 65 | ||
67 | #include "asn1_local.h" | 66 | #include "asn1_local.h" |
68 | #include "cms_local.h" | 67 | #include "cms_local.h" |
68 | #include "err_local.h" | ||
69 | #include "evp_local.h" | 69 | #include "evp_local.h" |
70 | #include "x509_local.h" | 70 | #include "x509_local.h" |
71 | 71 | ||
@@ -484,35 +484,6 @@ CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer, EVP_PKEY *pk, | |||
484 | } | 484 | } |
485 | LCRYPTO_ALIAS(CMS_add1_signer); | 485 | LCRYPTO_ALIAS(CMS_add1_signer); |
486 | 486 | ||
487 | static int | ||
488 | cms_add1_signingTime(CMS_SignerInfo *si, ASN1_TIME *t) | ||
489 | { | ||
490 | ASN1_TIME *tt; | ||
491 | int r = 0; | ||
492 | |||
493 | if (t) | ||
494 | tt = t; | ||
495 | else | ||
496 | tt = X509_gmtime_adj(NULL, 0); | ||
497 | |||
498 | if (!tt) | ||
499 | goto merr; | ||
500 | |||
501 | if (CMS_signed_add1_attr_by_NID(si, NID_pkcs9_signingTime, | ||
502 | tt->type, tt, -1) <= 0) | ||
503 | goto merr; | ||
504 | |||
505 | r = 1; | ||
506 | |||
507 | merr: | ||
508 | if (!t) | ||
509 | ASN1_TIME_free(tt); | ||
510 | if (!r) | ||
511 | CMSerror(ERR_R_MALLOC_FAILURE); | ||
512 | |||
513 | return r; | ||
514 | } | ||
515 | |||
516 | EVP_PKEY_CTX * | 487 | EVP_PKEY_CTX * |
517 | CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si) | 488 | CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si) |
518 | { | 489 | { |
@@ -778,6 +749,7 @@ cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain) | |||
778 | int | 749 | int |
779 | CMS_SignerInfo_sign(CMS_SignerInfo *si) | 750 | CMS_SignerInfo_sign(CMS_SignerInfo *si) |
780 | { | 751 | { |
752 | ASN1_TIME *at = NULL; | ||
781 | const EVP_MD *md; | 753 | const EVP_MD *md; |
782 | unsigned char *buf = NULL, *sig = NULL; | 754 | unsigned char *buf = NULL, *sig = NULL; |
783 | int buf_len = 0; | 755 | int buf_len = 0; |
@@ -788,7 +760,12 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
788 | goto err; | 760 | goto err; |
789 | 761 | ||
790 | if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) { | 762 | if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) { |
791 | if (!cms_add1_signingTime(si, NULL)) | 763 | if ((at = X509_gmtime_adj(NULL, 0)) == NULL) { |
764 | CMSerror(ERR_R_MALLOC_FAILURE); | ||
765 | goto err; | ||
766 | } | ||
767 | if (!CMS_signed_add1_attr_by_NID(si, NID_pkcs9_signingTime, | ||
768 | at->type, at, -1)) | ||
792 | goto err; | 769 | goto err; |
793 | } | 770 | } |
794 | 771 | ||
@@ -828,6 +805,7 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
828 | ret = 1; | 805 | ret = 1; |
829 | 806 | ||
830 | err: | 807 | err: |
808 | ASN1_TIME_free(at); | ||
831 | (void)EVP_MD_CTX_reset(si->mctx); | 809 | (void)EVP_MD_CTX_reset(si->mctx); |
832 | freezero(buf, buf_len); | 810 | freezero(buf, buf_len); |
833 | freezero(sig, sig_len); | 811 | freezero(sig, sig_len); |
@@ -1012,6 +990,8 @@ LCRYPTO_ALIAS(CMS_add_smimecap); | |||
1012 | * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute | 990 | * Add AlgorithmIdentifier OID of type |nid| to the SMIMECapability attribute |
1013 | * set |*out_algs| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has | 991 | * set |*out_algs| (see RFC 3851, section 2.5.2). If keysize > 0, the OID has |
1014 | * an integer parameter of value |keysize|, otherwise parameters are omitted. | 992 | * an integer parameter of value |keysize|, otherwise parameters are omitted. |
993 | * | ||
994 | * See also PKCS7_simple_smimecap(). | ||
1015 | */ | 995 | */ |
1016 | int | 996 | int |
1017 | CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **out_algs, int nid, int keysize) | 997 | CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **out_algs, int nid, int keysize) |
diff --git a/src/lib/libcrypto/cms/cms_smime.c b/src/lib/libcrypto/cms/cms_smime.c index 5a194748d9..85a0e6f6e5 100644 --- a/src/lib/libcrypto/cms/cms_smime.c +++ b/src/lib/libcrypto/cms/cms_smime.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_smime.c,v 1.28 2023/12/22 10:23:11 tb Exp $ */ | 1 | /* $OpenBSD: cms_smime.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
4 | * project. | 4 | * project. |
@@ -59,7 +59,6 @@ | |||
59 | #include <openssl/asn1.h> | 59 | #include <openssl/asn1.h> |
60 | #include <openssl/bio.h> | 60 | #include <openssl/bio.h> |
61 | #include <openssl/cms.h> | 61 | #include <openssl/cms.h> |
62 | #include <openssl/err.h> | ||
63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
64 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
65 | #include <openssl/pkcs7.h> | 64 | #include <openssl/pkcs7.h> |
@@ -67,6 +66,7 @@ | |||
67 | #include <openssl/x509_vfy.h> | 66 | #include <openssl/x509_vfy.h> |
68 | 67 | ||
69 | #include "cms_local.h" | 68 | #include "cms_local.h" |
69 | #include "err_local.h" | ||
70 | 70 | ||
71 | static BIO * | 71 | static BIO * |
72 | cms_get_text_bio(BIO *out, unsigned int flags) | 72 | cms_get_text_bio(BIO *out, unsigned int flags) |