xilsecure
Vitis Drivers API Documentation
XilSecure Generic Server APIs

Macros

#define XSECURE_DATACONTEXTLOST_SET   (1U)
 Set value of data context lost. More...
 
#define XSECURE_DATACONTEXTLOST_CLR   (0U)
 Clear value of data context lost. More...
 
#define XSECURE_IPI_FIRST_PACKET_MASK   (0x40000000U)
 IPI First packet Mask. More...
 
#define XSECURE_RESET_SET   (1U)
 To set the core into reset. More...
 
#define XSECURE_RESET_UNSET   (0U)
 To take the core out of reset. More...
 
#define XSECURE_WORD_SIZE   (4U)
 WORD size in BYTES. More...
 
#define XSECURE_QWORD_SIZE   (16U)
 QWORD size in BYTES. More...
 
#define XSECURE_WORD_IN_BITS   (32U)
 WORD size in BITS. More...
 
#define XSECURE_BYTE_IN_BITS   (8U)
 Byte size in BITS. More...
 
#define XSECURE_WORD_ALIGN_MASK   (XSECURE_WORD_SIZE - 1U)
 WORD alignment. More...
 
#define XSECURE_SET_BIT   (0x0U)
 To set bit. More...
 
#define XSECURE_CLEAR_BIT   (0xFFFFFFFFU)
 To clear bit. More...
 
#define XSecure_MemCpy   Xil_MemCpy
 Backward compatibility. More...
 
#define XSecure_MemCpy64   Xil_MemCpy64
 Backward compatibility. More...
 
#define XSecure_In32   (Xil_In32)
 Reads data from 32-bit address. More...
 
#define XSecure_Out32   (Xil_Out32)
 Writes data to 32-bit address. More...
 
#define XSecure_SecureOut32   (Xil_SecureOut32)
 Writes data to 32-bit address and checks for blind writes. More...
 

Functions

void XSecure_CmdsInit (void)
 This function registers the XilSecure commands to the PLMI. More...
 
int XSecure_CryptoCheck (void)
 This function checks if the EXPORT control eFuse is programmed and PL loading is done. More...
 
int XSecure_AesShaInit (void)
 This function initializes AES and SHA hardware instances. More...
 
int XSecure_Init (XSecure_PartialPdiEventParams *PpdiEventParamsPtr)
 This function registers the handlers for XilSecure IPI commands. More...
 
XSecure_Sha * XSecure_GetSha3Instance (u32 DeviceId)
 This function provides the pointer to the sha3 instance. More...
 
XSecure_Sha * XSecure_GetSha2Instance (u32 DeviceId)
 This function provides the pointer to the sha2 instance. More...
 
XSecure_Aes * XSecure_GetAesInstance (void)
 This function provides the pointer to the common Aes instance which has to be used between PLM and xilsecure server. More...
 
XSecure_RsaXSecure_GetRsaInstance (void)
 This function provides the pointer to the common Rsa instance which has to be used between PLM and xilsecure server. More...
 
XSecure_Sha * XSecure_GetShaInstance (u32 DeviceId)
 This function provides the pointer to the sha instance based on the DevieId. More...
 
int XSecure_MakeResFree (XPlmi_CoreType Core)
 The function frees AES/SHA resource. More...
 
int XSecure_IpiEventHandling (XPlmi_Cmd *Cmd, XPlmi_CoreType Core)
 The function handles the SHA/AES IPI events. More...
 
int XSecure_SetDataContextLost (XPlmi_CoreType Core)
 This function sets the status of data context of previous AES/SHA operation. More...
 
void XSecure_ReleaseReset (UINTPTR BaseAddress, u32 Offset)
 This function takes the hardware core out of reset. More...
 
void XSecure_SetReset (UINTPTR BaseAddress, u32 Offset)
 This function places the hardware core into the reset. More...
 

IP_DISABLE_0 register in EFUSE_CACHE module

#define XSECURE_EFUSE_CACHE_IP_DISABLE0   (0xF1250018U)
 < IP_DISABLE_0 register address and definitions More...
 
#define XSECURE_EFUSE_CACHE_IP_DISABLE0_EXPORT_MASK   (0x20000000U)
 

CFU_FGCR register in CFU_APB module

#define XSECURE_CFU_APB_CFU_FGCR   (0xF12B0018U)
 < CFU_FGCR register address and definitions More...
 
#define XSECURE_CFU_APB_CFU_FGCR_EOS_MASK   (0x00000002U)
 

RST_PS register in CRP module

#define XSECURE_CRP_RST_PS   (0xF126031CU)
 < RST_PS register address and definitions More...
 
