aboutsummaryrefslogtreecommitdiff
path: root/crypto/deflate.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-05-16 22:09:29 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2006-06-26 17:34:39 +1000
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 f209368d62a..5dd2404ae5b 100644
--- a/crypto/deflate.c
+++ b/crypto/deflate.c
@@ -102,8 +102,9 @@ static void deflate_decomp_exit(struct deflate_ctx *ctx)
kfree(ctx->decomp_stream.workspace);
}
-static int deflate_init(void *ctx)
+static int deflate_init(struct crypto_tfm *tfm)
{
+ struct deflate_ctx *ctx = crypto_tfm_ctx(tfm);
int ret;
ret = deflate_comp_init(ctx);
@@ -116,17 +117,19 @@ out:
return ret;
}
-static void deflate_exit(void *ctx)
+static void deflate_exit(struct crypto_tfm *tfm)
{
+ struct deflate_ctx *ctx = crypto_tfm_ctx(tfm);
+
deflate_comp_exit(ctx);
deflate_decomp_exit(ctx);
}
-static int deflate_compress(void *ctx, const u8 *src, unsigned int slen,
- u8 *dst, unsigned int *dlen)
+static int deflate_compress(struct crypto_tfm *tfm, const u8 *src,
+ unsigned int slen, u8 *dst, unsigned int *dlen)
{
int ret = 0;
- struct deflate_ctx *dctx = ctx;
+ struct deflate_ctx *dctx = crypto_tfm_ctx(tfm);
struct z_stream_s *stream = &dctx->comp_stream;
ret = zlib_deflateReset(stream);
@@ -151,12 +154,12 @@ out:
return ret;
}
-static int deflate_decompress(void *ctx, const u8 *src, unsigned int slen,
- u8 *dst, unsigned int *dlen)
+static int deflate_decompress(struct crypto_tfm *tfm, const u8 *src,
+ unsigned int slen, u8 *dst, unsigned int *dlen)
{
int ret = 0;
- struct deflate_ctx *dctx = ctx;
+ struct deflate_ctx *dctx = crypto_tfm_ctx(tfm);
struct z_stream_s *stream = &dctx->decomp_stream;
ret = zlib_inflateReset(stream);