Skip to content

Commit

Permalink
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:
 - Fix compiler warnings in inside-secure
 - Fix LS1021A support in caam
 - Avoid using RBP in x86 crypto code
 - Fix bug in talitos that prevents hashing with algif
 - Fix bugs talitos hashing code that cause incorrect hash result
 - Fix memory freeing path bug in drbg
 - Fix af_alg crash when two SG lists are chained

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: af_alg - update correct dst SGL entry
  crypto: caam - fix LS1021A support on ARMv7 multiplatform kernel
  crypto: inside-secure - fix gcc-4.9 warnings
  crypto: talitos - Don't provide setkey for non hmac hashing algs
  crypto: talitos - fix hashing
  crypto: talitos - fix sha224
  crypto: x86/twofish - Fix RBP usage
  crypto: sha512-avx2 - Fix RBP usage
  crypto: x86/sha256-ssse3 - Fix RBP usage
  crypto: x86/sha256-avx2 - Fix RBP usage
  crypto: x86/sha256-avx - Fix RBP usage
  crypto: x86/sha1-ssse3 - Fix RBP usage
  crypto: x86/sha1-avx2 - Fix RBP usage
  crypto: x86/des3_ede - Fix RBP usage
  crypto: x86/cast6 - Fix RBP usage
  crypto: x86/cast5 - Fix RBP usage
  crypto: x86/camellia - Fix RBP usage
  crypto: x86/blowfish - Fix RBP usage
  crypto: drbg - fix freeing of resources
  • Loading branch information
torvalds committed Sep 22, 2017
2 parents 6e80ecd + e117765 commit 7a6d007
Show file tree
Hide file tree
Showing 20 changed files with 236 additions and 212 deletions.
48 changes: 26 additions & 22 deletions arch/x86/crypto/blowfish-x86_64-asm_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define s3 ((16 + 2 + (3 * 256)) * 4)

/* register macros */
#define CTX %rdi
#define CTX %r12
#define RIO %rsi

#define RX0 %rax
Expand All @@ -56,12 +56,12 @@
#define RX2bh %ch
#define RX3bh %dh

#define RT0 %rbp
#define RT0 %rdi
#define RT1 %rsi
#define RT2 %r8
#define RT3 %r9

#define RT0d %ebp
#define RT0d %edi
#define RT1d %esi
#define RT2d %r8d
#define RT3d %r9d
Expand Down Expand Up @@ -120,13 +120,14 @@

ENTRY(__blowfish_enc_blk)
/* input:
* %rdi: ctx, CTX
* %rdi: ctx
* %rsi: dst
* %rdx: src
* %rcx: bool, if true: xor output
*/
movq %rbp, %r11;
movq %r12, %r11;

movq %rdi, CTX;
movq %rsi, %r10;
movq %rdx, RIO;

Expand All @@ -142,7 +143,7 @@ ENTRY(__blowfish_enc_blk)
round_enc(14);
add_roundkey_enc(16);

movq %r11, %rbp;
movq %r11, %r12;

movq %r10, RIO;
test %cl, %cl;
Expand All @@ -157,12 +158,13 @@ ENDPROC(__blowfish_enc_blk)

ENTRY(blowfish_dec_blk)
/* input:
* %rdi: ctx, CTX
* %rdi: ctx
* %rsi: dst
* %rdx: src
*/
movq %rbp, %r11;
movq %r12, %r11;

movq %rdi, CTX;
movq %rsi, %r10;
movq %rdx, RIO;

Expand All @@ -181,7 +183,7 @@ ENTRY(blowfish_dec_blk)
movq %r10, RIO;
write_block();

movq %r11, %rbp;
movq %r11, %r12;

ret;
ENDPROC(blowfish_dec_blk)
Expand Down Expand Up @@ -298,20 +300,21 @@ ENDPROC(blowfish_dec_blk)

ENTRY(__blowfish_enc_blk_4way)
/* input:
* %rdi: ctx, CTX
* %rdi: ctx
* %rsi: dst
* %rdx: src
* %rcx: bool, if true: xor output
*/
pushq %rbp;
pushq %r12;
pushq %rbx;
pushq %rcx;

preload_roundkey_enc(0);

movq %rdi, CTX
movq %rsi, %r11;
movq %rdx, RIO;

preload_roundkey_enc(0);

read_block4();

