trngpsv
Vitis Drivers API Documentation
xtrngpsv.h File Reference

Macros

#define XTRNGPSV_SEC_STRENGTH_BYTES   32U
 Security strength in bytes. More...
 
#define XTRNGPSV_SEC_STRENGTH_LEN   8U
 Security strength in Words. More...
 
#define XTRNGPSV_PERS_STR_LEN   12U
 Personalization string length in dwords. More...
 
#define XTRNGPSV_PERS_STR_LEN_BYTES   48U
 Personalization string length in bytes. More...
 
#define XTRNGPSV_SEED_LEN   12U
 Seed length in dwords. More...
 
#define XTRNGPSV_SEED_LEN_BYTES   48U
 Seed length in bytes. More...
 
#define XTRNGPSV_GEN_LEN_BYTES   32U
 No. More...
 
#define RAND_BUF_LEN   4U
 No. More...
 
#define MAX_PRE_DF_LEN_BYTES   160U
 With max DFLenMul of 9 (9+1)*128= 1280 bits. More...
 
#define MAX_PRE_DF_LEN_WORDS   40U
 With max DFLenMul of 9 (9+1)*128= 1280 bits. More...
 
#define DF_SEED   0U
 to indicate DF called for seed More...
 
#define DF_RAND   1U
 to indicate DF called for random number More...
 
#define DF_IP_IV_LEN   4U
 Input IV Length for DF. More...
 
#define BYTES_PER_BLOCK   16U
 No. More...
 
#define DF_PAD_DATA_LEN   8U
 Length of Padding data used for DF calculation. More...
 
#define XTRNGPSV_SUCCESS   (s32)XST_SUCCESS
 SUCCESS definition of TRNGPSV driver. More...
 
#define XTRNGPSV_FAILURE   (s32)XST_FAILURE
 FAILURE definition of TRNGPSV driver. More...
 
#define XTRNGPSV_TRUE   (u32)TRUE
 Boolean TRUE definition of TRNGPSV driver. More...
 
#define XTRNGPSV_FALSE   (u32)FALSE
 Boolean FALSE definition of TRNGPSV driver. More...
 
#define XTRNGPSV_SWAP_ENDIAN   Xil_EndianSwap32
 Macro to swap endianness of 32 bit data. More...
 

Enumerations

enum  XTrngpsv_ErrorCodes {
  XTRNGPSV_ERROR_INVALID_PARAM = 0x10, XTRNGPSV_ERROR_INVALID_STATE, XTRNGPSV_ERROR_UNNECESSARY_PARAM, XTRNGPSV_ERROR_GLITCH,
  XTRNGPSV_ERROR_NOT_UNINSTANTIATED = 0x20, XTRNGPSV_ERROR_INVALID_USRCFG_MODE, XTRNGPSV_ERROR_INVALID_USRCFG_SEEDLIFE, XTRNGPSV_ERROR_INVALID_USRCFG_PREDRES,
  XTRNGPSV_ERROR_NO_SEED_INSTANTIATE, XTRNGPSV_ERROR_INVALID_USRCFG_DFDIS, XTRNGPSV_ERROR_INVALID_USRCFG_DFLENMUL, XTRNGPSV_ERROR_USRCFG_CPY,
  XTRNGPSV_ERROR_INVALID_USRCFG_PERSPRES, XTRNGPSV_ERROR_INVALID_USRCFG_SEEDPRES, XTRNGPSV_ERROR_UNNECESSARY_PARAM_INSTANTIATE, XTRNGPSV_ERROR_NO_SEED = 0x30,
  XTRNGPSV_ERROR_SEED_INVALID_MODE, XTRNGPSV_ERROR_SAME_SEED, XTRNGPSV_ERROR_INVALID_RESEED_DFLENMUL, XTRNGPSV_ERROR_CERTF,
  XTRNGPSV_ERROR_CERTF_SW_A5_PATTERN, XTRNGPSV_ERROR_RESEED_TIMEOUT, XTRNGPSV_ERROR_CPY_RESEED, XTRNGPSV_ERROR_INSUFFICIENT_RANDBUF = 0x40,
  XTRNGPSV_ERROR_PREDRES_MISMATCH, XTRNGPSV_ERROR_RESEEDING_REQUIRED, XTRNGPSV_ERROR_RESEED_REQD_PREDRES, XTRNGPSV_ERROR_INVALID_GEN_PREDRES,
  XTRNGPSV_ERROR_CATASTROPHIC_DTF, XTRNGPSV_ERROR_CATASTROPHIC_DTF_SW, XTRNGPSV_ERROR_GENERATE_TIMEOUT, XTRNGPSV_ERROR_INVALID_RANDBUF_ADDR,
  XTRNGPSV_ERROR_DF_CPY = 0x50, XTRNGPSV_ERROR_DF_SETUP_KEY_FAILED, XTRNGPSV_ERROR_DF_MEMSET, XTRNGPSV_ERROR_DF_MEMMOVE,
  XTRNGPSV_ERROR_HEALTHTEST_INVALID_MODE = 0x60, XTRNGPSV_ERROR_KAT_MISMATCH, XTRNGPSV_ERROR_USRCFG_CPY_KAT
}
 
enum  XTrngpsv_State { XTRNGPSV_UNINITIALIZED = 0, XTRNGPSV_HEALTHY, XTRNGPSV_ERROR, XTRNGPSV_CATASTROPHIC }
 
enum  XTrngpsv_Mode { XTRNGPSV_HRNG = 0, XTRNGPSV_DRNG, XTRNGPSV_PTRNG }
 

Functions

XTrngpsv_Config * XTrngpsv_LookupConfig (u16 DeviceId)
 This function returns a reference to an XTrng_Config structure based on the DeviceId. More...
 
s32 XTrngpsv_Instantiate (XTrngpsv *InstancePtr, const XTrngpsv_UsrCfg *ConfigurValues)
 This function further initializes i.e. More...
 
s32 XTrngpsv_Reseed (XTrngpsv *InstancePtr, const u8 *ExtSeedPtr, u32 DFLenMul)
 This function reseeds the TRNG in DRNG, HRNG modes. More...
 
s32 XTrngpsv_Generate (XTrngpsv *InstancePtr, u8 *RandBufPtr, u32 RandBufSize, u8 PredResistanceEn)
 This the function which actually generates and provides random bits to the caller. More...
 
s32 XTrngpsv_Uninstantiate (XTrngpsv *InstancePtr)
 This function is used to put the TRNG in reset state, and clear the instance data including configuration, status. More...
 
s32 XTrngpsv_DF (XTrngpsv *InstancePtr, u8 *DFOutput, u32 DF_Flag, const u8 *PersStrPtr)
 This function implements the Derivative Function (per NIST SP80090A) by distilling the entropy available in a lot of bits at its input (DFInput) into a smaller number of bits on the output (DFOutput), thus bringing entropy per bit to 1. More...
 
s32 XTrngpsv_RunKAT (XTrngpsv *InstancePtr)
 KAT can be run at startup and on demand. More...
 
s32 XTrngpsv_RunHealthTest (XTrngpsv *InstancePtr)
 Health tests are entropy tests and hence should be run when the configured mode is of PTRNG or HRNG mode. More...