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

13 Коммитов

Автор SHA1 Сообщение Дата
Garrett Bodley 38a0b5da75 argon2: Avo port of blamka_amd64.s
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="argon2/blamka_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: I3567eb80ef80dff248225f17470122c0a4e6951e
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/600315
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2024-09-04 20:33:49 +00:00
Egon Elbre bda2f3f5cf argon2: avoid clobbering BP
go vet was reporting

  blamka_amd64.s:203:1: [amd64] mixBlocksSSE2: invalid offset a+24(FP); expected a+8(FP)
  blamka_amd64.s:226:1: [amd64] xorBlocksSSE2: invalid offset a+24(FP); expected a+8(FP)
  blamka_amd64.s:204:1: frame pointer is clobbered before saving
  blamka_amd64.s:227:1: frame pointer is clobbered before saving

Also fix a similar naming issue in sha3:

  sha3\keccakf_amd64.s:325:1: [amd64] keccakF1600: unknown variable state; offset 0 is a+0(FP)

Updates golang/go#47027

Change-Id: Ia74852cdb0721ae0216787054197b0cac9e1c0f8
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/332289
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Nicola Murino <nicola.murino@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2023-11-27 17:24:02 +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
Russ Cox 7b82a4e95d all: gofmt
Gofmt to update doc comments to the new formatting.

For golang/go#51082.

Change-Id: I076031b6613691eefbb0f21739366e3fd2011ec9
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/399356
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-04-11 22:02:26 +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
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
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
Mark Rushakoff 85f98707c9 argon2: fix typo and code formatting in comments
Change-Id: I31fde79e91dd2f19a688bd62ac421d564634d5b3
GitHub-Last-Rev: caab01d661
GitHub-Pull-Request: golang/crypto#33
Reviewed-on: https://go-review.googlesource.com/97798
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-06 22:39:34 +00:00
Andreas Auernhammer d9133f5469 argon2: add Argon2id and update parameter recommendations
This change exports the Argon2 variant Argon2id and improves documenation.
The following parameter recommendations are added:
 - Argon2i:
   time=3 and max. memory for non-interactive scenarios as recommended by the
   RFC draft https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03#section-9.3
 - Argon2id:
   time=2 and memory=64MB for interactive scenarios as used by libsodium >= 1.0.9
   https://download.libsodium.org/doc/password_hashing/the_argon2i_function.html

   time=1 and max. memory for non-interactive scenarios as recommended by the
   RFC draft linked above.

Fixes golang/go#23602

Change-Id: Ia4d537e6126e5aff1243f2b5579df6bc8edb851a
Reviewed-on: https://go-review.googlesource.com/91935
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-06 19:08:13 +00:00
Alex Vaghin a660000891 argon2: add missing amd64 tags
The change fixes argon2_test build failure which currently
reads as follows when built with gccgo:

./argon2/blamka_ref.go:9:1: error: redefinition of 'processBlock'
 func processBlock(out, in1, in2 *block) {
 ^
./argon2/blamka_amd64.go:53:1: note: previous definition of 'processBlock' was here
 func processBlock(out, in1, in2 *block) {
 ^
./argon2/blamka_ref.go:13:1: error: redefinition of 'processBlockXOR'
 func processBlockXOR(out, in1, in2 *block) {
 ^
./argon2/blamka_amd64.go:57:1: note: previous definition of 'processBlockXOR' was here
 func processBlockXOR(out, in1, in2 *block) {
 ^

Change-Id: I5c1d7360a2a91a2ac27273a5c1da2a139b1537a7
Reviewed-on: https://go-review.googlesource.com/88455
Run-TryBot: Alex Vaghin <ddos@google.com>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2018-01-19 16:59:57 +00:00
Andreas Auernhammer 2b4b18b6aa argon2: fix incorrect key derivation if parallelism > 1
This change fixes an incorrect key derivation if the
degree of parallelism is greater than 1.

This change adds additional test vectors generated by the
https://github.com/P-H-C/phc-winner-argon2 CLI.

Fixes golang/go#23200

Change-Id: I8add8382b9e9ebbf9a70493050867c9af4ed6aa7
Reviewed-on: https://go-review.googlesource.com/85055
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-31 21:46:28 +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