From patchwork Wed Dec 27 12:25:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 853140 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="aDr2XyBz"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3z6C282G6Nz9s9Y for ; Wed, 27 Dec 2017 23:33:36 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 71BEDC21EE9; Wed, 27 Dec 2017 12:33:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 76A35C21C4A; Wed, 27 Dec 2017 12:33:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 52EECC21C4A; Wed, 27 Dec 2017 12:26:20 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id EE85CC21C34 for ; Wed, 27 Dec 2017 12:26:19 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id g130so39342033wme.0 for ; Wed, 27 Dec 2017 04:26:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2JPEdoXIV+HhkEzn+ytFFSDenoW/N31ib58wcWtNHD8=; b=aDr2XyBzawL2sz/1Q8A1j/oW3lMHoDEIFPMZPZ5lsrIglTOTOBUyV5SIYdlTjNc/Tn 2vTU2Ab9w+NdtiY9Qs8wBG9+GURrB5QtU32gr9HdoZOW2WhtMyNnj2zBZMIpXJurBKXA uaakAzkDJD4UwC2X0rfrz78U4aQS5kOL876Cw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2JPEdoXIV+HhkEzn+ytFFSDenoW/N31ib58wcWtNHD8=; b=Mm7htqG/DG+hUckTh1fOerUfMAU3ossnm7G3sT3ztLS2bKmuZ3pC1Jfn+ffFx8sWV7 +HT9ycGQVGXuw+JCtA/yIclyEQl+h8r3SRfIgw6jY7lX+r7NrnrhkYon5Veh+poQ7NZs lqab9ycSJ3TgngQJOuUFNWVxPi6kII6CqOoOMD6f/nAfcNRxlMDFjBQKJwbXi+/D6e2I GzhmkQ2Dh6p29RD1hZjEvG9A1/lh0YveU/ubEQkhS1OC0VMjLF/+DkvKg0WZDjxA+R08 pE/NgPbN15p73ln74PFInd6H3y8bmpSDweSoyVvnzX8gRfci/p/JNMWnh07taIchM2+G o82g== X-Gm-Message-State: AKGB3mIoyzSGwkXT6pMK22yohIF2r123oOkyuD2P22DC41z56wJ0XvNU s9SEQz8UIxe7GzS+O4NXbQwsjwlou70= X-Google-Smtp-Source: ACJfBovUFSqI98m6U9GVDWkzl+JXy09Cz3t32nxXrkx5z9iJwJLaGVyg+ECkGG92E1zSi9v8q/tS5A== X-Received: by 10.80.201.12 with SMTP id o12mr34960461edh.90.1514377579344; Wed, 27 Dec 2017 04:26:19 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a5sm28388838edm.47.2017.12.27.04.26.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Dec 2017 04:26:18 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de Date: Wed, 27 Dec 2017 12:25:44 +0000 Message-Id: <1514377566-28512-2-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514377566-28512-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514377566-28512-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailman-Approved-At: Wed, 27 Dec 2017 12:32:58 +0000 Cc: Fabio Estevam Subject: [U-Boot] [PATCH 01/23] arm: imx: hab: Make authenticate_image return int X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" 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 Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister --- 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;