projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pull acpi-debug into release branch
[powerpc.git]
/
drivers
/
char
/
random.c
diff --git
a/drivers/char/random.c
b/drivers/char/random.c
index
0474cac
..
397c714
100644
(file)
--- a/
drivers/char/random.c
+++ b/
drivers/char/random.c
@@
-693,9
+693,14
@@
static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
if (r->pull && r->entropy_count < nbytes * 8 &&
r->entropy_count < r->poolinfo->POOLBITS) {
if (r->pull && r->entropy_count < nbytes * 8 &&
r->entropy_count < r->poolinfo->POOLBITS) {
- int bytes = max_t(int, random_read_wakeup_thresh / 8,
- min_t(int, nbytes, sizeof(tmp)));
+ /* If we're limited, always leave two wakeup worth's BITS */
int rsvd = r->limit ? 0 : random_read_wakeup_thresh/4;
int rsvd = r->limit ? 0 : random_read_wakeup_thresh/4;
+ int bytes = nbytes;
+
+ /* pull at least as many as BYTES as wakeup BITS */
+ bytes = max_t(int, bytes, random_read_wakeup_thresh / 8);
+ /* but never more than the buffer size */
+ bytes = min_t(int, bytes, sizeof(tmp));
DEBUG_ENT("going to reseed %s with %d bits "
"(%d of %d requested)\n",
DEBUG_ENT("going to reseed %s with %d bits "
"(%d of %d requested)\n",
@@
-794,7
+799,7
@@
static void extract_buf(struct entropy_store *r, __u8 *out)
buf[0] ^= buf[3];
buf[1] ^= buf[4];
buf[0] ^= buf[3];
buf[1] ^= buf[4];
- buf[
0] ^= rol32(buf[3
], 16);
+ buf[
2] ^= rol32(buf[2
], 16);
memcpy(out, buf, EXTRACT_SIZE);
memset(buf, 0, sizeof(buf));
}
memcpy(out, buf, EXTRACT_SIZE);
memset(buf, 0, sizeof(buf));
}