[CRYPTO] api: Add template registration
[deliverable/linux.git] / crypto / internal.h
index 37515beafc8ce44ff501d15d617968248656b59f..c3ab4a950f304e24b8f943dc064dc7dc828a8d5e 100644 (file)
@@ -2,6 +2,7 @@
  * Cryptographic API.
  *
  * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
+ * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
  */
 #ifndef _CRYPTO_INTERNAL_H
 #define _CRYPTO_INTERNAL_H
-#include <linux/crypto.h>
+
+#include <crypto/algapi.h>
 #include <linux/mm.h>
 #include <linux/highmem.h>
 #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;
+
 extern enum km_type crypto_km_types[];
 
 static inline enum km_type crypto_kmap_type(int out)
@@ -38,7 +50,7 @@ static inline void crypto_kunmap(void *vaddr, int out)
 
 static inline void crypto_yield(struct crypto_tfm *tfm)
 {
-       if (!in_atomic())
+       if (tfm->crt_flags & CRYPTO_TFM_REQ_MAY_SLEEP)
                cond_resched();
 }
 
@@ -57,9 +69,12 @@ static inline void crypto_free_hmac_block(struct crypto_tfm *tfm)
 
 #ifdef CONFIG_PROC_FS
 void __init crypto_init_proc(void);
+void __exit crypto_exit_proc(void);
 #else
 static inline void crypto_init_proc(void)
 { }
+static inline void crypto_exit_proc(void)
+{ }
 #endif
 
 static inline unsigned int crypto_digest_ctxsize(struct crypto_alg *alg,
@@ -101,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 */
 
This page took 0.024562 seconds and 5 git commands to generate.