This function decrypts the encrypted data provided and updates the DecData buffer with decrypted data.
Note: When using this function to decrypt data that was encrypted with
XSecure_AesEncryptData, the GCM tag is stored as the last sixteen (16) bytes of data in
XSecure_AesEncryptData's Dst (destination) buffer and is used as the GcmTagAddr pointer.
Prototype
s32 XSecure_AesDecryptData(XSecure_Aes *InstancePtr, u8 *DecData, u8 *EncData, u32 Size, u8 *GcmTagAddr);
Parameters
The following table lists the XSecure_AesDecryptData function arguments.
| Name | Description |
|---|---|
| InstancePtr | Pointer to the XSecure_Aes instance. |
| DecData | Pointer to a buffer in which decrypted data is stored. |
| EncData | Pointer to the encrypted data which requires decryption. |
| Size | Size of data to be decrypted in bytes, whereas the number of bytes is multiples of 4. |
Returns
This API returns the status of GCM tag matching.
- XSECURE_CSU_AES_GCM_TAG_MISMATCH: If GCM tag is mismatched
- XST_SUCCESS: If GCM tag was matched.