xref: /rk3399_rockchip-uboot/include/rng.h (revision 28507ac336d6a31c182ab824d4e8fa2b5536f773)
1*28507ac3SSughosh Ganu // SPDX-License-Identifier: GPL-2.0+
2*28507ac3SSughosh Ganu /*
3*28507ac3SSughosh Ganu  * Copyright (c) 2019, Linaro Limited
4*28507ac3SSughosh Ganu  */
5*28507ac3SSughosh Ganu 
6*28507ac3SSughosh Ganu #if !defined _RNG_H_
7*28507ac3SSughosh Ganu #define _RNG_H_
8*28507ac3SSughosh Ganu 
9*28507ac3SSughosh Ganu struct udevice;
10*28507ac3SSughosh Ganu 
11*28507ac3SSughosh Ganu /**
12*28507ac3SSughosh Ganu  * dm_rng_read() - read a random number seed from the rng device
13*28507ac3SSughosh Ganu  * @buffer:	input buffer to put the read random seed into
14*28507ac3SSughosh Ganu  * @size:	number of bytes of random seed read
15*28507ac3SSughosh Ganu  *
16*28507ac3SSughosh Ganu  * Return: 0 if OK, -ve on error
17*28507ac3SSughosh Ganu  */
18*28507ac3SSughosh Ganu int dm_rng_read(struct udevice *dev, void *buffer, size_t size);
19*28507ac3SSughosh Ganu 
20*28507ac3SSughosh Ganu /* struct dm_rng_ops - Operations for the hwrng uclass */
21*28507ac3SSughosh Ganu struct dm_rng_ops {
22*28507ac3SSughosh Ganu 	/**
23*28507ac3SSughosh Ganu 	 * @read() - read a random number seed
24*28507ac3SSughosh Ganu 	 *
25*28507ac3SSughosh Ganu 	 * @data:	input buffer to read the random seed
26*28507ac3SSughosh Ganu 	 * @max:	total number of bytes to read
27*28507ac3SSughosh Ganu 	 *
28*28507ac3SSughosh Ganu 	 * Return: 0 if OK, -ve on error
29*28507ac3SSughosh Ganu 	 */
30*28507ac3SSughosh Ganu 	int (*read)(struct udevice *dev, void *data, size_t max);
31*28507ac3SSughosh Ganu };
32*28507ac3SSughosh Ganu 
33*28507ac3SSughosh Ganu #endif /* _RNG_H_ */
34