diff options
author | Jian J Wang <jian.j.wang@intel.com> | 2020-01-17 11:05:40 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-01-20 16:41:23 +0000 |
commit | a23fdff6fb99bcf7ac226f0a1095c0bdd26b0468 (patch) | |
tree | 8b118eed37c0759aff3004320895318277e57bbc /CryptoPkg/Library/BaseCryptLibNull | |
parent | 5cd3d4bc43e543caf5f78baaacced8aaf04c1d91 (diff) | |
download | edk2-a23fdff6fb99bcf7ac226f0a1095c0bdd26b0468.tar.gz edk2-a23fdff6fb99bcf7ac226f0a1095c0bdd26b0468.tar.bz2 edk2-a23fdff6fb99bcf7ac226f0a1095c0bdd26b0468.zip |
CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1792
HmacXxxInit() is supposed to be initialize user supplied buffer as HMAC
context, as well as user supplied key. Currently it has no real use cases.
Due to BZ1792, the user has no way to get correct size of context buffer
after it's fixed, and then cannot make use of HmacXxxInit to initialize
it.
So it's decided to replace it with HmacXxxSetKey to keep the functionality
of supplying a key to HMAC, but drop all other initialization works. The
user can still get HMAC context via HmacXxxNew interface, which hides the
details about the context.
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
Diffstat (limited to 'CryptoPkg/Library/BaseCryptLibNull')
3 files changed, 12 insertions, 12 deletions
diff --git a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c index 3aafed874b..b77a2266db 100644 --- a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c +++ b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c @@ -65,12 +65,12 @@ HmacMd5Free ( }
/**
- Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for
- subsequent use.
+ Set user-supplied key for subsequent use. It must be done before any
+ calling to HmacMd5Update().
Return FALSE to indicate this interface is not supported.
- @param[out] HmacMd5Context Pointer to HMAC-MD5 context being initialized.
+ @param[out] HmacMd5Context Pointer to HMAC-MD5 context.
@param[in] Key Pointer to the user-supplied key.
@param[in] KeySize Key size in bytes.
@@ -79,7 +79,7 @@ HmacMd5Free ( **/
BOOLEAN
EFIAPI
-HmacMd5Init (
+HmacMd5SetKey (
OUT VOID *HmacMd5Context,
IN CONST UINT8 *Key,
IN UINTN KeySize
diff --git a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c index 547aa484ea..84f204a542 100644 --- a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c +++ b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c @@ -65,12 +65,12 @@ HmacSha1Free ( }
/**
- Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for
- subsequent use.
+ Set user-supplied key for subsequent use. It must be done before any
+ calling to HmacSha1Update().
Return FALSE to indicate this interface is not supported.
- @param[out] HmacSha1Context Pointer to HMAC-SHA1 context being initialized.
+ @param[out] HmacSha1Context Pointer to HMAC-SHA1 context.
@param[in] Key Pointer to the user-supplied key.
@param[in] KeySize Key size in bytes.
@@ -79,7 +79,7 @@ HmacSha1Free ( **/
BOOLEAN
EFIAPI
-HmacSha1Init (
+HmacSha1SetKey (
OUT VOID *HmacSha1Context,
IN CONST UINT8 *Key,
IN UINTN KeySize
diff --git a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c index f0a4420e27..cededebaa0 100644 --- a/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c +++ b/CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c @@ -65,12 +65,12 @@ HmacSha256Free ( }
/**
- Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for
- subsequent use.
+ Set user-supplied key for subsequent use. It must be done before any
+ calling to HmacSha256Update().
Return FALSE to indicate this interface is not supported.
- @param[out] HmacSha256Context Pointer to HMAC-SHA256 context being initialized.
+ @param[out] HmacSha256Context Pointer to HMAC-SHA256 context.
@param[in] Key Pointer to the user-supplied key.
@param[in] KeySize Key size in bytes.
@@ -79,7 +79,7 @@ HmacSha256Free ( **/
BOOLEAN
EFIAPI
-HmacSha256Init (
+HmacSha256SetKey (
OUT VOID *HmacSha256Context,
IN CONST UINT8 *Key,
IN UINTN KeySize
|