]> git.ipfire.org Git - people/ms/u-boot.git/commit
arm: imx: hab: Fix authenticate_image input parameters
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Fri, 12 Jan 2018 12:40:01 +0000 (12:40 +0000)
committerStefano Babic <sbabic@denx.de>
Sun, 14 Jan 2018 16:26:30 +0000 (17:26 +0100)
commitc5800b254159c58773004eae1b58502eea4d1f6b
tree8a6fc341879fba9f22b09c9fa6c11a4c996410ef
parent08a81cad2f7802166ab6adc349b3e247aa4517c7
arm: imx: hab: Fix authenticate_image input parameters

u-boot command "hab_auth_img" tells a user that it takes

- addr - image hex address
- offset - hex offset of IVT in the image

but in fact the callback hab_auth_img makes to authenticate_image treats
the second 'offset' parameter as an image length.

Furthermore existing code requires the IVT header to be appended to the end
of the image which is not actually a requirement of HABv4.

This patch fixes this situation by

1: Adding a new parameter to hab_auth_img
   - addr   : image hex address
   - length : total length of the image
   - offset : offset of IVT from addr

2: Updates the existing call into authenticate_image() in
   arch/arm/mach-imx/spl.c:jump_to_image_no_args() to pass
   addr, length and IVT offset respectively.

This allows then hab_auth_img to actually operate the way it was specified
in the help text and should still allow existing code to work.

It has the added advantage that the IVT header doesn't have to be appended
to an image given to HAB - it can be prepended for example.

Note prepending the IVT is what u-boot will do when making an IVT for the
BootROM. It should be possible for u-boot properly authenticate images
made by mkimage via HAB.

This patch is the first step in making that happen subsequent patches will
focus on removing hard-coded offsets to the IVT, which again is not
mandated to live at the end of a .imx image.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Sven Ebenfeld <sven.ebenfeld@gmail.com>
Cc: George McCollister <george.mccollister@gmail.com>
Cc: Breno Matheus Lima <brenomatheus@gmail.com>
Tested-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
arch/arm/include/asm/mach-imx/hab.h
arch/arm/mach-imx/hab.c
arch/arm/mach-imx/spl.c