]> Cypherpunks repositories - gostls13.git/commitdiff
vendor/golang_org/x/crypto/poly1305: update to 3ded668c5379f6951fb0de06174442072e5447d3
authorAdam Langley <agl@golang.org>
Thu, 20 Oct 2016 16:35:19 +0000 (09:35 -0700)
committerAdam Langley <agl@golang.org>
Thu, 20 Oct 2016 18:19:18 +0000 (18:19 +0000)
This change updates the vendored copy of x/crypto/poly1305, specifically
to include the following changes:
  3ded668 poly1305: enable assembly for ARM in Go 1.6.
  dec8741 poly1305: fix stack handling in sum_arm.s

Fixes #17499.

Change-Id: I8f152da9599bd15bb976f630b0ef602be05143d3
Reviewed-on: https://go-review.googlesource.com/31592
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/vendor/golang_org/x/crypto/poly1305/sum_amd64.go
src/vendor/golang_org/x/crypto/poly1305/sum_amd64.s
src/vendor/golang_org/x/crypto/poly1305/sum_arm.s
src/vendor/golang_org/x/crypto/poly1305/sum_ref.go

index 1501f13909123c3b53100eb947fb9e63d323bc45..4dd72fe799b2d3524b9af7457df67fbad4444170 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build amd64,!gccgo,!appengine,go1.7
+// +build amd64,!gccgo,!appengine
 
 package poly1305
 
index 56e8311c8d9ead5442928b82a9cf3659a651b362..bc75c61afcf6a7dd43b529396c65f469676fcef7 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build amd64,!gccgo,!appengine,go1.7
+// +build amd64,!gccgo,!appengine
 
 #include "textflag.h"
 
index 6742dfb88efdafba7379083461b7e9817655e38e..9c3d60f29d9d553e5befb26cfbf9a0e22d4414e6 100644 (file)
@@ -19,7 +19,10 @@ GLOBL poly1305_init_constants_armv6<>(SB), 8, $20
 // Warning: the linker may use R11 to synthesize certain instructions. Please
 // take care and verify that no synthetic instructions use it.
 
-TEXT poly1305_init_ext_armv6<>(SB), NOSPLIT|NOFRAME, $0
+TEXT poly1305_init_ext_armv6<>(SB), NOSPLIT, $0
+       // Needs 32 bytes of stack and 64 bytes of space pointed to by R0.
+       // (It might look like it's only 60 bytes of space but the final
+       // four bytes will be written by another function.)
        MOVM.DB.W [R4-R11], (R13)
        MOVM.IA.W (R1), [R2-R5]
        MOVW      $poly1305_init_constants_armv6<>(SB), R7
@@ -59,7 +62,8 @@ TEXT poly1305_init_ext_armv6<>(SB), NOSPLIT|NOFRAME, $0
        MOVBU (offset+3)(Rsrc), Rtmp; \
        MOVBU Rtmp, (offset+3)(Rdst)
 
-TEXT poly1305_blocks_armv6<>(SB), NOSPLIT|NOFRAME, $0
+TEXT poly1305_blocks_armv6<>(SB), NOSPLIT, $0
+       // Needs 36 + 128 bytes of stack.
        MOVM.DB.W [R4, R5, R6, R7, R8, R9, g, R11, R14], (R13)
        SUB       $128, R13
        MOVW      R0, 36(R13)
@@ -212,7 +216,8 @@ poly1305_blocks_armv6_done:
        MOVHUP_UNALIGNED(Rsrc, Rdst, Rtmp); \
        MOVHUP_UNALIGNED(Rsrc, Rdst, Rtmp)
 
-TEXT poly1305_finish_ext_armv6<>(SB), NOSPLIT | NOFRAME, $0
+TEXT poly1305_finish_ext_armv6<>(SB), NOSPLIT, $0
+       // Needs 36 + 16 bytes of stack.
        MOVM.DB.W [R4, R5, R6, R7, R8, R9, g, R11, R14], (R13)
        SUB       $16, R13, R13
        MOVW      R0, R5
@@ -364,15 +369,32 @@ poly1305_finish_ext_armv6_noremaining:
        RET
 
 // func poly1305_auth_armv6(out *[16]byte, m *byte, mlen uint32, key *[32]key)
-TEXT ·poly1305_auth_armv6(SB), $280-16
+TEXT ·poly1305_auth_armv6(SB), $228-16
+       // The value 228, just above, is the sum of 64 (the size of the context
+       // structure) and 164 (the amount of stack that |poly1305_blocks_armv6|
+       // needs).
+       //
+       // At this point, the stack pointer (R13) has been moved down. It
+       // points to the saved link register and there's 228 bytes of free
+       // space above it.
        MOVW out+0(FP), R4
        MOVW m+4(FP), R5
        MOVW mlen+8(FP), R6
        MOVW key+12(FP), R7
 
-       MOVW  R13, R8
-       BIC   $63, R13
-       SUB   $64, R13, R13
+       // We need to keep a 64-byte structure on the stack and have enough
+       // space for |poly1305_blocks_armv6| (which needs 164 bytes of stack
+       // space). This assembly code was written for a C-based world where
+       // code just assumes that sufficient stack is available below the
+       // current stack pointer. So the structure is kept at the highest
+       // addresses of the frame and the stack for other functions exists just
+       // below it.
+       //
+       // (In ARM, R13 points at the value currently at the top of the stack,
+       // so the structure address and stack pointer are the same value.)
+       //
+       // We add 168, not 164, because the link register is saved at *R13.
+       ADD   $168, R13, R13
        MOVW  R13, R0
        MOVW  R7, R1
        BL    poly1305_init_ext_armv6<>(SB)
@@ -390,5 +412,5 @@ poly1305_auth_armv6_noblocks:
        MOVW R6, R2
        MOVW R4, R3
        BL   poly1305_finish_ext_armv6<>(SB)
-       MOVW R8, R13
+       SUB  $168, R13, R13
        RET
index 908aae0d2fe57a747057e03db3e204c90386dbbf..dbe50e78a0d3c30f5d1842dbc1daf9079d51f9a5 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !amd64,!arm gccgo appengine nacl !go1.7
+// +build !amd64,!arm gccgo appengine nacl
 
 package poly1305