diff options
author | tb <> | 2023-10-18 07:24:15 +0000 |
---|---|---|
committer | tb <> | 2023-10-18 07:24:15 +0000 |
commit | e2ebbdd9c28ee3d35030ea6ec8d6e77abcd79d9e (patch) | |
tree | f2012e117257a994d2da701dd6bf0eb971e7f7ba /src/lib | |
parent | 06322ee09b46eec5e91ff54df8cf6fa191bf94ab (diff) | |
download | openbsd-e2ebbdd9c28ee3d35030ea6ec8d6e77abcd79d9e.tar.gz openbsd-e2ebbdd9c28ee3d35030ea6ec8d6e77abcd79d9e.tar.bz2 openbsd-e2ebbdd9c28ee3d35030ea6ec8d6e77abcd79d9e.zip |
cms_DigestedData_create() use X509_ALGOR_set_evp_md()
Our internal version allows for error checking and this avoids a silent
failure leading to corruption later on.
Clean up includes while there.
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/cms/cms_dd.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/libcrypto/cms/cms_dd.c b/src/lib/libcrypto/cms/cms_dd.c index a08fccc2a7..b6992b8774 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.15 2022/11/26 16:08:51 tb Exp $ */ | 1 | /* $OpenBSD: cms_dd.c,v 1.16 2023/10/18 07:24:15 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,13 +54,14 @@ | |||
54 | 54 | ||
55 | #include <string.h> | 55 | #include <string.h> |
56 | 56 | ||
57 | #include "cryptlib.h" | 57 | #include <openssl/asn1.h> |
58 | #include <openssl/asn1t.h> | ||
59 | #include <openssl/pem.h> | ||
60 | #include <openssl/x509v3.h> | ||
61 | #include <openssl/err.h> | 58 | #include <openssl/err.h> |
59 | #include <openssl/evp.h> | ||
62 | #include <openssl/cms.h> | 60 | #include <openssl/cms.h> |
61 | #include <openssl/objects.h> | ||
62 | |||
63 | #include "cms_local.h" | 63 | #include "cms_local.h" |
64 | #include "x509_local.h" | ||
64 | 65 | ||
65 | /* CMS DigestedData Utilities */ | 66 | /* CMS DigestedData Utilities */ |
66 | 67 | ||
@@ -85,7 +86,8 @@ cms_DigestedData_create(const EVP_MD *md) | |||
85 | dd->version = 0; | 86 | dd->version = 0; |
86 | dd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data); | 87 | dd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data); |
87 | 88 | ||
88 | X509_ALGOR_set_md(dd->digestAlgorithm, md); | 89 | if (!X509_ALGOR_set_evp_md(dd->digestAlgorithm, md)) |
90 | goto err; | ||
89 | 91 | ||
90 | return cms; | 92 | return cms; |
91 | 93 | ||