Граф коммитов

15 Коммитов

Автор SHA1 Сообщение Дата
Andreas Auernhammer cd11541cdf curve25519: improve cswap
Simplify the constant swap function.

On amd64: Replace the CMOVQEQ scheme with SSE2 code similar to the non-amd64 code.
On non-amd64: Avoid unnecessary loop iterations.

The result is less and slightly faster code.

name 			old time/op 	new time/op 	delta
ScalarBaseMult-4   	653µs ± 0%   	636µs ± 0%   	~     (p=0.100 n=3+3)

name 			old time/op 	new time/op 	delta
ConstantSwap-4  	10.4ns ± 1%   	6.2ns ± 0%  	-39.86%  (p=0.029 n=4+4)

On an i7-65000U

Change-Id: Ia5eea92e0b3eabb6c291d25229aa582b51278552
Reviewed-on: https://go-review.googlesource.com/39693
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-13 00:59:54 +00:00
Russ Cox 59a182cab6 curve25519: avoid loss of R15 in -dynlink mode
Fixes golang/go#18820.

Change-Id: I4b3a49b3bbbecc4e1008989fefd39da9725a28ea
Reviewed-on: https://go-review.googlesource.com/36359
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
2017-02-06 19:40:01 +00:00
Austin Clements f62085100e curve25519: eliminate unnecessary "callee save" prologues
The assembly implementations of ladderstep and mul contain register
save prologues that are unnecessary in Go because there are no callee
save registers in the Go ABI. Remove these prologues, update all SP
offsets, and reduce the frame size accordingly.

The SP offsets were updated with:

python -c 'import sys, re; sys.stdout.write(re.sub(r"(\d+)\(SP\)", lambda m: "%d(SP)" % (int(m.group(1))-YYY), sys.stdin.read()))'

where YYY was 64 for mul_amd64.s and 56 for ladderstep_amd64.s.

Change-Id: I728948809f479b1c061cc65167dadad651efab31
Reviewed-on: https://go-review.googlesource.com/31580
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-10-21 19:51:09 +00:00
Austin Clements 722a7b7827 curve25519: fix confusing SP adjustments
The curve25519 assembly routines do very non-Go-ABI SP adjustments.
These would thoroughly confuse traceback if it were to fire in one of
these functions (say, because of a signal). Plus, we're about to make
the assembler track SP balance through more operations (which it
should have done all along), and the SP alignment performed by these
functions is going to make the assembler think the SP is out of
balance.

Fix this by eliminating the SP alignment prologue from all four
assembly functions. They don't do any operations that care about SP
alignment, so this is simply unnecessary. square and freeze don't even
use the stack for anything other that saving what were presumably
"callee save" registers in some other ABI, so for these we can
eliminate the stack frame entirely.

Change-Id: If9dbb2fb6800d9cd733daa91f483eb2937e95f0f
Reviewed-on: https://go-review.googlesource.com/31579
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2016-10-21 19:51:06 +00:00
Marga Manterola c57d4a7191 poly1305, curve25519: add build constraints for appengine
Updates: golang/go#9845

Change-Id: I78ce460d2a188ee13dd3f80015919a14eba03d07
Reviewed-on: https://go-review.googlesource.com/8100
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-27 05:11:19 +00:00
David Symonds 1fbbd62cfe crypto: add import comments.
Change-Id: I33240faf1b8620d0cd600de661928d8e422ebdbc
Reviewed-on: https://go-review.googlesource.com/1235
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 23:26:36 +00:00
Ian Lance Taylor 902e2dcb72 curve25519, poly1305: change last CL to build with Go 1.3
It also still works with Go 1.4.

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/154120043
2014-10-07 18:09:31 -07:00
Ian Lance Taylor 20b2ab3f62 curve25519, poly1305: mark constants as RODATA
Fixes tests when using Go tip.  Without this the link steps
fails with errors like:

missing Go type information for global symbol: google3/third_party/golang/go_crypto/curve25519/curve25519.REDMASK51 size 8

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/156810043
2014-10-07 16:59:07 -07:00
Adam Langley 5a4ea2fde3 go.crypto/curve25519: rewrite generic code to be constant time.
Previously curve25519 contained a constant-time, optimised amd64 implementation and
a generic implemenation that used math/big and that was not constant-time.

This change contains a Go port of the public domain, "ref10" implementation from
SUPERCOP. This has the advantage of being faster and constant-time.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13343045
2013-09-03 09:31:32 -04:00
Shenghou Ma bf5456312c go.crypto/{curve25519,poly1305,salsa20/salsa}: add //go:noescape annotation
R=golang-dev, rsc, agl
CC=golang-dev
https://golang.org/cl/7319045
2013-02-19 19:15:01 +08:00
Ian Lance Taylor 6779fad1d0 go.crypto: add and adjust +build lines for 386 and gccgo
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6827061
2012-11-07 22:50:39 -08:00
Russ Cox b1c91de896 curve25519: fix asm comment
As suggested in review of CL 6544048.

TBR=seed
CC=golang-dev
https://golang.org/cl/6553065
2012-09-24 11:15:53 -04:00
Russ Cox 750c6a9860 go.crypto: match asm variable names to Go func declarations
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6544048
2012-09-21 00:36:01 -04:00
Dave Cheney f0da345629 go.crypto/curve25519: fix incorrect build tag
The build tag was incorrect. CL 6458091 exposed the mistake.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/6460067
2012-08-10 10:23:58 +10:00
Adam Langley 124e52db8d go.crypto/curve25519: add package.
This consists of ~2000 lines of amd64 assembly and a, much slower,
generic Go version in curve25519.go. The assembly has been ported from
djb's public domain sources and the only semantic alterations are to
deal with Go's split stacks.

R=rsc
CC=golang-dev
https://golang.org/cl/5786045
2012-03-12 10:59:04 -04:00