2 Hardware Random Number Generator
4 Please read Documentation/hw_random.txt for details on use.
6 ----------------------------------------------------------
7 This software may be used and distributed according to the terms
8 of the GNU General Public License, incorporated herein by reference.
12 #ifndef LINUX_HWRANDOM_H_
13 #define LINUX_HWRANDOM_H_
16 #include <linux/types.h>
17 #include <linux/list.h>
20 * struct hwrng - Hardware Random Number Generator driver
21 * @name: Unique RNG name.
22 * @init: Initialization callback (can be NULL).
23 * @cleanup: Cleanup callback (can be NULL).
24 * @data_present: Callback to determine if data is available
25 * on the RNG. If NULL, it is assumed that
26 * there is always data available.
27 * @data_read: Read data from the RNG device.
28 * Returns the number of lower random bytes in "data".
30 * @priv: Private data, for use by the RNG driver.
34 int (*init
)(struct hwrng
*rng
);
35 void (*cleanup
)(struct hwrng
*rng
);
36 int (*data_present
)(struct hwrng
*rng
, int wait
);
37 int (*data_read
)(struct hwrng
*rng
, u32
*data
);
41 struct list_head list
;
44 /** Register a new Hardware Random Number Generator driver. */
45 extern int hwrng_register(struct hwrng
*rng
);
46 /** Unregister a Hardware Random Number Generator driver. */
47 extern void __hwrng_unregister(struct hwrng
*rng
, bool suspended
);
48 static inline void hwrng_unregister(struct hwrng
*rng
)
50 __hwrng_unregister(rng
, false);
52 static inline void hwrng_unregister_suspended(struct hwrng
*rng
)
54 __hwrng_unregister(rng
, true);
57 #endif /* __KERNEL__ */
58 #endif /* LINUX_HWRANDOM_H_ */