crypto: x86/blowfish - Remove unused encode parameter
authorPeter Lafreniere <peter@n8pjl.ca>
Tue, 31 Jan 2023 01:27:14 +0000 (20:27 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 10 Feb 2023 09:20:19 +0000 (17:20 +0800)
The blowfish-x86_64 encryption functions have an unused argument. Remove
it.

This involves:
 1 - Removing xor_block() macros.
 2 - Removing handling of fourth argument from __blowfish_enc_blk{,_4way}()
     functions.
 3 - Renaming __blowfish_enc_blk{,_4way}() to blowfish_enc_blk{,_4way}().
 4 - Removing the blowfish_enc_blk{,_4way}() wrappers from
     blowfish_glue.c
 5 - Temporarily using SYM_TYPED_FUNC_START for now indirectly-callable
     encode functions.

Signed-off-by: Peter Lafreniere <peter@n8pjl.ca>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/blowfish-x86_64-asm_64.S
arch/x86/crypto/blowfish_glue.c

index 4a43e07..4c5d4bc 100644 (file)
        bswapq                  RX0; \
        movq RX0,               (RIO);
 
-#define xor_block() \
-       bswapq                  RX0; \
-       xorq RX0,               (RIO);
-
-SYM_FUNC_START(__blowfish_enc_blk)
+SYM_TYPED_FUNC_START(blowfish_enc_blk)
        /* input:
         *      %rdi: ctx
         *      %rsi: dst
         *      %rdx: src
-        *      %rcx: bool, if true: xor output
         */
        movq %r12, %r11;
 
@@ -130,17 +125,11 @@ SYM_FUNC_START(__blowfish_enc_blk)
        add_roundkey_enc(16);
 
        movq %r11, %r12;
-
        movq %r10, RIO;
-       test %cl, %cl;
-       jnz .L__enc_xor;
 
        write_block();
        RET;
-.L__enc_xor:
-       xor_block();
-       RET;
-SYM_FUNC_END(__blowfish_enc_blk)
+SYM_FUNC_END(blowfish_enc_blk)
 
 SYM_TYPED_FUNC_START(blowfish_dec_blk)
        /* input:
@@ -271,29 +260,14 @@ SYM_FUNC_END(blowfish_dec_blk)
        bswapq                  RX3; \
        movq RX3,               24(RIO);
 
-#define xor_block4() \
-       bswapq                  RX0; \
-       xorq RX0,               (RIO); \
-       \
-       bswapq                  RX1; \
-       xorq RX1,               8(RIO); \
-       \
-       bswapq                  RX2; \
-       xorq RX2,               16(RIO); \
-       \
-       bswapq                  RX3; \
-       xorq RX3,               24(RIO);
-
-SYM_FUNC_START(__blowfish_enc_blk_4way)
+SYM_TYPED_FUNC_START(blowfish_enc_blk_4way)
        /* input:
         *      %rdi: ctx
         *      %rsi: dst
         *      %rdx: src
-        *      %rcx: bool, if true: xor output
         */
        pushq %r12;
        pushq %rbx;
-       pushq %rcx;
 
        movq %rdi, CTX
        movq %rsi, %r11;
@@ -313,25 +287,13 @@ SYM_FUNC_START(__blowfish_enc_blk_4way)
        round_enc4(14);
        add_preloaded_roundkey4();
 
-       popq %r12;
        movq %r11, RIO;
-
-       test %r12b, %r12b;
-       jnz .L__enc_xor4;
-
        write_block4();
 
        popq %rbx;
        popq %r12;
        RET;
-
-.L__enc_xor4:
-       xor_block4();
-
-       popq %rbx;
-       popq %r12;
-       RET;
-SYM_FUNC_END(__blowfish_enc_blk_4way)
+SYM_FUNC_END(blowfish_enc_blk_4way)
 
 SYM_TYPED_FUNC_START(blowfish_dec_blk_4way)
        /* input:
index 019c64c..13a6664 100644 (file)
 #include <linux/types.h>
 
 /* regular block cipher functions */
-asmlinkage void __blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src,
-                                  bool xor);
+asmlinkage void blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src);
 asmlinkage void blowfish_dec_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src);
 
 /* 4-way parallel cipher functions */
-asmlinkage void __blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
-                                       const u8 *src, bool xor);
+asmlinkage void blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
+                                     const u8 *src);
 asmlinkage void blowfish_dec_blk_4way(struct bf_ctx *ctx, u8 *dst,
                                      const u8 *src);
 
-static inline void blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src)
-{
-       __blowfish_enc_blk(ctx, dst, src, false);
-}
-
-static inline void blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
-                                        const u8 *src)
-{
-       __blowfish_enc_blk_4way(ctx, dst, src, false);
-}
-
 static void blowfish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
 {
        blowfish_enc_blk(crypto_tfm_ctx(tfm), dst, src);