]> Cypherpunks repositories - gostls13.git/commit
crypto/ecdh: move implementation to crypto/internal/fips/ecdh
authorFilippo Valsorda <filippo@golang.org>
Thu, 14 Nov 2024 21:02:02 +0000 (22:02 +0100)
committerGopher Robot <gobot@golang.org>
Tue, 19 Nov 2024 23:01:37 +0000 (23:01 +0000)
commit566cf1c1083b26d4a15b94213c21142ecd9a8ca9
treef9f9998bd98d0995183e41dcbdd2f2955dcbbf56
parent2f35e1375e6706938d5a307f11388cad92afe288
crypto/ecdh: move implementation to crypto/internal/fips/ecdh

This intentionally gives up on the property of not computing the public
key until requested. It was nice, but it was making the code too
complex. The average use case is to call PublicKey immediately after
GenerateKey anyway.

Added support in the module for P-224, just in case we'd ever want to
support it in crypto/ecdh.

Tried various ways to fix test/fixedbugs/issue52193.go to be meaningful,
but crypto/ecdh is pretty complex and all the solutions would end up
locking in crypto/ecdh structure rather than compiler behavior. The rest
of that test is good enough on its own anyway. If we do the work in the
future of making crypto/ecdh zero-allocations using the affordances of
the compiler, we can add a more robust TestAllocations on our side.

For #69536

Change-Id: I68ac3955180cb31f6f96a0ef57604aaed88ab311
Reviewed-on: https://go-review.googlesource.com/c/go/+/628315
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
12 files changed:
src/crypto/ecdh/ecdh.go
src/crypto/ecdh/ecdh_test.go
src/crypto/ecdh/nist.go
src/crypto/ecdh/x25519.go
src/crypto/internal/boring/ecdh.go
src/crypto/internal/fips/ecdh/cast.go [new file with mode: 0644]
src/crypto/internal/fips/ecdh/ecdh.go [new file with mode: 0644]
src/crypto/internal/fips/ecdh/order_test.go [new file with mode: 0644]
src/crypto/internal/fipsdeps/fipsdeps_test.go
src/crypto/internal/fipstest/cast_test.go
src/go/build/deps_test.go
test/fixedbugs/issue52193.go