diff options
author | Sebastian Siewior <sebastian@breakpoint.cc> | 2007-11-29 08:15:11 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 16:16:24 -0500 |
commit | 06e1a8f0505426a97292174a959560fd86ea0a3d (patch) | |
tree | 4b002a28d57b35d655d74636b52924a20d4b686b /arch/x86 | |
parent | 28db8e3e38e593d22e2c69942bb1ca7be2a35f05 (diff) |
[CRYPTO] aes-asm: Merge common glue code
32 bit and 64 bit glue code is using (now) the same
piece code. This patch unifies them.
Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/crypto/Makefile | 4 | ||||
-rw-r--r-- | arch/x86/crypto/aes_32.c | 58 | ||||
-rw-r--r-- | arch/x86/crypto/aes_glue.c (renamed from arch/x86/crypto/aes_64.c) | 35 |
3 files changed, 20 insertions, 77 deletions
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile index 46bb609e2444..b8fbb43df6d7 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile | |||
@@ -8,8 +8,8 @@ obj-$(CONFIG_CRYPTO_TWOFISH_586) += twofish-i586.o | |||
8 | obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o | 8 | obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o |
9 | obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o | 9 | obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o |
10 | 10 | ||
11 | aes-i586-y := aes-i586-asm_32.o aes_32.o | 11 | aes-i586-y := aes-i586-asm_32.o aes_glue.o |
12 | twofish-i586-y := twofish-i586-asm_32.o twofish_32.o | 12 | twofish-i586-y := twofish-i586-asm_32.o twofish_32.o |
13 | 13 | ||
14 | aes-x86_64-y := aes-x86_64-asm_64.o aes_64.o | 14 | aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o |
15 | twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_64.o | 15 | twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_64.o |
diff --git a/arch/x86/crypto/aes_32.c b/arch/x86/crypto/aes_32.c deleted file mode 100644 index 8556d9561c20..000000000000 --- a/arch/x86/crypto/aes_32.c +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /* | ||
2 | * Glue Code for optimized 586 assembler version of AES | ||
3 | */ | ||
4 | |||
5 | #include <crypto/aes.h> | ||
6 | #include <linux/module.h> | ||
7 | #include <linux/crypto.h> | ||
8 | |||
9 | asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | ||
10 | asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | ||
11 | |||
12 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
13 | { | ||
14 | aes_enc_blk(tfm, dst, src); | ||
15 | } | ||
16 | |||
17 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
18 | { | ||
19 | aes_dec_blk(tfm, dst, src); | ||
20 | } | ||
21 | |||
22 | static struct crypto_alg aes_alg = { | ||
23 | .cra_name = "aes", | ||
24 | .cra_driver_name = "aes-i586", | ||
25 | .cra_priority = 200, | ||
26 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
27 | .cra_blocksize = AES_BLOCK_SIZE, | ||
28 | .cra_ctxsize = sizeof(struct crypto_aes_ctx), | ||
29 | .cra_module = THIS_MODULE, | ||
30 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), | ||
31 | .cra_u = { | ||
32 | .cipher = { | ||
33 | .cia_min_keysize = AES_MIN_KEY_SIZE, | ||
34 | .cia_max_keysize = AES_MAX_KEY_SIZE, | ||
35 | .cia_setkey = crypto_aes_set_key, | ||
36 | .cia_encrypt = aes_encrypt, | ||
37 | .cia_decrypt = aes_decrypt | ||
38 | } | ||
39 | } | ||
40 | }; | ||
41 | |||
42 | static int __init aes_init(void) | ||
43 | { | ||
44 | return crypto_register_alg(&aes_alg); | ||
45 | } | ||
46 | |||
47 | static void __exit aes_fini(void) | ||
48 | { | ||
49 | crypto_unregister_alg(&aes_alg); | ||
50 | } | ||
51 | |||
52 | module_init(aes_init); | ||
53 | module_exit(aes_fini); | ||
54 | |||
55 | MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, i586 asm optimized"); | ||
56 | MODULE_LICENSE("Dual BSD/GPL"); | ||
57 | MODULE_AUTHOR("Fruhwirth Clemens, James Morris, Brian Gladman, Adam Richter"); | ||
58 | MODULE_ALIAS("aes"); | ||
diff --git a/arch/x86/crypto/aes_64.c b/arch/x86/crypto/aes_glue.c index d7a41a97dd3f..71f457827116 100644 --- a/arch/x86/crypto/aes_64.c +++ b/arch/x86/crypto/aes_glue.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Glue Code for AES Cipher Algorithm | 2 | * Glue Code for the asm optimized version of the AES Cipher Algorithm |
3 | * | 3 | * |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -19,21 +19,21 @@ static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
19 | } | 19 | } |
20 | 20 | ||
21 | static struct crypto_alg aes_alg = { | 21 | static struct crypto_alg aes_alg = { |
22 | .cra_name = "aes", | 22 | .cra_name = "aes", |
23 | .cra_driver_name = "aes-x86_64", | 23 | .cra_driver_name = "aes-asm", |
24 | .cra_priority = 200, | 24 | .cra_priority = 200, |
25 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | 25 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, |
26 | .cra_blocksize = AES_BLOCK_SIZE, | 26 | .cra_blocksize = AES_BLOCK_SIZE, |
27 | .cra_ctxsize = sizeof(struct crypto_aes_ctx), | 27 | .cra_ctxsize = sizeof(struct crypto_aes_ctx), |
28 | .cra_module = THIS_MODULE, | 28 | .cra_module = THIS_MODULE, |
29 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), | 29 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), |
30 | .cra_u = { | 30 | .cra_u = { |
31 | .cipher = { | 31 | .cipher = { |
32 | .cia_min_keysize = AES_MIN_KEY_SIZE, | 32 | .cia_min_keysize = AES_MIN_KEY_SIZE, |
33 | .cia_max_keysize = AES_MAX_KEY_SIZE, | 33 | .cia_max_keysize = AES_MAX_KEY_SIZE, |
34 | .cia_setkey = crypto_aes_set_key, | 34 | .cia_setkey = crypto_aes_set_key, |
35 | .cia_encrypt = aes_encrypt, | 35 | .cia_encrypt = aes_encrypt, |
36 | .cia_decrypt = aes_decrypt | 36 | .cia_decrypt = aes_decrypt |
37 | } | 37 | } |
38 | } | 38 | } |
39 | }; | 39 | }; |
@@ -51,6 +51,7 @@ static void __exit aes_fini(void) | |||
51 | module_init(aes_init); | 51 | module_init(aes_init); |
52 | module_exit(aes_fini); | 52 | module_exit(aes_fini); |
53 | 53 | ||
54 | MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); | 54 | MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized"); |
55 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
56 | MODULE_ALIAS("aes"); | 56 | MODULE_ALIAS("aes"); |
57 | MODULE_ALIAS("aes-asm"); | ||