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

Commit da7f033d authored by Herbert Xu's avatar Herbert Xu
Browse files

crypto: cryptomgr - Add test infrastructure



This patch moves the newly created alg_test infrastructure into
cryptomgr.  This shall allow us to use it for testing at algorithm
registrations.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 01b32324
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -40,7 +40,9 @@ config CRYPTO_HASH

config CRYPTO_MANAGER
	tristate "Cryptographic algorithm manager"
	select CRYPTO_ALGAPI
	select CRYPTO_AEAD
	select CRYPTO_HASH
	select CRYPTO_BLKCIPHER
	help
	  Create default cryptographic template instantiations such as
	  cbc(aes).
@@ -85,9 +87,7 @@ config CRYPTO_AUTHENC
config CRYPTO_TEST
	tristate "Testing module"
	depends on m
	select CRYPTO_ALGAPI
	select CRYPTO_AEAD
	select CRYPTO_BLKCIPHER
	select CRYPTO_MANAGER
	help
	  Quick & dirty crypto test module.

+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ crypto_hash-objs := hash.o
crypto_hash-objs += ahash.o
obj-$(CONFIG_CRYPTO_HASH) += crypto_hash.o

cryptomgr-objs := algboss.o testmgr.o

obj-$(CONFIG_CRYPTO_MANAGER) += cryptomgr.o
obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
+18 −2
Original line number Diff line number Diff line
@@ -206,16 +206,32 @@ static struct notifier_block cryptomgr_notifier = {

static int __init cryptomgr_init(void)
{
	return crypto_register_notifier(&cryptomgr_notifier);
	int err;

	err = testmgr_init();
	if (err)
		return err;

	err = crypto_register_notifier(&cryptomgr_notifier);
	if (err)
		goto free_testmgr;

	return 0;

free_testmgr:
	testmgr_exit();
	return err;
}

static void __exit cryptomgr_exit(void)
{
	int err = crypto_unregister_notifier(&cryptomgr_notifier);
	BUG_ON(err);

	testmgr_exit();
}

module_init(cryptomgr_init);
subsys_initcall(cryptomgr_init);
module_exit(cryptomgr_exit);

MODULE_LICENSE("GPL");
+3 −0
Original line number Diff line number Diff line
@@ -108,6 +108,9 @@ int crypto_register_instance(struct crypto_template *tmpl,
int crypto_register_notifier(struct notifier_block *nb);
int crypto_unregister_notifier(struct notifier_block *nb);

int __init testmgr_init(void);
void testmgr_exit(void);

static inline void crypto_alg_put(struct crypto_alg *alg)
{
	if (atomic_dec_and_test(&alg->cra_refcnt) && alg->cra_destroy)
+8 −1700

File changed.

Preview size limit exceeded, changes collapsed.

Loading