Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef ASM_X86_SERPENT_SSE2_H
0003 #define ASM_X86_SERPENT_SSE2_H
0004 
0005 #include <linux/crypto.h>
0006 #include <crypto/serpent.h>
0007 
0008 #ifdef CONFIG_X86_32
0009 
0010 #define SERPENT_PARALLEL_BLOCKS 4
0011 
0012 asmlinkage void __serpent_enc_blk_4way(const struct serpent_ctx *ctx, u8 *dst,
0013                        const u8 *src, bool xor);
0014 asmlinkage void serpent_dec_blk_4way(const struct serpent_ctx *ctx, u8 *dst,
0015                      const u8 *src);
0016 
0017 static inline void serpent_enc_blk_xway(const void *ctx, u8 *dst, const u8 *src)
0018 {
0019     __serpent_enc_blk_4way(ctx, dst, src, false);
0020 }
0021 
0022 static inline void serpent_enc_blk_xway_xor(const struct serpent_ctx *ctx,
0023                         u8 *dst, const u8 *src)
0024 {
0025     __serpent_enc_blk_4way(ctx, dst, src, true);
0026 }
0027 
0028 static inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src)
0029 {
0030     serpent_dec_blk_4way(ctx, dst, src);
0031 }
0032 
0033 #else
0034 
0035 #define SERPENT_PARALLEL_BLOCKS 8
0036 
0037 asmlinkage void __serpent_enc_blk_8way(const struct serpent_ctx *ctx, u8 *dst,
0038                        const u8 *src, bool xor);
0039 asmlinkage void serpent_dec_blk_8way(const struct serpent_ctx *ctx, u8 *dst,
0040                      const u8 *src);
0041 
0042 static inline void serpent_enc_blk_xway(const void *ctx, u8 *dst, const u8 *src)
0043 {
0044     __serpent_enc_blk_8way(ctx, dst, src, false);
0045 }
0046 
0047 static inline void serpent_enc_blk_xway_xor(const struct serpent_ctx *ctx,
0048                         u8 *dst, const u8 *src)
0049 {
0050     __serpent_enc_blk_8way(ctx, dst, src, true);
0051 }
0052 
0053 static inline void serpent_dec_blk_xway(const void *ctx, u8 *dst, const u8 *src)
0054 {
0055     serpent_dec_blk_8way(ctx, dst, src);
0056 }
0057 
0058 #endif
0059 
0060 #endif