]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/aes: fix regression for ppc64x
authorLynn Boger <laboger@linux.vnet.ibm.com>
Mon, 25 Mar 2024 16:14:27 +0000 (11:14 -0500)
committerGopher Robot <gobot@golang.org>
Tue, 26 Mar 2024 19:58:31 +0000 (19:58 +0000)
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>
src/crypto/aes/cbc_ppc64x.go
src/crypto/aes/gcm_ppc64x.go

index 2cb9606e5864b4281249f2f27b42e5775d5c8093..d5b491e8e1fe5bb95bcc2cac4110fce451477641 100644 (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)
                }
        }
 }
index f206b476077d0998e6f917514fb560064502a463..20b0eade0a1fca4e1c40236d9841dc431d601d00 100644 (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.