TianoCore EDK2 master
|
#include "InternalCryptLib.h"
#include <openssl/hmac.h>
Go to the source code of this file.
Functions | |
STATIC VOID * | HmacMdNew (VOID) |
STATIC VOID | HmacMdFree (IN VOID *HmacMdCtx) |
STATIC BOOLEAN | HmacMdSetKey (IN CONST EVP_MD *Md, OUT VOID *HmacMdContext, IN CONST UINT8 *Key, IN UINTN KeySize) |
STATIC BOOLEAN | HmacMdDuplicate (IN CONST VOID *HmacMdContext, OUT VOID *NewHmacMdContext) |
STATIC BOOLEAN | HmacMdUpdate (IN OUT VOID *HmacMdContext, IN CONST VOID *Data, IN UINTN DataSize) |
STATIC BOOLEAN | HmacMdFinal (IN OUT VOID *HmacMdContext, 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) |
VOID *EFIAPI | HmacSha256New (VOID) |
VOID EFIAPI | HmacSha256Free (IN VOID *HmacSha256Ctx) |
BOOLEAN EFIAPI | HmacSha256SetKey (OUT VOID *HmacSha256Context, IN CONST UINT8 *Key, IN UINTN KeySize) |
BOOLEAN EFIAPI | HmacSha256Duplicate (IN CONST VOID *HmacSha256Context, OUT VOID *NewHmacSha256Context) |
BOOLEAN EFIAPI | HmacSha256Update (IN OUT VOID *HmacSha256Context, IN CONST VOID *Data, IN UINTN DataSize) |
BOOLEAN EFIAPI | HmacSha256Final (IN OUT VOID *HmacSha256Context, OUT UINT8 *HmacValue) |
BOOLEAN EFIAPI | HmacSha256All (IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue) |
VOID *EFIAPI | HmacSha384New (VOID) |
VOID EFIAPI | HmacSha384Free (IN VOID *HmacSha384Ctx) |
BOOLEAN EFIAPI | HmacSha384SetKey (OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize) |
BOOLEAN EFIAPI | HmacSha384Duplicate (IN CONST VOID *HmacSha384Context, OUT VOID *NewHmacSha384Context) |
BOOLEAN EFIAPI | HmacSha384Update (IN OUT VOID *HmacSha384Context, IN CONST VOID *Data, IN UINTN DataSize) |
BOOLEAN EFIAPI | HmacSha384Final (IN OUT VOID *HmacSha384Context, OUT UINT8 *HmacValue) |
BOOLEAN EFIAPI | HmacSha384All (IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue) |
HMAC-SHA256/SHA384 Wrapper Implementation over OpenSSL.
Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file CryptHmac.c.
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 | ||
) |
Computes the HMAC-MD digest of a input data buffer.
This function performs the HMAC-MD digest of a given data buffer, and places the digest value into the specified memory.
If this interface is not supported, then return FALSE.
[in] | Md | Message Digest. |
[in] | Data | Pointer to the buffer containing the data to be digested. |
[in] | DataSize | Size of Data buffer in bytes. |
[in] | Key | Pointer to the user-supplied key. |
[in] | KeySize | Key size in bytes. |
[out] | HmacValue | Pointer to a buffer that receives the HMAC-MD digest value. |
TRUE | HMAC-MD digest computation succeeded. |
FALSE | HMAC-MD digest computation failed. |
FALSE | This interface is not supported. |
Definition at line 244 of file CryptHmac.c.
Makes a copy of an existing HMAC-MD context.
If HmacMdContext is NULL, then return FALSE. If NewHmacMdContext is NULL, then return FALSE.
[in] | HmacMdContext | Pointer to HMAC-MD context being copied. |
[out] | NewHmacMdContext | Pointer to new HMAC-MD context. |
TRUE | HMAC-MD context copy succeeded. |
FALSE | HMAC-MD context copy failed. |
Definition at line 102 of file CryptHmac.c.
Completes computation of the HMAC-MD digest value.
This function completes HMAC-MD hash computation and retrieves the digest value into the specified memory. After this function has been called, the HMAC-MD context cannot be used again. HMAC-MD context should be initialized by HmacMdNew(), and should not be finalized by HmacMdFinal(). Behavior with invalid HMAC-MD context is undefined.
If HmacMdContext is NULL, then return FALSE. If HmacValue is NULL, then return FALSE.
[in,out] | HmacMdContext | Pointer to the HMAC-MD context. |
[out] | HmacValue | Pointer to a buffer that receives the HMAC-MD digest value. |
TRUE | HMAC-MD digest computation succeeded. |
FALSE | HMAC-MD digest computation failed. |
Definition at line 193 of file CryptHmac.c.
Release the specified HMAC_CTX context.
[in] | HmacMdCtx | Pointer to the HMAC_CTX context to be released. |
Definition at line 39 of file CryptHmac.c.
STATIC VOID * HmacMdNew | ( | VOID | ) |
Allocates and initializes one HMAC_CTX context for subsequent HMAC-MD use.
Definition at line 21 of file CryptHmac.c.
STATIC BOOLEAN HmacMdSetKey | ( | IN CONST EVP_MD * | Md, |
OUT VOID * | HmacMdContext, | ||
IN CONST UINT8 * | Key, | ||
IN UINTN | KeySize | ||
) |
Set user-supplied key for subsequent use. It must be done before any calling to HmacMdUpdate().
If HmacMdContext is NULL, then return FALSE.
[in] | Md | Message Digest. |
[out] | HmacMdContext | Pointer to HMAC-MD context. |
[in] | Key | Pointer to the user-supplied key. |
[in] | KeySize | Key size in bytes. |
TRUE | The Key is set successfully. |
FALSE | The Key is set unsuccessfully. |
Definition at line 66 of file CryptHmac.c.
STATIC BOOLEAN HmacMdUpdate | ( | IN OUT VOID * | HmacMdContext, |
IN CONST VOID * | Data, | ||
IN UINTN | DataSize | ||
) |
Digests the input data and updates HMAC-MD context.
This function performs HMAC-MD digest on a data buffer of the specified size. It can be called multiple times to compute the digest of long or discontinuous data streams. HMAC-MD context should be initialized by HmacMdNew(), and should not be finalized by HmacMdFinal(). Behavior with invalid context is undefined.
If HmacMdContext is NULL, then return FALSE.
[in,out] | HmacMdContext | Pointer to the HMAC-MD context. |
[in] | Data | Pointer to the buffer containing the data to be digested. |
[in] | DataSize | Size of Data buffer in bytes. |
TRUE | HMAC-MD data digest succeeded. |
FALSE | HMAC-MD data digest failed. |
Definition at line 141 of file CryptHmac.c.
BOOLEAN EFIAPI HmacSha256All | ( | IN CONST VOID * | Data, |
IN UINTN | DataSize, | ||
IN CONST UINT8 * | Key, | ||
IN UINTN | KeySize, | ||
OUT UINT8 * | HmacValue | ||
) |
Computes the HMAC-SHA256 digest of a input data buffer.
This function performs the HMAC-SHA256 digest of a given data buffer, and places the digest value into the specified memory.
If this interface is not supported, then return FALSE.
[in] | Data | Pointer to the buffer containing the data to be digested. |
[in] | DataSize | Size of Data buffer in bytes. |
[in] | Key | Pointer to the user-supplied key. |
[in] | KeySize | Key size in bytes. |
[out] | HmacValue | Pointer to a buffer that receives the HMAC-SHA256 digest value (32 bytes). |
TRUE | HMAC-SHA256 digest computation succeeded. |
FALSE | HMAC-SHA256 digest computation failed. |
FALSE | This interface is not supported. |
Definition at line 448 of file CryptHmac.c.
BOOLEAN EFIAPI HmacSha256Duplicate | ( | IN CONST VOID * | HmacSha256Context, |
OUT VOID * | NewHmacSha256Context | ||
) |
Makes a copy of an existing HMAC-SHA256 context.
If HmacSha256Context is NULL, then return FALSE. If NewHmacSha256Context is NULL, then return FALSE.
[in] | HmacSha256Context | Pointer to HMAC-SHA256 context being copied. |
[out] | NewHmacSha256Context | Pointer to new HMAC-SHA256 context. |
TRUE | HMAC-SHA256 context copy succeeded. |
FALSE | HMAC-SHA256 context copy failed. |
Definition at line 359 of file CryptHmac.c.
Completes computation of the HMAC-SHA256 digest value.
This function completes HMAC-SHA256 hash computation and retrieves the digest value into the specified memory. After this function has been called, the HMAC-SHA256 context cannot be used again. HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.
If HmacSha256Context is NULL, then return FALSE. If HmacValue is NULL, then return FALSE.
[in,out] | HmacSha256Context | Pointer to the HMAC-SHA256 context. |
[out] | HmacValue | Pointer to a buffer that receives the HMAC-SHA256 digest value (32 bytes). |
TRUE | HMAC-SHA256 digest computation succeeded. |
FALSE | HMAC-SHA256 digest computation failed. |
Definition at line 418 of file CryptHmac.c.
VOID EFIAPI HmacSha256Free | ( | IN VOID * | HmacSha256Ctx | ) |
Release the specified HMAC_CTX context.
[in] | HmacSha256Ctx | Pointer to the HMAC_CTX context to be released. |
Definition at line 312 of file CryptHmac.c.
VOID *EFIAPI HmacSha256New | ( | VOID | ) |
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.
Definition at line 297 of file CryptHmac.c.
BOOLEAN EFIAPI HmacSha256SetKey | ( | OUT VOID * | HmacSha256Context, |
IN CONST UINT8 * | Key, | ||
IN UINTN | KeySize | ||
) |
Set user-supplied key for subsequent use. It must be done before any calling to HmacSha256Update().
If HmacSha256Context is NULL, then return FALSE.
[out] | HmacSha256Context | Pointer to HMAC-SHA256 context. |
[in] | Key | Pointer to the user-supplied key. |
[in] | KeySize | Key size in bytes. |
TRUE | The Key is set successfully. |
FALSE | The Key is set unsuccessfully. |
Definition at line 335 of file CryptHmac.c.
BOOLEAN EFIAPI HmacSha256Update | ( | IN OUT VOID * | HmacSha256Context, |
IN CONST VOID * | Data, | ||
IN UINTN | DataSize | ||
) |
Digests the input data and updates HMAC-SHA256 context.
This function performs HMAC-SHA256 digest on a data buffer of the specified size. It can be called multiple times to compute the digest of long or discontinuous data streams. HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized by HmacSha256Final(). Behavior with invalid context is undefined.
If HmacSha256Context is NULL, then return FALSE.
[in,out] | HmacSha256Context | Pointer to the HMAC-SHA256 context. |
[in] | Data | Pointer to the buffer containing the data to be digested. |
[in] | DataSize | Size of Data buffer in bytes. |
TRUE | HMAC-SHA256 data digest succeeded. |
FALSE | HMAC-SHA256 data digest failed. |
Definition at line 387 of file CryptHmac.c.
BOOLEAN EFIAPI HmacSha384All | ( | IN CONST VOID * | Data, |
IN UINTN | DataSize, | ||
IN CONST UINT8 * | Key, | ||
IN UINTN | KeySize, | ||
OUT UINT8 * | HmacValue | ||
) |
Computes the HMAC-SHA384 digest of a input data buffer.
This function performs the HMAC-SHA384 digest of a given data buffer, and places the digest value into the specified memory.
If this interface is not supported, then return FALSE.
[in] | Data | Pointer to the buffer containing the data to be digested. |
[in] | DataSize | Size of Data buffer in bytes. |
[in] | Key | Pointer to the user-supplied key. |
[in] | KeySize | Key size in bytes. |
[out] | HmacValue | Pointer to a buffer that receives the HMAC-SHA384 digest value (48 bytes). |
TRUE | HMAC-SHA384 digest computation succeeded. |
FALSE | HMAC-SHA384 digest computation failed. |
FALSE | This interface is not supported. |
Definition at line 627 of file CryptHmac.c.
BOOLEAN EFIAPI HmacSha384Duplicate | ( | IN CONST VOID * | HmacSha384Context, |
OUT VOID * | NewHmacSha384Context | ||
) |
Makes a copy of an existing HMAC-SHA384 context.
If HmacSha384Context is NULL, then return FALSE. If NewHmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE.
[in] | HmacSha384Context | Pointer to HMAC-SHA384 context being copied. |
[out] | NewHmacSha384Context | Pointer to new HMAC-SHA384 context. |
TRUE | HMAC-SHA384 context copy succeeded. |
FALSE | HMAC-SHA384 context copy failed. |
FALSE | This interface is not supported. |
Definition at line 534 of file CryptHmac.c.
Completes computation of the HMAC-SHA384 digest value.
This function completes HMAC-SHA384 hash computation and retrieves the digest value into the specified memory. After this function has been called, the HMAC-SHA384 context cannot be used again. HMAC-SHA384 context should be initialized by HmacSha384New(), and should not be finalized by HmacSha384Final(). Behavior with invalid HMAC-SHA384 context is undefined.
If HmacSha384Context is NULL, then return FALSE. If HmacValue is NULL, then return FALSE. If this interface is not supported, then return FALSE.
[in,out] | HmacSha384Context | Pointer to the HMAC-SHA384 context. |
[out] | HmacValue | Pointer to a buffer that receives the HMAC-SHA384 digest value (48 bytes). |
TRUE | HMAC-SHA384 digest computation succeeded. |
FALSE | HMAC-SHA384 digest computation failed. |
FALSE | This interface is not supported. |
Definition at line 597 of file CryptHmac.c.
VOID EFIAPI HmacSha384Free | ( | IN VOID * | HmacSha384Ctx | ) |
Release the specified HMAC_CTX context.
[in] | HmacSha384Ctx | Pointer to the HMAC_CTX context to be released. |
Definition at line 483 of file CryptHmac.c.
VOID *EFIAPI HmacSha384New | ( | VOID | ) |
Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA384 use.
Definition at line 468 of file CryptHmac.c.
BOOLEAN EFIAPI HmacSha384SetKey | ( | OUT VOID * | HmacSha384Context, |
IN CONST UINT8 * | Key, | ||
IN UINTN | KeySize | ||
) |
Set user-supplied key for subsequent use. It must be done before any calling to HmacSha384Update().
If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE.
[out] | HmacSha384Context | Pointer to HMAC-SHA384 context. |
[in] | Key | Pointer to the user-supplied key. |
[in] | KeySize | Key size in bytes. |
TRUE | The Key is set successfully. |
FALSE | The Key is set unsuccessfully. |
FALSE | This interface is not supported. |
Definition at line 508 of file CryptHmac.c.
BOOLEAN EFIAPI HmacSha384Update | ( | IN OUT VOID * | HmacSha384Context, |
IN CONST VOID * | Data, | ||
IN UINTN | DataSize | ||
) |
Digests the input data and updates HMAC-SHA384 context.
This function performs HMAC-SHA384 digest on a data buffer of the specified size. It can be called multiple times to compute the digest of long or discontinuous data streams. HMAC-SHA384 context should be initialized by HmacSha384New(), and should not be finalized by HmacSha384Final(). Behavior with invalid context is undefined.
If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE.
[in,out] | HmacSha384Context | Pointer to the HMAC-SHA384 context. |
[in] | Data | Pointer to the buffer containing the data to be digested. |
[in] | DataSize | Size of Data buffer in bytes. |
TRUE | HMAC-SHA384 data digest succeeded. |
FALSE | HMAC-SHA384 data digest failed. |
FALSE | This interface is not supported. |
Definition at line 564 of file CryptHmac.c.