diff mbox series

[v6,01/25] arm: imx: hab: Make authenticate_image return int

Message ID 1515760819-15116-2-git-send-email-bryan.odonoghue@linaro.org
State Accepted
Commit adbb051f0897f5b41e9514ca4f974738396be6d6
Headers show
Series Fix and extend i.MX HAB layer | expand

Commit Message

Bryan O'Donoghue Jan. 12, 2018, 12:39 p.m. UTC
Both usages of authenticate_image treat the result code as a simple binary.
The command line usage of authenticate_image directly returns the result
code of authenticate_image as a success/failure code.

Right now when calling hab_auth_img and test the result code in a shell a
passing hab_auth_img will appear to the shell as a fail.

The first step in fixing this behaviour is to fix-up the result code return
by authenticate_image() itself, subsequent patches fix the interpretation
of authenticate_image so that zero will return CMD_RET_SUCCESS and non-zero
will return CMD_RET_FAILURE.

The first step is fixing the return type in authenticate_image() so do that
now.

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 | 2 +-
 arch/arm/mach-imx/hab.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Stefano Babic Jan. 14, 2018, 4:44 p.m. UTC | #1
On 12/01/2018 13:39, Bryan O'Donoghue wrote:
> Both usages of authenticate_image treat the result code as a simple binary.
> The command line usage of authenticate_image directly returns the result
> code of authenticate_image as a success/failure code.
> 
> Right now when calling hab_auth_img and test the result code in a shell a
> passing hab_auth_img will appear to the shell as a fail.
> 
> The first step in fixing this behaviour is to fix-up the result code return
> by authenticate_image() itself, subsequent patches fix the interpretation
> of authenticate_image so that zero will return CMD_RET_SUCCESS and non-zero
> will return CMD_RET_FAILURE.
> 
> The first step is fixing the return type in authenticate_image() so do that
> now.


Thanks for your series - applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

> 
> 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 | 2 +-
>  arch/arm/mach-imx/hab.c             | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h
> index e0ff459..1b7a5e4 100644
> --- a/arch/arm/include/asm/mach-imx/hab.h
> +++ b/arch/arm/include/asm/mach-imx/hab.h
> @@ -145,6 +145,6 @@ typedef void hapi_clock_init_t(void);
>  
>  /* ----------- end of HAB API updates ------------*/
>  
> -uint32_t authenticate_image(uint32_t ddr_start, uint32_t image_size);
> +int authenticate_image(uint32_t ddr_start, uint32_t image_size);
>  
>  #endif
> diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
> index 02c7ae4..09892a6 100644
> --- a/arch/arm/mach-imx/hab.c
> +++ b/arch/arm/mach-imx/hab.c
> @@ -410,7 +410,7 @@ static bool is_hab_enabled(void)
>  	return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT;
>  }
>  
> -uint32_t authenticate_image(uint32_t ddr_start, uint32_t image_size)
> +int authenticate_image(uint32_t ddr_start, uint32_t image_size)
>  {
>  	uint32_t load_addr = 0;
>  	size_t bytes;
>
diff mbox series

Patch

diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h
index e0ff459..1b7a5e4 100644
--- a/arch/arm/include/asm/mach-imx/hab.h
+++ b/arch/arm/include/asm/mach-imx/hab.h
@@ -145,6 +145,6 @@  typedef void hapi_clock_init_t(void);
 
 /* ----------- end of HAB API updates ------------*/
 
-uint32_t authenticate_image(uint32_t ddr_start, uint32_t image_size);
+int authenticate_image(uint32_t ddr_start, uint32_t image_size);
 
 #endif
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 02c7ae4..09892a6 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -410,7 +410,7 @@  static bool is_hab_enabled(void)
 	return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT;
 }
 
-uint32_t authenticate_image(uint32_t ddr_start, uint32_t image_size)
+int authenticate_image(uint32_t ddr_start, uint32_t image_size)
 {
 	uint32_t load_addr = 0;
 	size_t bytes;