crypto/internal/fips140/aes/gcm: use aes.EncryptBlockInternal on ppc64x and s390x

Left them out of CL 636775 because I did a search by reference, which
does not span architectures.

Fixes crypto/cipher.TestFIPSServiceIndicator failure on ppc64x and s390x.

For #69536

Change-Id: I34b49705a7099066e8c3871a7a34b394a9298e98
Reviewed-on: https://go-review.googlesource.com/c/go/+/637175
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Filippo Valsorda 2024-12-17 17:55:01 +01:00 committed by Gopher Robot
parent b9e2ffdcd2
commit b2c0168893
2 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,7 @@ func initGCM(g *GCM) {
}
hle := make([]byte, gcmBlockSize)
g.cipher.Encrypt(hle, hle)
aes.EncryptBlockInternal(&g.cipher, hle, hle)
// Reverse the bytes in each 8 byte chunk
// Load little endian, store big endian
@ -133,7 +133,7 @@ func seal(out []byte, g *GCM, nonce, plaintext, data []byte) {
var counter, tagMask [gcmBlockSize]byte
deriveCounter(&counter, nonce, &g.productTable)
g.cipher.Encrypt(tagMask[:], counter[:])
aes.EncryptBlockInternal(&g.cipher, tagMask[:], counter[:])
gcmInc32(&counter)
counterCrypt(&g.cipher, out, plaintext, &counter)
@ -151,7 +151,7 @@ func open(out []byte, g *GCM, nonce, ciphertext, data []byte) error {
var counter, tagMask [gcmBlockSize]byte
deriveCounter(&counter, nonce, &g.productTable)
g.cipher.Encrypt(tagMask[:], counter[:])
aes.EncryptBlockInternal(&g.cipher, tagMask[:], counter[:])
gcmInc32(&counter)
var expectedTag [gcmTagSize]byte

View File

@ -55,7 +55,7 @@ func initGCM(g *GCM) {
return
}
// Note that hashKey is also used in the KMA codepath to hash large nonces.
g.cipher.Encrypt(g.hashKey[:], g.hashKey[:])
aes.EncryptBlockInternal(&g.cipher, g.hashKey[:], g.hashKey[:])
}
// ghashAsm uses the GHASH algorithm to hash data with the given key. The initial
@ -115,7 +115,7 @@ func counterCrypt(g *GCM, dst, src []byte, cnt *[gcmBlockSize]byte) {
}
if len(src) > 0 {
var x [16]byte
g.cipher.Encrypt(x[:], cnt[:])
aes.EncryptBlockInternal(&g.cipher, x[:], cnt[:])
for i := range src {
dst[i] = src[i] ^ x[i]
}