From a0819bbd36c200141787f8a98ecdfd6902290702 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 20 Oct 2016 17:37:50 -0400 Subject: [PATCH] salsa20/salsa: hide SP alignment from spadj The spadj computation in the assembler can't handle SP alignment code and will just get confused by how it's currently written. Do the alignment in a scratch register to hide it from the assembler. Change-Id: I8857f428d96717db29e3a56050f2381bd86807c6 Reviewed-on: https://go-review.googlesource.com/31586 Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot Reviewed-by: Cherry Zhang Reviewed-by: Adam Langley --- salsa20/salsa/salsa2020_amd64.s | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/salsa20/salsa/salsa2020_amd64.s b/salsa20/salsa/salsa2020_amd64.s index 6e1df96..9c4ae96 100644 --- a/salsa20/salsa/salsa2020_amd64.s +++ b/salsa20/salsa/salsa2020_amd64.s @@ -16,10 +16,10 @@ TEXT ·salsa2020XORKeyStream(SB),0,$512-40 MOVQ key+32(FP),R8 MOVQ SP,R11 - MOVQ $31,R9 - NOTQ R9 - ANDQ R9,SP - ADDQ $32,SP + MOVQ SP,R9 + ADDQ $31, R9 + ANDQ $~31, R9 + MOVQ R9, SP MOVQ R11,352(SP) MOVQ R12,360(SP)