]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg/BaseCryptLibNull: Add missing HkdfSha256ExtractAndExpand()
authorMichael D Kinney <michael.d.kinney@intel.com>
Sat, 25 Jan 2020 00:11:54 +0000 (16:11 -0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 4 Feb 2020 21:35:48 +0000 (21:35 +0000)
https://bugzilla.tianocore.org/show_bug.cgi?id=2493

The BaseCryptLib was expanded to add the HkdfSha256ExtractAndExpand()
service in the following commit:

https://github.com/tianocore/edk2/commit/4b1b7c1913092d73d689d8086dcfa579c0217dc8

When BaseCryptLibNull was added in the commit below, this new
service was not included.

https://github.com/tianocore/edk2/commit/d95de082da01f4a4cb3ebf87e15972a12d0f8d53

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
CryptoPkg/Library/BaseCryptLibNull/Kdf/CryptHkdfNull.c [new file with mode: 0644]

index 1e4807968ab90ed3c63070dfcd73e46ca84f863c..8f53b0dfd07e5c4be2e5a730134b1c98e884df1a 100644 (file)
@@ -6,7 +6,7 @@
 #  This external input must be validated carefully to avoid security issues such as\r
 #  buffer overflow or integer overflow.\r
 #\r
-#  Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>\r
 #  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 ##\r
@@ -37,6 +37,7 @@
   Hmac/CryptHmacMd5Null.c\r
   Hmac/CryptHmacSha1Null.c\r
   Hmac/CryptHmacSha256Null.c\r
+  Kdf/CryptHkdfNull.c\r
   Cipher/CryptAesNull.c\r
   Cipher/CryptTdesNull.c\r
   Cipher/CryptArc4Null.c\r
diff --git a/CryptoPkg/Library/BaseCryptLibNull/Kdf/CryptHkdfNull.c b/CryptoPkg/Library/BaseCryptLibNull/Kdf/CryptHkdfNull.c
new file mode 100644 (file)
index 0000000..19d795a
--- /dev/null
@@ -0,0 +1,43 @@
+/** @file\r
+  HMAC-SHA256 KDF Wrapper Implementation which does not provide real capabilities.\r
+\r
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Library/BaseCryptLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+/**\r
+  Derive key data using HMAC-SHA256 based KDF.\r
+\r
+  @param[in]   Key              Pointer to the user-supplied key.\r
+  @param[in]   KeySize          Key size in bytes.\r
+  @param[in]   Salt             Pointer to the salt(non-secret) value.\r
+  @param[in]   SaltSize         Salt size in bytes.\r
+  @param[in]   Info             Pointer to the application specific info.\r
+  @param[in]   InfoSize         Info size in bytes.\r
+  @param[out]  Out              Pointer to buffer to receive hkdf value.\r
+  @param[in]   OutSize          Size of hkdf bytes to generate.\r
+\r
+  @retval TRUE   Hkdf generated successfully.\r
+  @retval FALSE  Hkdf generation failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+HkdfSha256ExtractAndExpand (\r
+  IN   CONST UINT8  *Key,\r
+  IN   UINTN        KeySize,\r
+  IN   CONST UINT8  *Salt,\r
+  IN   UINTN        SaltSize,\r
+  IN   CONST UINT8  *Info,\r
+  IN   UINTN        InfoSize,\r
+  OUT  UINT8        *Out,\r
+  IN   UINTN        OutSize\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r