mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
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: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
01b323245e
commit
da7f033ddc
9 changed files with 10527 additions and 10413 deletions
|
@ -40,7 +40,9 @@ config CRYPTO_HASH
|
||||||
|
|
||||||
config CRYPTO_MANAGER
|
config CRYPTO_MANAGER
|
||||||
tristate "Cryptographic algorithm manager"
|
tristate "Cryptographic algorithm manager"
|
||||||
select CRYPTO_ALGAPI
|
select CRYPTO_AEAD
|
||||||
|
select CRYPTO_HASH
|
||||||
|
select CRYPTO_BLKCIPHER
|
||||||
help
|
help
|
||||||
Create default cryptographic template instantiations such as
|
Create default cryptographic template instantiations such as
|
||||||
cbc(aes).
|
cbc(aes).
|
||||||
|
@ -85,9 +87,7 @@ config CRYPTO_AUTHENC
|
||||||
config CRYPTO_TEST
|
config CRYPTO_TEST
|
||||||
tristate "Testing module"
|
tristate "Testing module"
|
||||||
depends on m
|
depends on m
|
||||||
select CRYPTO_ALGAPI
|
select CRYPTO_MANAGER
|
||||||
select CRYPTO_AEAD
|
|
||||||
select CRYPTO_BLKCIPHER
|
|
||||||
help
|
help
|
||||||
Quick & dirty crypto test module.
|
Quick & dirty crypto test module.
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ crypto_hash-objs := hash.o
|
||||||
crypto_hash-objs += ahash.o
|
crypto_hash-objs += ahash.o
|
||||||
obj-$(CONFIG_CRYPTO_HASH) += crypto_hash.o
|
obj-$(CONFIG_CRYPTO_HASH) += crypto_hash.o
|
||||||
|
|
||||||
|
cryptomgr-objs := algboss.o testmgr.o
|
||||||
|
|
||||||
obj-$(CONFIG_CRYPTO_MANAGER) += cryptomgr.o
|
obj-$(CONFIG_CRYPTO_MANAGER) += cryptomgr.o
|
||||||
obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
|
obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
|
||||||
obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
|
obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
|
||||||
|
|
|
@ -206,16 +206,32 @@ static struct notifier_block cryptomgr_notifier = {
|
||||||
|
|
||||||
static int __init cryptomgr_init(void)
|
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)
|
static void __exit cryptomgr_exit(void)
|
||||||
{
|
{
|
||||||
int err = crypto_unregister_notifier(&cryptomgr_notifier);
|
int err = crypto_unregister_notifier(&cryptomgr_notifier);
|
||||||
BUG_ON(err);
|
BUG_ON(err);
|
||||||
|
|
||||||
|
testmgr_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(cryptomgr_init);
|
subsys_initcall(cryptomgr_init);
|
||||||
module_exit(cryptomgr_exit);
|
module_exit(cryptomgr_exit);
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
|
@ -108,6 +108,9 @@ int crypto_register_instance(struct crypto_template *tmpl,
|
||||||
int crypto_register_notifier(struct notifier_block *nb);
|
int crypto_register_notifier(struct notifier_block *nb);
|
||||||
int crypto_unregister_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)
|
static inline void crypto_alg_put(struct crypto_alg *alg)
|
||||||
{
|
{
|
||||||
if (atomic_dec_and_test(&alg->cra_refcnt) && alg->cra_destroy)
|
if (atomic_dec_and_test(&alg->cra_refcnt) && alg->cra_destroy)
|
||||||
|
|
1708
crypto/tcrypt.c
1708
crypto/tcrypt.c
File diff suppressed because it is too large
Load diff
8713
crypto/tcrypt.h
8713
crypto/tcrypt.h
File diff suppressed because it is too large
Load diff
1746
crypto/testmgr.c
Normal file
1746
crypto/testmgr.c
Normal file
File diff suppressed because it is too large
Load diff
8738
crypto/testmgr.h
Normal file
8738
crypto/testmgr.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -515,6 +515,8 @@ struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags);
|
||||||
struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
|
struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
|
||||||
void crypto_free_tfm(struct crypto_tfm *tfm);
|
void crypto_free_tfm(struct crypto_tfm *tfm);
|
||||||
|
|
||||||
|
int alg_test(const char *driver, const char *alg, u32 type, u32 mask);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Transform helpers which query the underlying algorithm.
|
* Transform helpers which query the underlying algorithm.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue