aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorHarald Freudenberger <freude@linux.vnet.ibm.com>2015-05-04 07:27:49 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-05-13 03:57:38 -0400
commitc431761dddff87039edb3300b9b29d1f9e0af2c9 (patch)
tree5e295f98543fc9b954971d48940bb6fd7dcda99d /arch/s390
parentf60b8d449d850ae4aa3ee4fdaefec6b7882c92f7 (diff)
s390/crypto: fix stckf loop
The store-clock-fast loop in generate_entropy() mixes (exors) only the first 64 bytes of the initial page before doing the first SHA256. Fix the loop to mix the store-clock-fast values all over the page. Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com> Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/crypto/prng.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index 1f374b39a4ec..9d5192c94963 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -125,7 +125,7 @@ static int generate_entropy(u8 *ebuf, size_t nbytes)
125 /* fill page with urandom bytes */ 125 /* fill page with urandom bytes */
126 get_random_bytes(pg, PAGE_SIZE); 126 get_random_bytes(pg, PAGE_SIZE);
127 /* exor page with stckf values */ 127 /* exor page with stckf values */
128 for (n = 0; n < sizeof(PAGE_SIZE/sizeof(u64)); n++) { 128 for (n = 0; n < PAGE_SIZE / sizeof(u64); n++) {
129 u64 *p = ((u64 *)pg) + n; 129 u64 *p = ((u64 *)pg) + n;
130 *p ^= get_tod_clock_fast(); 130 *p ^= get_tod_clock_fast();
131 } 131 }