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 72982AC0DF8 for ; Wed, 24 Apr 2024 08:24:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=3P9SgRZuC/evpYySbNrLM4ZA0ljP4H9sx+InFMvIda4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id: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=1713947093; v=1; b=sFwX08G3NWswfDmr41Wl+TZsykJjm3Rhb8p8TkEy0FvIT/cwydG2cqNw1119H/aaGFwnFpsS Xz2g2lVpD+8T4nD67+c8Fyv+mHbOQemjrMSgMplRxR00rS2X57hPlFte55L6p2zeOboDdQbntVt Rzy8kUz1Cja/RyH5FCwvpx3kflfHH/8LMvITUbjRDxoSa+6QhiBqxQdYlDMTSRtEsmeZFJlxSbP +dJ4uxhZWn1e4m5Dv9FDHUvI7OLHIB8/wuqDIbgxc8zD8yQKI3Y8aUFWOdB4a5rkPD50MJrUtMP 2WKhubBr2iIgod8WSyuGcXHJPaCsM/c5qpLnG6zUvPKUA== X-Received: by 127.0.0.2 with SMTP id CIBBYY7687511x9eJ2opHfUg; Wed, 24 Apr 2024 01:24:53 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mx.groups.io with SMTP id smtpd.web11.11526.1713947092717658027 for ; Wed, 24 Apr 2024 01:24:52 -0700 X-CSE-ConnectionGUID: pmWv8C/KTtynBn3b7X0BZg== X-CSE-MsgGUID: 9d0TsL3xR8mtxCbeWfYAvQ== X-IronPort-AV: E=McAfee;i="6600,9927,11053"; a="9784680" X-IronPort-AV: E=Sophos;i="6.07,225,1708416000"; d="scan'208";a="9784680" X-Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2024 01:24:52 -0700 X-CSE-ConnectionGUID: HkRkbnWcRJ6Tauwt3JKT3Q== X-CSE-MsgGUID: P/VLV6gHT0+N6aU3oNgfmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,225,1708416000"; d="scan'208";a="47894483" X-Received: from shwdejointd777.ccr.corp.intel.com ([10.239.58.116]) by fmviesa002.fm.intel.com with ESMTP; 24 Apr 2024 01:24:51 -0700 From: "Wenxing Hou" To: devel@edk2.groups.io Cc: Jiewen Yao , Yi Li Subject: [edk2-devel] [PATCH v2] Add SHA3/SM3 functions with openssl for Mbedtls Date: Wed, 24 Apr 2024 16:24:49 +0800 Message-Id: <20240424082449.1781-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, 24 Apr 2024 01:24:52 -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: wyEjarMVyqOQCXiRBA4ElnKrx7686176AA= 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=sFwX08G3; 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=0D =0D Because the Mbedlts 3.3.0 doesn't have SHA3 and Sm3, the SHA3 and Sm3=0D implementaion based on Openssl.=0D And the implementaion has passed build check.=0D =0D Cc: Jiewen Yao =0D Cc: Yi Li =0D Signed-off-by: Wenxing Hou =0D ---=0D CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf | 9 +++++++--=0D CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf | 9 +++++++--=0D .../Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf | 3 ++-=0D CryptoPkg/Library/BaseCryptLibMbedTls/SmmCryptLib.inf | 9 +++++++--=0D .../Library/BaseCryptLibMbedTls/TestBaseCryptLib.inf | 4 +++-=0D CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf | 6 ++++++=0D CryptoPkg/Library/MbedTlsLib/MbedTlsLibFull.inf | 6 ++++++=0D 7 files changed, 38 insertions(+), 8 deletions(-)=0D =0D diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf b/Crypt= oPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf=0D index 16def792c5..999054500f 100644=0D --- a/CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf=0D +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/BaseCryptLib.inf=0D @@ -18,6 +18,7 @@=0D 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,14 @@=0D Cipher/CryptAes.c=0D Hash/CryptSha256.c=0D Hash/CryptSha512.c=0D - Hash/CryptParallelHashNull.c=0D - Hash/CryptSm3Null.c=0D Hash/CryptMd5.c=0D Hash/CryptSha1.c=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 Pk/CryptRsaBasic.c=0D diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf b/Crypto= Pkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf=0D index 72b22a24e8..a153c0c8e4 100644=0D --- a/CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf=0D +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/PeiCryptLib.inf=0D @@ -26,6 +26,7 @@=0D 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 @@=0D 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=0D index 9f17ef00bf..1b33dbdaad 100644=0D --- a/CryptoPkg/Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf=0D +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/RuntimeCryptLib.inf=0D @@ -25,6 +25,7 @@=0D 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 @@=0D 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=0D index 40c56d1b7d..d9a9cb8d10 100644=0D --- a/CryptoPkg/Library/BaseCryptLibMbedTls/SmmCryptLib.inf=0D +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/SmmCryptLib.inf=0D @@ -24,6 +24,7 @@=0D 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 @@=0D 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=0D index def990b996..6a7f4bdbf6 100644=0D --- a/CryptoPkg/Library/BaseCryptLibMbedTls/TestBaseCryptLib.inf=0D +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/TestBaseCryptLib.inf=0D @@ -18,6 +18,7 @@=0D 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,9 +32,10 @@=0D Cipher/CryptAes.c=0D Hash/CryptSha256.c=0D Hash/CryptSha512.c=0D - Hash/CryptSm3Null.c=0D Hash/CryptMd5.c=0D Hash/CryptSha1.c=0D + $(BASE_CRYPT_PATH)/Hash/CryptSm3.c=0D + Hash/CryptParallelHashNull.c=0D Hmac/CryptHmac.c=0D Kdf/CryptHkdf.c=0D Pk/CryptRsaBasic.c=0D diff --git a/CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf b/CryptoPkg/Librar= y/MbedTlsLib/MbedTlsLib.inf=0D index adcf770902..93f8e69383 100644=0D --- a/CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf=0D +++ b/CryptoPkg/Library/MbedTlsLib/MbedTlsLib.inf=0D @@ -13,6 +13,7 @@=0D 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 =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=0D index 7715392a9d..98695312cf 100644=0D --- a/CryptoPkg/Library/MbedTlsLib/MbedTlsLibFull.inf=0D +++ b/CryptoPkg/Library/MbedTlsLib/MbedTlsLibFull.inf=0D @@ -13,6 +13,7 @@=0D 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 =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 -- =0D 2.26.2.windows.1=0D =0D -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118183): https://edk2.groups.io/g/devel/message/118183 Mute This Topic: https://groups.io/mt/105706562/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-