From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 9096F7803D0 for ; Thu, 9 May 2024 06:27:19 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=KuSBpQIsDsGr7g2rJ1QK4mwCmeZzGus4pD+Hw4fruFE=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1715236038; v=1; b=Zz681n16gjbW+ukra226mEh2E53r1HdlHvfYk9yQrON80c5BNZr/YYAP2xfQxcQda9V35qk7 MG0PTZCHwPJLtiMp7jHrOJeoZFsxQ2HnGymph4ZJzQw9x7WCb7aChzqDVdHmR/nfqpB+aOwLjHU sOkPJWjyDWRRj5ZctT9GmfMObt8T7YISgPU+u6zbRD1HmHWyICEOvjJkkZqI7xPo3AH1+qBynOD g/BQFUm9A3EiUG2P5swGAW3rmSyPwWU6drf+0VFQWqAaxMUgdJTksncs9BuCvWxwm/VxteI79Z0 boSgYi9UcwnVltNHajbKplanoQv4pdZXMxIptUmnoeTaw== X-Received: by 127.0.0.2 with SMTP id nS6YYY7687511xbSt24ODXT3; Wed, 08 May 2024 23:27:18 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by mx.groups.io with SMTP id smtpd.web10.3998.1715236024155799791 for ; Wed, 08 May 2024 23:27:17 -0700 X-CSE-ConnectionGUID: dPxffIoURsyjPPlpz1IT/A== X-CSE-MsgGUID: L2TFJaYHRwO6LXCYhuOoqg== X-IronPort-AV: E=McAfee;i="6600,9927,11067"; a="14946435" X-IronPort-AV: E=Sophos;i="6.08,147,1712646000"; d="scan'208";a="14946435" X-Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2024 23:27:17 -0700 X-CSE-ConnectionGUID: s5qm1UB3QKyX4w9EoSZCeA== X-CSE-MsgGUID: ohyrxL1ETkOrklKZLSeeQA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,147,1712646000"; d="scan'208";a="60305939" X-Received: from shwdejointd777.ccr.corp.intel.com ([10.239.58.116]) by fmviesa001.fm.intel.com with ESMTP; 08 May 2024 23:27:16 -0700 From: "Wenxing Hou" To: devel@edk2.groups.io Cc: Jiewen Yao , Yi Li Subject: [edk2-devel] [PATCH v3 11/11] Add SHA3/SM3 functions with openssl for Mbedtls Date: Thu, 9 May 2024 14:27:00 +0800 Message-Id: <20240509062700.2062-12-wenxing.hou@intel.com> In-Reply-To: <20240509062700.2062-1-wenxing.hou@intel.com> References: <20240509062700.2062-1-wenxing.hou@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 08 May 2024 23:27:17 -0700 Resent-From: wenxing.hou@intel.com Reply-To: devel@edk2.groups.io,wenxing.hou@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: LeqmlS4uXxhswc6xny4b2LH3x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=Zz681n16; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4177 Because the Mbedlts 3.3.0 doesn't have SHA3 and Sm3, the SHA3 and Sm3 implementaion based on Openssl. Cc: Jiewen Yao Cc: Yi Li Signed-off-by: Wenxing Hou --- .../Library/BaseCryptLibMbedTls/BaseCryptLib.inf | 11 +++++++---- CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf | 9 +++++++-- .../Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf | 3 ++- CryptoPkg/Library/BaseCryptLibMbedTls/SmmCryptLib.inf | 9 +++++++-- .../Library/BaseCryptLibMbedTls/TestBaseCryptLib.inf | 3 ++- CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf | 6 ++++++ CryptoPkg/Library/MbedTlsLib/MbedTlsLibFull.inf | 6 ++++++ 7 files changed, 37 insertions(+), 10 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf b/Crypt= oPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf index cb282fe648..f015d5afbd 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf @@ -18,6 +18,7 @@ MODULE_TYPE =3D DXE_DRIVER=0D VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D BaseCryptLib|DXE_DRIVER DXE_CORE UEFI= _APPLICATION UEFI_DRIVER=0D + DEFINE BASE_CRYPT_PATH =3D ../BaseCryptLib=0D =0D #=0D # The following information is for reference only and not required by the = build tools.=0D @@ -31,10 +32,12 @@ Hash/CryptSha1.c=0D Hash/CryptSha256.c=0D Hash/CryptSha512.c=0D - Hash/CryptSm3Null.c=0D -=0D - Hash/CryptParallelHashNull.c=0D -=0D + $(BASE_CRYPT_PATH)/Hash/CryptCShake256.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptDispatchApDxe.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptParallelHash.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSha3.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSm3.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptXkcp.c=0D Hmac/CryptHmac.c=0D Kdf/CryptHkdf.c=0D Cipher/CryptAes.c=0D diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf b/Crypto= Pkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf index 660e11a96e..479bb2f87d 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf @@ -26,6 +26,7 @@ MODULE_TYPE =3D PEIM=0D VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D BaseCryptLib|PEIM PEI_CORE=0D + DEFINE BASE_CRYPT_PATH =3D ../BaseCryptLib=0D =0D #=0D # The following information is for reference only and not required by the = build tools.=0D @@ -38,9 +39,13 @@ Hash/CryptMd5.c=0D Hash/CryptSha1.c=0D Hash/CryptSha256.c=0D - Hash/CryptSm3Null.c=0D Hash/CryptSha512.c=0D - Hash/CryptParallelHashNull.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptCShake256.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptDispatchApPei.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptParallelHash.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSha3.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSm3.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptXkcp.c=0D Hmac/CryptHmac.c=0D Kdf/CryptHkdf.c=0D Cipher/CryptAes.c=0D diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf b/Cr= yptoPkg/Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf index 280b1a9c29..0179640e03 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf @@ -25,6 +25,7 @@ VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D BaseCryptLib|DXE_RUNTIME_DRIVER=0D CONSTRUCTOR =3D RuntimeCryptLibConstructor=0D + DEFINE BASE_CRYPT_PATH =3D ../BaseCryptLib=0D =0D #=0D # The following information is for reference only and not required by the = build tools.=0D @@ -37,9 +38,9 @@ Hash/CryptMd5.c=0D Hash/CryptSha1.c=0D Hash/CryptSha256.c=0D - Hash/CryptSm3Null.c=0D Hash/CryptSha512.c=0D Hash/CryptParallelHashNull.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSm3.c=0D Hmac/CryptHmac.c=0D Kdf/CryptHkdf.c=0D Cipher/CryptAes.c=0D diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/SmmCryptLib.inf b/Crypto= Pkg/Library/BaseCryptLibMbedTls/SmmCryptLib.inf index 4a519b06ee..92013bd514 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/SmmCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/SmmCryptLib.inf @@ -24,6 +24,7 @@ VERSION_STRING =3D 1.0=0D PI_SPECIFICATION_VERSION =3D 0x0001000A=0D LIBRARY_CLASS =3D BaseCryptLib|DXE_SMM_DRIVER SMM_CORE = MM_STANDALONE=0D + DEFINE BASE_CRYPT_PATH =3D ../BaseCryptLib=0D =0D #=0D # The following information is for reference only and not required by the = build tools.=0D @@ -36,9 +37,13 @@ Hash/CryptMd5.c=0D Hash/CryptSha1.c=0D Hash/CryptSha256.c=0D - Hash/CryptSm3Null.c=0D Hash/CryptSha512.c=0D - Hash/CryptParallelHashNull.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptCShake256.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptDispatchApMm.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptParallelHash.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSha3.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSm3.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptXkcp.c=0D Hmac/CryptHmac.c=0D Kdf/CryptHkdf.c=0D Cipher/CryptAes.c=0D diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/TestBaseCryptLib.inf b/C= ryptoPkg/Library/BaseCryptLibMbedTls/TestBaseCryptLib.inf index 4e2fb73cd6..a14e1ab908 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/TestBaseCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/TestBaseCryptLib.inf @@ -18,6 +18,7 @@ MODULE_TYPE =3D DXE_DRIVER=0D VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D BaseCryptLib|DXE_DRIVER DXE_CORE UEFI= _APPLICATION UEFI_DRIVER=0D + DEFINE BASE_CRYPT_PATH =3D ../BaseCryptLib=0D =0D #=0D # The following information is for reference only and not required by the = build tools.=0D @@ -31,7 +32,7 @@ Hash/CryptSha1.c=0D Hash/CryptSha256.c=0D Hash/CryptSha512.c=0D - Hash/CryptSm3Null.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSm3.c=0D Hash/CryptParallelHashNull.c=0D Hmac/CryptHmac.c=0D Kdf/CryptHkdf.c=0D diff --git a/CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf b/CryptoPkg/Librar= y/MbedTlsLib/MbedTlsLib.inf index adcf770902..93f8e69383 100644 --- a/CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf +++ b/CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf @@ -13,6 +13,7 @@ MODULE_TYPE =3D BASE=0D VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D MbedTlsLib=0D + DEFINE OPENSSL_PATH =3D ../OpensslLib/openssl=0D =0D #=0D # The following information is for reference only and not required by the = build tools.=0D @@ -21,6 +22,11 @@ #=0D =0D [Sources]=0D +# Openssl files list starts here=0D + $(OPENSSL_PATH)/crypto/mem_clr.c=0D + $(OPENSSL_PATH)/crypto/sha/keccak1600.c=0D + $(OPENSSL_PATH)/crypto/sm3/sm3.c=0D +# Openssl files list ends here=0D Include/mbedtls/mbedtls_config.h=0D mbedtls/library/aes.c=0D mbedtls/library/asn1parse.c=0D diff --git a/CryptoPkg/Library/MbedTlsLib/MbedTlsLibFull.inf b/CryptoPkg/Li= brary/MbedTlsLib/MbedTlsLibFull.inf index 7715392a9d..98695312cf 100644 --- a/CryptoPkg/Library/MbedTlsLib/MbedTlsLibFull.inf +++ b/CryptoPkg/Library/MbedTlsLib/MbedTlsLibFull.inf @@ -13,6 +13,7 @@ MODULE_TYPE =3D BASE=0D VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D MbedTlsLib=0D + DEFINE OPENSSL_PATH =3D ../OpensslLib/openssl=0D =0D #=0D # The following information is for reference only and not required by the = build tools.=0D @@ -21,6 +22,11 @@ #=0D =0D [Sources]=0D +# Openssl files list starts here=0D + $(OPENSSL_PATH)/crypto/mem_clr.c=0D + $(OPENSSL_PATH)/crypto/sha/keccak1600.c=0D + $(OPENSSL_PATH)/crypto/sm3/sm3.c=0D +# Openssl files list ends here=0D Include/mbedtls/mbedtls_config.h=0D mbedtls/library/aes.c=0D mbedtls/library/asn1parse.c=0D --=20 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118742): https://edk2.groups.io/g/devel/message/118742 Mute This Topic: https://groups.io/mt/105996837/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-