[CRYPTO] api: Add template registration

A crypto_template generates a crypto_alg object when given a set of
parameters.  this patch adds the basic data structure fo templates
and code to handle their registration/deregistration.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Herbert Xu
2006-08-06 21:16:34 +10:00
parent cce9e06d10
commit 4cc7720cd1
3 changed files with 182 additions and 22 deletions

View File

@@ -19,11 +19,15 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/rwsem.h>
#include <linux/slab.h>
#include <asm/kmap_types.h>
struct crypto_instance;
struct crypto_template;
extern struct list_head crypto_alg_list;
extern struct rw_semaphore crypto_alg_sem;
@@ -112,5 +116,18 @@ void crypto_exit_digest_ops(struct crypto_tfm *tfm);
void crypto_exit_cipher_ops(struct crypto_tfm *tfm);
void crypto_exit_compress_ops(struct crypto_tfm *tfm);
int crypto_register_instance(struct crypto_template *tmpl,
struct crypto_instance *inst);
static inline int crypto_tmpl_get(struct crypto_template *tmpl)
{
return try_module_get(tmpl->module);
}
static inline void crypto_tmpl_put(struct crypto_template *tmpl)
{
module_put(tmpl->module);
}
#endif /* _CRYPTO_INTERNAL_H */