Private code shared between the CSRNG and EDN DIFs. More...
#include "sw/device/lib/base/bitfield.h"
#include "sw/device/lib/base/macros.h"
#include "sw/device/lib/base/memory.h"
#include "sw/device/lib/base/mmio.h"
#include "sw/device/lib/dif/dif_base.h"
#include "sw/device/lib/dif/dif_csrng.h"
Go to the source code of this file.
Data Structures | |
struct | csrng_app_cmd |
CSRNG application interface command header parameters. More... | |
Typedefs | |
typedef enum csrng_app_cmd_id | csrng_app_cmd_id_t |
Supported CSRNG application commands. | |
typedef struct csrng_app_cmd | csrng_app_cmd_t |
CSRNG application interface command header parameters. | |
typedef enum csrng_app_cmd_type | csrng_app_cmd_type_t |
This enum type contains all the different command types for csrng_send_cmd(). | |
Enumerations | |
enum | { kCsrngGenBitsBufferSize = 4 } |
enum | csrng_app_cmd_id { kCsrngAppCmdInstantiate = 1 , kCsrngAppCmdReseed = 2 , kCsrngAppCmdGenerate = 3 , kCsrngAppCmdUpdate = 4 , kCsrngAppCmdUninstantiate = 5 } |
Supported CSRNG application commands. More... | |
enum | csrng_app_cmd_type { kCsrngAppCmdTypeCsrng , kCsrngAppCmdTypeEdnSw , kCsrngAppCmdTypeEdnGen , kCsrngAppCmdTypeEdnRes } |
This enum type contains all the different command types for csrng_send_cmd(). More... | |
Functions | |
OT_WARN_UNUSED_RESULT uint32_t | csrng_cmd_header_build (csrng_app_cmd_id_t id, dif_csrng_entropy_src_toggle_t entropy_src_enable, uint32_t cmd_len, uint32_t generate_len) |
Builds a CSRNG command header. | |
OT_WARN_UNUSED_RESULT dif_result_t | csrng_send_app_cmd (mmio_region_t base_addr, csrng_app_cmd_type_t cmd_type, csrng_app_cmd_t cmd) |
Writes application command cmd to the CSRNG_CMD_REQ_REG register. | |
Private code shared between the CSRNG and EDN DIFs.
Definition in file dif_csrng_shared.h.
struct csrng_app_cmd |
CSRNG application interface command header parameters.
Definition at line 44 of file dif_csrng_shared.h.
Data Fields | ||
---|---|---|
dif_csrng_entropy_src_toggle_t | entropy_src_enable |
Entropy source enable. Mapped to flag0 in the hardware command interface. |
uint32_t | generate_len |
Generate length. Specified as number of 128bit blocks. |
csrng_app_cmd_id_t | id | Application command. |
const dif_csrng_seed_material_t * | seed_material |
Seed material. Only used in |
typedef enum csrng_app_cmd_id csrng_app_cmd_id_t |
Supported CSRNG application commands.
See https://opentitan.org/book/hw/ip/csrng/doc/theory_of_operation.html#command-header for details.
anonymous enum |
Enumerator | |
---|---|
kCsrngGenBitsBufferSize | CSRNG genbits buffer size in uint32_t words. |
Definition at line 20 of file dif_csrng_shared.h.
enum csrng_app_cmd_id |
Supported CSRNG application commands.
See https://opentitan.org/book/hw/ip/csrng/doc/theory_of_operation.html#command-header for details.
Definition at line 33 of file dif_csrng_shared.h.
enum csrng_app_cmd_type |
This enum type contains all the different command types for csrng_send_cmd().
Definition at line 70 of file dif_csrng_shared.h.
OT_WARN_UNUSED_RESULT uint32_t csrng_cmd_header_build | ( | csrng_app_cmd_id_t | id, |
dif_csrng_entropy_src_toggle_t | entropy_src_enable, | ||
uint32_t | cmd_len, | ||
uint32_t | generate_len ) |
Builds a CSRNG command header.
Build a CSRNG command header following the CSRNG specification. The caller is responsible for verifying the correctness of the parameters passed into this function.
id | CSRNG command ID. |
entropy_src_enable | Entropy source enable flag. Mapped to flag0 in the command header. |
cmd_len | The overall command lend. It should be set to the number of seed material words, or zero. |
generate_len | Number of 128bit blocks to request if the command ID is set to kCsrngAppCmdGenerate . |
uint32_t
format. Definition at line 21 of file dif_csrng_shared.c.
OT_WARN_UNUSED_RESULT dif_result_t csrng_send_app_cmd | ( | mmio_region_t | base_addr, |
csrng_app_cmd_type_t | cmd_type, | ||
csrng_app_cmd_t | cmd ) |
Writes application command cmd
to the CSRNG_CMD_REQ_REG register.
Returns the result of the operation.
Definition at line 35 of file dif_csrng_shared.c.