1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#ifndef ENTROPY_H_
#define ENTROPY_H_
#include <stddef.h>
#include <stdint.h>
/* Opaque type. */
struct entropy_read_cookie;
/**
* entropy_read_init(void):
* Initialize the ability to produce random bytes from the operating system,
* and return a cookie.
*/
struct entropy_read_cookie * entropy_read_init(void);
/**
* entropy_read_fill(er, buf, buflen):
* Fill the given buffer with random bytes provided by the operating system
* using the resources in ${er}.
*/
int entropy_read_fill(struct entropy_read_cookie *, uint8_t *, size_t);
/**
* entropy_read_done(er):
* Release any resources used by ${er}.
*/
int entropy_read_done(struct entropy_read_cookie *);
/**
* entropy_read(buf, buflen):
* Fill the given buffer with random bytes provided by the operating system.
*/
int entropy_read(uint8_t *, size_t);
#endif /* !ENTROPY_H_ */
|