This source file includes following definitions.
- twofish_encrypt
- twofish_decrypt
- fini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 #include <crypto/twofish.h>
42 #include <linux/crypto.h>
43 #include <linux/init.h>
44 #include <linux/module.h>
45 #include <linux/types.h>
46
47 asmlinkage void twofish_enc_blk(struct twofish_ctx *ctx, u8 *dst,
48 const u8 *src);
49 EXPORT_SYMBOL_GPL(twofish_enc_blk);
50 asmlinkage void twofish_dec_blk(struct twofish_ctx *ctx, u8 *dst,
51 const u8 *src);
52 EXPORT_SYMBOL_GPL(twofish_dec_blk);
53
54 static void twofish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
55 {
56 twofish_enc_blk(crypto_tfm_ctx(tfm), dst, src);
57 }
58
59 static void twofish_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
60 {
61 twofish_dec_blk(crypto_tfm_ctx(tfm), dst, src);
62 }
63
64 static struct crypto_alg alg = {
65 .cra_name = "twofish",
66 .cra_driver_name = "twofish-asm",
67 .cra_priority = 200,
68 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
69 .cra_blocksize = TF_BLOCK_SIZE,
70 .cra_ctxsize = sizeof(struct twofish_ctx),
71 .cra_alignmask = 0,
72 .cra_module = THIS_MODULE,
73 .cra_u = {
74 .cipher = {
75 .cia_min_keysize = TF_MIN_KEY_SIZE,
76 .cia_max_keysize = TF_MAX_KEY_SIZE,
77 .cia_setkey = twofish_setkey,
78 .cia_encrypt = twofish_encrypt,
79 .cia_decrypt = twofish_decrypt
80 }
81 }
82 };
83
84 static int __init init(void)
85 {
86 return crypto_register_alg(&alg);
87 }
88
89 static void __exit fini(void)
90 {
91 crypto_unregister_alg(&alg);
92 }
93
94 module_init(init);
95 module_exit(fini);
96
97 MODULE_LICENSE("GPL");
98 MODULE_DESCRIPTION ("Twofish Cipher Algorithm, asm optimized");
99 MODULE_ALIAS_CRYPTO("twofish");
100 MODULE_ALIAS_CRYPTO("twofish-asm");