Michael Pratt
51f005cfd4
Revert "salsa20: add loong64 SIMD implementation"
...
This reverts CL 663375.
Reason for revert: Does not build on 1.23 or 1.24
For golang/go#73354 .
Change-Id: I251d598423b83c01cc2e04ddf6f49ae14095fa7c
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/665535
Auto-Submit: Michael Pratt <mpratt@google.com >
Reviewed-by: abner chenc <chenguoqi@loongson.cn >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-04-16 06:50:29 -07:00
Xiaolin Zhao
18f770732f
salsa20: add loong64 SIMD implementation
...
The performance gains on Loongson 3A6000 and 3A5000 are as follows:
goos: linux
goarch: loong64
pkg: golang.org/x/crypto/salsa20
cpu: Loongson-3A6000-HV @ 2500.00MHz
| bench.old | bench.new |
| sec/op | sec/op vs base |
XOR1K 3175.0n ± 0% 435.4n ± 0% -86.29% (p=0.000 n=20)
| bench.old | bench.new |
| B/s | B/s vs base |
XOR1K 307.6Mi ± 0% 2242.7Mi ± 0% +629.13% (p=0.000 n=20)
goos: linux
goarch: loong64
pkg: golang.org/x/crypto/salsa20
cpu: Loongson-3A5000 @ 2500.00MHz
| bench.old | bench.new |
| sec/op | sec/op vs base |
XOR1K 4125.0n ± 0% 864.0n ± 0% -79.05% (p=0.000 n=20)
| bench.old | bench.new |
| B/s | B/s vs base |
XOR1K 236.7Mi ± 0% 1130.3Mi ± 0% +377.41% (p=0.000 n=20)
Change-Id: Ib37f603e6654f1e3837985fad4b6dee10b5af993
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/663375
Reviewed-by: Carlos Amedee <carlos@golang.org >
Reviewed-by: abner chenc <chenguoqi@loongson.cn >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Carlos Amedee <carlos@golang.org >
2025-04-11 13:55:20 -07:00
Roland Shoemaker
911360c8a4
all: bump golang.org/x/crypto dependencies of asm generators
...
Change-Id: Ieb2f0d45f82647978f0bd1eb47bb347f0bfb7d13
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/649499
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-02-14 15:32:41 -08:00
Garrett Bodley
620dfbc770
salsa20/salsa: Port salsa20_amd64.s to Avo
...
This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.
To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.
Commands used to verify Avo output:
GOROOT=$(go env GOROOT)
REFERENCE="b2d3a6a4b4d36521cd7f653879cf6981e7c5c340"
go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
<(git cat-file -p "$REFERENCE":salsa20/salsa/salsa20_amd64.s) \
> /tmp/reference.s
go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
salsa20/salsa/salsa20_amd64.s \
> /tmp/avo.s
normalize(){
awk '{
$1=$2=$3="";
print substr($0,4)
}'
}
diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)
Change-Id: Ica0bb06f8b074ad566a979d33ddc81d8a38491b1
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/601217
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
Reviewed-by: Roland Shoemaker <roland@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2024-09-04 20:34:59 +00:00
Filippo Valsorda
a6a393ffd6
all: bump go.mod version and drop compatibility shims
...
Also, remove the legacy import annotations.
Fixes golang/go#68147
Change-Id: Ibfcc9322f27224c0ba92ea42cd56912a7d8783fd
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/594256
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Auto-Submit: Filippo Valsorda <filippo@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Roland Shoemaker <roland@golang.org >
2024-06-26 15:12:35 +00:00
Dmitri Shuralyov
8779cbd1c9
all: update go directive to 1.18
...
Done with:
go get go@1.18
go mod tidy
go fix ./...
Using go1.21.3.
Also update avo to v0.5.0 in the curve25519/internal/field/_asm module.
It's newer and produces no diff in the generated code.
For golang/go#60268 .
Change-Id: I9bd771ee8561595d7f68aaca76df6e3e33d35013
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/534141
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Damien Neil <dneil@google.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2023-10-11 22:02:22 +00:00
Alexander Yastrebov
a3485e1740
all: use math/bits.RotateLeft
...
Updates golang/go#31456
Change-Id: Idf043a25632526baa190bf42ed360cb79f85e493
GitHub-Last-Rev: 59461578926a85a87cc68dac96c0b7559766b7cf
GitHub-Pull-Request: golang/crypto#195
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/356518
Auto-Submit: Filippo Valsorda <filippo@golang.org >
Run-TryBot: Filippo Valsorda <filippo@golang.org >
Reviewed-by: Heschi Kreinick <heschi@google.com >
Reviewed-by: David Chase <drchase@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2022-10-24 17:35:37 +00:00
Russ Cox
04dced17f7
internal/subtle: rename to internal/alias
...
This avoids an import conflict in code that needs to import
crypto/subtle as well.
CL 424194 does the same for the main repo.
Change-Id: Ic54cb62bbfdcf5c2cb6f15ac47075ee1c41981ad
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/424175
Reviewed-by: Cherry Mui <cherryyz@google.com >
Run-TryBot: Russ Cox <rsc@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Russ Cox <rsc@golang.org >
2022-08-17 18:37:53 +00:00
Tobias Klauser
cd7d49e622
all: add //go:build lines to assembly files
...
For golang/go#41184
Change-Id: Ica67fdbf2745ad2eef63dbb9ef70136e9e6fd348
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/319469
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2021-05-13 12:29:33 +00:00
Russ Cox
5ea612d1eb
all: go fmt ./...
...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).
Not strictly necessary but will avoid spurious changes
as files are edited.
Part of //go:build change (#41184 ).
See https://golang.org/design/draft-gobuild
Change-Id: I70526bf588bf4078887e567795867ece785d666b
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/294415
Trust: Russ Cox <rsc@golang.org >
Run-TryBot: Russ Cox <rsc@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2021-02-20 03:31:48 +00:00
Russ Cox
042588c79f
salsa20/salsa: fix amd64 assembly not to smash SP
...
For golang/go#44269 .
Change-Id: Ica352261d696317addbdd422d4cde5bf07fef839
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/292050
Trust: Russ Cox <rsc@golang.org >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
2021-02-18 14:52:05 +00:00
Tamir Duberstein
be400aefbc
all: build tags: appengine,!gccgo => purego,gc
...
appengine is obsolete and superseded by purego, and gc is a more
precise tag for files that use gc-syntax assembly.
Change-Id: I716f59de772ebeee4adf4d2a432edf300122cef0
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/269920
Trust: Ian Lance Taylor <iant@golang.org >
Run-TryBot: Filippo Valsorda <filippo@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2020-12-03 16:30:18 +00:00
Filippo Valsorda
b7391e95e5
salsa20/salsa: fix keystream loop in amd64 assembly when overflowing 32-bit counter
...
Fixes golang/go#30965
Change-Id: I83a804d555c048e0124c35f95c9e611b2c5bdb01
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/436856
Reviewed-by: Adam Langley <agl@google.com >
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/168406
Reviewed-by: Filippo Valsorda <filippo@golang.org >
Run-TryBot: Filippo Valsorda <filippo@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2019-03-20 22:39:03 +00:00
Filippo Valsorda
37a17fe027
internal/subtle: add Any/InexactOverlap (new package) and apply them across packages
...
AnyOverlap and InexactOverlap implement checks for the aliasing
requirements defined by the crypto/cipher interfaces. Apply them to all
implementations as the actual requirement could be architecture-dependent
and user code should not rely on undefined behavior.
Updates golang/go#21624
Change-Id: I465de02fb3fec4e0c6f1fdee1ef6ae7ed5abff10
Reviewed-on: https://go-review.googlesource.com/112236
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2018-06-13 22:47:33 +00:00
Filippo Valsorda
1258d06b9d
salsa20: panic when len(out) < len(in) following cipher.Stream
...
Change-Id: I5c8d603cc3ec844b8d44e51b3138bcf16e95c7fc
Reviewed-on: https://go-review.googlesource.com/112235
Reviewed-by: Adam Langley <agl@golang.org >
Run-TryBot: Filippo Valsorda <filippo@golang.org >
2018-05-09 19:27:45 +00:00
Filippo Valsorda
74b34b9dd6
all: make overlap rules wording consistent
...
Updates golang/go#21279
Change-Id: I686835c644f52e3d5ea2b7e6431ef096d188c19d
Reviewed-on: https://go-review.googlesource.com/61133
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2017-09-11 15:03:43 +00:00
Wei Congrui
358f15eacb
salsa20/salsa: fix out of bounds write
...
Fixes golang/go#21104
Change-Id: I59054f9e2beed8a0c7efd513eb84795dc0308353
Reviewed-on: https://go-review.googlesource.com/52391
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2017-08-02 16:21:30 +00:00
Kevin Burke
5ef0053f77
all: use HTTPS for links that support it
...
Many websites now support HTTPS that may not at the time the code was
committed; let's use the HTTPS links where we can.
Change-Id: I7099dfa0dbb213294e65b4387f343d6e8f955b97
Reviewed-on: https://go-review.googlesource.com/47131
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2017-06-29 04:21:55 +00:00
Austin Clements
1705134e1b
salsa20/salsa: eliminate unnecessary "callee save" prologue/epilogue
...
SP offsets were adjusted to fill in the now unused callee save area
using the following Python script:
import sys, re
def adj(m):
delta = int(m.group(1))
if delta >= 408:
delta -= (408 - 352)
return "%d(SP)" % delta
sys.stdout.write(re.sub(r"(\d+)\(SP\)", adj, sys.stdin.read()))
Change-Id: I06675a75d89e5834f804df595868fe4bb8976719
Reviewed-on: https://go-review.googlesource.com/31587
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 >
2016-10-21 19:51:17 +00:00
Austin Clements
a0819bbd36
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 >
2016-10-21 19:51:15 +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
Andrew Gerrand
a73c6bbfc5
go.crypto: use golang.org/x/... import paths
...
LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/167190043
2014-11-10 08:50:25 +11:00
Adam Langley
396847505b
go.crypto/salsa: fix typo in comment and move TODO out of package comment.
...
Thanks to Frithjof Schulze for noticing.
R=goland-dev, r
CC=golang-dev
https://golang.org/cl/11033044
2013-07-16 19:34:54 -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
Dave Cheney
4ce1924ebb
go.crypto: various: fix appengine compatibility
...
Fixes golang/go#4102 .
R=russross, minux.ma, rsc, agl
CC=golang-dev
https://golang.org/cl/6623053
2012-10-09 13:15:42 +11: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
Dmitry Chestnykh
815dd50d91
go.crypto/salsa20: add salsa.Core208.
...
R=golang-dev, agl, r
CC=golang-dev
https://golang.org/cl/6530044
2012-09-18 13:46:45 -04:00
Adam Langley
62fc357018
go.crypto/salsa20: add package.
...
Package salsa20 implements the Salsa20 stream cipher as specified in
http://cr.yp.to/snuffle/spec.pdf .
(Reference implementation by dchest.)
R=golang-dev, dchest
CC=golang-dev
https://golang.org/cl/6496083
2012-09-08 10:41:44 -04:00