aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/deflate.c
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 /crypto/deflate.c
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 'crypto/deflate.c')
-rw-r--r--crypto/deflate.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/crypto/deflate.c b/crypto/deflate.c
index f209368d62ae..5dd2404ae5b2 100644
--- a/crypto/deflate.c
+++ b/crypto/deflate.c
@@ -102,8 +102,9 @@ static void deflate_decomp_exit(struct deflate_ctx *ctx)
102 kfree(ctx->decomp_stream.workspace); 102 kfree(ctx->decomp_stream.workspace);
103} 103}
104 104
105static int deflate_init(void *ctx) 105static int deflate_init(struct crypto_tfm *tfm)
106{ 106{
107 struct deflate_ctx *ctx = crypto_tfm_ctx(tfm);
107 int ret; 108 int ret;
108 109
109 ret = deflate_comp_init(ctx); 110 ret = deflate_comp_init(ctx);
@@ -116,17 +117,19 @@ out:
116 return ret; 117 return ret;
117} 118}
118 119
119static void deflate_exit(void *ctx) 120static void deflate_exit(struct crypto_tfm *tfm)
120{ 121{
122 struct deflate_ctx *ctx = crypto_tfm_ctx(tfm);
123
121 deflate_comp_exit(ctx); 124 deflate_comp_exit(ctx);
122 deflate_decomp_exit(ctx); 125 deflate_decomp_exit(ctx);
123} 126}
124 127
125static int deflate_compress(void *ctx, const u8 *src, unsigned int slen, 128static int deflate_compress(struct crypto_tfm *tfm, const u8 *src,
126 u8 *dst, unsigned int *dlen) 129 unsigned int slen, u8 *dst, unsigned int *dlen)
127{ 130{
128 int ret = 0; 131 int ret = 0;
129 struct deflate_ctx *dctx = ctx; 132 struct deflate_ctx *dctx = crypto_tfm_ctx(tfm);
130 struct z_stream_s *stream = &dctx->comp_stream; 133 struct z_stream_s *stream = &dctx->comp_stream;
131 134
132 ret = zlib_deflateReset(stream); 135 ret = zlib_deflateReset(stream);
@@ -151,12 +154,12 @@ out:
151 return ret; 154 return ret;
152} 155}
153 156
154static int deflate_decompress(void *ctx, const u8 *src, unsigned int slen, 157static int deflate_decompress(struct crypto_tfm *tfm, const u8 *src,
155 u8 *dst, unsigned int *dlen) 158 unsigned int slen, u8 *dst, unsigned int *dlen)
156{ 159{
157 160
158 int ret = 0; 161 int ret = 0;
159 struct deflate_ctx *dctx = ctx; 162 struct deflate_ctx *dctx = crypto_tfm_ctx(tfm);
160 struct z_stream_s *stream = &dctx->decomp_stream; 163 struct z_stream_s *stream = &dctx->decomp_stream;
161 164
162 ret = zlib_inflateReset(stream); 165 ret = zlib_inflateReset(stream);