diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/random.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 46c1b97748b6..9705b439448a 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -760,7 +760,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
760 | 760 | ||
761 | static void extract_buf(struct entropy_store *r, __u8 *out) | 761 | static void extract_buf(struct entropy_store *r, __u8 *out) |
762 | { | 762 | { |
763 | int i, x; | 763 | int i; |
764 | __u32 data[16], buf[5 + SHA_WORKSPACE_WORDS]; | 764 | __u32 data[16], buf[5 + SHA_WORKSPACE_WORDS]; |
765 | 765 | ||
766 | sha_init(buf); | 766 | sha_init(buf); |
@@ -772,9 +772,11 @@ static void extract_buf(struct entropy_store *r, __u8 *out) | |||
772 | * attempts to find previous ouputs), unless the hash | 772 | * attempts to find previous ouputs), unless the hash |
773 | * function can be inverted. | 773 | * function can be inverted. |
774 | */ | 774 | */ |
775 | for (i = 0, x = 0; i < r->poolinfo->poolwords; i += 16, x+=2) { | 775 | for (i = 0; i < r->poolinfo->poolwords; i += 16) { |
776 | sha_transform(buf, (__u8 *)r->pool+i, buf + 5); | 776 | /* hash blocks of 16 words = 512 bits */ |
777 | add_entropy_words(r, &buf[x % 5], 1); | 777 | sha_transform(buf, (__u8 *)(r->pool + i), buf + 5); |
778 | /* feed back portion of the resulting hash */ | ||
779 | add_entropy_words(r, &buf[i % 5], 1); | ||
778 | } | 780 | } |
779 | 781 | ||
780 | /* | 782 | /* |
@@ -782,7 +784,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out) | |||
782 | * portion of the pool while mixing, and hash one | 784 | * portion of the pool while mixing, and hash one |
783 | * final time. | 785 | * final time. |
784 | */ | 786 | */ |
785 | __add_entropy_words(r, &buf[x % 5], 1, data); | 787 | __add_entropy_words(r, &buf[i % 5], 1, data); |
786 | sha_transform(buf, (__u8 *)data, buf + 5); | 788 | sha_transform(buf, (__u8 *)data, buf + 5); |
787 | 789 | ||
788 | /* | 790 | /* |