xilsecure
Vitis Drivers API Documentation
Xilsecure HMAC APIs

Macros

#define XSECURE_HMAC_8BIT_SHIFT   (8U)
 8 Bit shift for HMAC More...
 
#define XSECURE_HMAC_16BIT_SHIFT   (16U)
 16 Bit shift for HMAC More...
 
#define XSECURE_HMAC_24BIT_SHIFT   (24U)
 24 Bit shift for HMAC More...
 
#define XSECURE_HMAC_WORD_LEN   (4U)
 HMAC word length. More...
 
#define XSECURE_HMAC_IPAD_VALUE   (0x36U)
 HMAC IPAD value. More...
 
#define XSECURE_HMAC_OPAD_VALUE   (0x5CU)
 HMAC OPAD value. More...
 

Functions

int XSecure_HmacInit (XSecure_Hmac *InstancePtr, XSecure_Sha3 *Sha3InstancePtr, u64 KeyAddr, u32 KeyLen)
 This function initializes the HMAC instance. More...
 
int XSecure_HmacUpdate (XSecure_Hmac *InstancePtr, u64 DataAddr, u32 Len)
 This function updates the data to be authenticated, which can be called repeatedly with chunks of the message to be authenticated (len bytes at data). More...
 
int XSecure_HmacFinal (XSecure_Hmac *InstancePtr, XSecure_HmacRes *Hmac)
 This function calculates the final HMAC. More...
 

Macro Definition Documentation

#define XSECURE_HMAC_16BIT_SHIFT   (16U)

16 Bit shift for HMAC

#define XSECURE_HMAC_24BIT_SHIFT   (24U)

24 Bit shift for HMAC

#define XSECURE_HMAC_8BIT_SHIFT   (8U)

8 Bit shift for HMAC

#define XSECURE_HMAC_IPAD_VALUE   (0x36U)

HMAC IPAD value.

Referenced by XSecure_HmacInit().

#define XSECURE_HMAC_OPAD_VALUE   (0x5CU)

HMAC OPAD value.

Referenced by XSecure_HmacInit().

#define XSECURE_HMAC_WORD_LEN   (4U)

HMAC word length.

Function Documentation

int XSecure_HmacFinal ( XSecure_Hmac *  InstancePtr,
XSecure_HmacRes *  Hmac 
)

This function calculates the final HMAC.

Parameters
InstancePtris the pointer to the XSecure_Hmac instance
Hmacis the pointer of 48 bits which holds the resultant HMAC.
Returns
  • XST_SUCCESS If initialization was successful.
  • XSECURE_HMAC_INVALID_PARAM If any input parameter is invalid.
  • XST_FAILURE On failure.
Note
Though HMAC can be truncated, as the truncation of data may lead to security implications, this function always fills the HMAC pointer with 48 bytes of data.

References XSECURE_HMAC_INVALID_PARAM, XSecure_SetReset(), XSECURE_SHA3_BLOCK_LEN, and XSecure_Sha3Hash().

Referenced by XSecure_HmacKat().

int XSecure_HmacInit ( XSecure_Hmac *  InstancePtr,
XSecure_Sha3 *  Sha3InstancePtr,
u64  KeyAddr,
u32  KeyLen 
)

This function initializes the HMAC instance.

Parameters
InstancePtris the pointer to the XSecure_Hmac instance
Sha3InstancePtris the pointer to the XSecure_Sha3 instance.
KeyAddrholds the address of HMAC key.
KeyLenvariable holds the length of the key.
Returns
  • XST_SUCCESS If initialization was successful.
  • XSECURE_HMAC_INVALID_PARAM If any input parameter is invalid.
  • XST_FAILURE On failure.

References XSECURE_HMAC_INVALID_PARAM, XSECURE_HMAC_IPAD_VALUE, XSECURE_HMAC_OPAD_VALUE, XSecure_SetReset(), and XSECURE_SHA3_BLOCK_LEN.

Referenced by XSecure_HmacKat().

int XSecure_HmacUpdate ( XSecure_Hmac *  InstancePtr,
u64  DataAddr,
u32  Len 
)

This function updates the data to be authenticated, which can be called repeatedly with chunks of the message to be authenticated (len bytes at data).

Parameters
InstancePtris the pointer to the XSecure_Hmac instance
DataAddrholds the address of data to be updated.
Lenvariable holds the length of data.
Returns
  • XST_SUCCESS If initialization was successful.
  • XSECURE_HMAC_INVALID_PARAM If any input parameter is invalid.
  • XST_FAILURE On failure.

References XSECURE_HMAC_INVALID_PARAM, XSecure_SetReset(), and XSECURE_SHA3_BLOCK_LEN.

Referenced by XSecure_HmacKat().