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/aes.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/aes.c')
-rw-r--r-- | crypto/aes.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/aes.c b/crypto/aes.c index a5017292e066..a038711831e7 100644 --- a/crypto/aes.c +++ b/crypto/aes.c | |||
@@ -248,10 +248,10 @@ gen_tabs (void) | |||
248 | t ^= E_KEY[8 * i + 7]; E_KEY[8 * i + 15] = t; \ | 248 | t ^= E_KEY[8 * i + 7]; E_KEY[8 * i + 15] = t; \ |
249 | } | 249 | } |
250 | 250 | ||
251 | static int | 251 | static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, |
252 | aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) | 252 | unsigned int key_len, u32 *flags) |
253 | { | 253 | { |
254 | struct aes_ctx *ctx = ctx_arg; | 254 | struct aes_ctx *ctx = crypto_tfm_ctx(tfm); |
255 | const __le32 *key = (const __le32 *)in_key; | 255 | const __le32 *key = (const __le32 *)in_key; |
256 | u32 i, t, u, v, w; | 256 | u32 i, t, u, v, w; |
257 | 257 | ||
@@ -318,9 +318,9 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) | |||
318 | f_rl(bo, bi, 2, k); \ | 318 | f_rl(bo, bi, 2, k); \ |
319 | f_rl(bo, bi, 3, k) | 319 | f_rl(bo, bi, 3, k) |
320 | 320 | ||
321 | static void aes_encrypt(void *ctx_arg, u8 *out, const u8 *in) | 321 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
322 | { | 322 | { |
323 | const struct aes_ctx *ctx = ctx_arg; | 323 | const struct aes_ctx *ctx = crypto_tfm_ctx(tfm); |
324 | const __le32 *src = (const __le32 *)in; | 324 | const __le32 *src = (const __le32 *)in; |
325 | __le32 *dst = (__le32 *)out; | 325 | __le32 *dst = (__le32 *)out; |
326 | u32 b0[4], b1[4]; | 326 | u32 b0[4], b1[4]; |
@@ -373,9 +373,9 @@ static void aes_encrypt(void *ctx_arg, u8 *out, const u8 *in) | |||
373 | i_rl(bo, bi, 2, k); \ | 373 | i_rl(bo, bi, 2, k); \ |
374 | i_rl(bo, bi, 3, k) | 374 | i_rl(bo, bi, 3, k) |
375 | 375 | ||
376 | static void aes_decrypt(void *ctx_arg, u8 *out, const u8 *in) | 376 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
377 | { | 377 | { |
378 | const struct aes_ctx *ctx = ctx_arg; | 378 | const struct aes_ctx *ctx = crypto_tfm_ctx(tfm); |
379 | const __le32 *src = (const __le32 *)in; | 379 | const __le32 *src = (const __le32 *)in; |
380 | __le32 *dst = (__le32 *)out; | 380 | __le32 *dst = (__le32 *)out; |
381 | u32 b0[4], b1[4]; | 381 | u32 b0[4], b1[4]; |