From patchwork Mon Jan 8 17:36:28 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: 123773 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3014139qgn; Mon, 8 Jan 2018 09:45:29 -0800 (PST) X-Google-Smtp-Source: ACJfBouBnnLGk7zwhMmjl2SDS8k3NQhud7fYAUNZAPrVh/4HVaXKoaoiqAQ8elD9Z8wQd39Z2ZaP X-Received: by 10.80.205.15 with SMTP id z15mr18028731edi.83.1515433529401; Mon, 08 Jan 2018 09:45:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515433529; cv=none; d=google.com; s=arc-20160816; b=oFGlwXvld4AvQWMiBOuMrPf62uY4jkFcqWik1R8JEqAzX0WFdK/Z+dYDy9VHvM45Pk 2/LM5Sx6g4oK7sY8raspcqn3FnEEJFzb3uVUKA/Kg3GTqjUgzhX1L9ksVLvzNOxKTFe4 m5D0yJrfYG66bOhmJ9MwJ52Q28FmAuMsMcVY+RgeSEbwsIwh60GvXQ8/lDW0kdUlch5R lTje0QAnjV9j4nRVaXa3vKK6wxR5g09TkmBjZqSHzBAj6jNEk4BK4Ur8GUwnNjBQuAzf kx82fgzBgnkK5RkSGrE9EzE06OgrNvDdP/g8UI5hmlNUVacZ+bJb13ytI0FBSa32vWRC rr8g== 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=LBvBL24hJqc5Kgpwvc0yr71J+jcm1Apkk501EePYMuw=; b=HEnHfs46BexrhfKDfjzg0Xn71cgundTsrEK9Dwb86K5cISYbqHKzAnt9tfaqAIFgZ7 ikQnpkMLWODmGzdoV/8kTU+qkVPG1sz8HQ53RSheqFdTD/3g4tUN41dC6o+ZfEpSzGqa xgQiYfG41H6nkqcQTEAbwbUBcMXATPQl8H+CjrjxSo9JJ0YG1DrzYFT64iu9kGY8ZObB +/b+Mx41mxmLbfcrYZPo9Gzrg/Hqw2ahbQFLroUmlepkIvQ8iRDsPzmXmzb28nabyHkz AZOB8NW4wVwv56HYOTcPyfY3JmIol+goFCaRf1Fl2tklD00wu+ZnjYJoLG6IgNMnp+hg opWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dCWBR32B; 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 o6si231402eda.245.2018.01.08.09.45.29; Mon, 08 Jan 2018 09:45: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=dCWBR32B; 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 F267EC21FC9; Mon, 8 Jan 2018 17:39:12 +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 566F3C21FB5; Mon, 8 Jan 2018 17:37:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 660B9C21FBB; Mon, 8 Jan 2018 17:37:03 +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 5A86FC21FC6 for ; Mon, 8 Jan 2018 17:36:59 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id i11so15692422wmf.4 for ; Mon, 08 Jan 2018 09:36:59 -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=6OXj4fYFmVFuO0qKIl71ylmFylGW614qWO7jXCXWQJ4=; b=dCWBR32BXyJVJHY80vMSQHq7MMwP8yPY2YmvuWBa9nBeV/hjs1quAvQ+TBJrZaqWB9 fr7fTvXI7to3/o3ZDoLX9iSOBsHqGQu1uhdEY68nRT+DHlscrt03+18VSlCEnvkZ2jPa FWCFH22YWSRvH8SIjC+s5qqRGqXeTOGAQjl7I= 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=6OXj4fYFmVFuO0qKIl71ylmFylGW614qWO7jXCXWQJ4=; b=NmcyVuaVENMg66ei57j+lePV1MSLy+EdCsLhSDoJp2I24cZj+YPACsOXbuE6TKY1N8 i+O3MRxsplx0ZOqG09zhHiSFYGORoP00TiPhnbcExMX4Ac9WqvDLxjwCKtG+wW/ltcMp LpFSaEIQgZ3DjLFDih/sIgXqvtYZgYetQQdzZ5yuUkn1YSTHo5lqO2dnECOMo/n8zdf7 ihGP+3uX9/OHR86Unj6VApokPwAiRpbfXyr5Y7/SJ2BNJMxelHDensRMB16ZG1YOl9Yz NqaepRyuk5tsr0LlDEDzM6KbaKAR43Gda0CypSY5eJkdhncZkS1DCWPQe7jl5fAYgNLq TjKg== X-Gm-Message-State: AKGB3mLAnNXVy8GYy1aT9J0hYKIVpMxcnp0wHhTfDoAJj//N/Xlf5IhK XEFhJTkRPiyczeQhWX/p7j98VwHt6WM= X-Received: by 10.80.170.157 with SMTP id q29mr18074900edc.180.1515433018788; Mon, 08 Jan 2018 09:36:58 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a38sm7160033edf.3.2018.01.08.09.36.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jan 2018 09:36:58 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Mon, 8 Jan 2018 17:36:28 +0000 Message-Id: <1515433001-13857-12-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 11/24] arm: imx: hab: Only call ROM once headers are verified 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" Previous patches added IVT header verification steps. We shouldn't call hab_rvt_entry() until we have done the basic header verification steps. This patch changes the time we make the hab_rvt_entry() call so that it only takes place if we are happy with the IVT header sanity checks. 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/mach-imx/hab.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 39f8f2d..a8e3e79 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -436,11 +436,6 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, hab_caam_clock_enable(1); - if (hab_rvt_entry() != HAB_SUCCESS) { - puts("hab entry function fail\n"); - goto hab_caam_clock_disable; - } - /* Calculate IVT address header */ ivt_addr = ddr_start + ivt_offset; ivt = (struct ivt *)ivt_addr; @@ -459,6 +454,12 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, start = ddr_start; bytes = image_size; + + if (hab_rvt_entry() != HAB_SUCCESS) { + puts("hab entry function fail\n"); + goto hab_caam_clock_disable; + } + #ifdef DEBUG printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr); puts("Dumping IVT\n");