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