9#include "InternalCryptLib.h"
10#include <openssl/hmac.h>
28 return (VOID *)HMAC_CTX_new ();
46 HMAC_CTX_free ((HMAC_CTX *)HmacMdCtx);
68 OUT VOID *HmacMdContext,
76 if ((HmacMdContext ==
NULL) || (KeySize > INT_MAX)) {
80 if (HMAC_Init_ex ((HMAC_CTX *)HmacMdContext, Key, (UINT32)KeySize, Md,
NULL) != 1) {
104 OUT VOID *NewHmacMdContext
110 if ((HmacMdContext ==
NULL) || (NewHmacMdContext ==
NULL)) {
114 if (HMAC_CTX_copy ((HMAC_CTX *)NewHmacMdContext, (HMAC_CTX *)HmacMdContext) != 1) {
142 IN OUT VOID *HmacMdContext,
150 if (HmacMdContext ==
NULL) {
157 if ((Data ==
NULL) && (DataSize != 0)) {
164 if (HMAC_Update ((HMAC_CTX *)HmacMdContext, Data, DataSize) != 1) {
194 IN OUT VOID *HmacMdContext,
203 if ((HmacMdContext ==
NULL) || (HmacValue ==
NULL)) {
210 if (HMAC_Final ((HMAC_CTX *)HmacMdContext, HmacValue, &Length) != 1) {
214 if (HMAC_CTX_reset ((HMAC_CTX *)HmacMdContext) != 1) {
257 Ctx = HMAC_CTX_new ();
262 RetVal = (BOOLEAN)HMAC_CTX_reset (Ctx);
267 RetVal = (BOOLEAN)HMAC_Init_ex (Ctx, Key, (UINT32)KeySize, Md,
NULL);
272 RetVal = (BOOLEAN)HMAC_Update (Ctx, Data, DataSize);
277 RetVal = (BOOLEAN)HMAC_Final (Ctx, HmacValue, &Length);
313 IN VOID *HmacSha256Ctx
336 OUT VOID *HmacSha256Context,
341 return HmacMdSetKey (EVP_sha256 (), HmacSha256Context, Key, KeySize);
360 IN CONST VOID *HmacSha256Context,
361 OUT VOID *NewHmacSha256Context
388 IN OUT VOID *HmacSha256Context,
393 return HmacMdUpdate (HmacSha256Context, Data, DataSize);
419 IN OUT VOID *HmacSha256Context,
456 return HmacMdAll (EVP_sha256 (), Data, DataSize, Key, KeySize, HmacValue);
484 IN VOID *HmacSha384Ctx
509 OUT VOID *HmacSha384Context,
514 return HmacMdSetKey (EVP_sha384 (), HmacSha384Context, Key, KeySize);
535 IN CONST VOID *HmacSha384Context,
536 OUT VOID *NewHmacSha384Context
565 IN OUT VOID *HmacSha384Context,
570 return HmacMdUpdate (HmacSha384Context, Data, DataSize);
598 IN OUT VOID *HmacSha384Context,
635 return HmacMdAll (EVP_sha384 (), Data, DataSize, Key, KeySize, HmacValue);
BOOLEAN EFIAPI HmacSha384Update(IN OUT VOID *HmacSha384Context, IN CONST VOID *Data, IN UINTN DataSize)
STATIC VOID * HmacMdNew(VOID)
BOOLEAN EFIAPI HmacSha384SetKey(OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize)
STATIC VOID HmacMdFree(IN VOID *HmacMdCtx)
VOID *EFIAPI HmacSha256New(VOID)
BOOLEAN EFIAPI HmacSha256Duplicate(IN CONST VOID *HmacSha256Context, OUT VOID *NewHmacSha256Context)
VOID *EFIAPI HmacSha384New(VOID)
BOOLEAN EFIAPI HmacSha384All(IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
VOID EFIAPI HmacSha384Free(IN VOID *HmacSha384Ctx)
VOID EFIAPI HmacSha256Free(IN VOID *HmacSha256Ctx)
BOOLEAN EFIAPI HmacSha384Duplicate(IN CONST VOID *HmacSha384Context, OUT VOID *NewHmacSha384Context)
BOOLEAN EFIAPI HmacSha384Final(IN OUT VOID *HmacSha384Context, OUT UINT8 *HmacValue)
BOOLEAN EFIAPI HmacSha256SetKey(OUT VOID *HmacSha256Context, IN CONST UINT8 *Key, IN UINTN KeySize)
BOOLEAN EFIAPI HmacSha256Update(IN OUT VOID *HmacSha256Context, IN CONST VOID *Data, IN UINTN DataSize)
STATIC BOOLEAN HmacMdFinal(IN OUT VOID *HmacMdContext, OUT UINT8 *HmacValue)
BOOLEAN EFIAPI HmacSha256All(IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
STATIC BOOLEAN HmacMdAll(IN CONST EVP_MD *Md, IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
STATIC BOOLEAN HmacMdDuplicate(IN CONST VOID *HmacMdContext, OUT VOID *NewHmacMdContext)
BOOLEAN EFIAPI HmacSha256Final(IN OUT VOID *HmacSha256Context, OUT UINT8 *HmacValue)
STATIC BOOLEAN HmacMdUpdate(IN OUT VOID *HmacMdContext, IN CONST VOID *Data, IN UINTN DataSize)
STATIC BOOLEAN HmacMdSetKey(IN CONST EVP_MD *Md, OUT VOID *HmacMdContext, IN CONST UINT8 *Key, IN UINTN KeySize)