18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef ASM_X86_SERPENT_SSE2_H
38c2ecf20Sopenharmony_ci#define ASM_X86_SERPENT_SSE2_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/crypto.h>
68c2ecf20Sopenharmony_ci#include <crypto/serpent.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#define SERPENT_PARALLEL_BLOCKS 4
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciasmlinkage void __serpent_enc_blk_4way(const struct serpent_ctx *ctx, u8 *dst,
138c2ecf20Sopenharmony_ci				       const u8 *src, bool xor);
148c2ecf20Sopenharmony_ciasmlinkage void serpent_dec_blk_4way(const struct serpent_ctx *ctx, u8 *dst,
158c2ecf20Sopenharmony_ci				     const u8 *src);
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistatic inline void serpent_enc_blk_xway(const void *ctx, u8 *dst, const u8 *src)
188c2ecf20Sopenharmony_ci{
198c2ecf20Sopenharmony_ci	__serpent_enc_blk_4way(ctx, dst, src, false);
208c2ecf20Sopenharmony_ci}
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistatic inline void serpent_enc_blk_xway_xor(const struct serpent_ctx *ctx,
238c2ecf20Sopenharmony_ci					    u8 *dst, const u8 *src)
248c2ecf20Sopenharmony_ci{
258c2ecf20Sopenharmony_ci	__serpent_enc_blk_4way(ctx, dst, src, true);
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistatic inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src)
298c2ecf20Sopenharmony_ci{
308c2ecf20Sopenharmony_ci	serpent_dec_blk_4way(ctx, dst, src);
318c2ecf20Sopenharmony_ci}
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#else
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define SERPENT_PARALLEL_BLOCKS 8
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciasmlinkage void __serpent_enc_blk_8way(const struct serpent_ctx *ctx, u8 *dst,
388c2ecf20Sopenharmony_ci				       const u8 *src, bool xor);
398c2ecf20Sopenharmony_ciasmlinkage void serpent_dec_blk_8way(const struct serpent_ctx *ctx, u8 *dst,
408c2ecf20Sopenharmony_ci				     const u8 *src);
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistatic inline void serpent_enc_blk_xway(const void *ctx, u8 *dst, const u8 *src)
438c2ecf20Sopenharmony_ci{
448c2ecf20Sopenharmony_ci	__serpent_enc_blk_8way(ctx, dst, src, false);
458c2ecf20Sopenharmony_ci}
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cistatic inline void serpent_enc_blk_xway_xor(const struct serpent_ctx *ctx,
488c2ecf20Sopenharmony_ci					    u8 *dst, const u8 *src)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci	__serpent_enc_blk_8way(ctx, dst, src, true);
518c2ecf20Sopenharmony_ci}
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cistatic inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src)
548c2ecf20Sopenharmony_ci{
558c2ecf20Sopenharmony_ci	serpent_dec_blk_8way(ctx, dst, src);
568c2ecf20Sopenharmony_ci}
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#endif
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif
61