From e2ebbdd9c28ee3d35030ea6ec8d6e77abcd79d9e Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 18 Oct 2023 07:24:15 +0000 Subject: 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 --- src/lib/libcrypto/cms/cms_dd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/lib') 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 @@ -/* $OpenBSD: cms_dd.c,v 1.15 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_dd.c,v 1.16 2023/10/18 07:24:15 tb Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -54,13 +54,14 @@ #include -#include "cryptlib.h" -#include -#include -#include +#include #include +#include #include +#include + #include "cms_local.h" +#include "x509_local.h" /* CMS DigestedData Utilities */ @@ -85,7 +86,8 @@ cms_DigestedData_create(const EVP_MD *md) dd->version = 0; dd->encapContentInfo->eContentType = OBJ_nid2obj(NID_pkcs7_data); - X509_ALGOR_set_md(dd->digestAlgorithm, md); + if (!X509_ALGOR_set_evp_md(dd->digestAlgorithm, md)) + goto err; return cms; -- cgit v1.2.3-55-g6feb