Skip to content

Commit c8e0e23

Browse files
committed
use constant-time tag compare in TI AES
1 parent f382526 commit c8e0e23

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

wolfcrypt/src/port/ti/ti-aes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ static int AesAuthDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
592592
ROM_AESDataProcess(AES_BASE, aes->reg, tmpTag, WC_AES_BLOCK_SIZE);
593593
wolfSSL_TI_unlockCCM();
594594

595-
if (XMEMCMP(authTag, tmpTag, authTagSz) != 0) {
595+
if (ConstantCompare(authTag, tmpTag, authTagSz) != 0) {
596596
ret = AES_GCM_AUTH_E;
597597
}
598598
return ret;
@@ -645,7 +645,7 @@ static int AesAuthDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
645645
(unsigned int*)tmpTag);
646646
wolfSSL_TI_unlockCCM();
647647

648-
if ((ret == false) || (XMEMCMP(authTag, tmpTag, authTagSz) != 0)) {
648+
if ((ret == false) || (ConstantCompare(authTag, tmpTag, authTagSz) != 0)) {
649649
XMEMSET(out, 0, inSz);
650650
ret = AES_GCM_AUTH_E;
651651
}

0 commit comments

Comments
 (0)