Software APIs
sw
device
silicon_creator
lib
drivers
rnd.h
1
// Copyright lowRISC contributors (OpenTitan project).
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
5
#ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_RND_H_
6
#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_RND_H_
7
8
#include "
sw/device/lib/base/macros.h
"
9
#include "sw/device/silicon_creator/lib/drivers/lifecycle.h"
10
#include "sw/device/silicon_creator/lib/error.h"
11
12
#ifdef __cplusplus
13
extern
"C"
{
14
#endif
15
16
/**
17
* Compare the CRC32 of the configuration registers with the value in OTP.
18
*
19
* This function does not check the CRC32 in TEST_UNLOCKED* life cycle states to
20
* allow a test program to configure the entropy src before transitioning to
21
* other life cycle states.
22
*
23
* @param lc_state Life cycle state of the device.
24
* @return result of the operation.
25
*/
26
OT_WARN_UNUSED_RESULT
27
rom_error_t rnd_health_config_check(lifecycle_state_t lc_state);
28
29
/**
30
* Returns a random word from the RISC-V Ibex core wrapper.
31
*
32
* Requires the CREATOR_SW_CFG_RNG_EN OTP value set to `kHardenedBoolTrue`
33
* in order to enable the use of entropy, otherwise it only returns the current
34
* value of the MCYCLE CSR register.
35
*
36
* @returns MCYCLE CSR + entropy value.
37
*/
38
OT_WARN_UNUSED_RESULT
39
uint32_t rnd_uint32(
void
);
40
41
#ifdef __cplusplus
42
}
43
#endif
44
45
#endif
// OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_RND_H_
Return to
OpenTitan Documentation