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>
This commit is contained in:
		| @@ -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__ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user