Add linux-next specific files for 20110831
[linux-2.6/next.git] / arch / x86 / crypto / aes_glue.c
blobbdce3eeeaa37633ead43d56065892cfaa4a53c58
1 /*
2 * Glue Code for the asm optimized version of the AES Cipher Algorithm
4 */
6 #include <linux/module.h>
7 #include <crypto/aes.h>
9 asmlinkage void aes_enc_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in);
10 asmlinkage void aes_dec_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in);
12 void crypto_aes_encrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
14 aes_enc_blk(ctx, dst, src);
16 EXPORT_SYMBOL_GPL(crypto_aes_encrypt_x86);
18 void crypto_aes_decrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
20 aes_dec_blk(ctx, dst, src);
22 EXPORT_SYMBOL_GPL(crypto_aes_decrypt_x86);
24 static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
26 aes_enc_blk(crypto_tfm_ctx(tfm), dst, src);
29 static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
31 aes_dec_blk(crypto_tfm_ctx(tfm), dst, src);
34 static struct crypto_alg aes_alg = {
35 .cra_name = "aes",
36 .cra_driver_name = "aes-asm",
37 .cra_priority = 200,
38 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
39 .cra_blocksize = AES_BLOCK_SIZE,
40 .cra_ctxsize = sizeof(struct crypto_aes_ctx),
41 .cra_module = THIS_MODULE,
42 .cra_list = LIST_HEAD_INIT(aes_alg.cra_list),
43 .cra_u = {
44 .cipher = {
45 .cia_min_keysize = AES_MIN_KEY_SIZE,
46 .cia_max_keysize = AES_MAX_KEY_SIZE,
47 .cia_setkey = crypto_aes_set_key,
48 .cia_encrypt = aes_encrypt,
49 .cia_decrypt = aes_decrypt
54 static int __init aes_init(void)
56 return crypto_register_alg(&aes_alg);
59 static void __exit aes_fini(void)
61 crypto_unregister_alg(&aes_alg);
64 module_init(aes_init);
65 module_exit(aes_fini);
67 MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized");
68 MODULE_LICENSE("GPL");
69 MODULE_ALIAS("aes");
70 MODULE_ALIAS("aes-asm");