From patchwork Fri Jan 12 12:40:04 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: 124314 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2014926qgn; Fri, 12 Jan 2018 04:42:58 -0800 (PST) X-Google-Smtp-Source: ACJfBosr0RMkIPHw8hwewe0bhugqKCkcs8dplo0wBoBPLAaXnKfZMGiCsdaVj3UNOifYG4I8SLCe X-Received: by 10.80.187.73 with SMTP id y67mr35282553ede.172.1515760978032; Fri, 12 Jan 2018 04:42:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515760978; cv=none; d=google.com; s=arc-20160816; b=obDUt/p1TyuB9k5BTRLbE6IXdl7l0EwMzs8mLyL94OEFIkNQ8NKyQhpeuJ72D+ROJV l2SLGlTOrNbTDBco7mXF1YnQ45cLmgf/2ZqcMQ0VJXhSZ6LctKCHtbQTujwU6MUy2oKA yoxRCewD0nMe/ZkyliFOmNfnJf1ZW6En3l7syPL2SL4bdWz2d35So29qaMFjq4CozWqn wXj7FNzvgqwGqpc5dNPoMqrhr/qVAqZrD8aoyBkmgXFsKbs6qoH4aGk7iUx5q9PiCLYU npD7Aez5EBwBxOFDWwpaJmUai8UhIKAxA2nVAZumgRlvmyLbhNF2KmLcqCYR4U048D+p xhxg== 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=TdU6jj3ZF0bIGAml0QTCOd/25KCrTmwuadLeLaR0wW8=; b=howAxY1Jy1HpN7oPWVrIsR843lmTtMR82KYgtIM3Ja3Iw5kD3wFezBAA5ROYnYSRkT HCAlKYukP0MRqtlmTQR0ovOZyPDJ80P4wTyOTOE/yG/mPHErWDQq3l/NPzcVPn3Up10C SQdJTuC4Jcn00DD1sTYkiqBPPVcQqavBir2o79NHu9XCgm7XDErFqJvwDnKrhucriZiP f1g67UnWD3qBNX7ucAaE8/LLFfnpFQZ1YuKTZUGnYdVre9PonUV8u1sELBCSGhHKYR8W IJbDV8G95A0KdckamvJPqWiTxkVjvqdCeiLNjhzUfEVkbQTKlH+44dT+tvtW4haAVfkP 5Ihg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=A6I/VAMo; 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 d7si7748717edl.453.2018.01.12.04.42.57; Fri, 12 Jan 2018 04:42:58 -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=A6I/VAMo; 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 825C5C221A6; Fri, 12 Jan 2018 12:42: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_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 C0D8BC221D8; Fri, 12 Jan 2018 12:40:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 27571C221BB; Fri, 12 Jan 2018 12:40:39 +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 AA1BDC2219C for ; Fri, 12 Jan 2018 12:40:35 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id 141so11493981wme.3 for ; Fri, 12 Jan 2018 04:40:35 -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=w0UpYjfDIqm23d6EVyqoYJ+SiVwbAItHqPu71Xu0+2M=; b=A6I/VAMov1+zZre/F+9p+dGBrxDF9/xG2dj1UA4pFjofG3DHW2cQbkBcDDQpjtxQqY ABDe/KuWXNXY3dCLQshmC6yxYBWfLDF9SO4oRiSXCEcc+BEtsxgp03Z0ldP7BjLT5DmY B/v+9eqoKr0TaQYWgLKHBcLUYDFglRaS24k7M= 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=w0UpYjfDIqm23d6EVyqoYJ+SiVwbAItHqPu71Xu0+2M=; b=ZvWXPSCPIXaEpQs6Eot96qEBfptozfRDwRLK/TLRb75T6htAAd1hr+IxWruCdFuGnQ 5rQa5AXCMkQ/scLh6xMCC4iYrTJTEXA3Be8JdF6W7Ps6VUkkCKYU3yGlgRmxXNZjJqdZ 466Zg/f+HCTOIEhu/X0/bpDauWA9qaG3hKQwuRqIaofQg14Je6HAluuc4BFGpxAGXgFO /yBcNnvwR+1f8RZ1s+gnf6Jy+l9NhL1OVVgaAxxQ79tyvkuveKz33M3vnBFYTjIrr87x Ct2GiOHcqyloXX/Oatpn1zuEYnVF5Vhh4ssySqXxarhcLwcTJp5aCk94DV+nzTE7YRQ5 xDHA== X-Gm-Message-State: AKGB3mKp2QG03TIs0UeEg/wvzRM3c0pLpUU5Zt4UR+rLjqmfmXdnS//4 juU9LPURlh/KzQBdD89oZ++zQ4jyB0U= X-Received: by 10.80.205.15 with SMTP id z15mr36599976edi.83.1515760835136; Fri, 12 Jan 2018 04:40:35 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w2sm13893585edb.4.2018.01.12.04.40.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:40:34 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Fri, 12 Jan 2018 12:40:04 +0000 Message-Id: <1515760819-15116-11-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515760819-15116-1-git-send-email-bryan.odonoghue@linaro.org> References: <1515760819-15116-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v6 10/25] 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 Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- 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 998d253..39f8f2d 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