]> err.no Git - linux-2.6/blob - arch/x86/crypto/aes_32.c
8556d9561c2072ad76a8770856c6524b0b20f443
[linux-2.6] / arch / x86 / crypto / aes_32.c
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");