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