summaryrefslogtreecommitdiff
path: root/crypto/md4.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-05-16 16:09:29 +0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-06-26 11:34:39 +0400
commit6c2bb98bc33ae33c7a33a133a4cd5a06395fece5 (patch)
tree96684cd2c473cd05d651ce1fa3dd72b1b4b19b09 /crypto/md4.c
parent43600106e32809a4dead79fec67a63e9860e3d5d (diff)
downloadlinux-6c2bb98bc33ae33c7a33a133a4cd5a06395fece5.tar.xz
[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/md4.c')
-rw-r--r--crypto/md4.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/md4.c b/crypto/md4.c
index a2d6df5c0f8c..c1bc71bdc16b 100644
--- a/crypto/md4.c
+++ b/crypto/md4.c
@@ -152,9 +152,9 @@ static inline void md4_transform_helper(struct md4_ctx *ctx)
md4_transform(ctx->hash, ctx->block);
}
-static void md4_init(void *ctx)
+static void md4_init(struct crypto_tfm *tfm)
{
- struct md4_ctx *mctx = ctx;
+ struct md4_ctx *mctx = crypto_tfm_ctx(tfm);
mctx->hash[0] = 0x67452301;
mctx->hash[1] = 0xefcdab89;
@@ -163,9 +163,9 @@ static void md4_init(void *ctx)
mctx->byte_count = 0;
}
-static void md4_update(void *ctx, const u8 *data, unsigned int len)
+static void md4_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
{
- struct md4_ctx *mctx = ctx;
+ struct md4_ctx *mctx = crypto_tfm_ctx(tfm);
const u32 avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f);
mctx->byte_count += len;
@@ -193,9 +193,9 @@ static void md4_update(void *ctx, const u8 *data, unsigned int len)
memcpy(mctx->block, data, len);
}
-static void md4_final(void *ctx, u8 *out)
+static void md4_final(struct crypto_tfm *tfm, u8 *out)
{
- struct md4_ctx *mctx = ctx;
+ struct md4_ctx *mctx = crypto_tfm_ctx(tfm);
const unsigned int offset = mctx->byte_count & 0x3f;
char *p = (char *)mctx->block + offset;
int padding = 56 - (offset + 1);