aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-05-16 08:09:29 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-06-26 03:34:39 -0400
commit6c2bb98bc33ae33c7a33a133a4cd5a06395fece5 (patch)
tree96684cd2c473cd05d651ce1fa3dd72b1b4b19b09 /include
parent43600106e32809a4dead79fec67a63e9860e3d5d (diff)
[CRYPTO] all: Pass tfm instead of ctx to algorithms
Up until now algorithms have been happy to get a context pointer since they know everything that's in the tfm already (e.g., alignment, block size). However, once we have parameterised algorithms, such information will be specific to each tfm. So the algorithm API needs to be changed to pass the tfm structure instead of the context pointer. This patch is basically a text substitution. The only tricky bit is the assembly routines that need to get the context pointer offset through asm-offsets.h. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include')
-rw-r--r--include/linux/crypto.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 5a0470e36111..ef918803ec30 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -66,7 +66,7 @@ struct crypto_tfm;
66 66
67struct cipher_desc { 67struct cipher_desc {
68 struct crypto_tfm *tfm; 68 struct crypto_tfm *tfm;
69 void (*crfn)(void *ctx, u8 *dst, const u8 *src); 69 void (*crfn)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
70 unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst, 70 unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst,
71 const u8 *src, unsigned int nbytes); 71 const u8 *src, unsigned int nbytes);
72 void *info; 72 void *info;
@@ -79,10 +79,10 @@ struct cipher_desc {
79struct cipher_alg { 79struct cipher_alg {
80 unsigned int cia_min_keysize; 80 unsigned int cia_min_keysize;
81 unsigned int cia_max_keysize; 81 unsigned int cia_max_keysize;
82 int (*cia_setkey)(void *ctx, const u8 *key, 82 int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key,
83 unsigned int keylen, u32 *flags); 83 unsigned int keylen, u32 *flags);
84 void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); 84 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
85 void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); 85 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
86 86
87 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, 87 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
88 u8 *dst, const u8 *src, 88 u8 *dst, const u8 *src,
@@ -100,20 +100,21 @@ struct cipher_alg {
100 100
101struct digest_alg { 101struct digest_alg {
102 unsigned int dia_digestsize; 102 unsigned int dia_digestsize;
103 void (*dia_init)(void *ctx); 103 void (*dia_init)(struct crypto_tfm *tfm);
104 void (*dia_update)(void *ctx, const u8 *data, unsigned int len); 104 void (*dia_update)(struct crypto_tfm *tfm, const u8 *data,
105 void (*dia_final)(void *ctx, u8 *out); 105 unsigned int len);
106 int (*dia_setkey)(void *ctx, const u8 *key, 106 void (*dia_final)(struct crypto_tfm *tfm, u8 *out);
107 int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key,
107 unsigned int keylen, u32 *flags); 108 unsigned int keylen, u32 *flags);
108}; 109};
109 110
110struct compress_alg { 111struct compress_alg {
111 int (*coa_init)(void *ctx); 112 int (*coa_init)(struct crypto_tfm *tfm);
112 void (*coa_exit)(void *ctx); 113 void (*coa_exit)(struct crypto_tfm *tfm);
113 int (*coa_compress)(void *ctx, const u8 *src, unsigned int slen, 114 int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src,
114 u8 *dst, unsigned int *dlen); 115 unsigned int slen, u8 *dst, unsigned int *dlen);
115 int (*coa_decompress)(void *ctx, const u8 *src, unsigned int slen, 116 int (*coa_decompress)(struct crypto_tfm *tfm, const u8 *src,
116 u8 *dst, unsigned int *dlen); 117 unsigned int slen, u8 *dst, unsigned int *dlen);
117}; 118};
118 119
119#define cra_cipher cra_u.cipher 120#define cra_cipher cra_u.cipher