From patchwork Sat Dec 30 01:08:50 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: 122989 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5325750qgn; Fri, 29 Dec 2017 17:26:44 -0800 (PST) X-Google-Smtp-Source: ACJfBouiui2/xbthZbYnK2SwaOTOO42B3+450r2Rby8c6Q10dcZH06DvyhzGErDMon8v6SbG1pQm X-Received: by 10.80.173.227 with SMTP id b32mr48976125edd.65.1514597204497; Fri, 29 Dec 2017 17:26:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597204; cv=none; d=google.com; s=arc-20160816; b=C0wSB1+sX4kkP7hDiSxZ8HaCAqg1CAQPsflFPWHCPQR+d+OY6jYT0cvBJPVnTAYmCW 3O2UwpOt5kx1dnCewdotiN4+8Ta7uaaZuSgcb2XvRlDp1U9iGIyZBMeIoRqazyPQozfs kv+ZXbQH19sPAwoGu374frbcv9sREH3Z5lk4sOaiu0cun8WOPGEvuN+oqsus79FoaBoT 6NJYXbFgaUSYEtbaZ4yDbC5afzxujTE92mXkryQNkGhXRuhyb01NjC+LNCq6vQup8lRX LqplB9aeO0xx2+etikwZXyb0GVXBVjict7E4sr/eyFt6o8STtkGhDbbbUY4bfAnSK2J7 JRzg== 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=iB9nx5GpSchZoXbXsgkKVxjJFUb4ZHSu5flug2zUx+4=; b=mWQH6JKgdKfLNQVS5fdxdAiVA8sWoTn6M3b4pl4XLNrTsD7vta/Oil4AGD/XdmgxFI rkb179g98lFZysr5A9bLCDBdhz0owpKmkSKiSqYLnJzJBowNkEkWHc3Vn46Dt/WucXM5 NqXcTX6xWr5q1JFH0+sE+voBMvboJxcEkZqDI7E8hGMlJ4XF/mejfn5tKqo6PcUqgSmh Jw9nPgJWG5NvJuuAUVZoRhx4X+w87fTVwyvOBzDZ34pvEv+0gtq46yIVgUFjdxhEZCuO aq6/jbvGiq6OJ882Wvu7amwqR/6jsQSUttzChYqXJkEQ4LNfnSYbc4cusQCptuytqvNN I7tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HuaP12ty; 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 m5si2446131edb.33.2017.12.29.17.26.44; Fri, 29 Dec 2017 17:26:44 -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=HuaP12ty; 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 1DE56C21DED; Sat, 30 Dec 2017 01:13:15 +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 1B41BC21E3E; Sat, 30 Dec 2017 01:10:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 855BEC21DED; Sat, 30 Dec 2017 01:09:32 +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 B9E46C21DCE for ; Sat, 30 Dec 2017 01:09:28 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id b141so3827356wme.1 for ; Fri, 29 Dec 2017 17:09:28 -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=G7fTKLYOq4Lok+Hz5hewUWJcUgOuWEhVPp/pPb6cPrc=; b=HuaP12ty/ykJ25iWJRQkjbw3J/QTktGor7uGQLiFPjozg3uxCWjZZAaRHK6LekDFzE OgGkXRcLg1gbv6XJKe2F0tiZO2KGw9RZF+q/dzht+t9IJUL5mYk5EVltdUsLtebRCLLR 30C4MdBRhx8fxTWVdDBSdmjI08rQe1XUeMC2A= 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=G7fTKLYOq4Lok+Hz5hewUWJcUgOuWEhVPp/pPb6cPrc=; b=acaMT0dIZ4CC+rU49vuaPAqMDhUoObTN9KzclLzWwFffJhQN4FzsdmKiAutezmHNDC iVtPxUaoAB1asXj2a7B3lZudO3Jgsw1utr91JMhy2oGqYf3zODRg21pEcfaT381CDvsT hI9sB7nidnEhkrHlnlyI3geG583i8+WxrXVjPMEbNrYWpknAw8G0WLzlE5ZHcLad+8MC A1mmmlN0fL5gUe4hnG5x07iNjJzysgKxb5iOa0Yqd6ZTVs6VigNhSERgceeL40f3QDob M84qi7sCUheUuc4JYQEctdZ5STrpsZBEOKBh5Y4I9J2Gl498o9q0obyOCSWj2oiYxz85 B2bw== X-Gm-Message-State: AKGB3mKeA995CUtJS6TYxAtpPzhz52+c4AqK9M8i1zer3RH0GZztmo1H VRGDcFKoLdqPLk6IbXizVyttXP2ibss= X-Received: by 10.80.177.188 with SMTP id m57mr47681115edd.178.1514596168182; Fri, 29 Dec 2017 17:09:28 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:27 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:50 +0000 Message-Id: <1514596142-22050-22-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 19/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 4938eb3..edbd464 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");