diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-06-01 18:42:25 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2006-06-26 03:34:42 -0400 |
commit | e90b1a2be6010acf01673b0625cfbf18240f7744 (patch) | |
tree | 7b99c136335b94bde40a6a260a6d823c83433024 | |
parent | e805792851bcb0bb42f0c8a352be64564c13e374 (diff) |
[CRYPTO] aes: Add wrappers for assembly routines
The wrapper routines are required when asmlinkage differs from the usual
calling convention. So we need to have them. However, by rearranging
the parameters, they will get optimised away to a single jump for most
people.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | arch/i386/crypto/aes.c | 14 | ||||
-rw-r--r-- | arch/x86_64/crypto/aes-x86_64-asm.S | 8 | ||||
-rw-r--r-- | arch/x86_64/crypto/aes.c | 14 |
3 files changed, 28 insertions, 8 deletions
diff --git a/arch/i386/crypto/aes.c b/arch/i386/crypto/aes.c index b9c7d99160f..d3806daa3de 100644 --- a/arch/i386/crypto/aes.c +++ b/arch/i386/crypto/aes.c | |||
@@ -464,6 +464,16 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
464 | return 0; | 464 | return 0; |
465 | } | 465 | } |
466 | 466 | ||
467 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
468 | { | ||
469 | aes_enc_blk(tfm, dst, src); | ||
470 | } | ||
471 | |||
472 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
473 | { | ||
474 | aes_dec_blk(tfm, dst, src); | ||
475 | } | ||
476 | |||
467 | static struct crypto_alg aes_alg = { | 477 | static struct crypto_alg aes_alg = { |
468 | .cra_name = "aes", | 478 | .cra_name = "aes", |
469 | .cra_driver_name = "aes-i586", | 479 | .cra_driver_name = "aes-i586", |
@@ -478,8 +488,8 @@ static struct crypto_alg aes_alg = { | |||
478 | .cia_min_keysize = AES_MIN_KEY_SIZE, | 488 | .cia_min_keysize = AES_MIN_KEY_SIZE, |
479 | .cia_max_keysize = AES_MAX_KEY_SIZE, | 489 | .cia_max_keysize = AES_MAX_KEY_SIZE, |
480 | .cia_setkey = aes_set_key, | 490 | .cia_setkey = aes_set_key, |
481 | .cia_encrypt = aes_enc_blk, | 491 | .cia_encrypt = aes_encrypt, |
482 | .cia_decrypt = aes_dec_blk | 492 | .cia_decrypt = aes_decrypt |
483 | } | 493 | } |
484 | } | 494 | } |
485 | }; | 495 | }; |
diff --git a/arch/x86_64/crypto/aes-x86_64-asm.S b/arch/x86_64/crypto/aes-x86_64-asm.S index f3ba643e144..26b40de4d0b 100644 --- a/arch/x86_64/crypto/aes-x86_64-asm.S +++ b/arch/x86_64/crypto/aes-x86_64-asm.S | |||
@@ -151,9 +151,9 @@ FUNC: movq r1,r2; \ | |||
151 | #define decrypt_final(TAB,OFFSET) \ | 151 | #define decrypt_final(TAB,OFFSET) \ |
152 | round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4) | 152 | round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4) |
153 | 153 | ||
154 | /* void aes_encrypt(stuct crypto_tfm *tfm, u8 *out, const u8 *in) */ | 154 | /* void aes_enc_blk(stuct crypto_tfm *tfm, u8 *out, const u8 *in) */ |
155 | 155 | ||
156 | entry(aes_encrypt,0,enc128,enc192) | 156 | entry(aes_enc_blk,0,enc128,enc192) |
157 | encrypt_round(aes_ft_tab,-96) | 157 | encrypt_round(aes_ft_tab,-96) |
158 | encrypt_round(aes_ft_tab,-80) | 158 | encrypt_round(aes_ft_tab,-80) |
159 | enc192: encrypt_round(aes_ft_tab,-64) | 159 | enc192: encrypt_round(aes_ft_tab,-64) |
@@ -170,9 +170,9 @@ enc128: encrypt_round(aes_ft_tab,-32) | |||
170 | encrypt_final(aes_fl_tab,112) | 170 | encrypt_final(aes_fl_tab,112) |
171 | return | 171 | return |
172 | 172 | ||
173 | /* void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) */ | 173 | /* void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in) */ |
174 | 174 | ||
175 | entry(aes_decrypt,240,dec128,dec192) | 175 | entry(aes_dec_blk,240,dec128,dec192) |
176 | decrypt_round(aes_it_tab,-96) | 176 | decrypt_round(aes_it_tab,-96) |
177 | decrypt_round(aes_it_tab,-80) | 177 | decrypt_round(aes_it_tab,-80) |
178 | dec192: decrypt_round(aes_it_tab,-64) | 178 | dec192: decrypt_round(aes_it_tab,-64) |
diff --git a/arch/x86_64/crypto/aes.c b/arch/x86_64/crypto/aes.c index d6f8e0463b5..68866fab37a 100644 --- a/arch/x86_64/crypto/aes.c +++ b/arch/x86_64/crypto/aes.c | |||
@@ -283,8 +283,18 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
283 | return 0; | 283 | return 0; |
284 | } | 284 | } |
285 | 285 | ||
286 | extern void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in); | 286 | asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in); |
287 | extern void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in); | 287 | asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in); |
288 | |||
289 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
290 | { | ||
291 | aes_enc_blk(tfm, dst, src); | ||
292 | } | ||
293 | |||
294 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
295 | { | ||
296 | aes_dec_blk(tfm, dst, src); | ||
297 | } | ||
288 | 298 | ||
289 | static struct crypto_alg aes_alg = { | 299 | static struct crypto_alg aes_alg = { |
290 | .cra_name = "aes", | 300 | .cra_name = "aes", |