Skip to contentSkip to conversation

crypto: drbg - decrease verbosity

PATCH In review Stephan Mueller 2 participants 6 messages Jun 6, 2015 – Jun 9, 2015 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: drbg - decrease verbosity

When compiling the DRBG statically into the kernel, the testmgr allocation of the DRBG may be done at a time the Jitter RNG is not available. The testmgr instantiates a number of DRBGs for performing testing which may cause a flurry of logs about unavailable Jitter RNG. Note, the Jitter RNG is not needed for the testmgr operation anyways.

---
 crypto/drbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/drbg.c +1 -1
index 7339cc5..3fed67e 100644
@@ -1279,7 +1279,7 @@ static inline int drbg_alloc_state(struct drbg_state *drbg)
 	drbg->jent = crypto_alloc_rng("jitterentropy_rng", 0, 0);
 	if(IS_ERR(drbg->jent))
 	{
-		pr_info("DRBG: could not allocate Jitter RNG handle for seeding\n");
+		pr_devel("DRBG: could not allocate Jitter RNG handle for seeding\n");
 		/*
 		 * As the Jitter RNG is a module that may not be present, we
 		 * continue with the operation and do not fully tie the DRBG
Signature · 1 line
2.4.2
maintainer
#1 lore raw
Quoted 5 lines · Stephan Mueller

When compiling the DRBG statically into the kernel, the testmgr allocation of the DRBG may be done at a time the Jitter RNG is not available. The testmgr instantiates a number of DRBGs for performing testing which may cause a flurry of logs about unavailable Jitter RNG. Note, the Jitter RNG is not needed for the testmgr operation anyways.

I think we should fix by ensuring the jitter is registered first. You could try registering jitter at subsys_init instead of module_init.

Cheers,

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
#2 lore raw

Am Montag, 8. Juni 2015, 09:33:55 schrieb Herbert Xu:

Hi Herbert,

Quoted 9 lines · Stephan Mueller
Quoted 5 lines

When compiling the DRBG statically into the kernel, the testmgr allocation of the DRBG may be done at a time the Jitter RNG is not available. The testmgr instantiates a number of DRBGs for performing testing which may cause a flurry of logs about unavailable Jitter RNG. Note, the Jitter RNG is not needed for the testmgr operation anyways.

I think we should fix by ensuring the jitter is registered first. You could try registering jitter at subsys_init instead of module_init.

Thanks for the hint about the root cause. I will do that right away.

Quoted 2 lines

Cheers,

Signature · 2 lines
Ciao
Stephan
#3 lore raw

PATCH v2 1/1 crypto: drbg - initialize in subsys_initcall

In reply to Stephan Mueller

When compiling the DRBG statically into the kernel, the testmgr allocation of the DRBG may be done at a time the Jitter RNG is not available as it is registered later. The patch changes the initialization to be invoked in subsys_initcall.

---
 crypto/jitterentropy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/jitterentropy.c +1 -1
index a60147e..20dc178 100644
@@ -897,7 +897,7 @@ static void __exit jent_mod_exit(void)
 	crypto_unregister_rng(&jent_alg);
 }
 
-module_init(jent_mod_init);
+subsys_initcall(jent_mod_init);
 module_exit(jent_mod_exit);
 
 MODULE_LICENSE("Dual BSD/GPL");
Signature · 1 line
2.4.2
maintainer
#4 lore raw

Re: [PATCH v2] crypto: drbg - initialize in subsys_initcall

Quoted 6 lines · Stephan Mueller

When compiling the DRBG statically into the kernel, the testmgr allocation of the DRBG may be done at a time the Jitter RNG is not available as it is registered later. The patch changes the initialization to be invoked in subsys_initcall.

Actually I think we won't need this patch after all because after my callback patches we will never allocate jent in the testmgr path.

Cheers,

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
#5 lore raw

Re: [PATCH v2] crypto: drbg - initialize in subsys_initcall

Am Tuesday 09 June 2015, 22:17:43 schrieb Herbert Xu:

Hi Herbert,

Quoted 11 lines · Stephan Mueller
Quoted 6 lines

When compiling the DRBG statically into the kernel, the testmgr allocation of the DRBG may be done at a time the Jitter RNG is not available as it is registered later. The patch changes the initialization to be invoked in subsys_initcall.

Actually I think we won't need this patch after all because after my callback patches we will never allocate jent in the testmgr path.

Agreed. Let us drop the patch.

Quoted 2 lines

Cheers,

Ciao
Stephan