1 #ifndef ASM_X86_TWOFISH_H
2 #define ASM_X86_TWOFISH_H
4 #include <linux/crypto.h>
5 #include <crypto/twofish.h>
6 #include <crypto/lrw.h>
7 #include <crypto/b128ops.h>
9 struct twofish_lrw_ctx {
10 struct lrw_table_ctx lrw_table;
11 struct twofish_ctx twofish_ctx;
14 struct twofish_xts_ctx {
15 struct twofish_ctx tweak_ctx;
16 struct twofish_ctx crypt_ctx;
19 /* regular block cipher functions from twofish_x86_64 module */
20 asmlinkage void twofish_enc_blk(struct twofish_ctx *ctx, u8 *dst,
22 asmlinkage void twofish_dec_blk(struct twofish_ctx *ctx, u8 *dst,
25 /* 3-way parallel cipher functions */
26 asmlinkage void __twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
27 const u8 *src, bool xor);
28 asmlinkage void twofish_dec_blk_3way(struct twofish_ctx *ctx, u8 *dst,
31 /* 8-way parallel cipher functions */
32 asmlinkage void twofish_ecb_enc_8way(struct twofish_ctx *ctx, u8 *dst,
34 asmlinkage void twofish_ecb_dec_8way(struct twofish_ctx *ctx, u8 *dst,
36 asmlinkage void twofish_cbc_dec_8way(struct twofish_ctx *ctx, u8 *dst,
38 asmlinkage void twofish_ctr_8way(struct twofish_ctx *ctx, u8 *dst,
39 const u8 *src, le128 *iv);
40 asmlinkage void twofish_xts_enc_8way(struct twofish_ctx *ctx, u8 *dst,
41 const u8 *src, le128 *iv);
42 asmlinkage void twofish_xts_dec_8way(struct twofish_ctx *ctx, u8 *dst,
43 const u8 *src, le128 *iv);
45 /* helpers from twofish_x86_64-3way module */
46 extern void twofish_dec_blk_cbc_3way(void *ctx, u128 *dst, const u128 *src);
47 extern void twofish_enc_blk_ctr(void *ctx, u128 *dst, const u128 *src,
49 extern void twofish_enc_blk_ctr_3way(void *ctx, u128 *dst, const u128 *src,
52 extern int lrw_twofish_setkey(struct crypto_tfm *tfm, const u8 *key,
55 extern void lrw_twofish_exit_tfm(struct crypto_tfm *tfm);
57 extern int xts_twofish_setkey(struct crypto_tfm *tfm, const u8 *key,
60 /* helpers from twofish-avx module */
61 extern void twofish_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv);
62 extern void twofish_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv);
64 #endif /* ASM_X86_TWOFISH_H */