Merge branch 'for-linus' of git://neil.brown.name/md
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / x86 / crypto / aes_glue.c
blob49ae9fe32b22079dc22c8d0bf121410285010d3d
1 /*
2 * Glue Code for the asm optimized version of the AES Cipher Algorithm
4 */
6 #include <crypto/aes.h>
8 asmlinkage void aes_enc_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in);
9 asmlinkage void aes_dec_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in);
11 void crypto_aes_encrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
13 aes_enc_blk(ctx, dst, src);
15 EXPORT_SYMBOL_GPL(crypto_aes_encrypt_x86);
17 void crypto_aes_decrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
19 aes_dec_blk(ctx, dst, src);
21 EXPORT_SYMBOL_GPL(crypto_aes_decrypt_x86);
23 static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
25 aes_enc_blk(crypto_tfm_ctx(tfm), dst, src);
28 static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
30 aes_dec_blk(crypto_tfm_ctx(tfm), dst, src);
33 static struct crypto_alg aes_alg = {
34 .cra_name = "aes",
35 .cra_driver_name = "aes-asm",
36 .cra_priority = 200,
37 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
38 .cra_blocksize = AES_BLOCK_SIZE,
39 .cra_ctxsize = sizeof(struct crypto_aes_ctx),
40 .cra_module = THIS_MODULE,
41 .cra_list = LIST_HEAD_INIT(aes_alg.cra_list),
42 .cra_u = {
43 .cipher = {
44 .cia_min_keysize = AES_MIN_KEY_SIZE,
45 .cia_max_keysize = AES_MAX_KEY_SIZE,
46 .cia_setkey = crypto_aes_set_key,
47 .cia_encrypt = aes_encrypt,
48 .cia_decrypt = aes_decrypt
53 static int __init aes_init(void)
55 return crypto_register_alg(&aes_alg);
58 static void __exit aes_fini(void)
60 crypto_unregister_alg(&aes_alg);
63 module_init(aes_init);
64 module_exit(aes_fini);
66 MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized");
67 MODULE_LICENSE("GPL");
68 MODULE_ALIAS("aes");
69 MODULE_ALIAS("aes-asm");