Skip to content

Commit 15f3f7b

Browse files
authored
Merge pull request #10439 from ejohnstown/octeon-fix
port/cavium: fix Octeon AES-GCM AAD GHASH bug
2 parents 3e6efba + 82b3079 commit 15f3f7b

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

wolfcrypt/src/port/cavium/cavium_octeon_sync.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,13 +558,15 @@ static NOOPT int Octeon_AesGcm_SetAAD(Aes* aes, byte* aad, word32 aadSz)
558558
CVMX_MT_GFM_XORMUL1(p[1]);
559559
}
560560

561-
XMEMSET(aesBlock, 0, sizeof(aesBlock));
561+
if (remainder > 0) {
562+
XMEMSET(aesBlock, 0, sizeof(aesBlock));
562563

563-
for (i = 0; i < remainder; i++)
564-
aesBlock[i] = aad[i];
564+
for (i = 0; i < remainder; i++)
565+
aesBlock[i] = aad[i];
565566

566-
CVMX_MT_GFM_XOR0(p[0]);
567-
CVMX_MT_GFM_XORMUL1(p[1]);
567+
CVMX_MT_GFM_XOR0(p[0]);
568+
CVMX_MT_GFM_XORMUL1(p[1]);
569+
}
568570

569571
return 0;
570572
}

0 commit comments

Comments
 (0)