Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/random/random_harvestq.c
Show First 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | if (keyfile != NULL) { | ||||
/* Trim the size. If the admin has a file with a funny size, we lose some. Tough. */ | /* Trim the size. If the admin has a file with a funny size, we lose some. Tough. */ | ||||
size -= (size % sizeof(event.he_entropy)); | size -= (size % sizeof(event.he_entropy)); | ||||
if (data != NULL && size != 0) { | if (data != NULL && size != 0) { | ||||
for (i = 0; i < size; i += sizeof(event.he_entropy)) { | for (i = 0; i < size; i += sizeof(event.he_entropy)) { | ||||
count = sizeof(event.he_entropy); | count = sizeof(event.he_entropy); | ||||
event.he_somecounter = (uint32_t)get_cyclecount(); | event.he_somecounter = (uint32_t)get_cyclecount(); | ||||
event.he_size = count; | event.he_size = count; | ||||
event.he_source = RANDOM_CACHED; | event.he_source = RANDOM_CACHED; | ||||
event.he_destination = harvest_context.hc_destination[0]++; | event.he_destination = | ||||
harvest_context.hc_destination[RANDOM_CACHED]++; | |||||
memcpy(event.he_entropy, data + i, sizeof(event.he_entropy)); | memcpy(event.he_entropy, data + i, sizeof(event.he_entropy)); | ||||
random_harvestq_fast_process_event(&event); | random_harvestq_fast_process_event(&event); | ||||
explicit_bzero(&event, sizeof(event)); | explicit_bzero(&event, sizeof(event)); | ||||
} | } | ||||
explicit_bzero(data, size); | explicit_bzero(data, size); | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("random: read %zu bytes from preloaded cache\n", size); | printf("random: read %zu bytes from preloaded cache\n", size); | ||||
} else | } else | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |