crypto/rng: double the entropy delay interval for retry
PATCH 1/1 crypto/rng: double the entropy delay interval for retry
during entropy evaluation, if the generated samples fail any statistical test, then, all of the bits will be discarded, and a second set of samples will be generated and tested.
the entropy delay interval should be doubled before performing retry.
--- drivers/crypto/fsl/jr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/fsl/jr.c +1 -1
@@ -642,7 +642,7 @@ static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec)*/ if (!inst_handles) {kick_trng (ent_delay, sec); - ent_delay +=400 ; + ent_delay = ent_delay *2 ; }/* * if instantiate_rng(...) fails, the loop will rerun
Signature · 1 line
2.25.1
Hi Gaurav,
Quoted 16 lines · Gaurav Jain
during entropy evaluation, if the generated samples fail any statistical test, then, all of the bits will be discarded, and a second set of samples will be generated and tested.
the entropy delay interval should be doubled before performing retry.
Signed-off-by Gaurav Jain <[email protected]>---
drivers/crypto/fsl/jr.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/crypto/fsl/jr.c +0
-0
drivers/crypto/fsl/jr.c static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec) · line 645
Quoted 5 lines
drivers/crypto/fsl/jr.c +1
-1@@ -642,7 +642,7 @@ static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec)*/ if (!inst_handles) {kick_trng (ent_delay, sec); - ent_delay +=400 ; + ent_delay = ent_delay *2 ;
I not get the point on why need to double, would you please update the commit why not 500, 800 or else. What make ent_delay * 2 the best choice?
Thanks,
Peng
Quoted 6 lines
drivers/crypto/fsl/jr.c +0
-0}/* * if instantiate_rng(...) fails, the loop will rerun Signature · 1 line
2.25.1
Quoted 29 lines
-----Original Message-----
From: Peng Fan (OSS) <[email protected]>
Sent: Tuesday, September 23, 2025 2:43 PM
To: Gaurav Jain <[email protected]>
Cc: Horia Geanta <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; Silvano Di Ninno <[email protected]>; Meenakshi Aggarwal <[email protected]>; Tom Rini <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Baehring, Olaf <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: Re: [PATCH]crypto/rng: double the entropy delay interval for retryHi Gaurav,
Quoted 11 lines · Gaurav Jain
during entropy evaluation, if the generated samples fail any statistical test, then, all of the bits will be discarded, and a second set of samples will be generated and tested.
the entropy delay interval should be doubled before performing retry.
Signed-off-by Gaurav Jain <[email protected]>---
drivers/crypto/fsl/jr.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
drivers/crypto/fsl/jr.c static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec) · line 645
Quoted 10 lines
drivers/crypto/fsl/jr.c index renamed from drivers/crypto/fsl/jr.c +0
-0
8f7a821ebf3..07d336c074a100644drivers/crypto/fsl/jr.c +1
-1@@ -642,7 +642,7 @@ static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec)*/ if (!inst_handles) {kick_trng (ent_delay, sec); - ent_delay +=400 ; + ent_delay = ent_delay *2 ;I not get the point on why need to double, would you please update the commit why not 500, 800 or else. What make
ent_delay* 2 the best choice?
The typical reason a re-try is required when the entropy delay value is set too low.
Therefore, when the re-try is attempted the entropy delay is doubled, thus giving twice as long to generate each bit of entropy. This is done to prevent having too many failures.
Regards
Gaurav Jain
Quoted 10 lines
Thanks,
PengQuoted 6 lines
drivers/crypto/fsl/jr.c +0
-1}/* * if instantiate_rng(...) fails, the loop will rerun -- 2.25.1
Quoted 43 lines · Gaurav Jain
Quoted 29 lines
-----Original Message-----
From: Peng Fan (OSS) <[email protected]>
Sent: Tuesday, September 23, 2025 2:43 PM
To: Gaurav Jain <[email protected]>
Cc: Horia Geanta <[email protected]>; Pankaj Gupta <[email protected]>; Varun Sethi <[email protected]>; Silvano Di Ninno <[email protected]>; Meenakshi Aggarwal <[email protected]>; Tom Rini <[email protected]>; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Baehring, Olaf <[email protected]>; Heinrich Schuchardt <[email protected]>; [email protected]
Subject: Re: [PATCH]crypto/rng: double the entropy delay interval for retryHi Gaurav,
Quoted 11 lines · Gaurav Jain
during entropy evaluation, if the generated samples fail any statistical test, then, all of the bits will be discarded, and a second set of samples will be generated and tested.
the entropy delay interval should be doubled before performing retry.
Signed-off-by Gaurav Jain <[email protected]>---
drivers/crypto/fsl/jr.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/crypto/fsl/jr.c static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec) · line 645
Quoted 10 lines
drivers/crypto/fsl/jr.c index renamed from drivers/crypto/fsl/jr.c +0
-0
8f7a821ebf3..07d336c074a100644drivers/crypto/fsl/jr.c +1
-1@@ -642,7 +642,7 @@ static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec)*/ if (!inst_handles) {kick_trng (ent_delay, sec); - ent_delay +=400 ; + ent_delay = ent_delay *2 ;I not get the point on why need to double, would you please update the commit why not 500, 800 or else. What make
ent_delay* 2 the best choice?
Quoted 3 lines
The typical reason a re-try is required when the entropy delay value is set too low.
Therefore, when the re-try is attempted the entropy delay is doubled, thus giving twice as long to generate each bit of entropy. This is done to prevent having too many failures.
ok. I would say "double the ent_delay to give more chance to pass", I will update the commit, no need resend.
Thanks,
Peng
Quoted 13 lines
Regards
Gaurav JainQuoted 10 lines
Thanks,
PengQuoted 6 lines
drivers/crypto/fsl/jr.c +0
-1}/* * if instantiate_rng(...) fails, the loop will rerun -- 2.25.1