Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: jitter - fix intermediary handling

The intermediary value was included in the wrong
hash state. While there, adapt to user-space by
setting the timestamp to 0 if stuck and inserting
the values nevertheless.

Acked-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Markus Theil <theil.markus@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Markus Theil and committed by
Herbert Xu
735b7256 cb7fa6b6

+5 -4
+5 -4
crypto/jitterentropy-kcapi.c
··· 144 144 * Inject the data from the previous loop into the pool. This data is 145 145 * not considered to contain any entropy, but it stirs the pool a bit. 146 146 */ 147 - ret = crypto_shash_update(desc, intermediary, sizeof(intermediary)); 147 + ret = crypto_shash_update(hash_state_desc, intermediary, sizeof(intermediary)); 148 148 if (ret) 149 149 goto err; 150 150 ··· 157 157 * conditioning operation to have an identical amount of input data 158 158 * according to section 3.1.5. 159 159 */ 160 - if (!stuck) { 161 - ret = crypto_shash_update(hash_state_desc, (u8 *)&time, 162 - sizeof(__u64)); 160 + if (stuck) { 161 + time = 0; 163 162 } 163 + 164 + ret = crypto_shash_update(hash_state_desc, (u8 *)&time, sizeof(__u64)); 164 165 165 166 err: 166 167 shash_desc_zero(desc);