public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Hsieh, PaytonX" <paytonx.hsieh@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Guo" <guo.dong@intel.com>,
	"Lu, James" <james.lu@intel.com>, "Guo, Gua" <gua.guo@intel.com>
Subject: Re: [PATCH] UefiPayloadPkg: Add CryptoDxe driver to UefiPayload
Date: Thu, 7 Jul 2022 04:10:24 +0000	[thread overview]
Message-ID: <MWHPR11MB16314119C3EC0DC000D8E7B68C839@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1f79d8efdb7d4e0b8dfc923b259009e19ebc136e.1657161066.git.paytonx.hsieh@intel.com>

Can we always enable CRYPTO_ENABLE?
If yes, can we remove the macro?

> -----Original Message-----
> From: Hsieh, PaytonX <paytonx.hsieh@intel.com>
> Sent: Thursday, July 7, 2022 10:35 AM
> To: devel@edk2.groups.io
> Cc: Hsieh, PaytonX <paytonx.hsieh@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Lu,
> James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
> Subject: [PATCH] UefiPayloadPkg: Add CryptoDxe driver to UefiPayload
> 
> From: PaytonX Hsieh <paytonx.hsieh@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3979
> 
> Add macro CRYPTO_ENABLE to decide to build CryptoDxe into UPL.
> Drviers can locate protocol instead of building openssl lib into drivers.
> This can reduce the binary size that UPL required.
> 
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: James Lu <james.lu@intel.com>
> Cc: Gua Guo <gua.guo@intel.com>
> Signed-off-by: PaytonX Hsieh <paytonx.hsieh@intel.com>
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 42 +++++++++++++++++++++++++++++++
>  UefiPayloadPkg/UefiPayloadPkg.fdf |  3 +++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index cfcf38578d..782635431b 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -36,6 +36,7 @@
>    DEFINE PLATFORM_BOOT_TIMEOUT        = 3
> 
>    DEFINE ABOVE_4G_MEMORY              = TRUE
> 
>    DEFINE BOOT_MANAGER_ESCAPE          = FALSE
> 
> +  DEFINE CRYPTO_ENABLE                = FALSE
> 
>    DEFINE SD_MMC_TIMEOUT               = 1000000
> 
>    #
> 
>    # SBL:      UEFI payload for Slim Bootloader
> 
> @@ -180,8 +181,13 @@
>    CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
> 
>    SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> 
>    DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf
> 
> +!if $(CRYPTO_ENABLE) == TRUE
> 
> +  BaseCryptLib|CryptoPkg/Library/BaseCryptLibOnProtocolPpi/DxeCryptLib.inf
> 
> +  TlsLib|CryptoPkg/Library/BaseCryptLibOnProtocolPpi/DxeCryptLib.inf
> 
> +!else
> 
>    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> 
>    TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
> 
> +!endif
> 
>    IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> 
>    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> 
>    RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
> 
> @@ -412,6 +418,31 @@
>    gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
> 
>    gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1800000
> 
> 
> 
> +!if $(CRYPTO_ENABLE) == TRUE
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.HmacSha256.Family                        |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Md5.Family                               |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Pkcs.Family                              |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Dh.Family                                |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Random.Family                            |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Rsa.Family                               |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Sha1.Family                              |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Sha256.Family                            |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Sha384.Family                            |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Sha512.Family                            |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.X509.Family                              |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Tdes.Family                              |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Aes.Services.GetContextSize              | TRUE
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Aes.Services.Init                        | TRUE
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Aes.Services.CbcEncrypt                  | TRUE
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Aes.Services.CbcDecrypt                  | TRUE
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Arc4.Family                              |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Sm3.Family                               |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Hkdf.Family                              |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.Tls.Family                               |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.TlsSet.Family                            |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +  gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceFamilyEnable.TlsGet.Family                            |
> PCD_CRYPTO_SERVICE_ENABLE_FAMILY
> 
> +!endif
> 
> +
> 
>  [PcdsPatchableInModule.X64]
> 
>    gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)
> 
>    gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER)
> 
> @@ -719,6 +750,17 @@
>    MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
> 
>  !endif
> 
> 
> 
> +  #
> 
> +  # Misc
> 
> +  #
> 
> +!if $(CRYPTO_ENABLE) == TRUE
> 
> +  CryptoPkg/Driver/CryptoDxe.inf {
> 
> +    <LibraryClasses>
> 
> +      BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> 
> +      TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
> 
> +  }
> 
> +!endif
> 
> +
> 
>    #------------------------------
> 
>    #  Build the shell
> 
>    #------------------------------
> 
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index c7b04978ad..f609813cc8 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -99,6 +99,9 @@ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
>  INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
> 
>  INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
> 
> 
> 
> +!if $(CRYPTO_ENABLE) == TRUE
> 
> +INF CryptoPkg/Driver/CryptoDxe.inf
> 
> +!endif
> 
>  !if $(SECURITY_STUB_ENABLE) == TRUE
> 
>  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> 
>  !endif
> 
> --
> 2.28.0.windows.1


      reply	other threads:[~2022-07-07  4:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  2:35 [PATCH] UefiPayloadPkg: Add CryptoDxe driver to UefiPayload paytonx.hsieh
2022-07-07  4:10 ` Ni, Ray [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR11MB16314119C3EC0DC000D8E7B68C839@MWHPR11MB1631.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox