Commit 8b2d953b authored by Jason A. Donenfeld's avatar Jason A. Donenfeld

random: remove unused extract_entropy() reserved argument

This argument is always set to zero, as a result of us not caring about
keeping a certain amount reserved in the pool these days. So just remove
it and cleanup the function signatures.
Reviewed-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
parent a4bfa9b3
...@@ -519,7 +519,7 @@ struct entropy_store { ...@@ -519,7 +519,7 @@ struct entropy_store {
}; };
static ssize_t extract_entropy(struct entropy_store *r, void *buf, static ssize_t extract_entropy(struct entropy_store *r, void *buf,
size_t nbytes, int min, int rsvd); size_t nbytes, int min);
static ssize_t _extract_entropy(struct entropy_store *r, void *buf, static ssize_t _extract_entropy(struct entropy_store *r, void *buf,
size_t nbytes); size_t nbytes);
...@@ -989,7 +989,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) ...@@ -989,7 +989,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
} buf; } buf;
if (r) { if (r) {
num = extract_entropy(r, &buf, 32, 16, 0); num = extract_entropy(r, &buf, 32, 16);
if (num == 0) if (num == 0)
return; return;
} else { } else {
...@@ -1327,8 +1327,7 @@ EXPORT_SYMBOL_GPL(add_disk_randomness); ...@@ -1327,8 +1327,7 @@ EXPORT_SYMBOL_GPL(add_disk_randomness);
* This function decides how many bytes to actually take from the * This function decides how many bytes to actually take from the
* given pool, and also debits the entropy count accordingly. * given pool, and also debits the entropy count accordingly.
*/ */
static size_t account(struct entropy_store *r, size_t nbytes, int min, static size_t account(struct entropy_store *r, size_t nbytes, int min)
int reserved)
{ {
int entropy_count, orig, have_bytes; int entropy_count, orig, have_bytes;
size_t ibytes, nfrac; size_t ibytes, nfrac;
...@@ -1342,7 +1341,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, ...@@ -1342,7 +1341,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
/* never pull more than available */ /* never pull more than available */
have_bytes = entropy_count >> (ENTROPY_SHIFT + 3); have_bytes = entropy_count >> (ENTROPY_SHIFT + 3);
if ((have_bytes -= reserved) < 0) if (have_bytes < 0)
have_bytes = 0; have_bytes = 0;
ibytes = min_t(size_t, ibytes, have_bytes); ibytes = min_t(size_t, ibytes, have_bytes);
if (ibytes < min) if (ibytes < min)
...@@ -1448,15 +1447,13 @@ static ssize_t _extract_entropy(struct entropy_store *r, void *buf, ...@@ -1448,15 +1447,13 @@ static ssize_t _extract_entropy(struct entropy_store *r, void *buf,
* returns it in a buffer. * returns it in a buffer.
* *
* The min parameter specifies the minimum amount we can pull before * The min parameter specifies the minimum amount we can pull before
* failing to avoid races that defeat catastrophic reseeding while the * failing to avoid races that defeat catastrophic reseeding.
* reserved parameter indicates how much entropy we must leave in the
* pool after each pull to avoid starving other readers.
*/ */
static ssize_t extract_entropy(struct entropy_store *r, void *buf, static ssize_t extract_entropy(struct entropy_store *r, void *buf,
size_t nbytes, int min, int reserved) size_t nbytes, int min)
{ {
trace_extract_entropy(r->name, nbytes, ENTROPY_BITS(r), _RET_IP_); trace_extract_entropy(r->name, nbytes, ENTROPY_BITS(r), _RET_IP_);
nbytes = account(r, nbytes, min, reserved); nbytes = account(r, nbytes, min);
return _extract_entropy(r, buf, nbytes); return _extract_entropy(r, buf, nbytes);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment