Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/random/fortuna.c
Show First 20 Lines • Show All 483 Lines • ▼ Show 20 Lines | if (locked) { | ||||
MPASS(!random_chachamode); | MPASS(!random_chachamode); | ||||
chunk_size = RANDOM_FORTUNA_MAX_READ; | chunk_size = RANDOM_FORTUNA_MAX_READ; | ||||
} | } | ||||
chunk_size = MIN(bytecount, chunk_size); | chunk_size = MIN(bytecount, chunk_size); | ||||
if (!random_chachamode) | if (!random_chachamode) | ||||
chunk_size = rounddown(chunk_size, RANDOM_BLOCKSIZE); | chunk_size = rounddown(chunk_size, RANDOM_BLOCKSIZE); | ||||
while (bytecount >= chunk_size) { | while (bytecount >= chunk_size && chunk_size > 0) { | ||||
randomdev_keystream(p_key, p_counter, buf, chunk_size); | randomdev_keystream(p_key, p_counter, buf, chunk_size); | ||||
buf += chunk_size; | buf += chunk_size; | ||||
bytecount -= chunk_size; | bytecount -= chunk_size; | ||||
/* We have to rekey if there is any data remaining to be | /* We have to rekey if there is any data remaining to be | ||||
* generated, in two scenarios: | * generated, in two scenarios: | ||||
* | * | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |