]> Cypherpunks repositories - gostls13.git/commit
crypto/internal/fips: avoid some non-relocatable global initializers
authorRuss Cox <rsc@golang.org>
Tue, 5 Nov 2024 18:50:00 +0000 (13:50 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 11 Nov 2024 20:08:38 +0000 (20:08 +0000)
commit6051da46d01e967b55d088530fcbe84e8deb0e7a
tree3a41e4cea88766e4f9ef9d646585e63affb01d6b
parent5a9aeef9d54321702253257eb983d7a0cc1d97bf
crypto/internal/fips: avoid some non-relocatable global initializers

In normal code,

var x = []int{...}

will be laid out by the linker, but in FIPS packages, the slice
assignment has to be deferred to init time to avoid a global
data relocation. We can avoid the init time work by writing

var x = [...]int{...}

instead. Do that.

For #69536.

Change-Id: Ie3c1d25af3f79182ee254014e49d3711038aa327
Reviewed-on: https://go-review.googlesource.com/c/go/+/625815
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/crypto/internal/fips/sha256/sha256block.go
src/crypto/internal/fips/sha256/sha256block_arm64.s
src/crypto/internal/fips/sha256/sha256block_riscv64.s
src/crypto/internal/fips/sha512/_asm/sha512block_amd64_asm.go
src/crypto/internal/fips/sha512/sha512block.go
src/crypto/internal/fips/sha512/sha512block_amd64.s
src/crypto/internal/fips/sha512/sha512block_arm64.s
src/crypto/internal/fips/sha512/sha512block_riscv64.s