From patchwork Wed Dec 27 12:26:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122797 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2136413qgn; Wed, 27 Dec 2017 04:48:30 -0800 (PST) X-Google-Smtp-Source: ACJfBoulLCYN3Vytc26N8EHlKlm6/qHT9IWvpYuykJ1SP79RBFtboC0jqMV3n9asoW9b3c+iYCLS X-Received: by 10.80.187.99 with SMTP id y90mr34801921ede.154.1514378910001; Wed, 27 Dec 2017 04:48:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514378909; cv=none; d=google.com; s=arc-20160816; b=Bbpd3G2e8yX891I/euHhIE7EXgOAVeoLI0/PyGpA5YcFsyipH2Rqy2FQWY1YBTy9kZ gsLfdGUeU545x79gf5xiI3aVFSSLhsRoOug3E/8o5NzKs9r1Wd3RJ0nTj+Y4Wf0dXXxN et7ijrKJUFmuTBD20ThCRY8ZizLZhk8m3viw5khjaJtmWz/PxPU3Tg8cKh1i2oEA0N/Q H9MiaXxaMyzP6wVyPOiY56VyYhorbHqz9v27ZtqDDeBHWxLwvH3OvLmYwxessYSRMh1D /3J9e4j4Iv9DA4n/+7kehtbZe+/GzeJmB/vhrP5HEmE0IBf1Q4VA0vZLHYLwU6MWfnv9 DIiA== 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=IUcTgl5yQ+QDNy0aVIWBEFDS/ei4xHzAftvXHXAMTzY=; b=MqlMcYkdY2l6TX+E4p3PjFr5FY21W4f1REqqjcSAJ37kvqz+Lw0925hhv55A6WnAjx hU6aJlIwkg9L6p6xNyZ/I8NpOwhYGhsTOD8v9Afbd3hfKu1xXQls1uPqrC3NKcC0ZL2a 8nAurP7gnABoRmwVntaxxMebzbPgDLYJ1f4noe8d0ii8aVum3ZuHZ6UW/4aqcwlOuEb2 untmVTvbrEUtKpbNMVPcoeRvy1PABBhj+6It+XqlKzcdcUPwtFwx7yI3PFBfoTa4rR56 x4bN9tTkiKexkJezQBVpF5XZl+aN/IJmLsY02u8ZzJnafyay3+/RsXv50DC9xqWCKvjL SD8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UjnTREYz; 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 7si3762222edj.364.2017.12.27.04.48.29; Wed, 27 Dec 2017 04:48:29 -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=UjnTREYz; 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 9C4E1C21E3B; Wed, 27 Dec 2017 12:38:49 +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 1DE25C21F01; Wed, 27 Dec 2017 12:33:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A6B51C21DB0; Wed, 27 Dec 2017 12:26:41 +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 4D982C21C4A for ; Wed, 27 Dec 2017 12:26:41 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id t8so39118555wmc.3 for ; Wed, 27 Dec 2017 04:26:41 -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=e+PloxVFMAcPFnNVgb5LBjlkfyM01MpZPuOISj5yCtk=; b=UjnTREYzszwjlPdSHxOK6mKjkDd9GHTguEtzuN23Wm97kZ8k7b9bAqPETO4pxdH1wo dINimPm+Vw7hEXKjC2DpI+GAL7e3yocbs6YwXM0YRtnrrRgFhWdZVX+Fyu3ksPL6P0wC hI4QZ1Z9DYPV3wttxhzi/gL9ZKgT7IXaROPj0= 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=e+PloxVFMAcPFnNVgb5LBjlkfyM01MpZPuOISj5yCtk=; b=lBwhMGLwtkewQevIFE5z9zIzTOXxafrwKemn8daD1Rc+tLGsuQEzEODZyn2EwoqHcb MFqvWpYrtGfwzdQQw+vgLycuh+viJhm2Y/YkYGILkdU1aA4dJJLdVh0prpsnD+p5EVAt PRoJj8fj31wMEE6kYLdb8dc4zX45ad5IvOXM5WlbbnvC9Oz6bX6q8ojSN/otCF18DNb4 d73WliyFyI0qnPyfAJ7IUZLIwbU7bjwcSI9OpVsIeFpmGFVhfBsaN/SceVnZ308RhKSp hs39cbBGzbx6H6YWG7dEz/AcEjzElBxhY+1HETR/zO2qGNPJm2UMEm7S2KQnNYUQMPAS jJqg== X-Gm-Message-State: AKGB3mIuBI2pYhq95xvJUyzSzoNDWrq3wOOL/uVsv/y5qdpVH0Igg58R rIyWO/j5nBwD7+aef7ZPDt6Bbnuat5Y= X-Received: by 10.80.244.194 with SMTP id v2mr35419109edm.68.1514377600710; Wed, 27 Dec 2017 04:26:40 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a5sm28388838edm.47.2017.12.27.04.26.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Dec 2017 04:26:40 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de Date: Wed, 27 Dec 2017 12:26:01 +0000 Message-Id: <1514377566-28512-19-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514377566-28512-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514377566-28512-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailman-Approved-At: Wed, 27 Dec 2017 12:32:58 +0000 Cc: Fabio Estevam Subject: [U-Boot] [PATCH 18/23] 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 --- 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 4e1289e..e30e0f0 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");