diff --git a/wolfcrypt/src/port/xilinx/xil-aesgcm.c b/wolfcrypt/src/port/xilinx/xil-aesgcm.c index 4fd427b26..e2dfc8af4 100644 --- a/wolfcrypt/src/port/xilinx/xil-aesgcm.c +++ b/wolfcrypt/src/port/xilinx/xil-aesgcm.c @@ -627,7 +627,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, /* calls to hardened crypto */ XSecure_AesInitialize(&(aes->xilAes), &(aes->dma), aes->kup, (word32*)iv, aes->keyInit); - XSecure_AesDecryptData(&(aes->xilAes), out, in, sz, tag); + ret = XSecure_AesDecryptData(&(aes->xilAes), out, in, sz, tag); /* account for additional data */ if (authIn != NULL && authInSz > 0) { @@ -640,6 +640,12 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, return AES_GCM_AUTH_E; } } + else { + /* if no aad then check the result of the initial tag passed in */ + if (ret != XST_SUCCESS) { + return AES_GCM_AUTH_E; + } + } return 0;