aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/crypto.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-08-06 06:28:44 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:16:29 -0400
commit6521f30273fbec65146a0f16de74b7b402b0f7b0 (patch)
tree1e664f6c1a7c960c60c4cae01585933029f81a5f /include/linux/crypto.h
parent72fa491912689ca69dd15f4266945d2c2f2819f8 (diff)
[CRYPTO] api: Add crypto_alg reference counting
Up until now we've relied on module reference counting to ensure that the crypto_alg structures don't disappear from under us. This was good enough as long as each crypto_alg came from exactly one module. However, with parameterised crypto algorithms a crypto_alg object may need two or more modules to operate. This means that we need to count the references to the crypto_alg object directly. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/crypto.h')
-rw-r--r--include/linux/crypto.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index cb1e6631b132..7f57ff8ec975 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -17,6 +17,7 @@
17#ifndef _LINUX_CRYPTO_H 17#ifndef _LINUX_CRYPTO_H
18#define _LINUX_CRYPTO_H 18#define _LINUX_CRYPTO_H
19 19
20#include <asm/atomic.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/types.h> 23#include <linux/types.h>
@@ -148,6 +149,7 @@ struct crypto_alg {
148 unsigned int cra_alignmask; 149 unsigned int cra_alignmask;
149 150
150 int cra_priority; 151 int cra_priority;
152 atomic_t cra_refcnt;
151 153
152 char cra_name[CRYPTO_MAX_ALG_NAME]; 154 char cra_name[CRYPTO_MAX_ALG_NAME];
153 char cra_driver_name[CRYPTO_MAX_ALG_NAME]; 155 char cra_driver_name[CRYPTO_MAX_ALG_NAME];
@@ -160,6 +162,7 @@ struct crypto_alg {
160 162
161 int (*cra_init)(struct crypto_tfm *tfm); 163 int (*cra_init)(struct crypto_tfm *tfm);
162 void (*cra_exit)(struct crypto_tfm *tfm); 164 void (*cra_exit)(struct crypto_tfm *tfm);
165 void (*cra_destroy)(struct crypto_alg *alg);
163 166
164 struct module *cra_module; 167 struct module *cra_module;
165}; 168};