1
0
mirror of https://github.com/golang/go synced 2024-11-15 02:00:33 -07:00

crypto/aes: fix regression for ppc64x

CL 561080 introduced some failures for CBC and GCM crypto tests that are run during a build resulting in dashboard failures.

Tests that are failing:
- TestCBCEncrypterAES
- TestCBCDecrypterAES
- TestAESGCM
- TestGCMCounterWrap
- TestGCMAsm

This fixes those failures.

Change-Id: I90d6f8d279a3051cf951a1a9628afb8d0b5c2f17
Reviewed-on: https://go-review.googlesource.com/c/go/+/574076
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Lynn Boger 2024-03-25 11:14:27 -05:00 committed by Gopher Robot
parent 1e12eab870
commit d3e5e9fdf6
2 changed files with 4 additions and 3 deletions

View File

@ -59,9 +59,9 @@ func (x *cbc) CryptBlocks(dst, src []byte) {
}
if len(src) > 0 {
if x.enc == cbcEncrypt {
cryptBlocksChain(&src[0], &dst[0], len(src), &x.b.enc[0], &x.iv[0], x.enc, len(x.b.enc)/4-1)
cryptBlocksChain(&src[0], &dst[0], len(src), &x.b.enc[0], &x.iv[0], x.enc, int(x.b.l)/4-1)
} else {
cryptBlocksChain(&src[0], &dst[0], len(src), &x.b.dec[0], &x.iv[0], x.enc, len(x.b.dec)/4-1)
cryptBlocksChain(&src[0], &dst[0], len(src), &x.b.dec[0], &x.iv[0], x.enc, int(x.b.l)/4-1)
}
}
}

View File

@ -119,7 +119,8 @@ func (g *gcmAsm) deriveCounter(counter *[gcmBlockSize]byte, nonce []byte) {
// counterCryptASM implements counterCrypt which then allows the loop to
// be unrolled and optimized.
func (g *gcmAsm) counterCrypt(out, in []byte, counter *[gcmBlockSize]byte) {
counterCryptASM(len(g.cipher.enc)/4-1, out, in, counter, &g.cipher.enc[0])
counterCryptASM(int(g.cipher.l)/4-1, out, in, counter, &g.cipher.enc[0])
}
// increments the rightmost 32-bits of the count value by 1.