serpent-sse2.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef ASM_X86_SERPENT_SSE2_H
  3. #define ASM_X86_SERPENT_SSE2_H
  4. #include <linux/crypto.h>
  5. #include <crypto/serpent.h>
  6. #ifdef CONFIG_X86_32
  7. #define SERPENT_PARALLEL_BLOCKS 4
  8. asmlinkage void __serpent_enc_blk_4way(const struct serpent_ctx *ctx, u8 *dst,
  9. const u8 *src, bool xor);
  10. asmlinkage void serpent_dec_blk_4way(const struct serpent_ctx *ctx, u8 *dst,
  11. const u8 *src);
  12. static inline void serpent_enc_blk_xway(const void *ctx, u8 *dst, const u8 *src)
  13. {
  14. __serpent_enc_blk_4way(ctx, dst, src, false);
  15. }
  16. static inline void serpent_enc_blk_xway_xor(const struct serpent_ctx *ctx,
  17. u8 *dst, const u8 *src)
  18. {
  19. __serpent_enc_blk_4way(ctx, dst, src, true);
  20. }
  21. static inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src)
  22. {
  23. serpent_dec_blk_4way(ctx, dst, src);
  24. }
  25. #else
  26. #define SERPENT_PARALLEL_BLOCKS 8
  27. asmlinkage void __serpent_enc_blk_8way(const struct serpent_ctx *ctx, u8 *dst,
  28. const u8 *src, bool xor);
  29. asmlinkage void serpent_dec_blk_8way(const struct serpent_ctx *ctx, u8 *dst,
  30. const u8 *src);
  31. static inline void serpent_enc_blk_xway(const void *ctx, u8 *dst, const u8 *src)
  32. {
  33. __serpent_enc_blk_8way(ctx, dst, src, false);
  34. }
  35. static inline void serpent_enc_blk_xway_xor(const struct serpent_ctx *ctx,
  36. u8 *dst, const u8 *src)
  37. {
  38. __serpent_enc_blk_8way(ctx, dst, src, true);
  39. }
  40. static inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src)
  41. {
  42. serpent_dec_blk_8way(ctx, dst, src);
  43. }
  44. #endif
  45. #endif