Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4741b23 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu
Browse files

crypto: run initcalls for generic implementations earlier



Use subsys_initcall for registration of all templates and generic
algorithm implementations, rather than module_init.  Then change
cryptomgr to use arch_initcall, to place it before the subsys_initcalls.

This is needed so that when both a generic and optimized implementation
of an algorithm are built into the kernel (not loadable modules), the
generic implementation is registered before the optimized one.
Otherwise, the self-tests for the optimized implementation are unable to
allocate the generic implementation for the new comparison fuzz tests.

Note that on arm, a side effect of this change is that self-tests for
generic implementations may run before the unaligned access handler has
been installed.  So, unaligned accesses will crash the kernel.  This is
arguably a good thing as it makes it easier to detect that type of bug.

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 40153b10
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ static int __init crypto842_mod_init(void)

	return ret;
}
module_init(crypto842_mod_init);
subsys_initcall(crypto842_mod_init);

static void __exit crypto842_mod_exit(void)
{
+1 −1
Original line number Diff line number Diff line
@@ -659,7 +659,7 @@ static void __exit adiantum_module_exit(void)
	crypto_unregister_template(&adiantum_tmpl);
}

module_init(adiantum_module_init);
subsys_initcall(adiantum_module_init);
module_exit(adiantum_module_exit);

MODULE_DESCRIPTION("Adiantum length-preserving encryption mode");
+1 −1
Original line number Diff line number Diff line
@@ -448,7 +448,7 @@ static void __exit crypto_aegis128_module_exit(void)
	crypto_unregister_aead(&crypto_aegis128_alg);
}

module_init(crypto_aegis128_module_init);
subsys_initcall(crypto_aegis128_module_init);
module_exit(crypto_aegis128_module_exit);

MODULE_LICENSE("GPL");
+1 −1
Original line number Diff line number Diff line
@@ -512,7 +512,7 @@ static void __exit crypto_aegis128l_module_exit(void)
	crypto_unregister_aead(&crypto_aegis128l_alg);
}

module_init(crypto_aegis128l_module_init);
subsys_initcall(crypto_aegis128l_module_init);
module_exit(crypto_aegis128l_module_exit);

MODULE_LICENSE("GPL");
+1 −1
Original line number Diff line number Diff line
@@ -463,7 +463,7 @@ static void __exit crypto_aegis256_module_exit(void)
	crypto_unregister_aead(&crypto_aegis256_alg);
}

module_init(crypto_aegis256_module_init);
subsys_initcall(crypto_aegis256_module_init);
module_exit(crypto_aegis256_module_exit);

MODULE_LICENSE("GPL");
Loading