crm_trng_config Struct

C

struct crm_trng_config {
    /** FIFO level below which the module leaves the idle state to refill the FIFO
     * 
     * In numbers of 128-bit blocks.
     * 
     * Set to 0 to use default.
     */
    unsigned int wakeup_level;
    
    /** Number of clock cycles to wait before sampling data from the noise source
     * 
     * Set to 0 to use default.
     */
    unsigned int init_wait;
    
    /** Number of clock cycles to wait before stopping the rings after the FIFO is full.
     * 
     * Set to 0 to use default.
     */
    unsigned int off_time_delay;
    
    /** Clock divider for the frequency at which the outputs of the rings are sampled.
     * 
     * Set to 0 to sample at APB interface clock frequency.
     */
    unsigned int sample_clock_div;
};

Description

Configuration parameters for the TRNG

CRM_TRNG_INIT

C

typedef int (*FUNC_CRM_TRNG_INIT)(struct crm_trng *ctx, const struct crm_trng_config *config);
#define CRM_TRNG_INIT                              ((FUNC_CRM_TRNG_INIT)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_TRNG_INIT)))

Description

TRNG Initialization

Parameters

ParamDescription
ctxTRNG context to be used in other operations
configpointer to optional configuration. NULL to use default

Returns

CRM_OK CRM_ERR_INCOMPATIBLE_HW

CRM_TRNG_GET

C

typedef int (*FUNC_CRM_TRNG_GET)(struct crm_trng *ctx, char *dst, size_t size);
#define CRM_TRNG_GET                                    ((FUNC_CRM_TRNG_GET)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_TRNG_GET)))

Description

Get random bytes

When this function returns ::CRM_OK, \p size random bytes have been written to the \p dst memory location. If not enough random bytes are available, the function does not write any data to \p dst and returns ::CRM_ERR_INSUFFICIENT.

Parameters

ParamDescription
ctxTRNG context to be used in other operations
dstDestination in memory to copy \p size bytes to
sizelength in bytes

Returns

CRM_OK CRM_ERR_INSUFFICIENT CRM_ERR_HARDWARE_FAILURE