summaryrefslogtreecommitdiff
path: root/crypto/digest.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/digest.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/digest.c')
-rw-r--r--crypto/digest.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/crypto/digest.c b/crypto/digest.c
index 062d0a5a2c89..2d9d509c2c51 100644
--- a/crypto/digest.c
+++ b/crypto/digest.c
@@ -20,7 +20,7 @@
static void init(struct crypto_tfm *tfm)
{
- tfm->__crt_alg->cra_digest.dia_init(crypto_tfm_ctx(tfm));
+ tfm->__crt_alg->cra_digest.dia_init(tfm);
}
static void update(struct crypto_tfm *tfm,
@@ -46,16 +46,14 @@ static void update(struct crypto_tfm *tfm,
unsigned int bytes =
alignmask + 1 - (offset & alignmask);
bytes = min(bytes, bytes_from_page);
- tfm->__crt_alg->cra_digest.dia_update
- (crypto_tfm_ctx(tfm), p,
- bytes);
+ tfm->__crt_alg->cra_digest.dia_update(tfm, p,
+ bytes);
p += bytes;
bytes_from_page -= bytes;
l -= bytes;
}
- tfm->__crt_alg->cra_digest.dia_update
- (crypto_tfm_ctx(tfm), p,
- bytes_from_page);
+ tfm->__crt_alg->cra_digest.dia_update(tfm, p,
+ bytes_from_page);
crypto_kunmap(src, 0);
crypto_yield(tfm);
offset = 0;
@@ -83,8 +81,7 @@ static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
u32 flags;
if (tfm->__crt_alg->cra_digest.dia_setkey == NULL)
return -ENOSYS;
- return tfm->__crt_alg->cra_digest.dia_setkey(crypto_tfm_ctx(tfm),
- key, keylen, &flags);
+ return tfm->__crt_alg->cra_digest.dia_setkey(tfm, key, keylen, &flags);
}
static void digest(struct crypto_tfm *tfm,