From patchwork Tue Jan 2 16:43:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 123158 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9169731qgn; Tue, 2 Jan 2018 08:45:44 -0800 (PST) X-Google-Smtp-Source: ACJfBovNA7LumMaK2QiKjtJ6v71DCsCqwZlyK3iv78ut39J/r7imVwQSlVZ3tYOftxfwLWKDlZks X-Received: by 10.80.180.16 with SMTP id b16mr63143259edh.136.1514911544791; Tue, 02 Jan 2018 08:45:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514911544; cv=none; d=google.com; s=arc-20160816; b=BqAmp/eEtOW4zIMCroV+eFlbk6tF65qZsj/wVE5M/BHrCbEcbFBF3x60ku0OUkF6RL wA0iIoc7CSF5ggvH1s66Oqmh9DFcjCh3JBnaqiPkiAeUijGCsiqCP01dtNvw3Ge+oRTm V5HiRAlBISL2diXYHiRO++0mCa4uUkEOAgP/ys3GoYJztkQJdPvOlMFb6gxLASSKa42y i9SRWpypwKEjEaAg7jH09aZUjWBSPUmZe8hb+dduZMl3moyDrlz67YqsuqDgv+hRt8xJ qRu8aEHcsl0Pw3d7qx7RfiJLvJZ532HPlgVxMmfYlr5kkbQNxkQS6PGiXozQnJba1XCo KPxQ== 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=C6otGfEeT7pvk1l9akNh2syGSeCTDoUvMdbk89JYc62iuJpFS9/mZdkFYS3Sj8w6Kn ii/EZdx3WJiiqSdwxOCYnTK0MsSaEHF0eOKoQKeZVSghOHS0PqMuz8nVD6SY5Lk3B1B3 B0bnTdWRq27bKo2KDdBeyhoNgAOw8mUEdF4SsCVhNSdjAvfT7QYK3JmycYCdps+sem/D ud9WtVbuLpMXTSOz3NcP9/xg1TFSpfD0kAvtH1b+/myEOIF1KiboGjQdPRHxxluQNSXf GbTdT5cY90NXUAJymF4Xx7CIopIAUHWGcw4tIqGaX5hmVBrq/0Nk8f/9Y4E6mk2nbpb9 VO0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=R+TottIh; 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 g26si8649672edg.138.2018.01.02.08.45.44; Tue, 02 Jan 2018 08:45:44 -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=R+TottIh; 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 0E5E6C21E5A; Tue, 2 Jan 2018 16:44:46 +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 31C96C21DA3; Tue, 2 Jan 2018 16:44:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2C58EC21C2B; Tue, 2 Jan 2018 16:44:25 +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 CBAEAC21C29 for ; Tue, 2 Jan 2018 16:44:24 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id g75so62446117wme.0 for ; Tue, 02 Jan 2018 08:44:24 -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=R+TottIh2v4Yf5VdpHsJfHfdk6uOZbHt4yh1fL730Qeo7KWRR4lBvjZ73N2OISfiK2 ZS+VKoVZwpNY8PwO1VcVyGSV8IYUeSU1AB87ix0iXgML12opT+YSqYqMOBXZa2LFDfIh 1eqkNgcRZYYjwWYgYQ4YLtQKqFzrWXN+s1/vo= 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=tGaEGoJucCLjAfDp6VSh7wZ/ES9HfFnJgKeNECrT6bUAG6fUzrVm/um0KEs/ph9zIE lQhhjPBvS1YsN4V80zEygAk0rqkxKrqJVVUX5ZNvA+MvG/xzhab4g6zxkguc/PlhrbI0 Vva/fkqcE3QqGmBQzuX4MAC2PJcqKA28w299Iur9MhqLhDuIcqOIMTtE12tjX1cGX4YY M2TtM8SU2P3n9xvvZdayQehaS+CiChX8j8lV22JbHpuUy6AvHC1xQvpcNpJ7Z6sIj4TM xSOqUfKAtGj4nKGyv5sxBgYQE8AULlwPG77Q5r8M3o/wmjzNy+Fp0VzgPe05ZQo/mGHA CG1w== X-Gm-Message-State: AKGB3mJjoRGw+B7rGE+HsNVRxGywWaQXw8AFc/ux0dQb51n4T+O91vZb HViwh/h2jpgW5/t/KqLZLUg9Q3SK6F8= X-Received: by 10.80.209.193 with SMTP id i1mr61834644edg.107.1514911464223; Tue, 02 Jan 2018 08:44:24 -0800 (PST) Received: from localhost.localdomain (D4CCACC7.cm-2.dynamic.ziggo.nl. [212.204.172.199]) by smtp.gmail.com with ESMTPSA id z5sm29850584edh.76.2018.01.02.08.44.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 08:44:23 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Tue, 2 Jan 2018 16:43:47 +0000 Message-Id: <1514911451-4520-2-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514911451-4520-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514911451-4520-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v4 01/25] 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;