From patchwork Thu Dec 28 18:49:20 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: 122849 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3797086qgn; Thu, 28 Dec 2017 10:50:42 -0800 (PST) X-Google-Smtp-Source: ACJfBourCJ3dDqTIkwPRcA6S5dpDSZ33N5/hOzjh0T10dGDVXidRInZzE+VphBhngjJ/NsHUH0Wa X-Received: by 10.80.179.233 with SMTP id t38mr40110031edd.267.1514487042740; Thu, 28 Dec 2017 10:50:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514487042; cv=none; d=google.com; s=arc-20160816; b=u1WcH8lxolJjvXxyOBRTzlotI9SoUxkJ7W3j48pkj3oRzLagwSSARRblgs1l1NyLPE q3Zgxme0xErd9wlHn41l3XMzzYKKUvvRX/JOSHrm7fUwiu/5mQRWMqXEL3+8kn+tm5WS XHL5OhOtCfzrzMiyYQ4gcAr358X/6I1xNIuJ7k3dF/hLsRpctyq0F8UQSIxspanhYlca xMSzI+m/38mA7ai/Hg1rjysqrzZvZZNqf1xzZZyLyRzRPWxA9NZWq4ZBaZGBZN5XdqK7 sYCK632I3SgkexqEseXY/8IJNQQODIB6QBc4Yx/CNkaDLV7MjeS3d5pQkYg/wDMXGWqd 7DIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=HS7KCmC5EP3My/+W1w4nqOM20jbfY7ICfxQOJquCBzI=; b=EWZkmUNIoHpnI3EgaVVn0CnzqLaIrtiU5k/ytnhiZ+3vLFYn4MOGEHbvlNl95sw/R3 9fW4/zwNZ/BLpbNu6vIem+V402yZFNtNHjKkf3t43jj77R9t7PV0ljheSfFH5CvPzuKA Ah+5xbF+tfv1THVtwXDzcWapIOKGCsKY/ff2pyc1003v8rO/Pyc1OvSxAKPAD60P2HNi b92F3pJpOJZ/itzSAvTmwfRExxhAUHm4TWz76WXWK8e2qYkmCSQJbE+jF8PzFbriuphN L/xiPcGpQa6D3RR8iyNeaQGwoE7dWf/tj3eweORLSMWUJuXrENr7M4EaxLhEI1gbg0ON EadA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OmENK8AO; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id k23si3335657edj.263.2017.12.28.10.50.42; Thu, 28 Dec 2017 10:50:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OmENK8AO; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 5629EC21DCE; Thu, 28 Dec 2017 18:50:08 +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_DNSWL_BLOCKED, 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 E983AC21DB0; Thu, 28 Dec 2017 18:49:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 06712C21C34; Thu, 28 Dec 2017 18:49:45 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id 9CEF2C21C59 for ; Thu, 28 Dec 2017 18:49:45 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id f206so44969614wmf.5 for ; Thu, 28 Dec 2017 10:49:45 -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=3YZdInYDxFuSNZyaa3f41D9mVUQyXzcYYtPmrUIIf60=; b=OmENK8AOkf5X8KZAZm8LlgrEEaC9JCGYhAlcQv5Gw7HKyeCIqHVFkgNWxgZ8flGq6z HCOnXn8pBPGTNTCy2/My0Pv+bLBon/VhyD5uw30ef0DYED6MnEbDM6CFtKcACPUPxaro EaLXvUSkTdLxz75OtRXxTAA85kTA/LzTtVpJQ= 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=3YZdInYDxFuSNZyaa3f41D9mVUQyXzcYYtPmrUIIf60=; b=s2bX5GQ5lDqohyHaN6xQmoy7GGv0sGNhXfBBZ8hq9SXZzCMrb/zI90EG7FwGNa1sIH hF0zZoVcVnp0JUuSz+tlTo2K5HJrjla68H0IqFCHRcrJfDg5+BNCoQH4NU5uqVvoWiTj QKjFtiXRRdE4m1EfidXINk4PnPziC8TseX53LLMW9z4gn45sgyHmIRaFcC4rVlrXeetp d5hK9oRMydMtRtzHGDPcVukhEE9iCasBbukPP1bUc6M30ycynWrSNA49YwPeQF1r5LWc wnn5yE+9G6PZxb3vnssuHQOAVGg9+a7+SU47ebgwTPbN/uM5nUzQrUKQlwgWqZWvHIC4 /v4Q== X-Gm-Message-State: AKGB3mK4BdcSd0PobvzuA2saU6R1k/XMlgF04pADZcscCRGPK+f9eAxV jBCV014ZWb6efPQmkRRgv6kf42fl+pU= X-Received: by 10.80.213.158 with SMTP id v30mr41226761edi.102.1514486985035; Thu, 28 Dec 2017 10:49:45 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id x28sm35246579edd.0.2017.12.28.10.49.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Dec 2017 10:49:44 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Thu, 28 Dec 2017 18:49:20 +0000 Message-Id: <1514486982-19059-2-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514486982-19059-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514486982-19059-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v2 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 Cc: Breno Matheus Lima --- 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;