qiulaidongfeng
97bf787255
blake2b: implement hash.XOF
...
Fixes golang/go#69518
Change-Id: Id9989ac9b28262df77017e97f985f67c1571c3ce
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/644255
Reviewed-by: Austin Clements <austin@google.com >
Auto-Submit: Austin Clements <austin@google.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-06-30 09:39:26 -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
82942cf1d8
blake2b: port blake2b_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)
ASM_PATH="blake2b/blake2b_amd64.s"
REFERENCE="b2d3a6a4b4d36521cd7f653879cf6981e7c5c340"
go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
<(git cat-file -p "$REFERENCE:$ASM_PATH") \
> /tmp/reference.s
go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
"$ASM_PATH" \
> /tmp/avo.s
normalize(){
awk '{
$1=$2=$3="";
print substr($0,4)
}'
}
diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)
Change-Id: I6dd59fb0b0365674aa5e43b69a57ea60fbcc4ba1
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/600456
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Roland Shoemaker <roland@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2024-09-04 20:34:46 +00:00
Garrett Bodley
0484c26df7
blake2b: port blake2bAVX2_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)
ASM_PATH="blake2b/blake2bAVX2_amd64.s"
REFERENCE="b2d3a6a4b4d36521cd7f653879cf6981e7c5c340"
go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
<(git cat-file -p "$REFERENCE:$ASM_PATH") \
> /tmp/reference.s
go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
"$ASM_PATH" \
> /tmp/avo.s
normalize(){
awk '{
$1=$2=$3="";
print substr($0,4)
}'
}
diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)
Change-Id: Ia2af1b82c871e26b89bd9a2d9fb187cc49e18341
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/600836
Reviewed-by: Filippo Valsorda <filippo@golang.org >
Reviewed-by: Roland Shoemaker <roland@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-09-04 20:34:34 +00:00
Sebastiaan van Stijn
b8ffc16e10
blake2b: drop Go 1.6, Go 1.8 compatibility
...
Other packages already dropped compatibility with go < 1.12, so it
should be safe to remove it for this package as well.
Change-Id: I7e894fd11d2e7d1fe28c647bd921399a9a6e30d0
GitHub-Last-Rev: 2b4f576a19338f185e79f39cbfd476573b986369
GitHub-Pull-Request: golang/crypto#240
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/448240
Run-TryBot: Nicola Murino <nicola.murino@gmail.com >
Reviewed-by: Joedian Reid <joedian@golang.org >
Reviewed-by: Nicola Murino <nicola.murino@gmail.com >
Commit-Queue: Nicola Murino <nicola.murino@gmail.com >
Auto-Submit: Nicola Murino <nicola.murino@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Roland Shoemaker <roland@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2023-11-27 17:26:05 +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
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
1f2b32a52c
blake2b: fix amd64 assembly not to smash SP
...
For golang/go#44269 .
Change-Id: I7e405afd0b55c96ce0a4c6058ba01e8be1173a8c
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/292051
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:09 +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
Katie Hockman
baeed622b8
blake2b,blake2s: clarify difference between blake2b and blake2s
...
Fixes golang/go#37784
Change-Id: I2fdaf96979390f3744ba8135da78107a15f5e9a8
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/226845
Run-TryBot: Katie Hockman <katie@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Filippo Valsorda <filippo@golang.org >
2020-04-03 20:14:58 +00:00
Udalov Max
af44ce270e
blake2b: use math.bits rotate functions instead of ad-hoc implementations
...
This makes code more readable and idiomatic and slightly improves performance.
Updates golang/go#31456
Benchstat:
name old time/op new time/op delta
Write128-4 271ns ± 4% 250ns ± 2% -7.78% (p=0.000 n=10+9)
Write1K-4 2.01µs ± 6% 1.97µs ± 5% ~ (p=0.393 n=10+10)
Sum128-4 271ns ± 6% 276ns ± 5% ~ (p=0.342 n=10+10)
Sum1K-4 1.98µs ±11% 2.03µs ± 4% ~ (p=0.093 n=10+10)
name old speed new speed delta
Write128-4 471MB/s ± 4% 511MB/s ± 2% +8.34% (p=0.000 n=10+9)
Write1K-4 511MB/s ± 6% 521MB/s ± 5% ~ (p=0.393 n=10+10)
Sum128-4 472MB/s ± 6% 463MB/s ± 6% ~ (p=0.315 n=10+10)
Sum1K-4 520MB/s ±10% 504MB/s ± 4% ~ (p=0.105 n=10+10)
Change-Id: I7e18379c02a78c77afcf8195d42307f71bc49fe0
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/173277
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2019-04-22 16:24:23 +00:00
Ross Smith II
6407268620
blake2b: fix comments in grammar
...
Change-Id: Idacdbf5ee847be6e21ecce0c9d41818e643c4835
GitHub-Last-Rev: bf1a719b62167d294319f23576302ef567894cc3
GitHub-Pull-Request: golang/crypto#73
Reviewed-on: https://go-review.googlesource.com/c/158837
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2019-01-22 01:37:13 +00:00
Igor Zhilianin
45a5f77698
all: fix typos
...
Change-Id: I62cbcfcd0be5f6a74d93b85b24ff7607533bb239
GitHub-Last-Rev: 9967869e706e9fe7d13964bb32b30a44ba640869
GitHub-Pull-Request: golang/crypto#64
Reviewed-on: https://go-review.googlesource.com/c/145240
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2018-10-29 02:12:03 +00:00
Andreas Auernhammer
ae8bce0030
crypto/{blake2b,blake2s,argon2,chacha20poly1305}: replace CPU feature detection
...
This change removes package specific CPU-feature detection code and
replaces it with x/sys/cpu.
Fixes golang/go#24843
Change-Id: I150dd7b3aeb8eef428c91f9b1df741ceb8a87a24
Reviewed-on: https://go-review.googlesource.com/110355
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2018-04-30 18:12:35 +00:00
Andreas Auernhammer
b0697eccbe
blake2b: Revert "blake2b: use internal/cpu to determine AVX and SSE 4 support"
...
This reverts commit d6449816ce because of golang/go#24828 .
Change-Id: I14b4e1265b2e75897fa12548dbdfb77c308afaaf
Reviewed-on: https://go-review.googlesource.com/108795
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
2018-04-25 07:15:31 +00:00
Tobias Klauser
d6449816ce
blake2b: use internal/cpu to determine AVX and SSE 4 support
...
CL 106235 removed runtime.support_avx on which blake2b depends to
determine AVX support. Switch to use the corresponding feature flags
from internal/cpu instead. While at it, also use AVX2 and SSE4 (for Go
1.7 and later) from there.
Change-Id: I4f7a27fcfa0c5d0d7a50444c7aa32519b97e90dd
Reviewed-on: https://go-review.googlesource.com/106336
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2018-04-11 16:13:17 +00:00
ValarDragon
12892e8c23
blake2b,blake2s: implement BinaryMarshaler, BinaryUnmarshaler
...
The marshal method allows the hash's internal state to be serialized and
unmarshaled at a later time, without having the re-write the entire stream
of data that was already written to the hash.
Fixes golang/go#24548
Change-Id: I82358c34181fc815f85d5d1509fb2fe0e62e40bd
Reviewed-on: https://go-review.googlesource.com/103241
Reviewed-by: Filippo Valsorda <filippo@golang.org >
Run-TryBot: Filippo Valsorda <filippo@golang.org >
2018-03-30 21:03:55 +00:00
Andreas Auernhammer
625c6a7b44
argon2: add new package implementing the Argon2 PBKDF family
...
This CL adds the package argon2. The argon2 package implements
the Argon2 PBKDF family (Argon2i, Argon2d, Argon2id).
Argon2 is memory-hard key derivation function and is specified
at https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf
It can be used to derive cryptographic keys with high entropy from low
entropy passwords.
Fixes golang/go#19896
Change-Id: I5b099682a8e3d7569ad18400cebddefc99a7e22f
Reviewed-on: https://go-review.googlesource.com/82575
Run-TryBot: Adam Langley <agl@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Adam Langley <agl@golang.org >
2017-12-18 18:31:08 +00:00
Tobias Klauser
c84b36c635
blake2b: fix typo in error message
...
io.EOF is expected by the test, but the error message mentions os.EOF.
Adjust it to io.EOF.
Change-Id: I1a42da8d72f96f8757319183a6bb3281a64b3a40
Reviewed-on: https://go-review.googlesource.com/65870
Reviewed-by: Matt Layher <mdlayher@gmail.com >
Run-TryBot: Matt Layher <mdlayher@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2017-09-27 20:05:19 +00:00
Andreas Auernhammer
08a7dbd3d9
blake2b: implement BLAKE2X
...
This CL implements the BLAKE2X, a extensible-output function (XOF), on
top of BLAKE2b. BLAKE2X is described in https://blake2.net/blake2x.pdf
Fixes golang/go#19513
Change-Id: Ibf33c764c9902e90fd9c8e375583ed153f4de1c7
Reviewed-on: https://go-review.googlesource.com/38055
Reviewed-by: Andreas Auernhammer <aead@mail.de >
Reviewed-by: Adam Langley <agl@golang.org >
2017-07-09 16:53:45 +00:00
Andreas Auernhammer
ab89591268
blake2b: fix self-assignment in test
...
Fix self-assignment of useAVX variable. (vet warning)
Change-Id: I4194d7640f17cbf71dae27ce271d6f6d21354318
Reviewed-on: https://go-review.googlesource.com/43371
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2017-05-12 13:04:25 +00:00
Andreas Auernhammer
55a552f082
x/crypto/*: add import comment
...
Add import comment for blake2b, blake2s, chacha20poly1305 and cryptobyte.
Change-Id: I4703b5cd669e43a5d81422b2ded8b8f54eee5f9b
Reviewed-on: https://go-review.googlesource.com/39952
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
2017-04-07 17:36:45 +00:00
Andreas Auernhammer
83de8c7b40
blake2b: register BLAKE2b
...
Register BLAKE2b-256, BLAKE2b-384 and BLAKE2b-512 if the package is imported.
Change-Id: Iba425a62b42ed07219f7e56ff173ed5ae503704e
Reviewed-on: https://go-review.googlesource.com/36877
Reviewed-by: Matt Layher <mdlayher@gmail.com >
Reviewed-by: Adam Langley <agl@golang.org >
Run-TryBot: Matt Layher <mdlayher@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2017-03-02 19:32:28 +00:00
Andreas Auernhammer
f671756e04
blake2b: fix AVX performance problems on amd64
...
On some amd64 CPUs (Xeon E5-2680v4 / E5-2620v3) using SSE and AVX instructions
leads to very low performance.
On a i7-6500U the SSE-AVX code performs following:
AVX2:
name time/op
Write128-4 165ns ± 0%
Write1K-4 1.20µs ± 0%
Sum128-4 189ns ± 1%
Sum1K-4 1.22µs ± 0%
name speed
Write128-4 773MB/s ± 1%
Write1K-4 855MB/s ± 0%
Sum128-4 675MB/s ± 1%
Sum1K-4 838MB/s ± 0%
while the same code achieves values < 65MB/s on a Xeon E5-2620v3.
Replacing the `MOVQ` and `PINSRQ` with the AVX instructions `VMOVQ` and `VPINSRQ`
increases the performance of the AVX/AVX2 code to some expected values:
name old time/op new time/op delta
Write128-12 2.20µs ±10% 0.22µs ± 9% -90.00% (p=0.029 n=4+4)
Write1K-12 16.2µs ± 0% 1.1µs ± 0% -93.07% (p=0.029 n=4+4)
Sum128-12 2.10µs ± 0% 0.22µs ± 0% -89.47% (p=0.029 n=4+4)
Sum1K-12 16.3µs ± 0% 1.2µs ± 0% -92.65% (p=0.029 n=4+4)
name old speed new speed delta
Write128-12 58.5MB/s ±10% 582.8MB/s ±10% +897.08% (p=0.029 n=4+4)
Write1K-12 63.1MB/s ± 0% 909.8MB/s ± 0% +1341.40% (p=0.029 n=4+4)
Sum128-12 60.8MB/s ± 0% 576.3MB/s ± 0% +847.84% (p=0.029 n=4+4)
Sum1K-12 62.8MB/s ± 0% 855.2MB/s ± 0% +1260.78% (p=0.029 n=4+4)
The AVX/AVX2 code now uses only AVX (no SSE) instructions.
Fixes golang/go#18563 .
Change-Id: I1961dd8fa02014642587523b7f099816a263c9f5
Reviewed-on: https://go-review.googlesource.com/34993
Reviewed-by: Adam Langley <agl@golang.org >
2017-02-08 19:53:58 +00:00
Mikio Hara
f6b343c37c
blake2b: fix build on non-amd64 platforms
...
Change-Id: Ib9ebb1a2eff4b61f60453086be5c63ac7af1f7fc
Reviewed-on: https://go-review.googlesource.com/34672
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Adam Langley <agl@google.com >
Reviewed-by: Adam Langley <agl@golang.org >
2016-12-21 23:57:47 +00:00
Andreas Auernhammer
d8e61c69ab
blake2b: add AVX assembly
...
Add an AVX implementation and improve SSE4.1 assembly.
AVX vs SSE4.1
name old time/op new time/op delta
Write128-8 249ns ± 0% 220ns ± 0% -11.85% (p=0.029 n=4+4)
Write1K-8 1.68µs ± 1% 1.56µs ± 1% -6.71% (p=0.029 n=4+4)
Write32K-8 52.6µs ± 0% 48.7µs ± 0% -7.40% (p=0.029 n=4+4)
Sum128-8 264ns ± 0% 241ns ± 1% -8.52% (p=0.029 n=4+4)
Sum1K-8 1.70µs ± 0% 1.57µs ± 0% -7.79% (p=0.029 n=4+4)
Sum32K-8 54.1µs ± 3% 49.5µs ± 1% -8.36% (p=0.029 n=4+4)
name old speed new speed delta
Write128-8 513MB/s ± 0% 582MB/s ± 0% +13.38% (p=0.029 n=4+4)
Write1K-8 610MB/s ± 1% 654MB/s ± 1% +7.22% (p=0.029 n=4+4)
Write32K-8 622MB/s ± 0% 672MB/s ± 0% +7.99% (p=0.029 n=4+4)
Sum128-8 484MB/s ± 1% 529MB/s ± 0% +9.21% (p=0.029 n=4+4)
Sum1K-8 602MB/s ± 0% 653MB/s ± 0% +8.42% (p=0.029 n=4+4)
Sum32K-8 607MB/s ± 3% 662MB/s ± 1% +9.03% (p=0.029 n=4+4)
AVX2 vs AVX
name old time/op new time/op delta
Write128-4 192ns ± 0% 166ns ± 0% -14.03% (p=0.029 n=4+4)
Write1K-4 1.37µs ± 0% 1.19µs ± 0% -12.65% (p=0.029 n=4+4)
Write32K-4 42.5µs ± 0% 37.3µs ± 0% -12.33% (p=0.029 n=4+4)
Sum128-4 213ns ± 0% 188ns ± 0% -11.97% (p=0.029 n=4+4)
Sum1K-4 1.40µs ± 0% 1.22µs ± 0% -12.85% (p=0.029 n=4+4)
Sum32K-4 42.8µs ± 0% 37.3µs ± 0% -12.94% (p=0.029 n=4+4)
name old speed new speed delta
Write128-4 662MB/s ± 0% 771MB/s ± 0% +16.47% (p=0.029 n=4+4)
Write1K-4 748MB/s ± 0% 857MB/s ± 0% +14.49% (p=0.029 n=4+4)
Write32K-4 771MB/s ± 0% 879MB/s ± 0% +14.07% (p=0.029 n=4+4)
Sum128-4 600MB/s ± 0% 680MB/s ± 0% +13.49% (p=0.029 n=4+4)
Sum1K-4 733MB/s ± 0% 841MB/s ± 0% +14.72% (p=0.029 n=4+4)
Sum32K-4 765MB/s ± 0% 879MB/s ± 0% +14.85% (p=0.029 n=4+4)
Change-Id: Idf85742e952c07b76c0c7fb5404ed9b0caf0f6eb
Reviewed-on: https://go-review.googlesource.com/34319
Reviewed-by: Adam Langley <agl@golang.org >
2016-12-20 18:11:55 +00:00
Andreas Auernhammer
9a6f0a0198
blake2b: fix constant size
...
Change-Id: Icae0ec427183d1e319f5a28d6372c823c269d898
Reviewed-on: https://go-review.googlesource.com/34252
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2016-12-12 17:50:00 +00:00
Adam Langley
7efbae5d10
x/crypto/blake2b: SSE4.1 is bit 19, not 15.
...
I missed this in the initial review but this will cause blake2b to
SIGILL on, at least, some Atom chips.
Fixes golang/go#18113 .
Change-Id: I0c16319df71f3ce4a38411ad4c4e9d3871fd9533
Reviewed-on: https://go-review.googlesource.com/33830
Run-TryBot: Adam Langley <agl@golang.org >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2016-12-01 19:22:57 +00:00
Austin Clements
8291fff38a
blake2b: test all three hashing implementations
...
This adds use* flags for all arches so a common test can observe what
implementations are supported and test all supported implementations.
Change-Id: I0497b91294ed99309074ac4614ac996e006630c5
Reviewed-on: https://go-review.googlesource.com/31714
Run-TryBot: Austin Clements <austin@google.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Minux Ma <minux@golang.org >
Reviewed-by: Andreas Auernhammer <aead@mail.de >
2016-10-24 19:19:48 +00:00
Austin Clements
e67f5eca87
blake2b: use proper Go frame sizes
...
Similar to the previous commit, blake2b's assembly routines claim they
have a zero byte frame and manually subtract a frame from the SP,
which can fail to grow the stack when necessary, leading to memory
corruption.
Fix this by using the correct stack frame sizes so the generated stack
growth prologue is correct, and aligning the SP up instead of down.
Change-Id: Ic426338c45c94a2c01d549860c2295a0ee9200be
Reviewed-on: https://go-review.googlesource.com/31585
Reviewed-by: Adam Langley <agl@golang.org >
Reviewed-by: Andreas Auernhammer <aead@mail.de >
2016-10-21 19:51:14 +00:00
Andreas Auernhammer
c367d6eeb7
blake2s,blake2b: fix typo in package doc
...
Change-Id: I6c33e69dc3e45d86843861973952d6f11c0fae88
Reviewed-on: https://go-review.googlesource.com/31397
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2016-10-19 07:14:13 +00:00
Andreas Auernhammer
9e9c7d4ed3
blake2b: new package
...
Add the hash function BLAKE2b defined in RFC 7693.
On amd64/AVX2
name time/op
Write128-4 164ns ± 1%
Write1K-4 1.19µs ± 2%
Sum128-4 187ns ± 1%
Sum1K-4 1.21µs ± 1%
name speed
Write128-4 800MB/s ± 1%
Write1K-4 856MB/s ± 2%
Sum128-4 682MB/s ± 1%
Sum1K-4 842MB/s ± 1%
On amd64/SSE4
name time/op
Write128-4 192ns ± 1%
Write1K-4 1.37µs ± 0%
Sum128-4 215ns ± 1%
Sum1K-4 1.39µs ± 1%
name speed
Write128-4 665MB/s ± 1%
Write1K-4 746MB/s ± 0%
Sum128-4 592MB/s ± 1%
Sum1K-4 735MB/s ± 1%
Change-Id: I0b41ae136980b0e8a970be330e8cc5f02b9e6818
Reviewed-on: https://go-review.googlesource.com/30918
Reviewed-by: Adam Langley <agl@golang.org >
2016-10-18 17:05:21 +00:00