}\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
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
\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
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