]>
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 | ||
89e12654 | 6 | #include <crypto/aes.h> |
a2a892a2 | 7 | |
07bf44f8 HY |
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); | |
10 | ||
11 | void crypto_aes_encrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src) | |
12 | { | |
13 | aes_enc_blk(ctx, dst, src); | |
14 | } | |
15 | EXPORT_SYMBOL_GPL(crypto_aes_encrypt_x86); | |
16 | ||
17 | void crypto_aes_decrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src) | |
18 | { | |
19 | aes_dec_blk(ctx, dst, src); | |
20 | } | |
21 | EXPORT_SYMBOL_GPL(crypto_aes_decrypt_x86); | |
e90b1a2b HX |
22 | |
23 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |
24 | { | |
07bf44f8 | 25 | aes_enc_blk(crypto_tfm_ctx(tfm), dst, src); |
e90b1a2b HX |
26 | } |
27 | ||
28 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |
29 | { | |
07bf44f8 | 30 | aes_dec_blk(crypto_tfm_ctx(tfm), dst, src); |
e90b1a2b | 31 | } |
a2a892a2 AS |
32 | |
33 | static struct crypto_alg aes_alg = { | |
06e1a8f0 SS |
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 | |
a2a892a2 AS |
49 | } |
50 | } | |
51 | }; | |
52 | ||
53 | static int __init aes_init(void) | |
54 | { | |
a2a892a2 AS |
55 | return crypto_register_alg(&aes_alg); |
56 | } | |
57 | ||
58 | static void __exit aes_fini(void) | |
59 | { | |
60 | crypto_unregister_alg(&aes_alg); | |
61 | } | |
62 | ||
63 | module_init(aes_init); | |
64 | module_exit(aes_fini); | |
65 | ||
06e1a8f0 | 66 | MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm, asm optimized"); |
a2a892a2 | 67 | MODULE_LICENSE("GPL"); |
03c6b749 | 68 | MODULE_ALIAS("aes"); |
06e1a8f0 | 69 | MODULE_ALIAS("aes-asm"); |