1
0
mirror of https://github.com/golang/go synced 2024-11-14 17:30:29 -07:00

crypto/internal/fips: fix Avo generators

They needed their package names updated after packages were moved to
crypto/internal/fips. Also, mitigated mmcloughlin/avo#450 which would
require setting GOARCH=amd64 at generation time.

Change-Id: Ib903ef113ebb5a24844204f231f2507cea03a67e
Reviewed-on: https://go-review.googlesource.com/c/go/+/626075
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Filippo Valsorda 2024-11-06 20:15:59 +01:00 committed by Gopher Robot
parent 840ac5e037
commit 2c7b5ba8ca
6 changed files with 27 additions and 9 deletions

View File

@ -5,12 +5,14 @@
package main
import (
"os"
. "github.com/mmcloughlin/avo/build"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"
)
//go:generate go run . -out ../sha256block_amd64.s -pkg sha256
//go:generate go run . -out ../sha256block_amd64.s
// SHA256 block routine. See sha256block.go for Go equivalent.
//
@ -53,7 +55,11 @@ import (
// H7 = h + H7
func main() {
Package("crypto/sha256")
// https://github.com/mmcloughlin/avo/issues/450
os.Setenv("GOOS", "linux")
os.Setenv("GOARCH", "amd64")
Package("crypto/internal/fips/sha256")
ConstraintExpr("!purego")
blockAMD64()
blockAVX2()

View File

@ -1,4 +1,4 @@
// Code generated by command: go run sha256block_amd64_asm.go -out ../sha256block_amd64.s -pkg sha256. DO NOT EDIT.
// Code generated by command: go run sha256block_amd64_asm.go -out ../sha256block_amd64.s. DO NOT EDIT.
//go:build !purego

View File

@ -8,13 +8,15 @@
package main
import (
"os"
. "github.com/mmcloughlin/avo/build"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"
_ "golang.org/x/crypto/sha3"
)
//go:generate go run . -out ../keccakf_amd64.s -pkg sha3
//go:generate go run . -out ../sha3_amd64.s
// Round Constants for use in the ι step.
var RoundConstants = [24]uint64{
@ -100,7 +102,11 @@ const (
)
func main() {
Package("golang.org/x/crypto/sha3")
// https://github.com/mmcloughlin/avo/issues/450
os.Setenv("GOOS", "linux")
os.Setenv("GOARCH", "amd64")
Package("crypto/internal/fips/sha3")
ConstraintExpr("!purego")
keccakF1600()
Generate()

View File

@ -1,4 +1,4 @@
// Code generated by command: go run keccakf_amd64_asm.go -out ../keccakf_amd64.s -pkg sha3. DO NOT EDIT.
// Code generated by command: go run keccakf_amd64_asm.go -out ../sha3_amd64.s. DO NOT EDIT.
//go:build !purego

View File

@ -5,12 +5,14 @@
package main
import (
"os"
. "github.com/mmcloughlin/avo/build"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"
)
//go:generate go run . -out ../sha512block_amd64.s -pkg sha512
//go:generate go run . -out ../sha512block_amd64.s
// SHA512 block routine. See sha512block.go for Go equivalent.
//
@ -138,7 +140,11 @@ var _K = []uint64{
}
func main() {
Package("crypto/sha512")
// https://github.com/mmcloughlin/avo/issues/450
os.Setenv("GOOS", "linux")
os.Setenv("GOARCH", "amd64")
Package("crypto/internal/fips/sha512")
ConstraintExpr("!purego")
blockAMD64()
blockAVX2()

View File

@ -1,4 +1,4 @@
// Code generated by command: go run sha512block_amd64_asm.go -out ../sha512block_amd64.s -pkg sha512. DO NOT EDIT.
// Code generated by command: go run sha512block_amd64_asm.go -out ../sha512block_amd64.s. DO NOT EDIT.
//go:build !purego