]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Include/Library/BaseCryptLib.h
CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey
[mirror_edk2.git] / CryptoPkg / Include / Library / BaseCryptLib.h
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