Cryptographic HMAC(Keyed-Hash Message Authentication Code).

HMAC_API_FILE Macro

C

#define HMAC_API_FILE

The "create operation" functions are specific to HMAC. For the rest, the HMAC computation is done by using the following MAC API functions: SX_MAC_FEED(), SX_MAC_GENERATE(), SX_MAC_STATUS() and SX_MAC_WAIT(). The current implementation of HMAC does not support context-saving.

@file @copyright Copyright (c) 2019-2020 Silex Insight. All Rights reserved.

Examples: The following example shows typical sequence of function calls for computing the HMAC of a message. @code SX_MAC_CREATE_HMAC_SHA256(ctx, key) SX_MAC_FEED(ctx, 'chunk 1') SX_MAC_FEED(ctx, 'chunk 2') SX_MAC_GENERATE(ctx) SX_MAC_WAIT(ctx) @endcode

Prepares a HMAC SHA256 MAC operation

SX_MAC_CREATE_HMAC_SHA2_256 Macro

C

typedef int (FUNC_SX_MAC_CREATE_HMAC_SHA256)(struct sxmac c, struct sxkeyref keyref);
#define SX_MAC_CREATE_HMAC_SHA2_256 ((FUNC_SX_MAC_CREATE_HMAC_SHA256)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_MAC_CREATE_HMAC_SHA2_256)))

This function initializes the user allocated object \p c with a new MAC operation context and reserves the HW resource.

After successful execution of this function, the context \p c can be passed to any of the hashing functions (except the ones that are specific to context-saving).

Parameters

c MAC operation context

Parameters

hmackey HMAC key

Parameters

ksz size, in bytes, of the HMAC key, can be any size @return ::SX_OK @return ::SX_ERR_INCOMPATIBLE_HW @return ::SX_ERR_RETRY

Prepares a HMAC SHA384 MAC operation

SX_MAC_CREATE_HMAC_SHA2_384 Macro

C

typedef int (FUNC_SX_MAC_CREATE_HMAC_SHA384)(struct sxmac c, struct sxkeyref keyref);
#define SX_MAC_CREATE_HMAC_SHA2_384 ((FUNC_SX_MAC_CREATE_HMAC_SHA384)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_MAC_CREATE_HMAC_SHA2_384)))

This function initializes the user allocated object \p c with a new MAC operation context and reserves the HW resource.

After successful execution of this function, the context \p c can be passed to any of the hashing functions (except the ones that are specific to context-saving).

Parameters

c MAC operation context

Parameters

hmackey HMAC key

Parameters

ksz size, in bytes, of the HMAC key, can be any size @return ::SX_OK @return ::SX_ERR_INCOMPATIBLE_HW @return ::SX_ERR_RETRY | Param | Description | |:----- |:----------- |

| @remark | \p hmackey buffer should not be changed until the operation is completed.

Prepares a HMAC SHA512 MAC operation

SX_MAC_CREATE_HMAC_SHA2_512 Macro

C

typedef int (FUNC_SX_MAC_CREATE_HMAC_SHA2_512)(struct sxmac c, struct sxkeyref keyref);
#define SX_MAC_CREATE_HMAC_SHA2_512 ((FUNC_SX_MAC_CREATE_HMAC_SHA2_512)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_MAC_CREATE_HMAC_SHA2_512)))

This function initializes the user allocated object \p c with a new MAC operation context and reserves the HW resource.

After successful execution of this function, the context \p c can be passed to any of the hashing functions (except the ones that are specific to context-saving).

Parameters

c MAC operation context

Parameters

hmackey HMAC key

Parameters

ksz size, in bytes, of the HMAC key, can be any size @return ::SX_OK @return ::SX_ERR_INCOMPATIBLE_HW @return ::SX_ERR_RETRY | Param | Description | |:----- |:----------- |

| @remark | \p hmackey buffer should not be changed until the operation is completed.

Prepares a HMAC SHA1 MAC operation

SX_MAC_CREATE_HMAC_SHA1 Macro

C

typedef int (FUNC_SX_MAC_CREATE_HMAC_SHA1)(struct sxmac c, struct sxkeyref keyref);
#define SX_MAC_CREATE_HMAC_SHA1 ((FUNC_SX_MAC_CREATE_HMAC_SHA1)((uint32_t )(API_TABLE_BASE_ADDRESS + ATO_SX_MAC_CREATE_HMAC_SHA1)))

This function initializes the user allocated object \p c with a new MAC operation context and reserves the HW resource.

After successful execution of this function, the context \p c can be passed to any of the hashing functions (except the ones that are specific to context-saving).

Parameters

c MAC operation context

Parameters

hmackey HMAC key

Parameters

ksz size, in bytes, of the HMAC key, can be any size @return ::SX_OK @return ::SX_ERR_INCOMPATIBLE_HW @return ::SX_ERR_RETRY | Param | Description | |:----- |:----------- |

| @remark | \p hmackey buffer should not be changed until the operation is completed.

Prepares a HMAC SHA224 MAC operation

This function initializes the user allocated object \p c with a new MAC operation context and reserves the HW resource.

After successful execution of this function, the context \p c can be passed to any of the hashing functions (except the ones that are specific to context-saving).

Parameters

c MAC operation context

Parameters

hmackey HMAC key

Parameters

ksz size, in bytes, of the HMAC key, can be any size @return ::SX_OK @return ::SX_ERR_INCOMPATIBLE_HW @return ::SX_ERR_RETRY | Param | Description | |:----- |:----------- |

| @remark | \p hmackey buffer should not be changed until the operation is completed.