From patchwork Fri Jan 12 12:39:55 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: 124313 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2014451qgn; Fri, 12 Jan 2018 04:42:22 -0800 (PST) X-Google-Smtp-Source: ACJfBosVbfq52CgszKktTj1PZGA922HEi+qz1UfR7YTX4yj1ZF5aXcTtj0IFrB5dZG/s2p8OwdKU X-Received: by 10.80.222.2 with SMTP id z2mr16289686edk.78.1515760942592; Fri, 12 Jan 2018 04:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515760942; cv=none; d=google.com; s=arc-20160816; b=ftwh2RY4bQOVbPYo5cHYnjvtEXcwdad9GB8i/DEnlPVECR6oM3B4ZB2QO74JwZCw/T zAsB4HVTSRQr/YvRu9bpXbWqL6bBKu+T9juhIHairYnh80Hkp77zyrUlUTzUs2jeh1Yj NBIqGIFuj3J7uCJteSVj+RVse2T1a1lJGmQ998K/R6oIRm5Kvnp4pL0PQJsKCP2o8l+j r5F9oMtV3tGdXJDRmnzhSoiKukBFvduPwqIBTIAnYdhXuFM08JizaCduxtHM2J0TyZJ7 7iCrhzm5EIyXYJMhWCbKGDsf7lTbMi8E0GX+vrk9WOBVQeaITqjRpoh3tGqPGksXbbqT kf4Q== 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=Fz/H/d26BOAnzjaqYCmHzXbXgnQK6o6VpdEEdiIDe5U=; b=CtgfiBrojMwjQLfKvc+LporS28WGKpBoYuQ3ncr79fYUhMlfq+C/yIEZjEkGeCwTyv D7laByIfXgp00X3A/2pqWYGEEkuHzhHh/2GXwFrpOfJNsMdmpR8/occe2ZTAEDjEvgcV hk2jiOj/ZixIE/GxxkmwUsBFvaEgRU6xQfoyxkLxwv8BHJxbxtcVllEqDoLgznY9t9m8 G0y3ycAUFEONKNleKzVSfkSWOLhAEFE1csRJ9KO3yei44D83INJqUsyOt8x7EjOjSw24 7FELOxVB/eKXt8CBsjMhif7GH/DOLx6FL9HqfyLtAmbDkRnwLqeVQXqdlrljo4EjZGqp lu2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QF8N6Zyi; 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 w18si3465493edd.60.2018.01.12.04.42.22; Fri, 12 Jan 2018 04:42:22 -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=QF8N6Zyi; 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 27015C22203; Fri, 12 Jan 2018 12:40: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 9142FC22137; Fri, 12 Jan 2018 12:40:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5B940C220B3; Fri, 12 Jan 2018 12:40:24 +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 F14C2C220AD for ; Fri, 12 Jan 2018 12:40:23 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id v123so2390681wmd.5 for ; Fri, 12 Jan 2018 04:40:23 -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=cXmghMZnsBNvXEl+g9N7RrkYyrns9YqQPyDb/FcqhHA=; b=QF8N6Zyi2wp7yx9DKOWgDQP6nnr3CJat4WbupR/3zv+qHJvNosnkSN2Ke0P9s+DIKP vO8BSDh0nIyDbZdR0S8D6pBCEuFRi1HRz06Pwltamw77DC/z2jck3y0+3MSkn9xgCfO7 YFaLMiL+udIdWzSaXkYTepYkbry7zYcOlzFWY= 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=cXmghMZnsBNvXEl+g9N7RrkYyrns9YqQPyDb/FcqhHA=; b=XC1Z8EK/2ORL3ixgHXh4Zn+HK5+fQ+Ftrx4ykjwadXd7JTY7ueO8zF649k+6+mTG8T 6HgRPvJiiRblDywGr3c/2E71J1fVhYfsu5e/jspse6gYw7CsKc1iQCsK4EZpNFwnsp7r Zr1zl2SxmF277r1rPMPv+vCrfjHERVGN4IKjCKU5PM6Y6fAGkHzEBCHYyJhuOPcRgevV eWfcRox9StADtZvpsSptjC1JexLIQjmGbKePGzv705keeglGzDbhQHfWurwV0sYL4JfP vCfVwdPUgylkU45nzUvZAX3OCIm4gqfslZvY0Xm3rHo/bosctUbuY9APkv3unv2JfcK3 Zwvg== X-Gm-Message-State: AKGB3mJF+wevAcPHJnadKWsOrtKlPJEGA3TUKcl51+3hTKFkFPjrS5SV iKy/2vLMIROAdPQVM1CFCudJf3g6bRQ= X-Received: by 10.80.201.75 with SMTP id p11mr35508574edh.199.1515760823250; Fri, 12 Jan 2018 04:40:23 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w2sm13893585edb.4.2018.01.12.04.40.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:40:22 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Fri, 12 Jan 2018 12:39:55 +0000 Message-Id: <1515760819-15116-2-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515760819-15116-1-git-send-email-bryan.odonoghue@linaro.org> References: <1515760819-15116-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v6 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 Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- 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;