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/crypto/aes_glue.c | |
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/crypto/aes_glue.c')
-rw-r--r-- | arch/x86/crypto/aes_glue.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/x86/crypto/aes_glue.c b/arch/x86/crypto/aes_glue.c new file mode 100644 index 000000000000..71f457827116 --- /dev/null +++ b/arch/x86/crypto/aes_glue.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Glue Code for the asm optimized version of the AES Cipher Algorithm | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #include <crypto/aes.h> | ||
7 | |||
8 | asmlinkage void aes_enc_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in); | ||
9 | asmlinkage void aes_dec_blk(struct crypto_tfm *tfm, u8 *out, const u8 *in); | ||
10 | |||
11 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
12 | { | ||
13 | aes_enc_blk(tfm, dst, src); | ||
14 | } | ||
15 | |||
16 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
17 | { | ||
18 | aes_dec_blk(tfm, dst, src); | ||
19 | } | ||
20 | |||
21 | static struct crypto_alg aes_alg = { | ||
22 | .cra_name = "aes", | ||
23 | .cra_driver_name = "aes-asm", | ||
24 | .cra_priority = 200, | ||
25 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
26 | .cra_blocksize = AES_BLOCK_SIZE, | ||
27 | .cra_ctxsize = sizeof(struct crypto_aes_ctx), | ||
28 | .cra_module = THIS_MODULE, | ||
29 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), | ||
30 | .cra_u = { | ||
31 | .cipher = { | ||
32 | .cia_min_keysize = AES_MIN_KEY_SIZE, | ||
33 | .cia_max_keysize = AES_MAX_KEY_SIZE, | ||
34 | .cia_setkey = crypto_aes_set_key, | ||
35 | .cia_encrypt = aes_encrypt, | ||
36 | .cia_decrypt = aes_decrypt | ||
37 | } | ||
38 | } | ||
39 | }; | ||
40 | |||
41 | static int __init aes_init(void) | ||
42 | { | ||
43 | return crypto_register_alg(&aes_alg); | ||
44 | } | ||
45 | |||
46 | static void __exit aes_fini(void) | ||
47 | { | ||
48 | crypto_unregister_alg(&aes_alg); | ||
49 | } | ||
50 | |||
51 | module_init(aes_init); | ||
52 | module_exit(aes_fini); | ||
53 | |||
54 | MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized"); | ||
55 | MODULE_LICENSE("GPL"); | ||
56 | MODULE_ALIAS("aes"); | ||
57 | MODULE_ALIAS("aes-asm"); | ||