Commit 0d9fbb7d authored by Gaosheng Cui's avatar Gaosheng Cui Committed by Cui GaoSheng
Browse files

crypto: jitter - change module_init(jent_mod_init) to subsys_initcall(jent_mod_init)

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9K8D1



--------------------------------

The ecdh-nist-p256 algorithm will depend on jitterentropy_rng,
and when they are build into kernel, the order of registration
should be done such that the underlying algorithms are ready
before the ones on top are registered.

We can enable fips=1 and ecdh, the calltrace like below:

alg: ecdh-nist-p256: test failed on vector 2, err=-14
Kernel panic - not syncing: alg: self-tests for ecdh-generic (ecdh)
failed in fips mode!
Call Trace:
 dump_stack+0x57/0x6e
 panic+0x109/0x2ca
 alg_test+0x414/0x420
 ? __switch_to_asm+0x3a/0x60
 ? __switch_to_asm+0x34/0x60
 ? __schedule+0x263/0x640
 ? crypto_acomp_scomp_free_ctx+0x30/0x30
 cryptomgr_test+0x22/0x40
 kthread+0xf9/0x130
 ? kthread_park+0x90/0x90
 ret_from_fork+0x22/0x30

The module_init(jent_mod_init) is later than subsys_initcall(ecdh_init),
so changing module_init(jent_mod_init) to subsys_initcall(jent_mod_init)
to fix it.

Fixes: c4741b23 ("crypto: run initcalls for generic implementations earlier")
Signed-off-by: default avatarGaosheng Cui <cuigaosheng1@huawei.com>
parent f300accf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -214,7 +214,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");