[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220623164347.322756735@linuxfoundation.org>
Date: Thu, 23 Jun 2022 18:41:48 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Eric Biggers <ebiggers@...gle.com>,
"Jason A. Donenfeld" <Jason@...c4.com>
Subject: [PATCH 4.9 115/264] random: remove use_input_pool parameter from crng_reseed()
From: Eric Biggers <ebiggers@...gle.com>
commit 5d58ea3a31cc98b9fa563f6921d3d043bf0103d1 upstream.
The primary_crng is always reseeded from the input_pool, while the NUMA
crngs are always reseeded from the primary_crng. Remove the redundant
'use_input_pool' parameter from crng_reseed() and just directly check
whether the crng is the primary_crng.
Signed-off-by: Eric Biggers <ebiggers@...gle.com>
Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/char/random.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -366,7 +366,7 @@ static struct {
static void extract_entropy(void *buf, size_t nbytes);
-static void crng_reseed(struct crng_state *crng, bool use_input_pool);
+static void crng_reseed(struct crng_state *crng);
/*
* This function adds bytes into the entropy "pool". It does not
@@ -465,7 +465,7 @@ static void credit_entropy_bits(int nbit
trace_credit_entropy_bits(nbits, entropy_count, _RET_IP_);
if (crng_init < 2 && entropy_count >= POOL_MIN_BITS)
- crng_reseed(&primary_crng, true);
+ crng_reseed(&primary_crng);
}
/*********************************************************************
@@ -752,7 +752,7 @@ static int crng_slow_load(const u8 *cp,
return 1;
}
-static void crng_reseed(struct crng_state *crng, bool use_input_pool)
+static void crng_reseed(struct crng_state *crng)
{
unsigned long flags;
int i;
@@ -761,7 +761,7 @@ static void crng_reseed(struct crng_stat
u32 key[8];
} buf;
- if (use_input_pool) {
+ if (crng == &primary_crng) {
int entropy_count;
do {
entropy_count = READ_ONCE(input_pool.entropy_count);
@@ -799,7 +799,7 @@ static void _extract_crng(struct crng_st
init_time = READ_ONCE(crng->init_time);
if (time_after(READ_ONCE(crng_global_init_time), init_time) ||
time_after(jiffies, init_time + CRNG_RESEED_INTERVAL))
- crng_reseed(crng, crng == &primary_crng);
+ crng_reseed(crng);
}
spin_lock_irqsave(&crng->lock, flags);
chacha20_block(&crng->state[0], out);
@@ -1598,7 +1598,7 @@ static long random_ioctl(struct file *f,
return -EPERM;
if (crng_init < 2)
return -ENODATA;
- crng_reseed(&primary_crng, true);
+ crng_reseed(&primary_crng);
WRITE_ONCE(crng_global_init_time, jiffies - 1);
return 0;
default:
Powered by blists - more mailing lists