random: fix comment on "account"
This comment didn't quite keep up as extract_entropy() was split into four functions. Put each bit by the function it describes. Signed-off-by: Greg Price <price@mit.edu> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
12ff3a517a
commit
19fa5be1d9
1 changed files with 21 additions and 10 deletions
|
@ -958,17 +958,9 @@ static void push_to_pool(struct work_struct *work)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These functions extracts randomness from the "entropy pool", and
|
* This function decides how many bytes to actually take from the
|
||||||
* returns it in a buffer.
|
* given pool, and also debits the entropy count accordingly.
|
||||||
*
|
|
||||||
* The min parameter specifies the minimum amount we can pull before
|
|
||||||
* failing to avoid races that defeat catastrophic reseeding while the
|
|
||||||
* reserved parameter indicates how much entropy we must leave in the
|
|
||||||
* pool after each pull to avoid starving other readers.
|
|
||||||
*
|
|
||||||
* Note: extract_entropy() assumes that .poolwords is a multiple of 16 words.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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 reserved)
|
||||||
{
|
{
|
||||||
|
@ -1018,6 +1010,12 @@ retry:
|
||||||
return ibytes;
|
return ibytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function does the actual extraction for extract_entropy and
|
||||||
|
* extract_entropy_user.
|
||||||
|
*
|
||||||
|
* Note: we assume that .poolwords is a multiple of 16 words.
|
||||||
|
*/
|
||||||
static void extract_buf(struct entropy_store *r, __u8 *out)
|
static void extract_buf(struct entropy_store *r, __u8 *out)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1079,6 +1077,15 @@ static void extract_buf(struct entropy_store *r, __u8 *out)
|
||||||
memset(&hash, 0, sizeof(hash));
|
memset(&hash, 0, sizeof(hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function extracts randomness from the "entropy pool", and
|
||||||
|
* returns it in a buffer.
|
||||||
|
*
|
||||||
|
* The min parameter specifies the minimum amount we can pull before
|
||||||
|
* failing to avoid races that defeat catastrophic reseeding while the
|
||||||
|
* 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, int reserved)
|
||||||
{
|
{
|
||||||
|
@ -1129,6 +1136,10 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function extracts randomness from the "entropy pool", and
|
||||||
|
* returns it in a userspace buffer.
|
||||||
|
*/
|
||||||
static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
|
static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
|
||||||
size_t nbytes)
|
size_t nbytes)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue