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 <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
This commit is contained in:
Austin Clements
2016-10-21 19:51:15 +00:00
parent e67f5eca87
commit a0819bbd36
+4 -4
View File
@@ -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)