Lines Matching refs:yarrow_state

90 static struct yarrow_state {
105 } yarrow_state;
147 yarrow_state.ys_seeded = false;
160 &yarrow_state.ys_gengateinterval, 0,
166 &yarrow_state.ys_bins, 0,
172 &yarrow_state.ys_pool[0].ysp_thresh, 0,
178 &yarrow_state.ys_pool[1].ysp_thresh, 0,
184 &yarrow_state.ys_slowoverthresh, 0,
188 yarrow_state.ys_gengateinterval = 10;
189 yarrow_state.ys_bins = 10;
190 yarrow_state.ys_pool[RANDOM_YARROW_FAST].ysp_thresh = (3*(RANDOM_BLOCKSIZE*8))/4;
191 yarrow_state.ys_pool[RANDOM_YARROW_SLOW].ysp_thresh = (RANDOM_BLOCKSIZE*8);
192 yarrow_state.ys_slowoverthresh = 2;
194 yarrow_state.ys_outputblocks = yarrow_state.ys_gengateinterval;
197 randomdev_hash_init(&yarrow_state.ys_pool[i].ysp_hash);
199 yarrow_state.ys_pool[i].ysp_source_bits[j] = 0;
202 yarrow_state.ys_counter = UINT128_ZERO;
211 explicit_bzero(&yarrow_state, sizeof(yarrow_state));
232 randomdev_hash_iterate(&yarrow_state.ys_pool[pl].ysp_hash, event, sizeof(*event));
234 yarrow_state.ys_pool[pl].ysp_source_bits[event->he_source] += event->he_bits;
240 if (yarrow_state.ys_pool[pl].ysp_source_bits[src] > yarrow_state.ys_pool[pl].ysp_thresh)
248 if (overthreshhold[RANDOM_YARROW_SLOW] >= yarrow_state.ys_slowoverthresh)
250 else if (overthreshhold[RANDOM_YARROW_FAST] > 0 && yarrow_state.ys_seeded)
269 KASSERT(yarrow_state.ys_pool[RANDOM_YARROW_FAST].ysp_thresh > 0, ("random: Yarrow fast threshold = 0"));
270 KASSERT(yarrow_state.ys_pool[RANDOM_YARROW_SLOW].ysp_thresh > 0, ("random: Yarrow slow threshold = 0"));
273 SDT_PROBE3(random, yarrow, event_processor, debug, yarrow_state.ys_seeded, yarrow_state.ys_slowoverthresh, yarrow_state.ys_pool);
279 randomdev_hash_finish(&yarrow_state.ys_pool[RANDOM_YARROW_SLOW].ysp_hash, &temp);
282 randomdev_hash_finish(&yarrow_state.ys_pool[RANDOM_YARROW_FAST].ysp_hash, &temp);
289 if (yarrow_state.ys_bins > RANDOM_YARROW_TIMEBIN)
290 yarrow_state.ys_bins = RANDOM_YARROW_TIMEBIN;
291 for (i = 1; i < yarrow_state.ys_bins; i++) {
307 randomdev_hash_iterate(&context, &yarrow_state.ys_key, RANDOM_KEYSIZE);
308 for (i = 1; i < yarrow_state.ys_bins; i++)
311 randomdev_encrypt_init(&yarrow_state.ys_key, &temp);
313 yarrow_state.ys_counter = UINT128_ZERO;
314 randomdev_encrypt(&yarrow_state.ys_key, &yarrow_state.ys_counter, &temp, RANDOM_BLOCKSIZE);
315 yarrow_state.ys_counter = temp;
319 yarrow_state.ys_pool[i].ysp_source_bits[j] = 0;
336 if (!yarrow_state.ys_seeded) {
337 yarrow_state.ys_seeded = true;
351 uint128_increment(&yarrow_state.ys_counter);
353 randomdev_encrypt(&yarrow_state.ys_key, &yarrow_state.ys_counter, temp + i, RANDOM_BLOCKSIZE);
354 randomdev_encrypt_init(&yarrow_state.ys_key, temp);
385 if (yarrow_state.ys_outputblocks++ >= yarrow_state.ys_gengateinterval) {
387 yarrow_state.ys_outputblocks = 0;
389 uint128_increment(&yarrow_state.ys_counter);
390 randomdev_encrypt(&yarrow_state.ys_key, &yarrow_state.ys_counter, buf, RANDOM_BLOCKSIZE);
400 return (yarrow_state.ys_seeded);