crypto: jitter - fix intermediary handling
PATCH 1/1 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 <[email protected]>
Signed-off-by Markus Theil <[email protected]>
--- crypto/jitterentropy-kcapi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
crypto/jitterentropy-kcapi.c +5 -4
@@ -144,7 +144,7 @@ int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,* Inject the data from the previous loop into the pool. This data is * not considered to contain any entropy, but it stirs the pool a bit. */ - ret =crypto_shash_update (desc, intermediary,sizeof (intermediary)); + ret =crypto_shash_update (hash_state_desc, intermediary,sizeof (intermediary));if (ret) goto err;
@@ -157,11 +157,12 @@ int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,* conditioning operation to have an identical amount of input data * according to section 3.1.5. */ -if (!stuck) { - ret =crypto_shash_update (hash_state_desc, (u8 *)&time, -sizeof (__u64)); +if (stuck) { + time =0 ; } + ret =crypto_shash_update (hash_state_desc, (u8 *)&time,sizeof (__u64)); + err:shash_desc_zero (desc);memzero_explicit (intermediary,sizeof (intermediary));
Signature · 1 line
2.49.0
Herbert Xu
maintainerQuoted 10 lines · Markus Theil
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 <[email protected]>Signed-off-by Markus Theil <[email protected]>--- crypto/jitterentropy-kcapi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt