From patchwork Sun Nov 27 15:27:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 699691 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tRYfC2v4wz9t2T for ; Mon, 28 Nov 2016 02:30:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3874FB3830; Sun, 27 Nov 2016 16:30:06 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fZrHEZRvHnZG; Sun, 27 Nov 2016 16:30:05 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C2F8A7579; Sun, 27 Nov 2016 16:30:05 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E3B28A7579 for ; Sun, 27 Nov 2016 16:30:01 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KRvjIc__95zs for ; Sun, 27 Nov 2016 16:30:01 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from fed1rmfepo103.cox.net (fed1rmfepo103.cox.net [68.230.241.145]) by theia.denx.de (Postfix) with ESMTP id 3219CA7558 for ; Sun, 27 Nov 2016 16:29:57 +0100 (CET) Received: from fed1rmimpo209.cox.net ([68.230.241.160]) by fed1rmfepo103.cox.net (InterMail vM.8.01.05.28 201-2260-151-171-20160122) with ESMTP id <20161127152956.HDKJ4150.fed1rmfepo103.cox.net@fed1rmimpo209.cox.net> for ; Sun, 27 Nov 2016 10:29:56 -0500 Received: from localhost.localdomain ([98.165.102.90]) by fed1rmimpo209.cox.net with cox id D3Vk1u00B1x1f0q013Vk36; Sun, 27 Nov 2016 10:29:44 -0500 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A090203.583AFBE9.0019, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.1 cv=PtYzF143 c=1 sm=1 tr=0 a=i7nT0dqFxmwB8XGI+JTv/g==:117 a=i7nT0dqFxmwB8XGI+JTv/g==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=9_1hYV8uAAAA:8 a=oG6M4r6Lo98AtNuWmvcA:9 a=FKwbt-OhbrkoYuZlCyy7:22 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (CRAM-MD5) smtp.auth=eric.a.nelson@cox.net From: Eric Nelson To: u-boot@lists.denx.de Date: Sun, 27 Nov 2016 08:27:43 -0700 Message-Id: <1480260463-1517-1-git-send-email-eric@nelint.com> X-Mailer: git-send-email 2.7.4 Cc: gary.bisson@boundarydevices.com, albert.aribaud@3adev.fr Subject: [U-Boot] [PATCH RESEND] imx-common: hab: fix return value from hab_auth_img X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The authenticate_image routine returns a boolean to indicate a valid (1) or invalid (0) image. The hab_auth_img should return CMD_RET_SUCCESS to indicate success (a valid image), but currently doesn't. Before this patch, a valid image at addres 0x12000000 with an IVT offset of 0x7a8000 will produce the following: => if hab_auth_img 0x12000000 0x7a8000 ; then > echo worked > else > echo failed > fi Authenticate image from DDR location 0x12000000... Secure boot enabled HAB Configuration: 0xcc, HAB State: 0x99 failed Signed-off-by: Eric Nelson --- arch/arm/imx-common/hab.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/imx-common/hab.c b/arch/arm/imx-common/hab.c index 6731825..e2c04f9 100644 --- a/arch/arm/imx-common/hab.c +++ b/arch/arm/imx-common/hab.c @@ -486,7 +486,9 @@ static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc, rcode = authenticate_image(addr, ivt_offset); - return rcode; + return (rcode != 0) + ? CMD_RET_SUCCESS + : CMD_RET_FAILURE; } U_BOOT_CMD(