mirror of
https://github.com/torvalds/linux.git
synced 2025-08-15 14:11:42 +02:00
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>
This commit is contained in:
parent
cb7fa6b6fc
commit
735b72568c
1 changed files with 5 additions and 4 deletions
|
@ -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
|
* 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.
|
* 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)
|
if (ret)
|
||||||
goto err;
|
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
|
* conditioning operation to have an identical amount of input data
|
||||||
* according to section 3.1.5.
|
* according to section 3.1.5.
|
||||||
*/
|
*/
|
||||||
if (!stuck) {
|
if (stuck) {
|
||||||
ret = crypto_shash_update(hash_state_desc, (u8 *)&time,
|
time = 0;
|
||||||
sizeof(__u64));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = crypto_shash_update(hash_state_desc, (u8 *)&time, sizeof(__u64));
|
||||||
|
|
||||||
err:
|
err:
|
||||||
shash_desc_zero(desc);
|
shash_desc_zero(desc);
|
||||||
memzero_explicit(intermediary, sizeof(intermediary));
|
memzero_explicit(intermediary, sizeof(intermediary));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue