mirror of https://github.com/golang/go.git
crypto/sha256: Avo port of sha256block_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="src/crypto/sha256/sha256block_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"
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)
3513c3513
< MOVQ $K256<>(SB), BP
---
> LEAQ K256<>(SB), BP
4572c4572
< MOVQ $K256<>(SB), BP
---
> LEAQ K256<>(SB), BP
Change-Id: I637c01d746ca775b8a09f874f7925ffc3b4965ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/595559
Reviewed-by: Russell Webb <russell.webb@protonmail.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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
d6d5d8c8fb
commit
dbd50a16dc
|
|
@ -355,8 +355,9 @@ var excluded = map[string]bool{
|
|||
"builtin": true,
|
||||
|
||||
// go.dev/issue/46027: some imports are missing for this submodule.
|
||||
"crypto/internal/edwards25519/field/_asm": true,
|
||||
"crypto/internal/bigmod/_asm": true,
|
||||
"crypto/internal/edwards25519/field/_asm": true,
|
||||
"crypto/sha256/_asm": true,
|
||||
}
|
||||
|
||||
// printPackageMu synchronizes the printing of type-checked package files in
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
module std/crypto/sha256/_asm
|
||||
|
||||
go 1.24
|
||||
|
||||
require github.com/mmcloughlin/avo v0.6.0
|
||||
|
||||
require (
|
||||
golang.org/x/mod v0.20.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/tools v0.24.0 // indirect
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
github.com/mmcloughlin/avo v0.6.0 h1:QH6FU8SKoTLaVs80GA8TJuLNkUYl4VokHKlPhVDg4YY=
|
||||
github.com/mmcloughlin/avo v0.6.0/go.mod h1:8CoAGaCSYXtCPR+8y18Y9aB/kxb8JSS6FRI7mSkvD+8=
|
||||
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
|
||||
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
|
||||
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -357,8 +357,9 @@ var excluded = map[string]bool{
|
|||
"builtin": true,
|
||||
|
||||
// See go.dev/issue/46027: some imports are missing for this submodule.
|
||||
"crypto/internal/edwards25519/field/_asm": true,
|
||||
"crypto/internal/bigmod/_asm": true,
|
||||
"crypto/internal/edwards25519/field/_asm": true,
|
||||
"crypto/sha256/_asm": true,
|
||||
}
|
||||
|
||||
// printPackageMu synchronizes the printing of type-checked package files in
|
||||
|
|
|
|||
Loading…
Reference in New Issue