From patchwork Sat Dec 30 01:08:41 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: 122999 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5330275qgn; Fri, 29 Dec 2017 17:33:12 -0800 (PST) X-Google-Smtp-Source: ACJfBovZsw+0dqbJmVIfJ6a9cqmYT20ZALAnYLfrOHGetYJOvB/yTIGnmugi0hjcRDyhK90uLlk7 X-Received: by 10.80.140.176 with SMTP id q45mr49260996edq.186.1514597591935; Fri, 29 Dec 2017 17:33:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597591; cv=none; d=google.com; s=arc-20160816; b=P9O5HF95N5NzTUCQrqUXhLxwOEgf8ADofqUg2QWn55zRUfswC0be9wy2cnadZJr6hM SOgkk/lWHfMNIGJsxileYons7MGvKTCNMTbR6ne0Yl8HNPz238cXuv0zzMzik82qPhRV M14dsmTfDBjjdoV9VFVpdp+7WLD8awx4Tan6pl2hQbBX9pM+vBECray94qU7VS+XLV2A ktHXpOwbcGVJehsSfCfJ1svp6vytbzYh3Y+Qr26QnOupP3UaIxBIK4Qi5zef6OntjUor UvI5JGVcS9L+7Q0F0PohUxiUO9vErJwgnJRWHduqWo3AS0aevrMgsjtScwGEWC4gQYbS 7uEw== 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=/nuRl1OWXVRLCB+e7CucV1h9jwvZTNBoRIy+/w0y9DY=; b=Z7xTxQZL3wZ4wU5tfXzrPu7oiZTNNda/uOuLRP8eGILcQ0sjC77a4IducfE5A6KINK 0WSUjFjohfHd4ZbheDA9zfxUcPGezlDqh/u6qRmkFmZjARB4vDOWIiUGPxjDpQL70qjR JjFZv1x+yeHcNXb7ypGNxjT+tIc1Epn+8QxEKlt2PE4k2Z39lvQwETgJL+YOLMNlHsNA bglAIDfz2bMcCa2g5wnrjcifID5rTv3MUWX70V+e2dIgSBi/qZRJW32OqEbL7PLsvK2e VUaIZHqM/UA+cJVGNl4A97hjFZTMjbYD26fn/8wuirXIkPMuBZeP0xdsdEalxhBRmvfm nfog== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Qu7Z1B3p; 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 r5si2524952edk.250.2017.12.29.17.33.11; Fri, 29 Dec 2017 17:33:11 -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=Qu7Z1B3p; 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 805DFC21D56; Sat, 30 Dec 2017 01:16:44 +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 06534C21E5D; Sat, 30 Dec 2017 01:10:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E2635C21E6C; Sat, 30 Dec 2017 01:09:21 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id 3DC1AC21D5D for ; Sat, 30 Dec 2017 01:09:18 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id f206so50070730wmf.5 for ; Fri, 29 Dec 2017 17:09:18 -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=VtAGfiyk5udAW3m0qZRtOhS7+D+O3xb/XNtkhm1fVxU=; b=Qu7Z1B3p6q9Q+muWUqHXocDIYZj4Du1nLp6sb5jMaEaHI5ANdc6hsapuiIgeXNEZK3 TXn8Q0u5T9k5+2Ocx8W1g5oU1gAxEUED/v/mDaTpzxOJQI26Z2wM1EgRrKYP5bhKFnfl /RRYIRMY386qZzofoX841zD8VzLoGjBBd5Wuc= 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=VtAGfiyk5udAW3m0qZRtOhS7+D+O3xb/XNtkhm1fVxU=; b=c36r+IrcFk+C9l//Hp+1W1W+kcR7bKpeK8Fr+It3/+m8wlrUhspPaboxNyVgNXmVRn nQdtFJloOie2QhOEZbDehtJ2aEwp1XAFaaEoJsSvCeTVDfPZ11zhEEcx/jAWmVCrAOJL NgjjECPO9DX4NUw/O5Ya9RdiDu3dZSYC1gR2T0c8SNqP1zy5JcIOpaZ/U5LWnQ2G+G7A vowBEAuVa3mKOSYoddL2QEjKbfocwgjCCl7PQVU/LhTnflAszHMACN3otOY9nQxNcTDE RiHP8WSBlXZMdHUrskoJ6m5Mn4vl/GMk/IV8LuHCvMSU62YPbe0Ib0tIBTZ/O031t1YF RI5g== X-Gm-Message-State: AKGB3mI+4sry28rLYlD9WuhAH/V0icMH4hNxBeWlmNuQ0fJyyTD/LiK5 0Xhs99qgO8927lQYugCtvCHjjm18rQ0= X-Received: by 10.80.153.210 with SMTP id n18mr48378346edb.281.1514596157680; Fri, 29 Dec 2017 17:09:17 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:16 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:41 +0000 Message-Id: <1514596142-22050-13-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 12/25] 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 479ed96..e325d1f 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");