#define XSECURE_CRP_RST_PS_PS_SRST_MASK   (0x00000004U)
 

Definition of asserts if macro is defined

#define XSecure_AssertVoid(Expression)
 < All asserts are under XSECDEBUG macro now More...
 
#define XSecure_AssertNonvoid(Expression)
 

Macro Definition Documentation

#define XSecure_AssertVoid (   Expression)

< All asserts are under XSECDEBUG macro now

Referenced by XSecure_AesPmcDmaCfgEndianness().

#define XSECURE_BYTE_IN_BITS   (8U)

Byte size in BITS.

Referenced by XSecure_RsaOaepDecrypt().

#define XSECURE_CFU_APB_CFU_FGCR   (0xF12B0018U)

< CFU_FGCR register address and definitions

Referenced by XSecure_CryptoCheck().

#define XSECURE_CLEAR_BIT   (0xFFFFFFFFU)
#define XSECURE_CRP_RST_PS   (0xF126031CU)

< RST_PS register address and definitions

Referenced by XSecure_CryptoCheck().

#define XSECURE_DATACONTEXTLOST_CLR   (0U)

Clear value of data context lost.

Referenced by XSecure_IpiEventHandling().

#define XSECURE_DATACONTEXTLOST_SET   (1U)

Set value of data context lost.

Referenced by XSecure_IpiEventHandling(), and XSecure_SetDataContextLost().

#define XSECURE_EFUSE_CACHE_IP_DISABLE0   (0xF1250018U)

< IP_DISABLE_0 register address and definitions

Referenced by XSecure_CryptoCheck().

#define XSecure_In32   (Xil_In32)

Reads data from 32-bit address.

Referenced by SecureAesExample(), XSecure_CryptoCheck(), and XSecure_InitiateASUKeyTransfer().

#define XSECURE_IPI_FIRST_PACKET_MASK   (0x40000000U)

IPI First packet Mask.

#define XSecure_MemCpy   Xil_MemCpy

Backward compatibility.

#define XSecure_MemCpy64   Xil_MemCpy64

Backward compatibility.

Referenced by XSecure_KeyUnwrap().

#define XSecure_Out32   (Xil_Out32)
#define XSECURE_QWORD_SIZE   (16U)

QWORD size in BYTES.

Referenced by XSecure_AesValidateSize().

#define XSECURE_RESET_SET   (1U)

To set the core into reset.

Referenced by XSecure_ReleaseReset(), and XSecure_SetReset().

#define XSECURE_RESET_UNSET   (0U)

To take the core out of reset.

Referenced by XSecure_ReleaseReset().

#define XSecure_SecureOut32   (Xil_SecureOut32)

Writes data to 32-bit address and checks for blind writes.

#define XSECURE_SET_BIT   (0x0U)

To set bit.

Referenced by XSecure_ReleaseReset().

#define XSECURE_WORD_ALIGN_MASK   (XSECURE_WORD_SIZE - 1U)

WORD alignment.

#define XSECURE_WORD_IN_BITS   (32U)

WORD size in BITS.

Referenced by XSecure_RsaOperation().

#define XSECURE_WORD_SIZE   (4U)

Function Documentation

int XSecure_AesShaInit ( void  )

This function initializes AES and SHA hardware instances.

Returns
  • XST_SUCCESS On success
  • error code On failure

Initializes AES structure

References XSecure_AesInitialize(), XSecure_GetAesInstance(), XSecure_GetSha2Instance(), and XSecure_GetSha3Instance().

Referenced by XSecure_Init().

void XSecure_CmdsInit ( void  )

This function registers the XilSecure commands to the PLMI.

Referenced by XSecure_Init().

int XSecure_CryptoCheck ( void  )

This function checks if the EXPORT control eFuse is programmed and PL loading is done.

Returns
  • XST_SUCCESS When crypto accelerators are enabled
  • XSECURE_ERR_CRYPTO_ACCELERATOR_DISABLED When crypto accelerators are disabled

Validate export efuse control bit is programmed, to confirm crypto accelerator is enabled.

Referenced by XSecure_AesInitialize(), XSecure_EcdhGetSecret(), XSecure_EllipticGenerateKey_64Bit(), XSecure_EllipticGenerateSignature_64Bit(), XSecure_EllipticValidateKey_64Bit(), XSecure_EllipticVerifySign_64Bit(), and XSecure_RsaCfgInitialize().

XSecure_Aes * XSecure_GetAesInstance ( void  )

This function provides the pointer to the common Aes instance which has to be used between PLM and xilsecure server.

