From patchwork Thu Dec 28 18:49:30 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: 122860 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3804811qgn; Thu, 28 Dec 2017 11:00:11 -0800 (PST) X-Google-Smtp-Source: ACJfBouA+XQTu+O44myfh3DcPSQDj4OdPZDNw0Z5diQDD/lpTZ7SFlkKfVeeWmwzULk1eU7RF597 X-Received: by 10.80.144.248 with SMTP id d53mr31886612eda.234.1514487611260; Thu, 28 Dec 2017 11:00:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514487611; cv=none; d=google.com; s=arc-20160816; b=mW7kSt6Z0R2HDbCqjUifHpCvrgLNPefsmZzYWafstWDHKElHRP6hPU5YI8WNjWsORc PiSOTTuax7ouCaH0sI2qTBDXpXZNxQb0kSZk7//4xeAb0bsZvuSk3Uy+cgqE728w66uS 4NKI2DsLMIeZkjOPFHf7M/LgUbRHUYDqek8ey5mUQhpPIvFI3lBegKTfv4dmBXSEfg92 VgUcCKuaN2xd9v1f9lXSVmo5qt7P/SptU4AP7g7ihV4aS6jrYjKE8Opfd/6ob1eG6sLc v1G81r2DEtFo3VhqCFDDpBSSJcejy4stunrytzXcsQ75OkaLGaogvud7T31Sm8RA8Znb wCnA== 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=MMozsOA+Wk4tbzbRTQ3ojzdmn5TvblgykYvZr4MNXaI=; b=W8795sX73DM18/pGneYgvA248n17WFqN8c1SbVOKw40H2mVjyrUQKkCbAf+PS0vt5g Q5+Rqo3u/kklHwJ20+R07nFs7zrJ6KCaFtgmJzLQn+esoa787d7ufivAKzhzY8qVzt4e 9x+UO+L28WOYZP7qboQVo8WhtG6un9BipIw8p2o8HIA28AfDTXZiF5A33v44RICsqeNt 1yAaBSlKlK6v6y+kRvPaKzH0RIjAtcGT8NYMgmBR/1RF1ZVq3e4BaCKeXdWdwN79NGTy ApsTG5J8amjEzh3GTerS1gD4kY4rjpy3fU0+ODHBN/YXhgFUMMu/rFYLxMs2b+XMv0ON Z0Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EzK7nn3g; 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 o33si1045174edc.146.2017.12.28.11.00.10; Thu, 28 Dec 2017 11:00: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=EzK7nn3g; 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 BD897C21DDF; Thu, 28 Dec 2017 18:56:34 +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 69166C21E7F; Thu, 28 Dec 2017 18:51:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2B4CCC21E3C; Thu, 28 Dec 2017 18:50:01 +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 D11A7C21C59 for ; Thu, 28 Dec 2017 18:49:57 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id y82so2847114wmg.1 for ; Thu, 28 Dec 2017 10:49:57 -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=G8z/3TFmKGvjjpDslWr0bG7tKU0tOafBwtE3humwEZA=; b=EzK7nn3gzVHEZhKG60yCg/1XIi3aBixm1TVI+6AC9noJg06Gz6d1nh8NtzfIQXzaSn ZEAMkTGV63JtIeeDW26boi56PoQiwEx2bQe/OhfgT8hw2S5KmmkWhdQbWVaQpV41HbAe DwfptdgT1WrJB8z3JQxBAmBKJbYQdKWUb7ms8= 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=G8z/3TFmKGvjjpDslWr0bG7tKU0tOafBwtE3humwEZA=; b=YS/nYRdd5TxcEd9spmPEmVwWwWCkuM61T32/PEx5TJW2fRTtHoPI2pvH73I0vpaQEL 8d8W0kbRgwoGOyEC9AkRQ8DXGneb3WX+JX6wc/VPYLzUNMoNxD4FwuvMShn67nK6FEok GY40zA6Dpqi0GYmFZKWCLZbMM60PTgH+UQRNE22clqaIk4oS1t83rHtlkgCZhn6v+OHv KBWB956NmehKaPeDLLxjmsb70iMVIU+MTqanO6xQPUcoH6ml9TBSY7ttHyEjkCW0wdm4 rFVSWlFxug6NIZcgt/eRY9DtiEai8db0y4aXfTemPHhKFF00iyzZQ7BVEF5MT0+GSqov Y/Pg== X-Gm-Message-State: AKGB3mLmQM+YSaHc6T6X+FBwg9KT+ugZE9nJF3HHMr9wDoOrwQ4uwXk0 sJUSFyK2S2TcuK0j2yc4Cp54JcuecMA= X-Received: by 10.80.215.29 with SMTP id t29mr41518895edi.45.1514486997269; Thu, 28 Dec 2017 10:49:57 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id x28sm35246579edd.0.2017.12.28.10.49.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Dec 2017 10:49:56 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Thu, 28 Dec 2017 18:49:30 +0000 Message-Id: <1514486982-19059-12-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514486982-19059-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514486982-19059-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v2 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 Cc: Breno Matheus Lima --- 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 cb6214d..479ed96 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