diff options
author | Gary West <gary.west@intel.com> | 2019-07-31 05:54:08 +0000 |
---|---|---|
committer | Jian J Wang <jian.j.wang@intel.com> | 2019-08-09 09:38:56 +0800 |
commit | 4b1b7c1913092d73d689d8086dcfa579c0217dc8 (patch) | |
tree | 97cff40d818ef84f120166908313ba34d67cedfd /CryptoPkg/Include | |
parent | 466f5e89c3e97a76c9a4a94c8fdb59f44ec5dd13 (diff) | |
download | edk2-4b1b7c1913092d73d689d8086dcfa579c0217dc8.tar.gz edk2-4b1b7c1913092d73d689d8086dcfa579c0217dc8.tar.bz2 edk2-4b1b7c1913092d73d689d8086dcfa579c0217dc8.zip |
CryptoPkg/BaseCryptLib: Wrap OpenSSL HKDF algorithm
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1928
1. Implement OpenSSL HKDF wrapped function in CryptHkdf.c file.
2. Implement stub implementation function in CryptHkdfNull.c file.
3. Add wrapped HKDF function declaration to BaseCryptLib.h file.
4. Add CryptHkdf.c to module information BaseCryptLib.inf file.
5. Add CryptHkdfNull.c to module information PeiCryptLib.inf,
RuntimeCryptLib.inf and SmmCryptLib.inf
Signed-off-by: Gary West <Gary.West@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Reviewed-by: Jian Wang <jian.j.wang@intel.com>
Diffstat (limited to 'CryptoPkg/Include')
-rw-r--r-- | CryptoPkg/Include/Library/BaseCryptLib.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h index 19d1afe3c8..da32bb2444 100644 --- a/CryptoPkg/Include/Library/BaseCryptLib.h +++ b/CryptoPkg/Include/Library/BaseCryptLib.h @@ -3122,4 +3122,37 @@ RandomBytes ( IN UINTN Size
);
+//=====================================================================================
+// Key Derivation Function Primitive
+//=====================================================================================
+
+/**
+ Derive key data using HMAC-SHA256 based KDF.
+
+ @param[in] Key Pointer to the user-supplied key.
+ @param[in] KeySize Key size in bytes.
+ @param[in] Salt Pointer to the salt(non-secret) value.
+ @param[in] SaltSize Salt size in bytes.
+ @param[in] Info Pointer to the application specific info.
+ @param[in] InfoSize Info size in bytes.
+ @param[Out] Out Pointer to buffer to receive hkdf value.
+ @param[in] OutSize Size of hkdf bytes to generate.
+
+ @retval TRUE Hkdf generated successfully.
+ @retval FALSE Hkdf generation failed.
+
+**/
+BOOLEAN
+EFIAPI
+HkdfSha256ExtractAndExpand (
+ IN CONST UINT8 *Key,
+ IN UINTN KeySize,
+ IN CONST UINT8 *Salt,
+ IN UINTN SaltSize,
+ IN CONST UINT8 *Info,
+ IN UINTN InfoSize,
+ OUT UINT8 *Out,
+ IN UINTN OutSize
+ );
+
#endif // __BASE_CRYPT_LIB_H__
|