]> err.no Git - linux-2.6/commitdiff
[CRYPTO] aes: Add wrappers for assembly routines
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 1 Jun 2006 22:42:25 +0000 (08:42 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 26 Jun 2006 07:34:42 +0000 (17:34 +1000)
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>
arch/i386/crypto/aes.c
arch/x86_64/crypto/aes-x86_64-asm.S
arch/x86_64/crypto/aes.c

index b9c7d99160f174a6ea3ed51f23c8a1503741a144..d3806daa3de3b91c3c13c7dedc28ec451809dd67 100644 (file)
@@ -464,6 +464,16 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
        return 0;
 }
 
+static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
+{
+       aes_enc_blk(tfm, dst, src);
+}
+
+static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
+{
+       aes_dec_blk(tfm, dst, src);
+}
+
 static struct crypto_alg aes_alg = {
        .cra_name               =       "aes",
        .cra_driver_name        =       "aes-i586",
@@ -478,8 +488,8 @@ static struct crypto_alg aes_alg = {
                        .cia_min_keysize        =       AES_MIN_KEY_SIZE,
                        .cia_max_keysize        =       AES_MAX_KEY_SIZE,
                        .cia_setkey             =       aes_set_key,
-                       .cia_encrypt            =       aes_enc_blk,
-                       .cia_decrypt            =       aes_dec_blk
+                       .cia_encrypt            =       aes_encrypt,
+                       .cia_decrypt            =       aes_decrypt
                }
        }
 };
index f3ba643e144d08d9fe9feb39089bee181294c82d..26b40de4d0b0299939591aead1d6652e296f60f7 100644 (file)
@@ -151,9 +151,9 @@ FUNC:       movq    r1,r2;                  \
 #define decrypt_final(TAB,OFFSET) \
        round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4)
 
-/* void aes_encrypt(stuct crypto_tfm *tfm, u8 *out, const u8 *in) */
+/* void aes_enc_blk(stuct crypto_tfm *tfm, u8 *out, const u8 *in) */
 
-       entry(aes_encrypt,0,enc128,enc192)
+       entry(aes_enc_blk,0,enc128,enc192)
        encrypt_round(aes_ft_tab,-96)
        encrypt_round(aes_ft_tab,-80)
 enc192:        encrypt_round(aes_ft_tab,-64)
@@ -170,9 +170,9 @@ enc128:     encrypt_round(aes_ft_tab,-32)
        encrypt_final(aes_fl_tab,112)
        return
 
-/* void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) */
+/* void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in) */
 
-       entry(aes_decrypt,240,dec128,dec192)
+       entry(aes_dec_blk,240,dec128,dec192)
        decrypt_round(aes_it_tab,-96)
        decrypt_round(aes_it_tab,-80)
 dec192:        decrypt_round(aes_it_tab,-64)
index d6f8e0463b5df85c1de6bf4cade2efc7a2bf41ae..68866fab37aa15804a76065286e87cb55da85804 100644 (file)
@@ -283,8 +283,18 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
        return 0;
 }
 
-extern void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in);
-extern void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in);
+asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in);
+asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in);
+
+static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
+{
+       aes_enc_blk(tfm, dst, src);
+}
+
+static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
+{
+       aes_dec_blk(tfm, dst, src);
+}
 
 static struct crypto_alg aes_alg = {
        .cra_name               =       "aes",