cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

serpent-sse2.h (1541B)


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