mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 10:24:49 +00:00
crypto: fsl_hash: fix flush dcache alignment in caam_hash()
Loading a FIT kernel image with hash hardware acceleration enabled (CONFIG_SHA_HW_ACCEL=y) displays the following CACHE warning: [...] Trying 'kernel-1' kernel subimage [...] Verifying Hash Integrity ... sha256CACHE: Misaligned operation at range [16000128, 1673fae8] [...] Trying 'ramdisk-1' ramdisk subimage [...] Verifying Hash Integrity ... sha256CACHE: Misaligned operation at range [1676d6d4, 1737a5d4] [...] Trying 'fdt-imx6q-xxx.dtb' fdt subimage [...] Verifying Hash Integrity ... sha256CACHE: Misaligned operation at range [1673fbdc, 1674b0dc] [...] This patch fixes it. Tested on: - i.MX 6 custom board - LS1021A custom board Signed-off-by: Benjamin Lemouzy <blemouzy@centralp.fr> Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
9f258e4820
commit
ef0e979e14
1 changed files with 4 additions and 2 deletions
|
@ -183,6 +183,7 @@ int caam_hash(const unsigned char *pbuf, unsigned int buf_len,
|
|||
{
|
||||
int ret = 0;
|
||||
uint32_t *desc;
|
||||
unsigned long pbuf_aligned;
|
||||
unsigned int size;
|
||||
|
||||
desc = malloc_cache_aligned(sizeof(int) * MAX_CAAM_DESCSIZE);
|
||||
|
@ -191,8 +192,9 @@ int caam_hash(const unsigned char *pbuf, unsigned int buf_len,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
size = ALIGN(buf_len, ARCH_DMA_MINALIGN);
|
||||
flush_dcache_range((unsigned long)pbuf, (unsigned long)pbuf + size);
|
||||
pbuf_aligned = ALIGN_DOWN((unsigned long)pbuf, ARCH_DMA_MINALIGN);
|
||||
size = ALIGN(buf_len + ((unsigned long)pbuf - pbuf_aligned), ARCH_DMA_MINALIGN);
|
||||
flush_dcache_range(pbuf_aligned, pbuf_aligned + size);
|
||||
|
||||
inline_cnstr_jobdesc_hash(desc, pbuf, buf_len, pout,
|
||||
driver_hash[algo].alg_type,
|
||||
|
|
Loading…
Add table
Reference in a new issue