From patchwork Wed Dec 27 12:25:54 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: 122784 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2126302qgn; Wed, 27 Dec 2017 04:37:51 -0800 (PST) X-Google-Smtp-Source: ACJfBosASTcMmh5AUJtqNCx20QqOqrX8lGRlx7xw78c+sIw1v449ydRmXV7c0piClG6Nxq9MXjUK X-Received: by 10.80.227.193 with SMTP id c1mr35445121edm.16.1514378271155; Wed, 27 Dec 2017 04:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514378271; cv=none; d=google.com; s=arc-20160816; b=nv6XB59cGrDbeOfo8Z4uOyyX81s39wAJ9JL90ZWuPHfiHp73PJ8+kBbEQWTrbY41Po a7Q8aqbJnHZmrBhTxKyI0ZBBYitQlEEAa69GlNbFUOtNqiezeQMmF2USaFZd6X2iDrgN D8LP/8Wmcrs5MKrwNkuZ2uDh8qshmicBbvvZPWPC4jaAlh/FcTUJfD694yCPSFyPVh/X M1VVa42zvED2AZx4P5WJYroyATxzfFknUWm22FhJdwSmtBE5uWeDdcA6ztr4KUQh03g1 9QkiNzgu3C0UO7DljfAGx/0SR+hSLcmhhB+6d7hh1Rffttr0ajgxOsQqVBAvHqxcjmCb u+gQ== 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=b+u9rRRR5vNXg1ISSxuqhvGDIqYCNiCLjnKkPZ8kzS4=; b=sIgdQ+pgETanNHLrpxuvXM5RFcpn8qPBB6RaCr7Q77jxbzOYs+4KM1BGpxOKukQcfC FpiZ4Cw9tKgTtkhsGXfM34jSmVc4Kg5qiVL5ei8lBbUcQIDEnRBFSyxkb9cgOw4wgtoj SjWqT7ObFCZAuceXQjqQu9TwO88Ahc7yfyjaYUv5Cg3vuFSdIICrHpXUNROvZfng6jvX MiMyls4vVNpiwCHMrNtbifq6ECjhqam5dt8gk+jePgnIAxts++O2p+nqFueAH9xRYCjO h4iT/Bh/izHRjkvB2AWqqMw8rdf33yS8G2i9w5UgONxp8jzj/ouvPXdyfzJe5kg0+Kea QAZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HRPDa/9M; 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 p6si5305063edi.553.2017.12.27.04.37.50; Wed, 27 Dec 2017 04:37:51 -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=HRPDa/9M; 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 ADF69C21E3B; Wed, 27 Dec 2017 12:36:41 +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 D5971C21E5D; Wed, 27 Dec 2017 12:33:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 287C9C21C59; Wed, 27 Dec 2017 12:26:33 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id B9569C21C59 for ; Wed, 27 Dec 2017 12:26:32 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id n138so39128252wmg.2 for ; Wed, 27 Dec 2017 04:26:32 -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=P9u5NqvqMl22xGhcG/VI5xoMMiekv1o5CaYnjb0ZKeY=; b=HRPDa/9M2mkHLzquK/q51fh3DATzX+llx8LB5aKorPWnRHxCovFVqaMz5uKYAeZDDI SWMImBYYNixKH5gmjCPYr4GO3n1OYwIpUM8EusoNM9M+UBXrrcUTLd1q7kn+5DGgLNeN to9+/iaZbyR2PZnZmZU0Wfw+dJ1aCSIMd+dwk= 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=P9u5NqvqMl22xGhcG/VI5xoMMiekv1o5CaYnjb0ZKeY=; b=bFVNMWUqXxEwrjZoMOkFkbdfZW6ZbYjnUtTjVvxoCr7G442ahPCNxJvpgmVHrxoUdQ FeIVnchuj9xTdZlNEyLraWkp9z8Ar/d5n2cpcIPuQkkgvMz8PhToX8rZS9uH2QJTSEf0 ftb37KUpLWjP+pSlYT32KaKMghv9Qvgzk+mR/yfgUyf19bPgOhE80T9KqoMaI8UXeeKy Yx/WWlkc6Q7t4aNtAprbEpwASBqAwQDif1RrLGejeWJyE65pkMCK5bLuSvhEz6sS0dIu wC8wcM8fTyjqVfUT7O14826rklf+4X5wVgeo84ffaIp+TkKxBgfq8zR60+g/vH6ZE6i5 qVBA== X-Gm-Message-State: AKGB3mIoyp+WrPwA8frPqxSl8ykQ3ZcI8aDbCvMkyHiZiQVmmumfa30B mDhKE5bf7WrUSf/HR0aS8fBMEufwrd0= X-Received: by 10.80.244.16 with SMTP id r16mr35157842edm.26.1514377592101; Wed, 27 Dec 2017 04:26:32 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a5sm28388838edm.47.2017.12.27.04.26.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Dec 2017 04:26:31 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de Date: Wed, 27 Dec 2017 12:25:54 +0000 Message-Id: <1514377566-28512-12-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514377566-28512-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514377566-28512-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailman-Approved-At: Wed, 27 Dec 2017 12:32:58 +0000 Cc: Fabio Estevam Subject: [U-Boot] [PATCH 11/23] arm: imx: hab: Verify IVT self matches calculated address 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" The IVT is a self-describing structure which contains a self field. The self field is the absolute physical base address the IVT ought to be at in memory. Use the IVT self field to validate the calculated ivt_addr bugging out if the two values differ. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister --- arch/arm/mach-imx/hab.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 5591cb5..8ac4f92 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -450,6 +450,13 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, if (verify_ivt_header(ivt_hdr)) goto hab_caam_clock_disable; + /* Verify IVT body */ + if (ivt->self != ivt_addr) { + printf("ivt->self 0x%08x pointer is 0x%08x\n", + ivt->self, ivt_addr); + goto hab_caam_clock_disable; + } + start = ddr_start; bytes = image_size; #ifdef DEBUG