From patchwork Mon Jan 8 17:36:36 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: 123784 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3019782qgn; Mon, 8 Jan 2018 09:51:12 -0800 (PST) X-Google-Smtp-Source: ACJfBossixDNb7Jgrr8H2D0m4wjDOii7IIvchKHCc8bA769+x+W5w6tQJ5oTSXOfEzMLjqp4c/1t X-Received: by 10.80.152.44 with SMTP id g41mr17477649edb.247.1515433872859; Mon, 08 Jan 2018 09:51:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515433872; cv=none; d=google.com; s=arc-20160816; b=ZZsE2thnxfyoGkfsBT00T+nadvJiaJCMHXjnKS1gTUEltPSPswx/OLEkZHBfSsO0tL tT3dOiharsFZQ+Kk/JdUo35EZaUHEvwANMKHOSi5Bnqe+ymDp4/QzZTHVELhxFUg8X2z 8oLIYZ/z1Rugrx4aT2oK7KWGGL94Il7BW1K6TRKMgQKsqhcpgF9aWca6k6vKBHLzgX66 C3dcRVrVFKXCu4VQFskQYQtEBnPK33HZSh9BerNXJlcihK8lFkt2uRp0zYlisy5d7zRS cbUk6aWjOc9m4CaL3Ha9v16yu74NNxFLtbecnT0hgEJnt8r1f8NLtJryMxBaEKZLe/v8 dvvQ== 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=DXkR2j1oxNcWeIl+xs1+0ETHBzZ+ilAQwMDO/taxzy0=; b=OJ3737Q5hbW7WFv2IAIcQhJM3cp12+YUEgEj0FcXxirjD1HyYd0Zhv9ufMODRymNhY LgfUjkcjXTtJcXMSjSjR1IHClLLB+GHEJc1/qM9xHHfgZKtYC9L4Lk4W/jeXXpss7dm4 P4f/2T+qlb2njDY9yz4EznwFxRhd6oiVUp47ogmqCa/IC/OIOcvYhNTb/zfvX5MwmPxm nLy0eA55XbDEZk6LoaycS/U3PF60Iur/P1rpfdpKnutJk4WSHvshGg1NPr/VuMb2eMBg CAe6OilQdJ66V+C5nQy00ONTMYxtwDhCD2YbZK/G0ezdtuikV00YVVKjuLJ56YTx2vDW eWOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JEcvS+Bg; 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 d93si4578401edc.431.2018.01.08.09.51.12; Mon, 08 Jan 2018 09:51:12 -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=JEcvS+Bg; 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 6509AC22010; Mon, 8 Jan 2018 17:41:42 +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 0458EC21F34; Mon, 8 Jan 2018 17:37:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 67FA1C21FEA; Mon, 8 Jan 2018 17:37:13 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id 25615C21FB2 for ; Mon, 8 Jan 2018 17:37:09 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id r78so15702662wme.5 for ; Mon, 08 Jan 2018 09:37:09 -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=0v85GZrGCitCwBATqD5yxfGjXAWTdFERjIXWxnVLUy8=; b=JEcvS+Bg/ozZ1v2+xb0yMIesO49+ESDXeyw8bepHjVZQ+3VN4+yYf7mpeleVqZy+sj ORHwy+dzIvT1rKLlk80lBAPxwJEpVgl5cP5eoi8yElSp/BTeMKa6YmboCnYscv/unStq Vd+AssTtXIKx8Ecc3pQZRWb0akHxJzqnRvM5Q= 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=0v85GZrGCitCwBATqD5yxfGjXAWTdFERjIXWxnVLUy8=; b=Prtye+TmfSltvCZTaazL7i0LdpsKLgP28IgC8SOnu6xiWzcvNEtdy93hYkyi3I66+Z lMENWEoMlfEICXMIci2pPcmhZD026Ok1QgrAMI/AAaQOnxB7EskYPl/XtL5hbnwt7xdI vXdThfpjhCHUDh84tiLGsjxrR9+Aw7GsL9uEbDVp2SsAXS27q9nxn0CZ9ZH9Npybs44Y MlStAdRV/fXZG1rE+o9KcGB7TtKqfd3DbLVOPqd/U0TDVFtjKZStNByRYSjvZ5WfvVkA 32IlqUt+TlYEAItYQ+5Z/VvPIgLCIhau4lBNDJp68F0X1Vq40ENREwJrxRcqfGtIUNXv nVtQ== X-Gm-Message-State: AKGB3mL2nT+l3NfkT54B7T39oKO3QDQ6q4WH0OtjweyLHDBVGtM3VOTx aLuXXZSvpyGwAi1KkcN+ocecl7EI03o= X-Received: by 10.80.148.163 with SMTP id s32mr17636203eda.164.1515433028533; Mon, 08 Jan 2018 09:37:08 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a38sm7160033edf.3.2018.01.08.09.37.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jan 2018 09:37:07 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Mon, 8 Jan 2018 17:36:36 +0000 Message-Id: <1515433001-13857-20-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 19/24] 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 ec85548..7c2f828 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");