diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-05-16 08:09:29 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2006-06-26 03:34:39 -0400 |
commit | 6c2bb98bc33ae33c7a33a133a4cd5a06395fece5 (patch) | |
tree | 96684cd2c473cd05d651ce1fa3dd72b1b4b19b09 /crypto/digest.c | |
parent | 43600106e32809a4dead79fec67a63e9860e3d5d (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.c | 15 |
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 @@ | |||
20 | 20 | ||
21 | static void init(struct crypto_tfm *tfm) | 21 | static void init(struct crypto_tfm *tfm) |
22 | { | 22 | { |
23 | tfm->__crt_alg->cra_digest.dia_init(crypto_tfm_ctx(tfm)); | 23 | tfm->__crt_alg->cra_digest.dia_init(tfm); |
24 | } | 24 | } |
25 | 25 | ||
26 | static void update(struct crypto_tfm *tfm, | 26 | static void update(struct crypto_tfm *tfm, |
@@ -46,16 +46,14 @@ static void update(struct crypto_tfm *tfm, | |||
46 | unsigned int bytes = | 46 | unsigned int bytes = |
47 | alignmask + 1 - (offset & alignmask); | 47 | alignmask + 1 - (offset & alignmask); |
48 | bytes = min(bytes, bytes_from_page); | 48 | bytes = min(bytes, bytes_from_page); |
49 | tfm->__crt_alg->cra_digest.dia_update | 49 | tfm->__crt_alg->cra_digest.dia_update(tfm, p, |
50 | (crypto_tfm_ctx(tfm), p, | 50 | bytes); |
51 | bytes); | ||
52 | p += bytes; | 51 | p += bytes; |
53 | bytes_from_page -= bytes; | 52 | bytes_from_page -= bytes; |
54 | l -= bytes; | 53 | l -= bytes; |
55 | } | 54 | } |
56 | tfm->__crt_alg->cra_digest.dia_update | 55 | tfm->__crt_alg->cra_digest.dia_update(tfm, p, |
57 | (crypto_tfm_ctx(tfm), p, | 56 | bytes_from_page); |
58 | bytes_from_page); | ||
59 | crypto_kunmap(src, 0); | 57 | crypto_kunmap(src, 0); |
60 | crypto_yield(tfm); | 58 | crypto_yield(tfm); |
61 | offset = 0; | 59 | offset = 0; |
@@ -83,8 +81,7 @@ static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) | |||
83 | u32 flags; | 81 | u32 flags; |
84 | if (tfm->__crt_alg->cra_digest.dia_setkey == NULL) | 82 | if (tfm->__crt_alg->cra_digest.dia_setkey == NULL) |
85 | return -ENOSYS; | 83 | return -ENOSYS; |
86 | return tfm->__crt_alg->cra_digest.dia_setkey(crypto_tfm_ctx(tfm), | 84 | return tfm->__crt_alg->cra_digest.dia_setkey(tfm, key, keylen, &flags); |
87 | key, keylen, &flags); | ||
88 | } | 85 | } |
89 | 86 | ||
90 | static void digest(struct crypto_tfm *tfm, | 87 | static void digest(struct crypto_tfm *tfm, |