Lines Matching defs:base_crng
74 * crng_init is protected by base_crng->lock, and only increases
225 } base_crng = {
226 .lock = __SPIN_LOCK_UNLOCKED(base_crng.lock)
253 * We copy the new key into the base_crng, overwriting the old one,
258 spin_lock_irqsave(&base_crng.lock, flags);
259 memcpy(base_crng.key, key, sizeof(base_crng.key));
260 next_gen = base_crng.generation + 1;
263 WRITE_ONCE(base_crng.generation, next_gen);
264 WRITE_ONCE(base_crng.birth, jiffies);
267 spin_unlock_irqrestore(&base_crng.lock, flags);
322 return time_is_before_jiffies(READ_ONCE(base_crng.birth) + interval);
341 * ready, we do fast key erasure with the base_crng directly, extracting
347 spin_lock_irqsave(&base_crng.lock, flags);
351 extract_entropy(base_crng.key, sizeof(base_crng.key));
352 crng_fast_key_erasure(base_crng.key, chacha_state,
355 spin_unlock_irqrestore(&base_crng.lock, flags);
361 * If the base_crng is old enough, we reseed, which in turn bumps the
371 * If our per-cpu crng is older than the base_crng, then it means
372 * somebody reseeded the base_crng. In that case, we do fast key
373 * erasure on the base_crng, and use its output as the new key
374 * for our per-cpu crng. This brings us up to date with base_crng.
376 if (unlikely(crng->generation != READ_ONCE(base_crng.generation))) {
377 spin_lock(&base_crng.lock);
378 crng_fast_key_erasure(base_crng.key, chacha_state,
380 crng->generation = base_crng.generation;
381 spin_unlock(&base_crng.lock);
537 next_gen = READ_ONCE(base_crng.generation); \
722 crng_reseed(); /* Sets crng_init to CRNG_READY under base_crng.lock. */
731 spin_lock_irqsave(&base_crng.lock, flags);
734 extract_entropy(base_crng.key, sizeof(base_crng.key));
737 spin_unlock_irqrestore(&base_crng.lock, flags);