From patchwork Tue Jan 2 16:43:58 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: 123176 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9180962qgn; Tue, 2 Jan 2018 08:58:07 -0800 (PST) X-Google-Smtp-Source: ACJfBou17H04adMcJmh0rQ2MpJjC72AWY5l1g+dww+MsofGe66k6APP1F6d1kKQCHM60kZTz+MUb X-Received: by 10.80.173.227 with SMTP id b32mr65102124edd.65.1514912287479; Tue, 02 Jan 2018 08:58:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514912287; cv=none; d=google.com; s=arc-20160816; b=wXy/Ph1GXyvUVgd78Wz5xEf0KmifiNGWdgceeIIPvIvmZ9viaEldDKUuQPGR7xJCuG GE965J/BJAoEFUnxOvjw14F4fLXb6fpxPaP9iFkV9HZYsokC2laPcod6bSVGO7rNhJHf AfuJXIF44Pl9099OKvP+X8Z2vjT+kamToyrgo+pabMh+k1AEPOrFySVd0LBaRV44YNDH 2U+QwJFrQqvKwPAEUsXbN64jjCGkrQjn1kahR7KmMt76D9bdFWrXK97aPTmLQQ4w6w4p WJDoEDPmazSSh4NA419kwIdU1qn94Jj8Xu7AnEUbLjxM9Dym5twy2KJBDNXliLFavzS4 sWDQ== 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=dEkWygJwtWoQwgi/Ybmmzhr+TnrBAPM/aW9G1HJcJbPg16Ulu7lISfanyV7FUtBO6B i4BMFdjf/2gi8GC4AUz6aM+7P5ZdV2ZAb3m0KrjG5P5MWBbOXh/+fAaaAfHGiaY+42C5 jfqUSjN1obW5LTOY7GGvw1aM+MG6PiSd0Sk/5mVbu11URPWBaAvQP3eCy6JbzmNrr42c zOOF7F1SvjWdJsf+DUQ7X9wnCuaV7PyYAoFNnfdOYHs9+yS/+FcvLAUahSJV7pWb1Pkr o5IfQzCSIaVisfEK50wWKmBWuSC94foYllHyQEB8iuVrtYcqqWqxeh+Jef32A6yjNLLH fouA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CO85uKYU; 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 y1si237206ede.494.2018.01.02.08.58.07; Tue, 02 Jan 2018 08:58:07 -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=CO85uKYU; 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 1E8BDC21DDD; Tue, 2 Jan 2018 16:47:11 +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 7E7FEC21DDA; Tue, 2 Jan 2018 16:45:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BFC59C21C29; Tue, 2 Jan 2018 16:44:43 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id C8348C21DA9 for ; Tue, 2 Jan 2018 16:44:39 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id r78so62432429wme.5 for ; Tue, 02 Jan 2018 08:44:39 -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=CO85uKYUOm1sq2IzH62ddnaChni5XCDi3MauiYgrX/q+apz5Wty8drVLyfe1h+6z+i LgwWzLxFZyAlVhsYXhTTtn2xXDHYVV96KcBhdsofq1h8ynQJyWlnfAN8vGW6lugwUibs CAMSF9Qgcci2ysQqXeL26FUh2ItlRc4z7/Nbc= 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=cnGRc3uDIEVu0xvDArEpKsOh+k+JJBNDg8Z96ythSDegEp5rpBaBopjpWFMgxigVWe 2cNbz/8IEpOVPw3cFezjXbYEo5/5nGsP+6qnyRI/HvZT1H3Rw0+UKu2uDRE/Wxwi08tz J3nx+YE5Yno2HE28hJ1UPgpJrQZ1F+8O6RXBKveQIpEcW+QrWQsB7SqQR4HhfsPKpISd iXqYSegY+Y7LMWEVL+W9Le5WQ20mghJniUeVF4nBU7ZEv2JeNiD0RNocnJRUgfYkcj4Y jYw7pxYAQfhLRoFMVkU24XbE4VPOKLAA+stDSNvNpTGDje2SVDFy5HZC5KdsixwP31CX j9nw== X-Gm-Message-State: AKGB3mJFSDfVRjGxYGBY8TXVx9kEcxN5rHthGE6kJo+VVw56z8Zi/23F 1ntLigwT4j+JToUC/UDW6WbkYS2cCZo= X-Received: by 10.80.209.193 with SMTP id i1mr61835576edg.107.1514911479214; Tue, 02 Jan 2018 08:44:39 -0800 (PST) Received: from localhost.localdomain (D4CCACC7.cm-2.dynamic.ziggo.nl. [212.204.172.199]) by smtp.gmail.com with ESMTPSA id z5sm29850584edh.76.2018.01.02.08.44.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 08:44:38 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Tue, 2 Jan 2018 16:43:58 +0000 Message-Id: <1514911451-4520-13-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514911451-4520-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514911451-4520-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v4 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");