![]() |
trngpsx
Vitis Drivers API Documentation
|
Macros | |
| #define | XTRNGPSX_RESEED_TIMEOUT 1500000U |
| Reseed timeout in micro-seconds. More... | |
| #define | XTRNGPSX_GENERATE_TIMEOUT 1500000U |
| Generate timeout in micro-seconds. More... | |
| #define | XTRNGPSX_WORD_LEN_IN_BYTES 4U |
| Word length in bytes. More... | |
| #define | XTRNGPSX_BYTE_LEN_IN_BITS 8U |
| Byte length in bits. More... | |
| #define | XTRNGPSX_BLOCK_LEN_IN_BYTES 16U |
| TRNG block length length in bytes. More... | |
| #define | XTRNGPSX_MIN_SEEDLIFE 1U |
| Minimum seed life. More... | |
| #define | XTRNGPSX_MAX_SEEDLIFE 0x80000 |
| Maximum seed life 2^19. More... | |
| #define | XTRNGPSX_SEC_STRENGTH_IN_BURSTS 2U |
| Security strength in 128-bit bursts. More... | |
| #define | XTRNGPSX_BURST_SIZE_IN_WORDS 4U |
| Burst size in words. More... | |
| #define | XTRNGPSX_DF_MIN_LENGTH 2U |
| Minimum DF input length. More... | |
| #define | XTRNGPSX_DF_MAX_LENGTH 0x1FU |
| Maximum DF input length. More... | |
| #define | XTRNGPSX_DF_NUM_OF_BYTES_BEFORE_MIN_700CLKS_WAIT 8U |
| Number of bytes to be written before wait. More... | |
| #define | XTRNGPSX_ADAPTPROPTESTCUTOFF_MAX_VAL 0x3FFU |
| maximum adaptprpptest cutoff value More... | |
| #define | XTRNGPSX_REPCOUNTTESTCUTOFF_MAX_VAL 0x1FFU |
| maximum repcounttest cutoff value More... | |
| #define | XTRNGPSX_DEFAULT_SEED_LIFE 256U |
| Default seed life. More... | |
| #define | XTRNGPSX_PERS_STRING_LEN_IN_WORDS 12U |
| Personalization string length in words. More... | |
| #define | XTRNGPSX_PERS_STRING_LEN_IN_BYTES 48U |
| Personalization string length in bytes. More... | |
| #define | XTRNGPSX_SEC_STRENGTH_IN_BYTES 32U |
| security strength in Bytes More... | |
| #define | TRNG_STATUS (0x00000004U) |
| Register: TRNG_STATUS. More... | |
| #define | TRNG_CTRL (0x00000008U) |
| Register: TRNG_CTRL. More... | |
| #define | TRNG_CTRL_2 (0x0000000CU) |
| Register: TRNG_CTRL_2. More... | |
| #define | TRNG_CTRL_3 (0x00000010U) |
| Register: TRNG_CTRL_3. More... | |
| #define | TRNG_CTRL_4 (0x00000014U) |
| Register: TRNG_CTRL_4. More... | |
| #define | TRNG_PER_STRNG_11 (0x000000ACU) |
| Register: TRNG_PER_STRNG_11. More... | |
| #define | TRNG_CORE_OUTPUT (0x000000C0U) |
| Register: TRNG_CORE_OUTPUT. More... | |
| #define | TRNG_RESET (0x000000D0U) |
| Register: TRNG_RESET. More... | |
| #define | TRNG_OSC_EN (0x000000D4U) |
| Register: TRNG_OSC_EN. More... | |
Functions | |
| int | XTrngpsx_CfgInitialize (XTrngpsx_Instance *InstancePtr, const XTrngpsx_Config *CfgPtr, UINTPTR EffectiveAddr) |
| This function initializes the TRNGPSV instance/driver. More... | |
| int | XTrngpsx_Instantiate (XTrngpsx_Instance *InstancePtr, const u8 *Seed, u32 SeedLength, const u8 *PersStr, const XTrngpsx_UserConfig *UserCfg) |
| This function instantiates the TRNG instance with user configure values. More... | |
| int | XTrngpsx_Reseed (XTrngpsx_Instance *InstancePtr, const u8 *Seed, u8 DLen) |
| This function triggers and reseeds the DRBG module. More... | |
| int | XTrngpsx_Generate (XTrngpsx_Instance *InstancePtr, u8 *RandBuf, u32 RandBufSize, u8 PredResistance) |
| This function generates and collects random data in to a buffer. More... | |
| int | XTrngpsx_Uninstantiate (XTrngpsx_Instance *InstancePtr) |
| This function uninstantiates the TRNG instance. More... | |
| XTrngpsx_Config * | XTrngpsx_LookupConfig (u16 DeviceId) |
| This function returns a reference to an XTrngpsx_Config structure based on the DeviceId. More... | |
| int | XTrngpsx_DRBGKat (XTrngpsx_Instance *InstancePtr) |
| This function runs DRBG self test i.e DRBG full cycle Instantiate+Reseed, Reseed and Generate. More... | |
| int | XTrngpsx_HealthTest (XTrngpsx_Instance *InstancePtr) |
| This function runs health tests. More... | |
| int | XTrngpsx_PreOperationalSelfTests (XTrngpsx_Instance *InstancePtr) |
| This function runs preoperational self tests and updates TRNG error state. More... | |
Constant definitions for parameters used for Health and KAT tests | |
| #define | XTRNGPSX_KAT_DEFAULT_DF_lENGTH 7U |
| Constant definitions for Health and KAT tests. More... | |
| #define | XTRNGPSX_KAT_DEFAULT_SEED_LIFE 2U |
| Seed life. More... | |
| #define | XTRNGPSX_KAT_SEED_LEN_IN_BYTES 128U |
| Seed length in bytes. More... | |
| #define TRNG_CORE_OUTPUT (0x000000C0U) |
Register: TRNG_CORE_OUTPUT.
| #define TRNG_CTRL (0x00000008U) |
Register: TRNG_CTRL.
Referenced by XTrngpsx_Generate().
| #define TRNG_CTRL_2 (0x0000000CU) |
Register: TRNG_CTRL_2.
| #define TRNG_CTRL_3 (0x00000010U) |
Register: TRNG_CTRL_3.
| #define TRNG_CTRL_4 (0x00000014U) |
Register: TRNG_CTRL_4.
| #define TRNG_OSC_EN (0x000000D4U) |
Register: TRNG_OSC_EN.
Referenced by XTrngpsx_Generate(), and XTrngpsx_Uninstantiate().
| #define TRNG_PER_STRNG_11 (0x000000ACU) |
Register: TRNG_PER_STRNG_11.
| #define TRNG_RESET (0x000000D0U) |
Register: TRNG_RESET.
| #define TRNG_STATUS (0x00000004U) |
Register: TRNG_STATUS.
| #define XTRNGPSX_ADAPTPROPTESTCUTOFF_MAX_VAL 0x3FFU |
maximum adaptprpptest cutoff value
Referenced by XTrngpsx_Instantiate().
| #define XTRNGPSX_BLOCK_LEN_IN_BYTES 16U |
TRNG block length length in bytes.
Referenced by XTrngpsx_Instantiate().
| #define XTRNGPSX_BURST_SIZE_IN_WORDS 4U |
Burst size in words.
| #define XTRNGPSX_BYTE_LEN_IN_BITS 8U |
Byte length in bits.
| #define XTRNGPSX_DEFAULT_SEED_LIFE 256U |
Default seed life.
| #define XTRNGPSX_DF_MAX_LENGTH 0x1FU |
Maximum DF input length.
Referenced by XTrngpsx_Instantiate(), and XTrngpsx_Reseed().
| #define XTRNGPSX_DF_MIN_LENGTH 2U |
Minimum DF input length.
Referenced by XTrngpsx_Instantiate(), and XTrngpsx_Reseed().
| #define XTRNGPSX_DF_NUM_OF_BYTES_BEFORE_MIN_700CLKS_WAIT 8U |
Number of bytes to be written before wait.
| #define XTRNGPSX_GENERATE_TIMEOUT 1500000U |
Generate timeout in micro-seconds.
| #define XTRNGPSX_KAT_DEFAULT_DF_lENGTH 7U |
| #define XTRNGPSX_KAT_DEFAULT_SEED_LIFE 2U |
Seed life.
Referenced by XTrngpsx_DRBGKat().
| #define XTRNGPSX_KAT_SEED_LEN_IN_BYTES 128U |
Seed length in bytes.
Referenced by XTrngpsx_DRBGKat().
| #define XTRNGPSX_MAX_SEEDLIFE 0x80000 |
Maximum seed life 2^19.
Referenced by XTrngpsx_Instantiate().
| #define XTRNGPSX_MIN_SEEDLIFE 1U |
Minimum seed life.
Referenced by XTrngpsx_Instantiate().
| #define XTRNGPSX_PERS_STRING_LEN_IN_BYTES 48U |
Personalization string length in bytes.
Referenced by XTrngpsx_DRBGKat().
| #define XTRNGPSX_PERS_STRING_LEN_IN_WORDS 12U |
Personalization string length in words.
| #define XTRNGPSX_REPCOUNTTESTCUTOFF_MAX_VAL 0x1FFU |
maximum repcounttest cutoff value
Referenced by XTrngpsx_Instantiate().
| #define XTRNGPSX_RESEED_TIMEOUT 1500000U |
Reseed timeout in micro-seconds.
| #define XTRNGPSX_SEC_STRENGTH_IN_BURSTS 2U |
Security strength in 128-bit bursts.
| #define XTRNGPSX_SEC_STRENGTH_IN_BYTES 32U |
security strength in Bytes
Referenced by XTrngpsx_DRBGKat(), and XTrngpsx_Generate().
| #define XTRNGPSX_WORD_LEN_IN_BYTES 4U |
Word length in bytes.
Referenced by XTrngpsx_Generate().
| enum XTrngpsx_ErrorCodes |
| enum XTrngpsx_ErrorState |
| enum XTrngpsx_State |
| int XTrngpsx_CfgInitialize | ( | XTrngpsx_Instance * | InstancePtr, |
| const XTrngpsx_Config * | CfgPtr, | ||
| UINTPTR | EffectiveAddr | ||
| ) |
This function initializes the TRNGPSV instance/driver.
This function must be called prior to using the driver. Initialization includes only setting up the device id and base address. All the remaining parameters of the Instance will be initialized in Instantiate function.
| InstancePtr | is a pointer to the XTrngpsx instance. |
| CfgPtr | points to the configuration structure associated with the TRNGPSX driver. |
| EffectiveAddr | is the base address of the device. If address translation is being used, then this parameter must reflect the virtual base address. Otherwise, the physical address should be used. |
References XTRNGPSX_ERROR, XTRNGPSX_INVALID_PARAM, and XTRNGPSX_UNINITIALIZED_STATE.
| int XTrngpsx_DRBGKat | ( | XTrngpsx_Instance * | InstancePtr | ) |
This function runs DRBG self test i.e DRBG full cycle Instantiate+Reseed, Reseed and Generate.
| InstancePtr | Pointer to XTrngpsx_Instance. |
References XTrngpsx_Generate(), XTrngpsx_Instantiate(), XTRNGPSX_KAT_DEFAULT_DF_lENGTH, XTRNGPSX_KAT_DEFAULT_SEED_LIFE, XTRNGPSX_KAT_FAILED_ERROR, XTRNGPSX_KAT_SEED_LEN_IN_BYTES, XTRNGPSX_PERS_STRING_LEN_IN_BYTES, XTrngpsx_Reseed(), XTRNGPSX_SEC_STRENGTH_IN_BYTES, and XTrngpsx_Uninstantiate().
Referenced by XTrngpsx_PreOperationalSelfTests().
| int XTrngpsx_Generate | ( | XTrngpsx_Instance * | InstancePtr, |
| u8 * | RandBuf, | ||
| u32 | RandBufSize, | ||
| u8 | PredResistance | ||
| ) |
This function generates and collects random data in to a buffer.
| InstancePtr | Pointer to XTrngpsx_Instance |
| RandBuf | Pointer to buffer in which random data is stored. |
| RandBufSize | Size of the buffer in which random data is stored. |
| PredResistance | is the flag that controls Generate level Prediction Resistance. When enabled, it mandates fresh seed for every Generate operation. |
XTRNGPSX_TIMEOUT_ERROR If timeout occurred waiting for QCNT to become 4.
References TRNG_CTRL, TRNG_OSC_EN, XTRNG_PSX_INVALID_PREDRES_VALUE, XTRNGPSX_CATASTROPHIC, XTRNGPSX_ERROR, XTRNGPSX_GENERATE_STATE, XTRNGPSX_HEALTHY, XTRNGPSX_INSTANTIATE_STATE, XTRNGPSX_INVALID_BUF_SIZE, XTRNGPSX_INVALID_MODE, XTRNGPSX_INVALID_PARAM, XTRNGPSX_INVALID_STATE, XTrngpsx_Reseed(), XTRNGPSX_RESEED_REQUIRED_ERROR, XTRNGPSX_RESEED_STATE, XTRNGPSX_SEC_STRENGTH_IN_BYTES, XTRNGPSX_STARTUP_TEST, XTRNGPSX_UNHEALTHY_STATE, and XTRNGPSX_WORD_LEN_IN_BYTES.
Referenced by XTrngpsx_DRBGKat().
| int XTrngpsx_HealthTest | ( | XTrngpsx_Instance * | InstancePtr | ) |
This function runs health tests.
| InstancePtr | Pointer to XTrngpsx_Instance. |
References XTrngpsx_Instantiate(), and XTrngpsx_Uninstantiate().
Referenced by XTrngpsx_PreOperationalSelfTests().
| int XTrngpsx_Instantiate | ( | XTrngpsx_Instance * | InstancePtr, |
| const u8 * | Seed, | ||
| u32 | SeedLength, | ||
| const u8 * | PersStr, | ||
| const XTrngpsx_UserConfig * | UserCfg | ||
| ) |
This function instantiates the TRNG instance with user configure values.
| InstancePtr | Pointer to the XTrngpsx_Instance. |
| Seed | Pointer to the seed input |
| SeedLength | Seed length in bytes |
| PersStr | Pointer to the personalization string input |
| UserCfg | Pointer to the XTrngpsx_UserConfig |
References XTRNGPSX_ADAPTPROPTESTCUTOFF_MAX_VAL, XTRNGPSX_BLOCK_LEN_IN_BYTES, XTRNGPSX_CATASTROPHIC, XTRNGPSX_DF_MAX_LENGTH, XTRNGPSX_DF_MIN_LENGTH, XTRNGPSX_ERROR, XTRNGPSX_HEALTHY, XTRNGPSX_INSTANTIATE_STATE, XTRNGPSX_INVALID_ADAPTPROPTEST_CUTOFF_VALUE, XTRNGPSX_INVALID_BLOCKING_MODE, XTRNGPSX_INVALID_DF_LENGTH, XTRNGPSX_INVALID_MODE, XTRNGPSX_INVALID_PARAM, XTRNGPSX_INVALID_REPCOUNTTEST_CUTOFF_VALUE, XTRNGPSX_INVALID_SEED_LENGTH, XTRNGPSX_INVALID_SEED_LIFE, XTRNGPSX_INVALID_SEED_VALUE, XTRNGPSX_INVALID_STATE, XTRNGPSX_MAX_SEEDLIFE, XTRNGPSX_MIN_SEEDLIFE, XTRNGPSX_REPCOUNTTESTCUTOFF_MAX_VAL, XTRNGPSX_UNINITIALIZED_STATE, and XTRNGPSX_USER_CFG_COPY_ERROR.
Referenced by XTrngpsx_DRBGKat(), and XTrngpsx_HealthTest().
| XTrngpsx_Config * XTrngpsx_LookupConfig | ( | u16 | DeviceId | ) |
This function returns a reference to an XTrngpsx_Config structure based on the DeviceId.
The return value will refer to an entry in the device configuration table defined in the xtrngpsx_g.c file.
| DeviceId | is the unique device ID of the device being lookedup. |
| int XTrngpsx_PreOperationalSelfTests | ( | XTrngpsx_Instance * | InstancePtr | ) |
This function runs preoperational self tests and updates TRNG error state.
| InstancePtr | Pointer to XTrngpsx_Instance. |
References XTrngpsx_DRBGKat(), XTrngpsx_HealthTest(), and XTrngpsx_Uninstantiate().
| int XTrngpsx_Reseed | ( | XTrngpsx_Instance * | InstancePtr, |
| const u8 * | Seed, | ||
| u8 | DLen | ||
| ) |
This function triggers and reseeds the DRBG module.
| InstancePtr | Pointer to XTrngpsx_Instance. |
| Seed | Pointer to the seed input |
| DLen | Seed length in TRNG block size |
References XTRNGPSX_DF_MAX_LENGTH, XTRNGPSX_DF_MIN_LENGTH, XTRNGPSX_HEALTHY, XTRNGPSX_INVALID_DF_LENGTH, XTRNGPSX_INVALID_MODE, XTRNGPSX_INVALID_PARAM, XTRNGPSX_INVALID_SEED_VALUE, XTRNGPSX_INVALID_STATE, XTRNGPSX_RESEED_STATE, XTRNGPSX_STARTUP_TEST, XTRNGPSX_UNHEALTHY_STATE, and XTRNGPSX_UNINITIALIZED_STATE.
Referenced by XTrngpsx_DRBGKat(), and XTrngpsx_Generate().
| int XTrngpsx_Uninstantiate | ( | XTrngpsx_Instance * | InstancePtr | ) |
This function uninstantiates the TRNG instance.
| InstancePtr | Pointer to XTrngpsx_Instance. |
References TRNG_OSC_EN, XTRNGPSX_INVALID_PARAM, and XTRNGPSX_UNINITIALIZED_STATE.
Referenced by XTrngpsx_DRBGKat(), XTrngpsx_HealthTest(), and XTrngpsx_PreOperationalSelfTests().