Skip to content

Commit 3901fa6

Browse files
fix check on non aad use
1 parent f8dbc7f commit 3901fa6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

wolfcrypt/src/port/xilinx/xil-aesgcm.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out,
627627
/* calls to hardened crypto */
628628
XSecure_AesInitialize(&(aes->xilAes), &(aes->dma), aes->kup,
629629
(word32*)iv, aes->keyInit);
630-
XSecure_AesDecryptData(&(aes->xilAes), out, in, sz, tag);
630+
ret = XSecure_AesDecryptData(&(aes->xilAes), out, in, sz, tag);
631631

632632
/* account for additional data */
633633
if (authIn != NULL && authInSz > 0) {
@@ -640,6 +640,12 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out,
640640
return AES_GCM_AUTH_E;
641641
}
642642
}
643+
else {
644+
/* if no aad then check the result of the initial tag passed in */
645+
if (ret != XST_SUCCESS) {
646+
return AES_GCM_AUTH_E;
647+
}
648+
}
643649

644650
return 0;
645651

0 commit comments

Comments
 (0)