Returns
  • Pointer to the XSecure_Aes instance

Referenced by XSecure_AesInit(), XSecure_AesIpiHandler(), XSecure_AesKeyWrite(), XSecure_AesKeyZeroize(), XSecure_AesPerformOperation(), XSecure_AesPlatPmcDmaCfgAndXfer(), XSecure_AesShaInit(), XSecure_ConfigureDmaByteSwap(), XSecure_KatIpiHandler(), XSecure_KeyUnwrap(), XSecure_PlatAesIpiHandler(), and XSecure_SetDataContextLost().

XSecure_Rsa * XSecure_GetRsaInstance ( void  )

This function provides the pointer to the common Rsa instance which has to be used between PLM and xilsecure server.

Returns
XSecure_Sha * XSecure_GetSha2Instance ( u32  DeviceId)

This function provides the pointer to the sha2 instance.

Returns
  • Pointer to the XSecure_Sha instance

References XSecure_GetShaInstance().

Referenced by XSecure_AesShaInit(), XSecure_KatPlatIpiHandler(), and XSecure_ShaIpiHandler().

XSecure_Sha * XSecure_GetSha3Instance ( u32  DeviceId)

This function provides the pointer to the sha3 instance.

Returns
  • Pointer to the XSecure_Sha instance

References XSecure_GetShaInstance().

Referenced by XSecure_AesShaInit(), XSecure_KatIpiHandler(), XSecure_SetDataContextLost(), XSecure_Sha3IpiHandler(), and XSecure_ShaIpiHandler().

XSecure_Sha * XSecure_GetShaInstance ( u32  DeviceId)

This function provides the pointer to the sha instance based on the DevieId.

Returns
  • Pointer to the XSecure_Sha instance

Referenced by XSecure_GetSha2Instance(), and XSecure_GetSha3Instance().

int XSecure_Init ( XSecure_PartialPdiEventParams *  PpdiEventParamsPtr)

This function registers the handlers for XilSecure IPI commands.

Parameters
PpdiEventParamsPtris the pointer to partial PDI event parameters
Returns
  • XST_SUCCESS On success
  • error code On failure

References XSecure_AddRsaKeyPairGenerationToScheduler(), XSecure_AesShaInit(), and XSecure_CmdsInit().

int XSecure_IpiEventHandling ( XPlmi_Cmd *  Cmd,
XPlmi_CoreType  Core 
)

The function handles the SHA/AES IPI events.

Parameters
Cmdis the pointer to received IPI command
Coreis the resource whose IPI events are to be handled
Returns
  • XST_SUCCESS on success
  • error code on failure

Input parameters validation

Notify IPI event if the operation is in progress and if IPI mask gets mismatched and the received command is 1st Pkt

Check received command in case of IPI mask mismatch

Load current IPI mask

References XSECURE_DATACONTEXTLOST_CLR, XSECURE_DATACONTEXTLOST_SET, and XSECURE_IPI_MASK_DEF_VAL.

Referenced by XSecure_AesIpiHandler(), XSecure_KatIpiHandler(), XSecure_KatPlatIpiHandler(), XSecure_PlatAesIpiHandler(), XSecure_Sha3IpiHandler(), and XSecure_ShaIpiHandler().

int XSecure_MakeResFree ( XPlmi_CoreType  Core)

The function frees AES/SHA resource.

Parameters
Coreis the resource which is to be freed
Returns
  • XST_SUCCESS on success
  • error code on failure

Free resource by clearing its IPI mask

References XSECURE_IPI_MASK_DEF_VAL.

Referenced by XSecure_AesIpiHandler(), XSecure_KatIpiHandler(), XSecure_KatPlatIpiHandler(), XSecure_PlatAesIpiHandler(), XSecure_Sha3IpiHandler(), and XSecure_ShaIpiHandler().

void XSecure_ReleaseReset ( UINTPTR  BaseAddress,
u32  Offset 
)
int XSecure_SetDataContextLost ( XPlmi_CoreType  Core)

This function sets the status of data context of previous AES/SHA operation.

Parameters
Coreis the SHA/AES source whose data context status has to be set
Returns
  • XST_SUCCESS On success
  • XST_INVALID_PARAM On failure

Input parameters validation

Set data context lost only when resource is busy

Set SHA under reset

Set AES under reset

References XSECURE_AES_SOFT_RST_OFFSET, XSECURE_DATACONTEXTLOST_SET, XSecure_GetAesInstance(), XSecure_GetSha3Instance(), XSECURE_IPI_MASK_DEF_VAL, and XSecure_SetReset().