xref: /optee_os/core/drivers/crypto/caam/include/caam_hal_rng.h (revision 1ad6158d3b4b149c0ab05ce80fbb534d6ebb2ab9)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2019-2021 NXP
4  *
5  * Brief   CAAM Random Number Generator Hardware Abstration Layer.
6  *         Implementation of primitives to access HW
7  */
8 #ifndef __CAAM_HAL_RNG_H__
9 #define __CAAM_HAL_RNG_H__
10 
11 #include <caam_status.h>
12 #include <types_ext.h>
13 
14 /*
15  * Returns if all RNG State Handler already instantiated or not
16  *
17  * @baseaddr  RNG Base Address
18  */
19 enum caam_status caam_hal_rng_instantiated(vaddr_t baseaddr);
20 
21 /*
22  * Returns the number of RNG State Handle
23  *
24  * @baseaddr  RNG Base Address
25  */
26 uint32_t caam_hal_rng_get_nb_sh(vaddr_t baseaddr);
27 
28 /*
29  * Returns the RNG Status State Handle
30  *
31  * @baseaddr  RNG Base Address
32  */
33 uint32_t caam_hal_rng_get_sh_status(vaddr_t baseaddr);
34 
35 /*
36  * Returns true if the RNG Key is loaded, false otherwise
37  *
38  * @baseaddr  RNG Base Address
39  */
40 bool caam_hal_rng_key_loaded(vaddr_t baseaddr);
41 
42 /*
43  * Returns true if the RNG was initialized for prediction resistance
44  *
45  * @baseaddr  RNG Base Address
46  */
47 bool caam_hal_rng_pr_enabled(vaddr_t baseaddr);
48 
49 /*
50  * Configures the RNG entropy delay
51  *
52  * @baseaddr   RNG Base Address
53  * @inc_delay  Entropy Delay incrementation
54  */
55 enum caam_status caam_hal_rng_kick(vaddr_t baseaddr, uint32_t inc_delay);
56 
57 #endif /* __CAAM_HAL_RNG_H__ */
58