Skip to content

Commit

Permalink
random: de-duplicate INPUT_POOL constants
Browse files Browse the repository at this point in the history
commit 5b87adf upstream.

We already had the POOL_* constants, so deduplicate the older INPUT_POOL
ones. As well, fold EXTRACT_SIZE into the poolinfo enum, since it's
related.

Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
zx2c4 authored and gregkh committed May 30, 2022
1 parent 09ae6b8 commit f87f50b
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions drivers/char/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,6 @@

/* #define ADD_INTERRUPT_BENCH */

/*
* Configuration information
*/
#define INPUT_POOL_SHIFT 12
#define INPUT_POOL_WORDS (1 << (INPUT_POOL_SHIFT-5))
#define EXTRACT_SIZE (BLAKE2S_HASH_SIZE / 2)

/*
* To allow fractional bits to be tracked, the entropy_count field is
* denominated in units of 1/8th bits.
Expand Down Expand Up @@ -440,7 +433,9 @@ enum poolinfo {
POOL_TAP2 = 76,
POOL_TAP3 = 51,
POOL_TAP4 = 25,
POOL_TAP5 = 1
POOL_TAP5 = 1,

EXTRACT_SIZE = BLAKE2S_HASH_SIZE / 2
};

/*
Expand Down Expand Up @@ -503,7 +498,7 @@ MODULE_PARM_DESC(ratelimit_disable, "Disable random ratelimit suppression");
*
**********************************************************************/

static u32 input_pool_data[INPUT_POOL_WORDS] __latent_entropy;
static u32 input_pool_data[POOL_WORDS] __latent_entropy;

static struct {
/* read-only data: */
Expand Down Expand Up @@ -1964,7 +1959,7 @@ SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count,
#include <linux/sysctl.h>

static int min_write_thresh;
static int max_write_thresh = INPUT_POOL_WORDS * 32;
static int max_write_thresh = POOL_BITS;
static int random_min_urandom_seed = 60;
static char sysctl_bootid[16];

Expand Down Expand Up @@ -2021,7 +2016,7 @@ static int proc_do_entropy(struct ctl_table *table, int write,
return proc_dointvec(&fake_table, write, buffer, lenp, ppos);
}

static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
static int sysctl_poolsize = POOL_BITS;
extern struct ctl_table random_table[];
struct ctl_table random_table[] = {
{
Expand Down

0 comments on commit f87f50b

Please sign in to comment.