Commit | Line | Data |
---|---|---|
a2a892a2 | 1 | /* |
06e1a8f0 | 2 | * Glue Code for the asm optimized version of the AES Cipher Algorithm |
a2a892a2 | 3 | * |
a2a892a2 AS |
4 | */ |
5 | ||
7c52d551 | 6 | #include <linux/module.h> |
89e12654 | 7 | #include <crypto/aes.h> |
70ef2601 | 8 | #include <asm/crypto/aes.h> |
a2a892a2 | 9 | |
07bf44f8 HY |
10 | asmlinkage void aes_enc_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in); |
11 | asmlinkage void aes_dec_blk(struct crypto_aes_ctx *ctx, u8 *out, const u8 *in); | |
12 | ||
13 | void crypto_aes_encrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src) | |
14 | { | |
15 | aes_enc_blk(ctx, dst, src); | |
16 | } | |
17 | EXPORT_SYMBOL_GPL(crypto_aes_encrypt_x86); | |
18 | ||
19 | void crypto_aes_decrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src) | |
20 | { | |
21 | aes_dec_blk(ctx, dst, src); | |
22 | } | |
23 | EXPORT_SYMBOL_GPL(crypto_aes_decrypt_x86); | |
e90b1a2b HX |
24 | |
25 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |
26 | { | |
07bf44f8 | 27 | aes_enc_blk(crypto_tfm_ctx(tfm), dst, src); |
e90b1a2b HX |
28 | } |
29 | ||
30 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |
31 | { | |
07bf44f8 | 32 | aes_dec_blk(crypto_tfm_ctx(tfm), dst, src); |
e90b1a2b | 33 | } |
a2a892a2 AS |
34 | |
35 | static struct crypto_alg aes_alg = { | |
06e1a8f0 SS |
36 | .cra_name = "aes", |
37 | .cra_driver_name = "aes-asm", | |
38 | .cra_priority = 200, | |
39 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | |
40 | .cra_blocksize = AES_BLOCK_SIZE, | |
41 | .cra_ctxsize = sizeof(struct crypto_aes_ctx), | |
42 | .cra_module = THIS_MODULE, | |
06e1a8f0 SS |
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 | |
a2a892a2 AS |
50 | } |
51 | } | |
52 | }; | |
53 | ||
54 | static int __init aes_init(void) | |
55 | { | |
a2a892a2 AS |
56 | return crypto_register_alg(&aes_alg); |
57 | } | |
58 | ||
59 | static void __exit aes_fini(void) | |
60 | { | |
61 | crypto_unregister_alg(&aes_alg); | |
62 | } | |
63 | ||
64 | module_init(aes_init); | |
65 | module_exit(aes_fini); | |
66 | ||
06e1a8f0 | 67 | MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized"); |
a2a892a2 | 68 | MODULE_LICENSE("GPL"); |
03c6b749 | 69 | MODULE_ALIAS("aes"); |
06e1a8f0 | 70 | MODULE_ALIAS("aes-asm"); |