* [PATCH] crypto: jitter - fix intermediary handling
@ 2025-06-21 11:36 Markus Theil
2025-07-07 3:30 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Markus Theil @ 2025-06-21 11:36 UTC (permalink / raw)
To: linux-crypto, linux-kernel; +Cc: davem, herbert, Markus Theil, Stephan Mueller
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>
---
crypto/jitterentropy-kcapi.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
index c24d4ff2b4a8..1266eb790708 100644
--- a/crypto/jitterentropy-kcapi.c
+++ b/crypto/jitterentropy-kcapi.c
@@ -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));
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: jitter - fix intermediary handling
2025-06-21 11:36 [PATCH] crypto: jitter - fix intermediary handling Markus Theil
@ 2025-07-07 3:30 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2025-07-07 3:30 UTC (permalink / raw)
To: Markus Theil; +Cc: linux-crypto, linux-kernel, davem, Stephan Mueller
On Sat, Jun 21, 2025 at 01:36:43PM +0200, Markus Theil wrote:
> 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>
> ---
> crypto/jitterentropy-kcapi.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-07 3:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-21 11:36 [PATCH] crypto: jitter - fix intermediary handling Markus Theil
2025-07-07 3:30 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).