From patchwork Sat Dec 30 01:08:51 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: 122995 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5327828qgn; Fri, 29 Dec 2017 17:30:04 -0800 (PST) X-Google-Smtp-Source: ACJfBoty9QxUXHzKiRtKOOPj3LHWly5fUXuk9seYTQdnXJsx98uqaaTsh6R8kwfarwF7bbpQb7Du X-Received: by 10.80.219.69 with SMTP id b5mr47244186edl.218.1514597403995; Fri, 29 Dec 2017 17:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597403; cv=none; d=google.com; s=arc-20160816; b=cNLyYZ6K1+xj6+/Sxw3cNNSWzhQYE/BQqYRT3///Q753TATOEdFikef4WZPDaK5KQD Kl0tldZgLunP9t58AyIFp23d5VlY1f1B6uLyX6nqHJ0+DrjJ8kUJyJhL5wR9eY1yo5AY PN187QQjXMyTOsbYM8RQLqOxx70NSL6IyIC8MWV70B8PiXQmbePSaK5cB6asxTDpEdYN +8VX1H/F1RmPM+gO6Gg2LXhzwZOsOlePbY/144Y9bev7RS8UJRrhHkCs39DWLn/6nCrE p6cTPd4FAG8kC4LR+SQDKg/rz/2XayBPXNBg+da8KE4HJbPWJ8xr1/OcTnb4+NZjJZuv inJg== 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=xNuxLgCZ2l6yj+nEZ2WVztVysGZDVgmGzMgTiNIuV4lDPg5h5aPDkWRMywmLi0AH38 +UbP4VmJGiXRu8svYNvSWoacvePWGqYw86YlVOhIExQxF63y/ePrMbtFKg3YNfA5yIFJ Qc6d0F+wHRX+SDNLRHTkh6eZNIQFCsjTmjae6+EQjnU8PqnjbmB1FRy+DISwehnIq/2P 2a9HYN5ikS12zsE+8LtFKD+yk+uWw5MUjvWx5gag6GFmro+FWU7BieHlCWAm8A7ePvfk 6B8VHt5Ckw9LKaDqE91bxcNbv/1E2BFeZxH/29XNpwxeEFgjwds6rTQY3kUbvP/TIwM3 qgZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DwXnIUJY; 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 90si1161865edp.541.2017.12.29.17.30.03; Fri, 29 Dec 2017 17:30:03 -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=DwXnIUJY; 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 8956EC21D56; Sat, 30 Dec 2017 01:16:23 +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 AB835C21E66; Sat, 30 Dec 2017 01:10:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BAFF6C21E30; Sat, 30 Dec 2017 01:09:33 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id D8263C21DB0 for ; Sat, 30 Dec 2017 01:09:29 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id a79so11259527wma.0 for ; Fri, 29 Dec 2017 17:09:29 -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=DwXnIUJYlNfpSpjCk6kfM5bRYb/gLOY8lR3bkgoUMUr+7uqmPEOnA/j/zpOToIYVm0 KQezvS4b6ulDvc+RXJVdrvYCKnEMCcV+bNCaz9IAgPWOf2vk2HFPGNvwa/UwI/XWX0hq s/oOZUuTfwCCq6eS/6Ozn85v1ukq4QFtBoDvM= 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=Xq+PFcJOWRZPuOLBCdOBid89Xt4DUDSXaJ8lXWZUEHQ3NnjgWFGVtgBHgmxCsnpruY qj/Nl4mYjB6NNYFtBLGk1wou47HQbwAWOpDJAunkTlbEtLKHNH3yVmVjvbxaKUxmV9B1 cE0bxUS287wB8FsNz188lHKYjMXeob0gV6bsVoxrDmPefl0R6foW22C2kKb4ivtxwmhW FzEh2gzN7qjSvtqhvF5RVQj6lrDNrcB0gifxLP5EUIUxajCKHyeGgqzb+v6urSQSvAOZ f9CgzoW+xdEMwu7lyEmwham1inVI9pJcE39XFc+rvBPkzUG5J9TGI6+gmhHsfab1D8+M sCzg== X-Gm-Message-State: AKGB3mLUNGgPkJ2LInlgILqMBAu2ulXDmuv3FWrnmh//a2i5g9ONxMxg jr1TogQ3rrzPYSaOAPYrYD841phJ8sM= X-Received: by 10.80.202.72 with SMTP id e8mr47545380edi.60.1514596169302; Fri, 29 Dec 2017 17:09:29 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:28 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:51 +0000 Message-Id: <1514596142-22050-23-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 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");