twofish.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef ASM_X86_TWOFISH_H
  2. #define ASM_X86_TWOFISH_H
  3. #include <linux/crypto.h>
  4. #include <crypto/twofish.h>
  5. #include <crypto/lrw.h>
  6. #include <crypto/b128ops.h>
  7. struct twofish_lrw_ctx {
  8. struct lrw_table_ctx lrw_table;
  9. struct twofish_ctx twofish_ctx;
  10. };
  11. struct twofish_xts_ctx {
  12. struct twofish_ctx tweak_ctx;
  13. struct twofish_ctx crypt_ctx;
  14. };
  15. /* regular block cipher functions from twofish_x86_64 module */
  16. asmlinkage void twofish_enc_blk(struct twofish_ctx *ctx, u8 *dst,
  17. const u8 *src);
  18. asmlinkage void twofish_dec_blk(struct twofish_ctx *ctx, u8 *dst,
  19. const u8 *src);
  20. /* 3-way parallel cipher functions */
  21. asmlinkage void __twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
  22. const u8 *src, bool xor);
  23. asmlinkage void twofish_dec_blk_3way(struct twofish_ctx *ctx, u8 *dst,
  24. const u8 *src);
  25. /* helpers from twofish_x86_64-3way module */
  26. extern void twofish_dec_blk_cbc_3way(void *ctx, u128 *dst, const u128 *src);
  27. extern void twofish_enc_blk_ctr(void *ctx, u128 *dst, const u128 *src,
  28. u128 *iv);
  29. extern void twofish_enc_blk_ctr_3way(void *ctx, u128 *dst, const u128 *src,
  30. u128 *iv);
  31. extern int lrw_twofish_setkey(struct crypto_tfm *tfm, const u8 *key,
  32. unsigned int keylen);
  33. extern void lrw_twofish_exit_tfm(struct crypto_tfm *tfm);
  34. extern int xts_twofish_setkey(struct crypto_tfm *tfm, const u8 *key,
  35. unsigned int keylen);
  36. #endif /* ASM_X86_TWOFISH_H */