Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/random/fortuna.c
Show First 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | |||||
* This generates no more than 2^20 bytes of data, and cleans up its | * This generates no more than 2^20 bytes of data, and cleans up its | ||||
* internal state when finished. It is assumed that a whole number of | * internal state when finished. It is assumed that a whole number of | ||||
* blocks are available for writing; any excess generated will be | * blocks are available for writing; any excess generated will be | ||||
* ignored. | * ignored. | ||||
*/ | */ | ||||
static __inline void | static __inline void | ||||
random_fortuna_genrandom(uint8_t *buf, u_int bytecount) | random_fortuna_genrandom(uint8_t *buf, u_int bytecount) | ||||
{ | { | ||||
static uint8_t temp[RANDOM_BLOCKSIZE*(RANDOM_KEYS_PER_BLOCK)]; | uint8_t temp[RANDOM_BLOCKSIZE * RANDOM_KEYS_PER_BLOCK]; | ||||
u_int blockcount; | u_int blockcount; | ||||
RANDOM_RESEED_ASSERT_LOCK_OWNED(); | RANDOM_RESEED_ASSERT_LOCK_OWNED(); | ||||
/*- | /*- | ||||
* FS&K - assert(n < 2^20 (== 1 MB) | * FS&K - assert(n < 2^20 (== 1 MB) | ||||
* - r = first-n-bytes(GenerateBlocks(ceil(n/16))) | * - r = first-n-bytes(GenerateBlocks(ceil(n/16))) | ||||
* - K = GenerateBlocks(2) | * - K = GenerateBlocks(2) | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |