summaryrefslogtreecommitdiff
path: root/boot/image-fit.c
diff options
context:
space:
mode:
authorSean Anderson <sean.anderson@seco.com>2022-03-24 11:26:11 -0400
committerTom Rini <trini@konsulko.com>2022-04-11 11:39:19 -0400
commitb583348ca8c8ce74d5dd665446d20f4c6c6e3f06 (patch)
tree46c9d7af8d9c1ccc8210caa049c34c39aae56d09 /boot/image-fit.c
parente6fe02a5715b3dc02fe4041c4f5a59099a711d70 (diff)
downloadu-boot-b583348ca8c8ce74d5dd665446d20f4c6c6e3f06.tar.gz
u-boot-b583348ca8c8ce74d5dd665446d20f4c6c6e3f06.tar.bz2
u-boot-b583348ca8c8ce74d5dd665446d20f4c6c6e3f06.zip
image: fit: Align hash output buffers
Hardware-accelerated hash functions require that the input and output buffers be aligned to the minimum DMA alignment. memalign.h helpfully provides a macro just for this purpose. It doesn't exist on the host, but we don't need to be aligned there either. Fixes: 5dfb521386 ("[new uImage] New uImage low-level API") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/image-fit.c')
-rw-r--r--boot/image-fit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/boot/image-fit.c b/boot/image-fit.c
index f01cafe4e2..6610035d0a 100644
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -24,6 +24,7 @@
#include <mapmem.h>
#include <asm/io.h>
#include <malloc.h>
+#include <memalign.h>
#include <asm/global_data.h>
#ifdef CONFIG_DM_HASH
#include <dm.h>
@@ -1263,7 +1264,8 @@ int calculate_hash(const void *data, int data_len, const char *name,
static int fit_image_check_hash(const void *fit, int noffset, const void *data,
size_t size, char **err_msgp)
{
- uint8_t value[FIT_MAX_HASH_LEN];
+ DEFINE_ALIGN_BUFFER(uint8_t, value, FIT_MAX_HASH_LEN,
+ ARCH_DMA_MINALIGN);
int value_len;
const char *algo;
uint8_t *fit_value;