]> Cypherpunks repositories - gostls13.git/commit
crypto/internal/constanttime: expose intrinsics to the FIPS 140-3 packages
authorFilippo Valsorda <filippo@golang.org>
Wed, 29 Oct 2025 12:05:19 +0000 (13:05 +0100)
committerGopher Robot <gobot@golang.org>
Mon, 3 Nov 2025 15:14:16 +0000 (07:14 -0800)
commit00ee1860ce877ec9e2e323d7e48dee083e0902bd
treec3985753e112120527a399b956cdd424fcffd465
parent388c41c412c24b751c8c09465787ae79bceca9c7
crypto/internal/constanttime: expose intrinsics to the FIPS 140-3 packages

Intrinsifying things inside the module (crypto/internal/fips140/subtle)
is asking for trouble, as the import paths are rewritten by the
GOFIPS140 mechanism, and we might have to support multiple modules
in the future.

Importing crypto/subtle from inside a FIPS 140-3 module is not allowed,
and is basically asking for circular dependencies.

Instead, break off the intrinsics into their own package
(crypto/internal/constanttime), and keep the byte slice operations
in crypto/internal/fips140/subtle. crypto/subtle then becomes a thin
dispatch layer.

Change-Id: I6a6a6964cd5cb5ad06e9d1679201447f5a811da4
Reviewed-on: https://go-review.googlesource.com/c/go/+/716120
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
14 files changed:
src/cmd/compile/internal/ssagen/intrinsics.go
src/cmd/compile/internal/ssagen/intrinsics_test.go
src/crypto/internal/constanttime/constant_time.go [new file with mode: 0644]
src/crypto/internal/fips140/edwards25519/tables.go
src/crypto/internal/fips140/nistec/generate.go
src/crypto/internal/fips140/nistec/p224.go
src/crypto/internal/fips140/nistec/p256.go
src/crypto/internal/fips140/nistec/p384.go
src/crypto/internal/fips140/nistec/p521.go
src/crypto/internal/fips140/rsa/pkcs1v22.go
src/crypto/internal/fips140/subtle/constant_time.go
src/crypto/internal/fips140deps/fipsdeps_test.go
src/crypto/subtle/constant_time.go
src/go/build/deps_test.go