From: Breno Matheus Lima Date: Wed, 21 Nov 2018 11:24:45 -0200 Subject: [U-Boot] [PATCH] imx: hab: extend hab_auth_img to calculate ivt_offset In-Reply-To: <20181106163925.4180994-1-pn@denx.de> References: <20181106163925.4180994-1-pn@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Hi Parthiban, Em ter, 6 de nov de 2018 =C3=A0s 14:42, Parthiban Nallathambi = escreveu: > > Current implementation of hab_auth_img command needs ivt_offset to > authenticate the image. But ivt header is placed at the end of image > date after padding. > > This leaves the usage of hab_auth_img command to fixed size or static > offset for ivt header. New function "get_image_ivt_offset" is introduced > to find the ivt offset during runtime. The case conditional check in this > function is same as boot_get_kernel in common/bootm.c > > With this variable length image e.g. FIT image with any random size can > have IVT at the end and ivt_offset option can be left optional > > Can be used as "hab_auth_img $loadaddr $filesize" from u-boot script > > Signed-off-by: Parthiban Nallathambi > --- > arch/arm/mach-imx/hab.c | 29 +++++++++++++++++++++++++++-- > 1 file changed, 27 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c > index b88acd13da..060d0866b3 100644 > --- a/arch/arm/mach-imx/hab.c > +++ b/arch/arm/mach-imx/hab.c > @@ -6,6 +6,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -302,18 +304,41 @@ static int do_hab_status(cmd_tbl_t *cmdtp, int flag= , int argc, > return 0; > } > > +static ulong get_image_ivt_offset(ulong img_addr, ulong length) > +{ I'm seeing that function get_image_ivt_offset() requires a length but we are not using it, there is any reason for that? Thanks, Breno Lima