fix check on non aad use

This commit is contained in:
JacobBarthelmeh
2024-01-02 08:48:45 -08:00
parent f8dbc7f15c
commit 3901fa6a96

View File

@ -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;