From patchwork Mon Jan 8 17:36:18 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: 123762 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3006928qgn; Mon, 8 Jan 2018 09:37:58 -0800 (PST) X-Google-Smtp-Source: ACJfBot0AT+kNEteSI6dFnd4/zXkOcnSPBZZRAPpy8JtMY6vcjvCZHOBW/2KAwoixbh9v+2uFYAv X-Received: by 10.80.183.34 with SMTP id g31mr17114538ede.191.1515433078670; Mon, 08 Jan 2018 09:37:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515433078; cv=none; d=google.com; s=arc-20160816; b=Q3+xhACQvqPRVbcsWTylQC0VMyFLhou8fOCQqC35wyaUIzieWHjzcn0HZ3vhX5eUbr Q7gFUwic8hv4RuQUy+8APUoaDY19706Esezc31Bz949PPSaHX5AM/T1u3ry8HlEOAUwA Sn4uR2soINWciAsMc4ytrvixUMZNYd2inJ9x3PMvORtVoBguDiAHP11lp2owCVdigVIv 4OHsBblWMc+e4vdyMEKS3V7FriL/3iYi8ocehwX0XYbgw13VAZ6hHpiYEWWqkVW758gc 4E6OCH9Fsi7uc5cMbZ3DpupcAZLHEqZ7Ki/qN7ybgpo6B3lKQw903bpq4oe/EJ+JC8Du dU5A== 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=mu98hPHJrvsDdBg26o1RtVdTwBtOukYHI6cfbKd7VuPdCbZgKZ0Y9+G5NzMWmCR4Eg 0AJUF5pd6EIEX5sVd7mfjEMdzOx4cpNNqKhfznNKzlQVc+iqwMGJHn2rfAjFNDeuN5Bo orYAfzIeTv3ECxxU3mpczJVWTTaYKZIi3HdTV3R4oes8vKN6Q1YFjqBFPMXB8kspxvL6 Gt6BSyPnH3vA9TPkT219OyuNSehW6Ud9hc7bKpgUdu/0hsijbR3rIH6os5eKbqTO2OQy XJO1XBXJhWj1SFoeI1LtsEyTtKkVU3xW9gEQqV8f0GxNmp0QHMQLY5hjCv+x7adoZCyS VZIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MQo+V59P; 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 c30si1795542eda.147.2018.01.08.09.37.58; Mon, 08 Jan 2018 09:37:58 -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=MQo+V59P; 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 362ECC21F72; Mon, 8 Jan 2018 17:37: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 42A8EC21E90; Mon, 8 Jan 2018 17:36:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DCC69C21F72; Mon, 8 Jan 2018 17:36:47 +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 5B58DC21E90 for ; Mon, 8 Jan 2018 17:36:47 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id f206so15696153wmf.5 for ; Mon, 08 Jan 2018 09:36:47 -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=MQo+V59PmoWFaVaWGtx8feDxljalonE1OmpUFUTd+pV6AT3INcKoXEZ6tOC6cUkHTM YOr1xDYdSwogF3p8aOX+LXa27xdCn9cPz6zjWtfOdvJGikB9ewN9vXbN1jy1eq0I7EPq +fPDtCSPsbWGM3dd34iphkOOpxjstKAgqQgI0= 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=NqqD1K3crB8r66Bgh8IxhabV7nDWIj8IJz87w1DDDxA34GYcYXh/bnh9B+XrXVa04I b31PgxDSPf0mU5Y/lXKDb+pyTlC+sBoK+YHOuDaaL34c86BHxoPt2rEraFeDpbnW50ft hGBKzrOd2+BvwQCssot9Ys94vbXPaEN/dSat78TgAfzQ5/AiLaYpWkV7mfGpOLhGnP4d y+F5w4YUGZeWO/HbAFBrP2vkun2eYvzUUpPFq6ypdCv5uXyML3oKGA7aYlMaNosp9LF+ nNdfJMCKvvlD2S2V+cBUd2O8hEnAg6lLg/74A9tBQc2nB2mAfqPB96u5cfV2zn68xASi TMfA== X-Gm-Message-State: AKGB3mJia6IkbmmHIprvHy5pCX9dbeh+qcoS/olH/OlpGa2GnWzpAbt4 2r+QF4WYxZrAr6O/BIPi+oZmb9VVtxE= X-Received: by 10.80.177.28 with SMTP id k28mr17271766edd.124.1515433006724; Mon, 08 Jan 2018 09:36:46 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a38sm7160033edf.3.2018.01.08.09.36.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jan 2018 09:36:45 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Mon, 8 Jan 2018 17:36:18 +0000 Message-Id: <1515433001-13857-2-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515433001-13857-1-git-send-email-bryan.odonoghue@linaro.org> References: <1515433001-13857-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v5 01/24] 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;