From patchwork Tue Jan 2 16:44:06 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: 123172 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9179871qgn; Tue, 2 Jan 2018 08:56:46 -0800 (PST) X-Google-Smtp-Source: ACJfBos4IcqNAKgSBBmyOK7d24rqovqECc236+F8fv6vVzf6lz22os224wknxzPGPcaVZO5fxiG7 X-Received: by 10.80.178.195 with SMTP id p61mr63751970edd.113.1514912206824; Tue, 02 Jan 2018 08:56:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514912206; cv=none; d=google.com; s=arc-20160816; b=qaHpGJ1816Y5DwtBxIfPzY1EDx5QYE32e6VW5VCSbIdM7SRNN6YM2sTM5Evp3R5je3 Ry3FxK1+iiCU7CLIu3q9vdlzceUx+p+gYtZ3ytrq13G6ZSzMkR8wwZwo9LpLqhb8JLWI 2SkjSausf2sD6pEJaIQtS6EE7smG5zNRcLwe/z74yn4WOZ0HXMS3Jp0pEE0nja16TCez aGmVjIWx4vJZCjnin2rp1U07CfespOZh3RZ4QI6CzHgcImJzMl58sZ7svsrxAIKIemha v5LKlmmf9RwHKBrz5xBHLLxXiyjc1GoEm3awexBnmtVXtZAqF8MSNZweutEC93d49uSW jOZw== 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=22dF+e3huFLZmIRbjIwf+ehsrCbjE0AcINiAj07HYgI=; b=ZvVEf7on/eIuQMYPD38rgDV2lnUukaCrBy2Cc/MjIC8tXexIxI9Ca/zs5F7UUFNoYM imwCKQMpD3Psmj2z084+svbSSNXE9kBCcJnaD7UBKqy3mXT1YRPLuI7GEl5aAa37vfdE m/EwUjfdFrLP1BetWqS2wW82H/FpjEn6jiSgPlJzVulYwiV3GV1AreYe/mI00/9hGeko WRqdnbw6+uil5RilqPG9YDeJplMzyYTO7n0iBeBOXlwttp3F3FFtks23huZtlcEScNCe R3re9FV2v0mcIEIujagnbDPbMj8fXuPIDcZFZ9DXmirISW7HNToFrh8xNtthE+9k79r2 N3jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WDpC8XTu; 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 m18si2697569edf.244.2018.01.02.08.56.46; Tue, 02 Jan 2018 08:56:46 -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=WDpC8XTu; 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 70C09C21C2B; Tue, 2 Jan 2018 16:52: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_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 CBA75C21E09; Tue, 2 Jan 2018 16:49:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 945A6C21DB9; Tue, 2 Jan 2018 16:44:54 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id C8529C21DDF for ; Tue, 2 Jan 2018 16:44:49 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id t8so62062297wmc.3 for ; Tue, 02 Jan 2018 08:44:49 -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=UqVqhCaIeOzN2MgQXJr9c+L5sychqrTpuh+6MMjPlEs=; b=WDpC8XTuIwP+s6nb64AMLZtPCxT/0vGqvGTB/u200cq9B9Q59BmNG3K4+cVzb6/sHd ZKPouGlvemJdC/X4r0dj3360hE6Ce+PMgK9k1xYU+ub+zNpcGvi44dYcqml+qu07vrQr q16dTIqFYfZWO76s9XTDjg5X1C19biQrPc4cA= 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=UqVqhCaIeOzN2MgQXJr9c+L5sychqrTpuh+6MMjPlEs=; b=i/lH1Yq3F1WDKjybF0SiraXYWDe4g9/+TIi7Vn6Zy06KtQtYBvk9NSqRScmLCjE2Hu mqZAlsGJyf8765iVkPHw82YVukuj0Y7I0nQnJK/BsOaDwlf8RfS51Ytb9hpxl5JtWayN noQ9ZOmlaLAQrkzE2HerRZ34BzBY8oOYgChu+0GZO7tQ/X84Gr+GpBKcQLWrfFTDh5u3 /zBSxW21CpHrg/2Euc/jToTBJSdp153xu4dz4poF6DgjPDwZcGlTnELCjnX07Y0tRkT/ Y0vPnieWaDCZuqHWDu+q8150iKYSzprb2FMf2QG3TY2P5iEiNWotmvYtHPRQKIfEuyD4 1pvg== X-Gm-Message-State: AKGB3mL8m5xXBVtyM1OsXM/JlNDYvDijDph59jZ2MyMW5Xm4WsVYI2eJ i/3/xrT2sSUdc0ZQXP+glOffVd2D9CU= X-Received: by 10.80.142.178 with SMTP id w47mr64305138edw.251.1514911489230; Tue, 02 Jan 2018 08:44:49 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 08:44:48 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Tue, 2 Jan 2018 16:44:06 +0000 Message-Id: <1514911451-4520-21-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 20/25] arm: imx: hab: Prefix authenticate_image with imx_hab 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" Tidy up the HAB namespace a bit by prefixing external functions with imx_hab. All external facing functions past this point will be prefixed in the same way to make the fact we are doing IMX HAB activities clear from reading the code. authenticate_image() could mean anything imx_hab_authenticate_image() is on the other hand very explicit. 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 | 4 ++-- arch/arm/mach-imx/hab.c | 6 +++--- arch/arm/mach-imx/spl.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 14e1220..98bc1bd 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -185,7 +185,7 @@ typedef void hapi_clock_init_t(void); /* ----------- end of HAB API updates ------------*/ -int authenticate_image(uint32_t ddr_start, uint32_t image_size, - uint32_t ivt_offset); +int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, + uint32_t ivt_offset); #endif diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index b2c3875..c72508b 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -392,7 +392,7 @@ static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc, length = simple_strtoul(argv[2], NULL, 16); ivt_offset = simple_strtoul(argv[3], NULL, 16); - rcode = authenticate_image(addr, length, ivt_offset); + rcode = imx_hab_authenticate_image(addr, length, ivt_offset); if (rcode == 0) rcode = CMD_RET_SUCCESS; else @@ -435,8 +435,8 @@ static bool is_hab_enabled(void) return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT; } -int authenticate_image(uint32_t ddr_start, uint32_t image_size, - uint32_t ivt_offset) +int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, + uint32_t ivt_offset) { uint32_t load_addr = 0; size_t bytes; diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index e5d0c35..a5478ce 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -196,8 +196,9 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) /* HAB looks for the CSF at the end of the authenticated data therefore, * we need to subtract the size of the CSF from the actual filesize */ offset = spl_image->size - CONFIG_CSF_SIZE; - if (!authenticate_image(spl_image->load_addr, - offset + IVT_SIZE + CSF_PAD_SIZE, offset)) { + if (!imx_hab_authenticate_image(spl_image->load_addr, + offset + IVT_SIZE + CSF_PAD_SIZE, + offset)) { image_entry(); } else { puts("spl: ERROR: image authentication unsuccessful\n");