round_enc4(0);
Expand All @@ -324,39 +327,40 @@ ENTRY(__blowfish_enc_blk_4way)
round_enc4(14);
add_preloaded_roundkey4();

popq %rbp;
popq %r12;
movq %r11, RIO;

test %bpl, %bpl;
test %r12b, %r12b;
jnz .L__enc_xor4;

write_block4();

popq %rbx;
popq %rbp;
popq %r12;
ret;

.L__enc_xor4:
xor_block4();

popq %rbx;
popq %rbp;
popq %r12;
ret;
ENDPROC(__blowfish_enc_blk_4way)

ENTRY(blowfish_dec_blk_4way)
/* input:
* %rdi: ctx, CTX
* %rdi: ctx
* %rsi: dst
* %rdx: src
*/
pushq %rbp;
pushq %r12;
pushq %rbx;
preload_roundkey_dec(17);

movq %rsi, %r11;
movq %rdi, CTX;
movq %rsi, %r11
movq %rdx, RIO;

preload_roundkey_dec(17);
read_block4();

round_dec4(17);
Expand All @@ -373,7 +377,7 @@ ENTRY(blowfish_dec_blk_4way)
write_block4();

popq %rbx;
popq %rbp;
popq %r12;

ret;
ENDPROC(blowfish_dec_blk_4way)
26 changes: 13 additions & 13 deletions arch/x86/crypto/camellia-x86_64-asm_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@
#define RCD1bh %dh

#define RT0 %rsi
#define RT1 %rbp
#define RT1 %r12
#define RT2 %r8

#define RT0d %esi
#define RT1d %ebp
#define RT1d %r12d
#define RT2d %r8d

#define RT2bl %r8b

#define RXOR %r9
#define RRBP %r10
#define RR12 %r10
#define RDST %r11

#define RXORd %r9d
Expand Down Expand Up @@ -197,7 +197,7 @@ ENTRY(__camellia_enc_blk)
* %rdx: src
* %rcx: bool xor
*/
movq %rbp, RRBP;
movq %r12, RR12;

movq %rcx, RXOR;
movq %rsi, RDST;
Expand Down Expand Up @@ -227,13 +227,13 @@ ENTRY(__camellia_enc_blk)

enc_outunpack(mov, RT1);

movq RRBP, %rbp;
movq RR12, %r12;
ret;

.L__enc_xor:
enc_outunpack(xor, RT1);

movq RRBP, %rbp;
movq RR12, %r12;
ret;
ENDPROC(__camellia_enc_blk)

Expand All @@ -248,7 +248,7 @@ ENTRY(camellia_dec_blk)
movl $24, RXORd;
cmovel RXORd, RT2d; /* max */

movq %rbp, RRBP;
movq %r12, RR12;
movq %rsi, RDST;
movq %rdx, RIO;

Expand All @@ -271,7 +271,7 @@ ENTRY(camellia_dec_blk)

dec_outunpack();

movq RRBP, %rbp;
movq RR12, %r12;
ret;
ENDPROC(camellia_dec_blk)

Expand Down Expand Up @@ -433,7 +433,7 @@ ENTRY(__camellia_enc_blk_2way)
*/
pushq %rbx;

movq %rbp, RRBP;
movq %r12, RR12;
movq %rcx, RXOR;
movq %rsi, RDST;
movq %rdx, RIO;
Expand Down Expand Up @@ -461,14 +461,14 @@ ENTRY(__camellia_enc_blk_2way)

enc_outunpack2(mov, RT2);

movq RRBP, %rbp;
movq RR12, %r12;
popq %rbx;
ret;

.L__enc2_xor:
enc_outunpack2(xor, RT2);

movq RRBP, %rbp;
movq RR12, %r12;
popq %rbx;
ret;
ENDPROC(__camellia_enc_blk_2way)
Expand All @@ -485,7 +485,7 @@ ENTRY(camellia_dec_blk_2way)
cmovel RXORd, RT2d; /* max */

movq %rbx, RXOR;
movq %rbp, RRBP;
movq %r12, RR12;
movq %rsi, RDST;
movq %rdx, RIO;

Expand All @@ -508,7 +508,7 @@ ENTRY(camellia_dec_blk_2way)

dec_outunpack2();

movq RRBP, %rbp;
movq RR12, %r12;
movq RXOR, %rbx;
ret;
ENDPROC(camellia_dec_blk_2way)
Loading

0 comments on commit 7a6d007

Please sign in to comment.