forked from wolfSSL/wolfssl
fix check on non aad use
This commit is contained in:
@ -627,7 +627,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out,
|
|||||||
/* calls to hardened crypto */
|
/* calls to hardened crypto */
|
||||||
XSecure_AesInitialize(&(aes->xilAes), &(aes->dma), aes->kup,
|
XSecure_AesInitialize(&(aes->xilAes), &(aes->dma), aes->kup,
|
||||||
(word32*)iv, aes->keyInit);
|
(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 */
|
/* account for additional data */
|
||||||
if (authIn != NULL && authInSz > 0) {
|
if (authIn != NULL && authInSz > 0) {
|
||||||
@ -640,6 +640,12 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out,
|
|||||||
return AES_GCM_AUTH_E;
|
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;
|
return 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user