Skip to content

Commit

Permalink
[release-branch.go1.8] vendor/golang.org/x/crypto/curve25519: avoid l…
Browse files Browse the repository at this point in the history
…oss of R15 in -dynlink mode

Original code fixed in https://go-review.googlesource.com/#/c/36359/.

Fixes #18820.

Change-Id: I060e6c9d0e312b4fd5d0674aff131055bf5cf61d
Reviewed-on: https://go-review.googlesource.com/36412
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-on: https://go-review.googlesource.com/36414
Reviewed-by: Austin Clements <austin@google.com>
  • Loading branch information
rsc committed Feb 6, 2017
1 parent 67cd1fa commit 6177f6d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
8 changes: 8 additions & 0 deletions src/vendor/golang_org/x/crypto/curve25519/const_amd64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// This code was translated into a form compatible with 6a from the public
// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html

#define REDMASK51 0x0007FFFFFFFFFFFF
4 changes: 2 additions & 2 deletions src/vendor/golang_org/x/crypto/curve25519/const_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

// +build amd64,!gccgo,!appengine

DATA ·REDMASK51(SB)/8, $0x0007FFFFFFFFFFFF
GLOBL ·REDMASK51(SB), 8, $8
// These constants cannot be encoded in non-MOVQ immediates.
// We access them directly from memory instead.

DATA ·_121666_213(SB)/8, $996687872
GLOBL ·_121666_213(SB), 8, $8
Expand Down
4 changes: 3 additions & 1 deletion src/vendor/golang_org/x/crypto/curve25519/freeze_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

// +build amd64,!gccgo,!appengine

#include "const_amd64.h"

// func freeze(inout *[5]uint64)
TEXT ·freeze(SB),7,$0-8
MOVQ inout+0(FP), DI
Expand All @@ -16,7 +18,7 @@ TEXT ·freeze(SB),7,$0-8
MOVQ 16(DI),CX
MOVQ 24(DI),R8
MOVQ 32(DI),R9
MOVQ ·REDMASK51(SB),AX
MOVQ $REDMASK51,AX
MOVQ AX,R10
SUBQ $18,R10
MOVQ $3,R11
Expand Down
20 changes: 11 additions & 9 deletions src/vendor/golang_org/x/crypto/curve25519/ladderstep_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

// +build amd64,!gccgo,!appengine

#include "const_amd64.h"

// func ladderstep(inout *[5][5]uint64)
TEXT ·ladderstep(SB),0,$296-8
MOVQ inout+0(FP),DI
Expand Down Expand Up @@ -118,7 +120,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 72(SP)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down Expand Up @@ -233,7 +235,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 32(SP)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down Expand Up @@ -438,7 +440,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 72(SP)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down Expand Up @@ -588,7 +590,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 32(SP)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down Expand Up @@ -728,7 +730,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 152(DI)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down Expand Up @@ -843,7 +845,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 192(DI)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down Expand Up @@ -993,7 +995,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 32(DI)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down Expand Up @@ -1143,7 +1145,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 112(SP)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down Expand Up @@ -1329,7 +1331,7 @@ TEXT ·ladderstep(SB),0,$296-8
MULQ 192(SP)
ADDQ AX,R12
ADCQ DX,R13
MOVQ ·REDMASK51(SB),DX
MOVQ $REDMASK51,DX
SHLQ $13,CX:SI
ANDQ DX,SI
SHLQ $13,R9:R8
Expand Down
4 changes: 3 additions & 1 deletion src/vendor/golang_org/x/crypto/curve25519/mul_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

// +build amd64,!gccgo,!appengine

#include "const_amd64.h"

// func mul(dest, a, b *[5]uint64)
TEXT ·mul(SB),0,$16-24
MOVQ dest+0(FP), DI
Expand Down Expand Up @@ -121,7 +123,7 @@ TEXT ·mul(SB),0,$16-24
MULQ 32(CX)
ADDQ AX,R14
ADCQ DX,R15
MOVQ ·REDMASK51(SB),SI
MOVQ $REDMASK51,SI
SHLQ $13,R9:R8
ANDQ SI,R8
SHLQ $13,R11:R10
Expand Down
4 changes: 3 additions & 1 deletion src/vendor/golang_org/x/crypto/curve25519/square_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

// +build amd64,!gccgo,!appengine

#include "const_amd64.h"

// func square(out, in *[5]uint64)
TEXT ·square(SB),7,$0-16
MOVQ out+0(FP), DI
Expand Down Expand Up @@ -84,7 +86,7 @@ TEXT ·square(SB),7,$0-16
MULQ 32(SI)
ADDQ AX,R13
ADCQ DX,R14
MOVQ ·REDMASK51(SB),SI
MOVQ $REDMASK51,SI
SHLQ $13,R8:CX
ANDQ SI,CX
SHLQ $13,R10:R9
Expand Down

0 comments on commit 6177f6d

Please sign in to comment.