|
@@ -1895,14 +1895,22 @@ static int
|
|
write_pool(struct entropy_store *r, const char __user *buffer, size_t count)
|
|
write_pool(struct entropy_store *r, const char __user *buffer, size_t count)
|
|
{
|
|
{
|
|
size_t bytes;
|
|
size_t bytes;
|
|
- __u32 buf[16];
|
|
|
|
|
|
+ __u32 t, buf[16];
|
|
const char __user *p = buffer;
|
|
const char __user *p = buffer;
|
|
|
|
|
|
while (count > 0) {
|
|
while (count > 0) {
|
|
|
|
+ int b, i = 0;
|
|
|
|
+
|
|
bytes = min(count, sizeof(buf));
|
|
bytes = min(count, sizeof(buf));
|
|
if (copy_from_user(&buf, p, bytes))
|
|
if (copy_from_user(&buf, p, bytes))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
+ for (b = bytes ; b > 0 ; b -= sizeof(__u32), i++) {
|
|
|
|
+ if (!arch_get_random_int(&t))
|
|
|
|
+ break;
|
|
|
|
+ buf[i] ^= t;
|
|
|
|
+ }
|
|
|
|
+
|
|
count -= bytes;
|
|
count -= bytes;
|
|
p += bytes;
|
|
p += bytes;
|
|
|
|
|