]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey
authorJian J Wang <jian.j.wang@intel.com>
Fri, 17 Jan 2020 03:05:40 +0000 (11:05 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 20 Jan 2020 16:41:23 +0000 (16:41 +0000)
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>
CryptoPkg/Include/Library/BaseCryptLib.h
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5Null.c
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1Null.c
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256.c
CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha256Null.c
CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacMd5Null.c
CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha1Null.c
CryptoPkg/Library/BaseCryptLibNull/Hmac/CryptHmacSha256Null.c

index 8fe303a0b390c1103fbf2373309e93742a109f25..5fafcd72bc0225921745ab503efe4c2cdcaac4ca 100644 (file)
@@ -1073,24 +1073,24 @@ HmacMd5Free (
   );\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacMd5Update().\r
 \r
   If HmacMd5Context is NULL, then return FALSE.\r
   If this interface is not supported, then return FALSE.\r
 \r
-  @param[out]  HmacMd5Context  Pointer to HMAC-MD5 context being initialized.\r
+  @param[out]  HmacMd5Context  Pointer to HMAC-MD5 context.\r
   @param[in]   Key             Pointer to the user-supplied key.\r
   @param[in]   KeySize         Key size in bytes.\r
 \r
-  @retval TRUE   HMAC-MD5 context initialization succeeded.\r
-  @retval FALSE  HMAC-MD5 context initialization failed.\r
+  @retval TRUE   Key is set successfully.\r
+  @retval FALSE  Key is set unsuccessfully.\r
   @retval FALSE  This interface is not supported.\r
 \r
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacMd5Init (\r
+HmacMd5SetKey (\r
   OUT  VOID         *HmacMd5Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
@@ -1123,8 +1123,8 @@ HmacMd5Duplicate (
 \r
   This function performs HMAC-MD5 digest on a data buffer of the specified size.\r
   It can be called multiple times to compute the digest of long or discontinuous data streams.\r
-  HMAC-MD5 context should be already correctly initialized by HmacMd5Init(), and should not be\r
-  finalized by HmacMd5Final(). Behavior with invalid context is undefined.\r
+  HMAC-MD5 context should be initialized by HmacMd5New(), and should not be finalized by\r
+  HmacMd5Final(). Behavior with invalid context is undefined.\r
 \r
   If HmacMd5Context is NULL, then return FALSE.\r
   If this interface is not supported, then return FALSE.\r
@@ -1152,8 +1152,8 @@ HmacMd5Update (
   This function completes HMAC-MD5 hash computation and retrieves the digest value into\r
   the specified memory. After this function has been called, the HMAC-MD5 context cannot\r
   be used again.\r
-  HMAC-MD5 context should be already correctly initialized by HmacMd5Init(), and should not be\r
-  finalized by HmacMd5Final(). Behavior with invalid HMAC-MD5 context is undefined.\r
+  HMAC-MD5 context should be initialized by HmacMd5New(), and should not be finalized by\r
+  HmacMd5Final(). Behavior with invalid HMAC-MD5 context is undefined.\r
 \r
   If HmacMd5Context is NULL, then return FALSE.\r
   If HmacValue is NULL, then return FALSE.\r
@@ -1223,24 +1223,24 @@ HmacSha1Free (
   );\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacSha1Update().\r
 \r
   If HmacSha1Context is NULL, then return FALSE.\r
   If this interface is not supported, then return FALSE.\r
 \r
-  @param[out]  HmacSha1Context  Pointer to HMAC-SHA1 context being initialized.\r
+  @param[out]  HmacSha1Context  Pointer to HMAC-SHA1 context.\r
   @param[in]   Key              Pointer to the user-supplied key.\r
   @param[in]   KeySize          Key size in bytes.\r
 \r
-  @retval TRUE   HMAC-SHA1 context initialization succeeded.\r
-  @retval FALSE  HMAC-SHA1 context initialization failed.\r
+  @retval TRUE   The Key is set successfully.\r
+  @retval FALSE  The Key is set unsuccessfully.\r
   @retval FALSE  This interface is not supported.\r
 \r
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacSha1Init (\r
+HmacSha1SetKey (\r
   OUT  VOID         *HmacSha1Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
@@ -1273,8 +1273,8 @@ HmacSha1Duplicate (
 \r
   This function performs HMAC-SHA1 digest on a data buffer of the specified size.\r
   It can be called multiple times to compute the digest of long or discontinuous data streams.\r
-  HMAC-SHA1 context should be already correctly initialized by HmacSha1Init(), and should not\r
-  be finalized by HmacSha1Final(). Behavior with invalid context is undefined.\r
+  HMAC-SHA1 context should be initialized by HmacSha1New(), and should not be finalized by\r
+  HmacSha1Final(). Behavior with invalid context is undefined.\r
 \r
   If HmacSha1Context is NULL, then return FALSE.\r
   If this interface is not supported, then return FALSE.\r
@@ -1302,8 +1302,8 @@ HmacSha1Update (
   This function completes HMAC-SHA1 hash computation and retrieves the digest value into\r
   the specified memory. After this function has been called, the HMAC-SHA1 context cannot\r
   be used again.\r
-  HMAC-SHA1 context should be already correctly initialized by HmacSha1Init(), and should\r
-  not be finalized by HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined.\r
+  HMAC-SHA1 context should be initialized by HmacSha1New(), and should not be finalized\r
+  by HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined.\r
 \r
   If HmacSha1Context is NULL, then return FALSE.\r
   If HmacValue is NULL, then return FALSE.\r
@@ -1368,24 +1368,24 @@ HmacSha256Free (
   );\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacSha256Update().\r
 \r
   If HmacSha256Context is NULL, then return FALSE.\r
   If this interface is not supported, then return FALSE.\r
 \r
-  @param[out]  HmacSha256Context  Pointer to HMAC-SHA256 context being initialized.\r
+  @param[out]  HmacSha256Context  Pointer to HMAC-SHA256 context.\r
   @param[in]   Key                Pointer to the user-supplied key.\r
   @param[in]   KeySize            Key size in bytes.\r
 \r
-  @retval TRUE   HMAC-SHA256 context initialization succeeded.\r
-  @retval FALSE  HMAC-SHA256 context initialization failed.\r
+  @retval TRUE   The Key is set successfully.\r
+  @retval FALSE  The Key is set unsuccessfully.\r
   @retval FALSE  This interface is not supported.\r
 \r
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacSha256Init (\r
+HmacSha256SetKey (\r
   OUT  VOID         *HmacSha256Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
@@ -1418,8 +1418,8 @@ HmacSha256Duplicate (
 \r
   This function performs HMAC-SHA256 digest on a data buffer of the specified size.\r
   It can be called multiple times to compute the digest of long or discontinuous data streams.\r
-  HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should not\r
-  be finalized by HmacSha256Final(). Behavior with invalid context is undefined.\r
+  HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized\r
+  by HmacSha256Final(). Behavior with invalid context is undefined.\r
 \r
   If HmacSha256Context is NULL, then return FALSE.\r
   If this interface is not supported, then return FALSE.\r
@@ -1447,8 +1447,8 @@ HmacSha256Update (
   This function completes HMAC-SHA256 hash computation and retrieves the digest value into\r
   the specified memory. After this function has been called, the HMAC-SHA256 context cannot\r
   be used again.\r
-  HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should\r
-  not be finalized by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.\r
+  HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized\r
+  by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.\r
 \r
   If HmacSha256Context is NULL, then return FALSE.\r
   If HmacValue is NULL, then return FALSE.\r
index 19e9fbeae66fe9ab9a105f9249d7d93b8b8d3f12..7d49dc2698f8f953273fd880f2ee46632d3d8855 100644 (file)
@@ -78,22 +78,22 @@ HmacMd5Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacMd5Update().\r
 \r
   If HmacMd5Context is NULL, then return FALSE.\r
 \r
-  @param[out]  HmacMd5Context  Pointer to HMAC-MD5 context being initialized.\r
+  @param[out]  HmacMd5Context  Pointer to HMAC-MD5 context.\r
   @param[in]   Key             Pointer to the user-supplied key.\r
   @param[in]   KeySize         Key size in bytes.\r
 \r
-  @retval TRUE   HMAC-MD5 context initialization succeeded.\r
-  @retval FALSE  HMAC-MD5 context initialization failed.\r
+  @retval TRUE   Key is set successfully.\r
+  @retval FALSE  Key is set unsuccessfully.\r
 \r
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacMd5Init (\r
+HmacMd5SetKey (\r
   OUT  VOID         *HmacMd5Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
@@ -106,13 +106,6 @@ HmacMd5Init (
     return FALSE;\r
   }\r
 \r
-  //\r
-  // OpenSSL HMAC-MD5 Context Initialization\r
-  //\r
-  memset(HmacMd5Context, 0, HMAC_MD5_CTX_SIZE);\r
-  if (HMAC_CTX_reset ((HMAC_CTX *)HmacMd5Context) != 1) {\r
-    return FALSE;\r
-  }\r
   if (HMAC_Init_ex ((HMAC_CTX *)HmacMd5Context, Key, (UINT32) KeySize, EVP_md5(), NULL) != 1) {\r
     return FALSE;\r
   }\r
@@ -159,8 +152,8 @@ HmacMd5Duplicate (
 \r
   This function performs HMAC-MD5 digest on a data buffer of the specified size.\r
   It can be called multiple times to compute the digest of long or discontinuous data streams.\r
-  HMAC-MD5 context should be already correctly initialized by HmacMd5Init(), and should not be\r
-  finalized by HmacMd5Final(). Behavior with invalid context is undefined.\r
+  HMAC-MD5 context should be initialized by HmacMd5New(), and should not be finalized by\r
+  HmacMd5Final(). Behavior with invalid context is undefined.\r
 \r
   If HmacMd5Context is NULL, then return FALSE.\r
 \r
@@ -210,8 +203,8 @@ HmacMd5Update (
   This function completes HMAC-MD5 digest computation and retrieves the digest value into\r
   the specified memory. After this function has been called, the HMAC-MD5 context cannot\r
   be used again.\r
-  HMAC-MD5 context should be already correctly initialized by HmacMd5Init(), and should not be\r
-  finalized by HmacMd5Final(). Behavior with invalid HMAC-MD5 context is undefined.\r
+  HMAC-MD5 context should be initialized by HmacMd5New(), and should not be finalized by\r
+  HmacMd5Final(). Behavior with invalid HMAC-MD5 context is undefined.\r
 \r
   If HmacMd5Context is NULL, then return FALSE.\r
   If HmacValue is NULL, then return FALSE.\r
index 3aafed874b4b7e97624509359313aa6c3d1c4d22..b77a2266db2efc209edd507c4e6aab19cf811c36 100644 (file)
@@ -65,12 +65,12 @@ HmacMd5Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacMd5Update().\r
 \r
   Return FALSE to indicate this interface is not supported.\r
 \r
-  @param[out]  HmacMd5Context  Pointer to HMAC-MD5 context being initialized.\r
+  @param[out]  HmacMd5Context  Pointer to HMAC-MD5 context.\r
   @param[in]   Key             Pointer to the user-supplied key.\r
   @param[in]   KeySize         Key size in bytes.\r
 \r
@@ -79,7 +79,7 @@ HmacMd5Free (
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacMd5Init (\r
+HmacMd5SetKey (\r
   OUT  VOID         *HmacMd5Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
index 7d7df9640e7f6ad7a57b17b2deeb019bfe32aed9..8126fb525f3586f911f8812ff95d09891313a72f 100644 (file)
@@ -79,22 +79,22 @@ HmacSha1Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacSha1Update().\r
 \r
   If HmacSha1Context is NULL, then return FALSE.\r
 \r
-  @param[out]  HmacSha1Context  Pointer to HMAC-SHA1 context being initialized.\r
+  @param[out]  HmacSha1Context  Pointer to HMAC-SHA1 context.\r
   @param[in]   Key              Pointer to the user-supplied key.\r
   @param[in]   KeySize          Key size in bytes.\r
 \r
-  @retval TRUE   HMAC-SHA1 context initialization succeeded.\r
-  @retval FALSE  HMAC-SHA1 context initialization failed.\r
+  @retval TRUE   The Key is set successfully.\r
+  @retval FALSE  The Key is set unsuccessfully.\r
 \r
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacSha1Init (\r
+HmacSha1SetKey (\r
   OUT  VOID         *HmacSha1Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
@@ -107,13 +107,6 @@ HmacSha1Init (
     return FALSE;\r
   }\r
 \r
-  //\r
-  // OpenSSL HMAC-SHA1 Context Initialization\r
-  //\r
-  memset(HmacSha1Context, 0, HMAC_SHA1_CTX_SIZE);\r
-  if (HMAC_CTX_reset ((HMAC_CTX *)HmacSha1Context) != 1) {\r
-    return FALSE;\r
-  }\r
   if (HMAC_Init_ex ((HMAC_CTX *)HmacSha1Context, Key, (UINT32) KeySize, EVP_sha1(), NULL) != 1) {\r
     return FALSE;\r
   }\r
@@ -160,8 +153,8 @@ HmacSha1Duplicate (
 \r
   This function performs HMAC-SHA1 digest on a data buffer of the specified size.\r
   It can be called multiple times to compute the digest of long or discontinuous data streams.\r
-  HMAC-SHA1 context should be already correctly initialized by HmacSha1Init(), and should not\r
-  be finalized by HmacSha1Final(). Behavior with invalid context is undefined.\r
+  HMAC-SHA1 context should be initialized by HmacSha1New(), and should not be finalized by\r
+  HmacSha1Final(). Behavior with invalid context is undefined.\r
 \r
   If HmacSha1Context is NULL, then return FALSE.\r
 \r
@@ -211,8 +204,8 @@ HmacSha1Update (
   This function completes HMAC-SHA1 digest computation and retrieves the digest value into\r
   the specified memory. After this function has been called, the HMAC-SHA1 context cannot\r
   be used again.\r
-  HMAC-SHA1 context should be already correctly initialized by HmacSha1Init(), and should\r
-  not be finalized by HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined.\r
+  HMAC-SHA1 context should be initialized by HmacSha1New(), and should not be finalized by\r
+  HmacSha1Final(). Behavior with invalid HMAC-SHA1 context is undefined.\r
 \r
   If HmacSha1Context is NULL, then return FALSE.\r
   If HmacValue is NULL, then return FALSE.\r
index 547aa484ea1647de91a79710402a8d1bb99cc779..84f204a542f3b120756316b42b7a2b0db20d68ae 100644 (file)
@@ -65,12 +65,12 @@ HmacSha1Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacSha1Update().\r
 \r
   Return FALSE to indicate this interface is not supported.\r
 \r
-  @param[out]  HmacSha1Context  Pointer to HMAC-SHA1 context being initialized.\r
+  @param[out]  HmacSha1Context  Pointer to HMAC-SHA1 context.\r
   @param[in]   Key              Pointer to the user-supplied key.\r
   @param[in]   KeySize          Key size in bytes.\r
 \r
@@ -79,7 +79,7 @@ HmacSha1Free (
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacSha1Init (\r
+HmacSha1SetKey (\r
   OUT  VOID         *HmacSha1Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
index f24443e7455289ac56d6e41d3b9079799f24a366..f8fd0b172ad86575e87733ea2d3b29a6e3fafc96 100644 (file)
@@ -78,22 +78,22 @@ HmacSha256Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacSha256Update().\r
 \r
   If HmacSha256Context is NULL, then return FALSE.\r
 \r
-  @param[out]  HmacSha256Context  Pointer to HMAC-SHA256 context being initialized.\r
+  @param[out]  HmacSha256Context  Pointer to HMAC-SHA256 context.\r
   @param[in]   Key                Pointer to the user-supplied key.\r
   @param[in]   KeySize            Key size in bytes.\r
 \r
-  @retval TRUE   HMAC-SHA256 context initialization succeeded.\r
-  @retval FALSE  HMAC-SHA256 context initialization failed.\r
+  @retval TRUE   The Key is set successfully.\r
+  @retval FALSE  The Key is set unsuccessfully.\r
 \r
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacSha256Init (\r
+HmacSha256SetKey (\r
   OUT  VOID         *HmacSha256Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
@@ -106,13 +106,6 @@ HmacSha256Init (
     return FALSE;\r
   }\r
 \r
-  //\r
-  // OpenSSL HMAC-SHA256 Context Initialization\r
-  //\r
-  memset(HmacSha256Context, 0, HMAC_SHA256_CTX_SIZE);\r
-  if (HMAC_CTX_reset ((HMAC_CTX *)HmacSha256Context) != 1) {\r
-    return FALSE;\r
-  }\r
   if (HMAC_Init_ex ((HMAC_CTX *)HmacSha256Context, Key, (UINT32) KeySize, EVP_sha256(), NULL) != 1) {\r
     return FALSE;\r
   }\r
@@ -159,8 +152,8 @@ HmacSha256Duplicate (
 \r
   This function performs HMAC-SHA256 digest on a data buffer of the specified size.\r
   It can be called multiple times to compute the digest of long or discontinuous data streams.\r
-  HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should not\r
-  be finalized by HmacSha256Final(). Behavior with invalid context is undefined.\r
+  HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized\r
+  by HmacSha256Final(). Behavior with invalid context is undefined.\r
 \r
   If HmacSha256Context is NULL, then return FALSE.\r
 \r
@@ -210,8 +203,8 @@ HmacSha256Update (
   This function completes HMAC-SHA256 hash computation and retrieves the digest value into\r
   the specified memory. After this function has been called, the HMAC-SHA256 context cannot\r
   be used again.\r
-  HMAC-SHA256 context should be already correctly initialized by HmacSha256Init(), and should\r
-  not be finalized by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.\r
+  HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized\r
+  by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.\r
 \r
   If HmacSha256Context is NULL, then return FALSE.\r
   If HmacValue is NULL, then return FALSE.\r
index f0a4420e276d5ed35d27acd1e9ffe605a4db3532..cededebaa01c5d963a0d92afab0c67deadba835d 100644 (file)
@@ -65,12 +65,12 @@ HmacSha256Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacSha256Update().\r
 \r
   Return FALSE to indicate this interface is not supported.\r
 \r
-  @param[out]  HmacSha256Context  Pointer to HMAC-SHA256 context being initialized.\r
+  @param[out]  HmacSha256Context  Pointer to HMAC-SHA256 context.\r
   @param[in]   Key                Pointer to the user-supplied key.\r
   @param[in]   KeySize            Key size in bytes.\r
 \r
@@ -79,7 +79,7 @@ HmacSha256Free (
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacSha256Init (\r
+HmacSha256SetKey (\r
   OUT  VOID         *HmacSha256Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
index 3aafed874b4b7e97624509359313aa6c3d1c4d22..b77a2266db2efc209edd507c4e6aab19cf811c36 100644 (file)
@@ -65,12 +65,12 @@ HmacMd5Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacMd5Context as HMAC-MD5 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacMd5Update().\r
 \r
   Return FALSE to indicate this interface is not supported.\r
 \r
-  @param[out]  HmacMd5Context  Pointer to HMAC-MD5 context being initialized.\r
+  @param[out]  HmacMd5Context  Pointer to HMAC-MD5 context.\r
   @param[in]   Key             Pointer to the user-supplied key.\r
   @param[in]   KeySize         Key size in bytes.\r
 \r
@@ -79,7 +79,7 @@ HmacMd5Free (
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacMd5Init (\r
+HmacMd5SetKey (\r
   OUT  VOID         *HmacMd5Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
index 547aa484ea1647de91a79710402a8d1bb99cc779..84f204a542f3b120756316b42b7a2b0db20d68ae 100644 (file)
@@ -65,12 +65,12 @@ HmacSha1Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacSha1Context as HMAC-SHA1 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacSha1Update().\r
 \r
   Return FALSE to indicate this interface is not supported.\r
 \r
-  @param[out]  HmacSha1Context  Pointer to HMAC-SHA1 context being initialized.\r
+  @param[out]  HmacSha1Context  Pointer to HMAC-SHA1 context.\r
   @param[in]   Key              Pointer to the user-supplied key.\r
   @param[in]   KeySize          Key size in bytes.\r
 \r
@@ -79,7 +79,7 @@ HmacSha1Free (
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacSha1Init (\r
+HmacSha1SetKey (\r
   OUT  VOID         *HmacSha1Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r
index f0a4420e276d5ed35d27acd1e9ffe605a4db3532..cededebaa01c5d963a0d92afab0c67deadba835d 100644 (file)
@@ -65,12 +65,12 @@ HmacSha256Free (
 }\r
 \r
 /**\r
-  Initializes user-supplied memory pointed by HmacSha256Context as HMAC-SHA256 context for\r
-  subsequent use.\r
+  Set user-supplied key for subsequent use. It must be done before any\r
+  calling to HmacSha256Update().\r
 \r
   Return FALSE to indicate this interface is not supported.\r
 \r
-  @param[out]  HmacSha256Context  Pointer to HMAC-SHA256 context being initialized.\r
+  @param[out]  HmacSha256Context  Pointer to HMAC-SHA256 context.\r
   @param[in]   Key                Pointer to the user-supplied key.\r
   @param[in]   KeySize            Key size in bytes.\r
 \r
@@ -79,7 +79,7 @@ HmacSha256Free (
 **/\r
 BOOLEAN\r
 EFIAPI\r
-HmacSha256Init (\r
+HmacSha256SetKey (\r
   OUT  VOID         *HmacSha256Context,\r
   IN   CONST UINT8  *Key,\r
   IN   UINTN        KeySize\r