hwrng.h

Hardware random number generator driver interface.

void hwrng_init(void)

Initialize the hardware random number generator.

On some platforms, the random number generator needs some global initialization before it can be used. This should happen in this function if it would impose too much overhead to do this everytime the hwrng_read function is called. The device should however be put into power-off mode after initialization and will be powered on and of when hwrng_read is called.

void hwrng_read(void * buf, unsigned int num)

Read N bytes of random data from the hardware device.

The read function should power on the HWRNG MCU peripheral, read the given number of random bytes and than put the peripheral back to sleep.

Parameters

buf:destination buffer to write the bytes to
num:number of bytes to get from device