Skip to contentSkip to conversation

crypto: twofish-avx - remove useless instruction

PATCH In review Johannes Goetzfried 3 participants 4 messages Jul 5, 2012 – Jul 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: twofish-avx - remove useless instruction

The register %rdx is written, but never read till the end of the encryption routine. Therefore let's delete the useless instruction.

---
 arch/x86/crypto/twofish-avx-x86_64-asm_64.S |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/x86/crypto/twofish-avx-x86_64-asm_64.S +0 -1
index fc31b89..35f4557 100644
@@ -243,7 +243,6 @@ __twofish_enc_blk_8way:
 	popq %rbx;
 
 	leaq (4*4*4)(%rsi), %rax;
-	leaq (4*4*4)(%rax), %rdx;
 
 	testb %cl, %cl;
 	jnz __enc_xor8;
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 2 lines · Johannes Goetzfried

The register %rdx is written, but never read till the end of the encryption routine. Therefore let's delete the useless instruction.

Is it useless, or is it there to harden against some side-channel attack?

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
#2 lore raw
Quoted 2 lines · Henrique de Moraes Holschuh

Is it useless, or is it there to harden against some side-channel attack?

When writing this implementation, I first had a different approach with more data getting read in and I just forgot to delete this instruction in the end. The instruction didn't have any purpose regarding side-channel attacks. In the decryption routine the instruction has been correctly deleted in the same place.