1
0
mirror of https://github.com/golang/go synced 2024-11-22 14:34:45 -07:00

crypto/ed25519: fix TestAllocations in FIPS mode

Change-Id: Ic36e95dba29d43e73ddf105d538c4795bc4ce557
Reviewed-on: https://go-review.googlesource.com/c/go/+/630097
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Filippo Valsorda 2024-11-20 16:11:49 +01:00 committed by Gopher Robot
parent 93fcd8fb18
commit c483fdbfcf

View File

@ -14,6 +14,13 @@ import (
func fipsPCT(k *PrivateKey) error {
return fips.PCT("Ed25519 sign and verify PCT", func() error {
return pairwiseTest(k)
})
}
// pairwiseTest needs to be a top-level function declaration to let the calls
// inline and their allocations not escape.
func pairwiseTest(k *PrivateKey) error {
msg := []byte("PCT")
sig := Sign(k, msg)
// Note that this runs pub.a.SetBytes. If we wanted to make key generation
@ -24,7 +31,6 @@ func fipsPCT(k *PrivateKey) error {
return err
}
return Verify(pub, msg, sig)
})
}
func signWithoutSelfTest(priv *PrivateKey, message []byte) []byte {