XSecure_AesDecryptData - 2023.1 English

Standalone Library Documentation: BSP and Libraries Document Collection (UG643)

Document ID
UG643
Release Date
2023-05-16
Version
2023.1 English

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 will be stored as the last sixteen (16) bytes of data in XSecure_AesEncryptData's Dst (destination) buffer and should be used as the GcmTagAddr's 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.

Table 1. XSecure_AesDecryptData Arguments
Name Description
InstancePtr Pointer to the XSecure_Aes instance.
DecData Pointer to a buffer in which decrypted data will be stored.
EncData Pointer to the encrypted data which needs to be decrypted.
Size Size of data to be decrypted in bytes, whereas the number of bytes should be multiples of 4.

Returns

This API returns the status of GCM tag matching.
  • XSECURE_CSU_AES_GCM_TAG_MISMATCH: If GCM tag was mismatched
  • XST_SUCCESS: If GCM tag was matched.