162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef ASM_X86_SERPENT_SSE2_H
362306a36Sopenharmony_ci#define ASM_X86_SERPENT_SSE2_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/crypto.h>
662306a36Sopenharmony_ci#include <crypto/serpent.h>
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifdef CONFIG_X86_32
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#define SERPENT_PARALLEL_BLOCKS 4
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciasmlinkage void __serpent_enc_blk_4way(const struct serpent_ctx *ctx, u8 *dst,
1362306a36Sopenharmony_ci				       const u8 *src, bool xor);
1462306a36Sopenharmony_ciasmlinkage void serpent_dec_blk_4way(const struct serpent_ctx *ctx, u8 *dst,
1562306a36Sopenharmony_ci				     const u8 *src);
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistatic inline void serpent_enc_blk_xway(const void *ctx, u8 *dst, const u8 *src)
1862306a36Sopenharmony_ci{
1962306a36Sopenharmony_ci	__serpent_enc_blk_4way(ctx, dst, src, false);
2062306a36Sopenharmony_ci}
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cistatic inline void serpent_enc_blk_xway_xor(const struct serpent_ctx *ctx,
2362306a36Sopenharmony_ci					    u8 *dst, const u8 *src)
2462306a36Sopenharmony_ci{
2562306a36Sopenharmony_ci	__serpent_enc_blk_4way(ctx, dst, src, true);
2662306a36Sopenharmony_ci}
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_cistatic inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src)
2962306a36Sopenharmony_ci{
3062306a36Sopenharmony_ci	serpent_dec_blk_4way(ctx, dst, src);
3162306a36Sopenharmony_ci}
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#else
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define SERPENT_PARALLEL_BLOCKS 8
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciasmlinkage void __serpent_enc_blk_8way(const struct serpent_ctx *ctx, u8 *dst,
3862306a36Sopenharmony_ci				       const u8 *src, bool xor);
3962306a36Sopenharmony_ciasmlinkage void serpent_dec_blk_8way(const struct serpent_ctx *ctx, u8 *dst,
4062306a36Sopenharmony_ci				     const u8 *src);
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cistatic inline void serpent_enc_blk_xway(const void *ctx, u8 *dst, const u8 *src)
4362306a36Sopenharmony_ci{
4462306a36Sopenharmony_ci	__serpent_enc_blk_8way(ctx, dst, src, false);
4562306a36Sopenharmony_ci}
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_cistatic inline void serpent_enc_blk_xway_xor(const struct serpent_ctx *ctx,
4862306a36Sopenharmony_ci					    u8 *dst, const u8 *src)
4962306a36Sopenharmony_ci{
5062306a36Sopenharmony_ci	__serpent_enc_blk_8way(ctx, dst, src, true);
5162306a36Sopenharmony_ci}
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_cistatic inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src)
5462306a36Sopenharmony_ci{
5562306a36Sopenharmony_ci	serpent_dec_blk_8way(ctx, dst, src);
5662306a36Sopenharmony_ci}
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#endif
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#endif
61