AR# 73383: Zynq UltraScale+ MPSoC/RFSoC: 2019.1 XilSecure, SHA3 hash calculation fails in cases where the data is less than 104 bytes
Zynq UltraScale+ MPSoC/RFSoC: 2019.1 XilSecure, SHA3 hash calculation fails in cases where the data is less than 104 bytes
In the 2019.1 release, XilSecure fails to support SHA3 hash calculation when the data size is less than 104 bytes in the below scenarios:
If the input data is non-word aligned
If the input data is from non-word aligned address.
A patch for the 2019.1 version is attached to this Answer Record.
The library has been updated to improve performance of SHA3 in the below two use cases:
Data blob length is not in a multiple of 4 bytes. The new code processes maximum data in multiples of 4 bytes and the remaining less than 4 bytes of data is processed along with the next data or padding. For example, if the data blob size is 258, the first 256 bytes are sent to the SHA engine first, and then the remaining 2 bytes are send to SHA engine along with padding.
There is partial data remaining from an earlier call. The new code sends the partial data along with data copied from the new data of total size 104 to SHA3. It then checks if the data address of the remaining data to be processed is WORD aligned and if it is, it processes the remaining data as explained in point 1.
This issue will be addressed in the 2019.2 version of the XilSecure library.
Note: The patch attached in this Answer Record also addresses the performance issue described in (Xilinx Answer 73416).