crypto: x86/twofish - assembler clean-ups: use ENTRY/ENDPROC, localize jump labels
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
ac9d55dd42
commit
d3f5188dfe
4 changed files with 29 additions and 48 deletions
|
@ -23,6 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/linkage.h>
|
||||||
#include "glue_helper-asm-avx.S"
|
#include "glue_helper-asm-avx.S"
|
||||||
|
|
||||||
.file "twofish-avx-x86_64-asm_64.S"
|
.file "twofish-avx-x86_64-asm_64.S"
|
||||||
|
@ -243,8 +244,6 @@
|
||||||
vpxor x3, wkey, x3;
|
vpxor x3, wkey, x3;
|
||||||
|
|
||||||
.align 8
|
.align 8
|
||||||
.type __twofish_enc_blk8,@function;
|
|
||||||
|
|
||||||
__twofish_enc_blk8:
|
__twofish_enc_blk8:
|
||||||
/* input:
|
/* input:
|
||||||
* %rdi: ctx, CTX
|
* %rdi: ctx, CTX
|
||||||
|
@ -284,10 +283,9 @@ __twofish_enc_blk8:
|
||||||
outunpack_blocks(RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2);
|
outunpack_blocks(RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2);
|
||||||
|
|
||||||
ret;
|
ret;
|
||||||
|
ENDPROC(__twofish_enc_blk8)
|
||||||
|
|
||||||
.align 8
|
.align 8
|
||||||
.type __twofish_dec_blk8,@function;
|
|
||||||
|
|
||||||
__twofish_dec_blk8:
|
__twofish_dec_blk8:
|
||||||
/* input:
|
/* input:
|
||||||
* %rdi: ctx, CTX
|
* %rdi: ctx, CTX
|
||||||
|
@ -325,12 +323,9 @@ __twofish_dec_blk8:
|
||||||
outunpack_blocks(RA2, RB2, RC2, RD2, RK1, RX0, RY0, RK2);
|
outunpack_blocks(RA2, RB2, RC2, RD2, RK1, RX0, RY0, RK2);
|
||||||
|
|
||||||
ret;
|
ret;
|
||||||
|
ENDPROC(__twofish_dec_blk8)
|
||||||
|
|
||||||
.align 8
|
ENTRY(twofish_ecb_enc_8way)
|
||||||
.global twofish_ecb_enc_8way
|
|
||||||
.type twofish_ecb_enc_8way,@function;
|
|
||||||
|
|
||||||
twofish_ecb_enc_8way:
|
|
||||||
/* input:
|
/* input:
|
||||||
* %rdi: ctx, CTX
|
* %rdi: ctx, CTX
|
||||||
* %rsi: dst
|
* %rsi: dst
|
||||||
|
@ -346,12 +341,9 @@ twofish_ecb_enc_8way:
|
||||||
store_8way(%r11, RC1, RD1, RA1, RB1, RC2, RD2, RA2, RB2);
|
store_8way(%r11, RC1, RD1, RA1, RB1, RC2, RD2, RA2, RB2);
|
||||||
|
|
||||||
ret;
|
ret;
|
||||||
|
ENDPROC(twofish_ecb_enc_8way)
|
||||||
|
|
||||||
.align 8
|
ENTRY(twofish_ecb_dec_8way)
|
||||||
.global twofish_ecb_dec_8way
|
|
||||||
.type twofish_ecb_dec_8way,@function;
|
|
||||||
|
|
||||||
twofish_ecb_dec_8way:
|
|
||||||
/* input:
|
/* input:
|
||||||
* %rdi: ctx, CTX
|
* %rdi: ctx, CTX
|
||||||
* %rsi: dst
|
* %rsi: dst
|
||||||
|
@ -367,12 +359,9 @@ twofish_ecb_dec_8way:
|
||||||
store_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
|
store_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
|
||||||
|
|
||||||
ret;
|
ret;
|
||||||
|
ENDPROC(twofish_ecb_dec_8way)
|
||||||
|
|
||||||
.align 8
|
ENTRY(twofish_cbc_dec_8way)
|
||||||
.global twofish_cbc_dec_8way
|
|
||||||
.type twofish_cbc_dec_8way,@function;
|
|
||||||
|
|
||||||
twofish_cbc_dec_8way:
|
|
||||||
/* input:
|
/* input:
|
||||||
* %rdi: ctx, CTX
|
* %rdi: ctx, CTX
|
||||||
* %rsi: dst
|
* %rsi: dst
|
||||||
|
@ -393,12 +382,9 @@ twofish_cbc_dec_8way:
|
||||||
popq %r12;
|
popq %r12;
|
||||||
|
|
||||||
ret;
|
ret;
|
||||||
|
ENDPROC(twofish_cbc_dec_8way)
|
||||||
|
|
||||||
.align 8
|
ENTRY(twofish_ctr_8way)
|
||||||
.global twofish_ctr_8way
|
|
||||||
.type twofish_ctr_8way,@function;
|
|
||||||
|
|
||||||
twofish_ctr_8way:
|
|
||||||
/* input:
|
/* input:
|
||||||
* %rdi: ctx, CTX
|
* %rdi: ctx, CTX
|
||||||
* %rsi: dst
|
* %rsi: dst
|
||||||
|
@ -421,3 +407,4 @@ twofish_ctr_8way:
|
||||||
popq %r12;
|
popq %r12;
|
||||||
|
|
||||||
ret;
|
ret;
|
||||||
|
ENDPROC(twofish_ctr_8way)
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
.file "twofish-i586-asm.S"
|
.file "twofish-i586-asm.S"
|
||||||
.text
|
.text
|
||||||
|
|
||||||
|
#include <linux/linkage.h>
|
||||||
#include <asm/asm-offsets.h>
|
#include <asm/asm-offsets.h>
|
||||||
|
|
||||||
/* return address at 0 */
|
/* return address at 0 */
|
||||||
|
@ -219,11 +220,7 @@
|
||||||
xor %esi, d ## D;\
|
xor %esi, d ## D;\
|
||||||
ror $1, d ## D;
|
ror $1, d ## D;
|
||||||
|
|
||||||
.align 4
|
ENTRY(twofish_enc_blk)
|
||||||
.global twofish_enc_blk
|
|
||||||
.global twofish_dec_blk
|
|
||||||
|
|
||||||
twofish_enc_blk:
|
|
||||||
push %ebp /* save registers according to calling convention*/
|
push %ebp /* save registers according to calling convention*/
|
||||||
push %ebx
|
push %ebx
|
||||||
push %esi
|
push %esi
|
||||||
|
@ -277,8 +274,9 @@ twofish_enc_blk:
|
||||||
pop %ebp
|
pop %ebp
|
||||||
mov $1, %eax
|
mov $1, %eax
|
||||||
ret
|
ret
|
||||||
|
ENDPROC(twofish_enc_blk)
|
||||||
|
|
||||||
twofish_dec_blk:
|
ENTRY(twofish_dec_blk)
|
||||||
push %ebp /* save registers according to calling convention*/
|
push %ebp /* save registers according to calling convention*/
|
||||||
push %ebx
|
push %ebx
|
||||||
push %esi
|
push %esi
|
||||||
|
@ -333,3 +331,4 @@ twofish_dec_blk:
|
||||||
pop %ebp
|
pop %ebp
|
||||||
mov $1, %eax
|
mov $1, %eax
|
||||||
ret
|
ret
|
||||||
|
ENDPROC(twofish_dec_blk)
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/linkage.h>
|
||||||
|
|
||||||
.file "twofish-x86_64-asm-3way.S"
|
.file "twofish-x86_64-asm-3way.S"
|
||||||
.text
|
.text
|
||||||
|
|
||||||
|
@ -214,11 +216,7 @@
|
||||||
rorq $32, RAB2; \
|
rorq $32, RAB2; \
|
||||||
outunpack3(mov, RIO, 2, RAB, 2);
|
outunpack3(mov, RIO, 2, RAB, 2);
|
||||||
|
|
||||||
.align 8
|
ENTRY(__twofish_enc_blk_3way)
|
||||||
.global __twofish_enc_blk_3way
|
|
||||||
.type __twofish_enc_blk_3way,@function;
|
|
||||||
|
|
||||||
__twofish_enc_blk_3way:
|
|
||||||
/* input:
|
/* input:
|
||||||
* %rdi: ctx, CTX
|
* %rdi: ctx, CTX
|
||||||
* %rsi: dst
|
* %rsi: dst
|
||||||
|
@ -250,7 +248,7 @@ __twofish_enc_blk_3way:
|
||||||
popq %rbp; /* bool xor */
|
popq %rbp; /* bool xor */
|
||||||
|
|
||||||
testb %bpl, %bpl;
|
testb %bpl, %bpl;
|
||||||
jnz __enc_xor3;
|
jnz .L__enc_xor3;
|
||||||
|
|
||||||
outunpack_enc3(mov);
|
outunpack_enc3(mov);
|
||||||
|
|
||||||
|
@ -262,7 +260,7 @@ __twofish_enc_blk_3way:
|
||||||
popq %r15;
|
popq %r15;
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
__enc_xor3:
|
.L__enc_xor3:
|
||||||
outunpack_enc3(xor);
|
outunpack_enc3(xor);
|
||||||
|
|
||||||
popq %rbx;
|
popq %rbx;
|
||||||
|
@ -272,11 +270,9 @@ __enc_xor3:
|
||||||
popq %r14;
|
popq %r14;
|
||||||
popq %r15;
|
popq %r15;
|
||||||
ret;
|
ret;
|
||||||
|
ENDPROC(__twofish_enc_blk_3way)
|
||||||
|
|
||||||
.global twofish_dec_blk_3way
|
ENTRY(twofish_dec_blk_3way)
|
||||||
.type twofish_dec_blk_3way,@function;
|
|
||||||
|
|
||||||
twofish_dec_blk_3way:
|
|
||||||
/* input:
|
/* input:
|
||||||
* %rdi: ctx, CTX
|
* %rdi: ctx, CTX
|
||||||
* %rsi: dst
|
* %rsi: dst
|
||||||
|
@ -313,4 +309,4 @@ twofish_dec_blk_3way:
|
||||||
popq %r14;
|
popq %r14;
|
||||||
popq %r15;
|
popq %r15;
|
||||||
ret;
|
ret;
|
||||||
|
ENDPROC(twofish_dec_blk_3way)
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
.file "twofish-x86_64-asm.S"
|
.file "twofish-x86_64-asm.S"
|
||||||
.text
|
.text
|
||||||
|
|
||||||
|
#include <linux/linkage.h>
|
||||||
#include <asm/asm-offsets.h>
|
#include <asm/asm-offsets.h>
|
||||||
|
|
||||||
#define a_offset 0
|
#define a_offset 0
|
||||||
|
@ -214,11 +215,7 @@
|
||||||
xor %r8d, d ## D;\
|
xor %r8d, d ## D;\
|
||||||
ror $1, d ## D;
|
ror $1, d ## D;
|
||||||
|
|
||||||
.align 8
|
ENTRY(twofish_enc_blk)
|
||||||
.global twofish_enc_blk
|
|
||||||
.global twofish_dec_blk
|
|
||||||
|
|
||||||
twofish_enc_blk:
|
|
||||||
pushq R1
|
pushq R1
|
||||||
|
|
||||||
/* %rdi contains the ctx address */
|
/* %rdi contains the ctx address */
|
||||||
|
@ -269,8 +266,9 @@ twofish_enc_blk:
|
||||||
popq R1
|
popq R1
|
||||||
movq $1,%rax
|
movq $1,%rax
|
||||||
ret
|
ret
|
||||||
|
ENDPROC(twofish_enc_blk)
|
||||||
|
|
||||||
twofish_dec_blk:
|
ENTRY(twofish_dec_blk)
|
||||||
pushq R1
|
pushq R1
|
||||||
|
|
||||||
/* %rdi contains the ctx address */
|
/* %rdi contains the ctx address */
|
||||||
|
@ -320,3 +318,4 @@ twofish_dec_blk:
|
||||||
popq R1
|
popq R1
|
||||||
movq $1,%rax
|
movq $1,%rax
|
||||||
ret
|
ret
|
||||||
|
ENDPROC(twofish_dec_blk)
|
||||||
|
|
Loading…
Reference in a new issue