瀏覽代碼

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>
Austin Clements 9 年之前
父節點
當前提交
a0819bbd36
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      salsa20/salsa/salsa2020_amd64.s

+ 4 - 4
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)