]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Revert "SecurityPkg: introduce the SM3 digest algorithm"
authorLaszlo Ersek <lersek@redhat.com>
Thu, 4 Jul 2019 09:20:27 +0000 (11:20 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 4 Jul 2019 15:50:48 +0000 (17:50 +0200)
This reverts commit 06dd5863b66edd9908834371e07fb4e11383c172.

The reason is that said commit directly depends on commit 49c1e683c452
("MdePkg/Protocol/Hash: introduce GUID for SM3", 2019-07-03), and the
latter commit is going to be reverted, due to its review process not
having followed established edk2 norms.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Imran Desai <imran.desai@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1781
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
SecurityPkg/Include/Library/HashLib.h
SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c [deleted file]
SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf [deleted file]
SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni [deleted file]
SecurityPkg/SecurityPkg.dsc

index a5b433d824a40bedc47990bcf491f582df1ce216..63f08398788b9a4b36a9b09863792cad609d074c 100644 (file)
@@ -137,7 +137,6 @@ EFI_STATUS
 #define HASH_ALGORITHM_SHA256_GUID  EFI_HASH_ALGORITHM_SHA256_GUID\r
 #define HASH_ALGORITHM_SHA384_GUID  EFI_HASH_ALGORITHM_SHA384_GUID\r
 #define HASH_ALGORITHM_SHA512_GUID  EFI_HASH_ALGORITHM_SHA512_GUID\r
-#define HASH_ALGORITHM_SM3_256_GUID EFI_HASH_ALGORITHM_SM3_256_GUID\r
 \r
 typedef struct {\r
   EFI_GUID                           HashGuid;\r
diff --git a/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.c
deleted file mode 100644 (file)
index 8fd9516..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/** @file\r
-  BaseCrypto SM3 hash instance library.\r
-  It can be registered to BaseCrypto router, to serve as hash engine.\r
-\r
-  Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-**/\r
-\r
-#include <PiPei.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/Tpm2CommandLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseCryptLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/HashLib.h>\r
-\r
-/**\r
-  The function set SM3 to digest list.\r
-\r
-  @param DigestList   digest list\r
-  @param Sm3Digest    SM3 digest\r
-**/\r
-VOID\r
-Tpm2SetSm3ToDigestList (\r
-  IN TPML_DIGEST_VALUES *DigestList,\r
-  IN UINT8              *Sm3Digest\r
-  )\r
-{\r
-  DigestList->count = 1;\r
-  DigestList->digests[0].hashAlg = TPM_ALG_SM3_256;\r
-  CopyMem (\r
-    DigestList->digests[0].digest.sm3_256,\r
-    Sm3Digest,\r
-    SM3_256_DIGEST_SIZE\r
-    );\r
-}\r
-\r
-/**\r
-  Start hash sequence.\r
-\r
-  @param HashHandle Hash handle.\r
-\r
-  @retval EFI_SUCCESS          Hash sequence start and HandleHandle returned.\r
-  @retval EFI_OUT_OF_RESOURCES No enough resource to start hash.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Sm3HashInit (\r
-  OUT HASH_HANDLE    *HashHandle\r
-  )\r
-{\r
-  VOID     *Sm3Ctx;\r
-  UINTN    CtxSize;\r
-\r
-  CtxSize = Sm3GetContextSize ();\r
-  Sm3Ctx = AllocatePool (CtxSize);\r
-  if (Sm3Ctx == NULL) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  Sm3Init (Sm3Ctx);\r
-\r
-  *HashHandle = (HASH_HANDLE)Sm3Ctx;\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Update hash sequence data.\r
-\r
-  @param HashHandle    Hash handle.\r
-  @param DataToHash    Data to be hashed.\r
-  @param DataToHashLen Data size.\r
-\r
-  @retval EFI_SUCCESS     Hash sequence updated.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Sm3HashUpdate (\r
-  IN HASH_HANDLE    HashHandle,\r
-  IN VOID           *DataToHash,\r
-  IN UINTN          DataToHashLen\r
-  )\r
-{\r
-  VOID     *Sm3Ctx;\r
-\r
-  Sm3Ctx = (VOID *)HashHandle;\r
-  Sm3Update (Sm3Ctx, DataToHash, DataToHashLen);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Complete hash sequence complete.\r
-\r
-  @param HashHandle    Hash handle.\r
-  @param DigestList    Digest list.\r
-\r
-  @retval EFI_SUCCESS     Hash sequence complete and DigestList is returned.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Sm3HashFinal (\r
-  IN HASH_HANDLE         HashHandle,\r
-  OUT TPML_DIGEST_VALUES *DigestList\r
-  )\r
-{\r
-  UINT8         Digest[SM3_256_DIGEST_SIZE];\r
-  VOID          *Sm3Ctx;\r
-\r
-  Sm3Ctx = (VOID *)HashHandle;\r
-  Sm3Final (Sm3Ctx, Digest);\r
-\r
-  FreePool (Sm3Ctx);\r
-\r
-  Tpm2SetSm3ToDigestList (DigestList, Digest);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-HASH_INTERFACE  mSm3InternalHashInstance = {\r
-  HASH_ALGORITHM_SM3_256_GUID,\r
-  Sm3HashInit,\r
-  Sm3HashUpdate,\r
-  Sm3HashFinal,\r
-};\r
-\r
-/**\r
-  The function register SM3 instance.\r
-\r
-  @retval EFI_SUCCESS   SM3 instance is registered, or system dose not support register SM3 instance\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-HashInstanceLibSm3Constructor (\r
-  VOID\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-\r
-  Status = RegisterHashInterfaceLib (&mSm3InternalHashInstance);\r
-  if ((Status == EFI_SUCCESS) || (Status == EFI_UNSUPPORTED)) {\r
-    //\r
-    // Unsupported means platform policy does not need this instance enabled.\r
-    //\r
-    return EFI_SUCCESS;\r
-  }\r
-  return Status;\r
-}\r
diff --git a/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
deleted file mode 100644 (file)
index 781164d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-## @file\r
-#  Provides BaseCrypto SM3 hash service\r
-#\r
-#  This library can be registered to BaseCrypto router, to serve as hash engine.\r
-#\r
-#  Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>\r
-#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-#\r
-##\r
-\r
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = HashInstanceLibSm3\r
-  MODULE_UNI_FILE                = HashInstanceLibSm3.uni\r
-  FILE_GUID                      = C5865D5D-9ACE-39FB-DC7C-0511891D40F9\r
-  MODULE_TYPE                    = BASE\r
-  VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = NULL\r
-  CONSTRUCTOR                    = HashInstanceLibSm3Constructor\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-#  VALID_ARCHITECTURES           = IA32 X64\r
-#\r
-\r
-[Sources]\r
-  HashInstanceLibSm3.c\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  SecurityPkg/SecurityPkg.dec\r
-  CryptoPkg/CryptoPkg.dec\r
-\r
-[LibraryClasses]\r
-  BaseLib\r
-  BaseMemoryLib\r
-  DebugLib\r
-  Tpm2CommandLib\r
-  MemoryAllocationLib\r
-  BaseCryptLib\r
diff --git a/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni b/SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.uni
deleted file mode 100644 (file)
index 07a5c53..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// /** @file\r
-// Provides BaseCrypto SM3 hash service\r
-//\r
-// This library can be registered to BaseCrypto router, to serve as hash engine.\r
-//\r
-// Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.<BR>\r
-// SPDX-License-Identifier: BSD-2-Clause-Patent\r
-//\r
-// **/\r
-\r
-\r
-#string STR_MODULE_ABSTRACT             #language en-US "Provides BaseCrypto SM3 hash service"\r
-\r
-#string STR_MODULE_DESCRIPTION          #language en-US "This library can be registered to BaseCrypto router, to serve as hash engine."\r
-\r
index aef2ac3a208d715848b549a539ae929eaa313f93..60f3b0110eb7ebb8cc7bfa56c5a56b99bf0a1b57 100644 (file)
   SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf\r
   SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf\r
   SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf\r
-  SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf\r
 \r
   SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf {\r
     <LibraryClasses>\r
       NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf\r
       NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf\r
       NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf\r
-      NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf\r
   }\r
 \r
   SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {\r
       NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf\r
       NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf\r
       NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf\r
-      NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf\r
       PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
   }\r
   SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf {\r