Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHA3 Final appears to write outside of bounds #295

Open
xes-pbrodnick opened this issue Apr 10, 2024 · 1 comment
Open

SHA3 Final appears to write outside of bounds #295

xes-pbrodnick opened this issue Apr 10, 2024 · 1 comment

Comments

@xes-pbrodnick
Copy link

When executing a SHA3 Final IPI operation the DMA appears to corrupt bytes outside the 384 bit (48 byte) output buffer.

I believe this is due to calls to XPlmi_DmaXfr with the length specified in bytes rather than words

From sw_services/xilsecure/src/common/versal_common/server/xsecure_sha_ipihandler.c

			/* Initiate and complete the DMA to DMA transfer */
			Status = XPlmi_DmaXfr((u64)(UINTPTR)(Hash.Hash), DstAddr,
				XSECURE_HASH_SIZE_IN_BYTES, XPLMI_PMCDMA_0);

Here XSECURE_HASH_SIZE_IN_BYTES is 48, but the XPlmi_DmaXfr() routine states that it takes words (I verified this by reviewing the XPlmi_MemCpy64 routine which shifts the byte length by the XPLMI_WORD_LEN_SHIFT macro.)

/*****************************************************************************/
/**
 * @brief	This function is used to initiate and complete the DMA to DMA transfer.
 *
 * @param	SrcAddr for SRC channel to fetch data from
 * @param	DestAddr for DST channel to store the data
 * @param	Len of the data in words
 * @param	Flags to select PMC DMA and DMA Burst type
 *
 * @return
 * 			- XST_SUCCESS on success.
 * 			- XPLMI_ERR_DMA_XFER_WAIT_SRC if Dma Xfer failed in Src Channel
 * 			wait for done.
 * 			- XPLMI_ERR_DMA_XFER_WAIT_DEST if Dma Xfer failed in Dest Channel
 * 			wait for done.
 *
 *****************************************************************************/
int XPlmi_DmaXfr(u64 SrcAddr, u64 DestAddr, u32 Len, u32 Flags)
@praveent-amd
Copy link

Thanks @xes-pbrodnick for reporting. your analysis is correct, and this will be fixed in the upcoming (2024.1) release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants