Skip to content

Commit

Permalink
crypto: cryptomgr - Add test infrastructure
Browse files Browse the repository at this point in the history
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: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Aug 29, 2008
1 parent 01b3232 commit da7f033
Show file tree
Hide file tree
Showing 9 changed files with 10,527 additions and 10,413 deletions.
8 changes: 4 additions & 4 deletions crypto/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions crypto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions crypto/cryptomgr.c → crypto/algboss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 3 additions & 0 deletions crypto/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit da7f033

Please sign in to comment.