From patchwork Mon Jan 8 17:36:27 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: 123765 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3008922qgn; Mon, 8 Jan 2018 09:39:54 -0800 (PST) X-Google-Smtp-Source: ACJfBouH5zvkdXkwmAvnuoVb3sxXcLiUxoMxHCTRonajtkZAuBscCZ9jrwKtLbQJe7SwSJ6HGyIn X-Received: by 10.80.146.117 with SMTP id j50mr17579648eda.45.1515433193990; Mon, 08 Jan 2018 09:39:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515433193; cv=none; d=google.com; s=arc-20160816; b=cZOJW+IY5I+x3+bBW03/V2N4XVRPFSHPrKrsvR7331dMYQNaVHHaQnzXihFZMhWcKv 3nR8pb3zpNXuoS8agWjxEdRLAeMOAziezOwpcgxNg7Fp+NmRwP6mxNesVYuAaDdvs6+I Nys72RBiqVtBKFMSV2YBYhioxc/G8je3oY/Q21JGbzrprlRLitc4wzlaYsR781BYYTbN NgolR/NRN51EURE61h5pdO2M5hUrSlAaZavDqF78yNeErxAyXwPwVR6tzgQMJ0g5vorm YFxgcoU+ag4K2f0sIMK87+yUT56gLeX3Ds+119nxi7hHDWiWhv+pw9pFwdVRR0BDima1 IF4A== 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=tgWKR2MZ+R3WBrJi+Aj/5jRuBjQ63xdG3SSf7yXTmKI=; b=hERF3Vtb17tXAmKocoLqlab1PiA8XTEQjoW71sfK+WTfGxHw/LyboUydwXGU5m/QHr eODwUZideCMrtXXlPIQFq5IFNLXXqOFy3sGO/LNYqYJ2zEMfxumYUbqcXp30Lrkx+AjX KlEHWLgn+dpGbpjtFNX/zmDGSYqFu4inkQWFw8YXdm5khyuw3B8dfdjT5BR4ZTeuhgVk kEBe+DCfJ0oNGfKqXcGOQ6oxtBwlt0eNJv8HP0lizMSCGKFvyQUAY1aMT7mDy7iII69q 9yT69apEEZvFI8liopWPaLndmCIZtTKLKxtOHMqJFBXFLnS+YnmmfGekb8WKRb1yV+RX P46g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JiOTCNG2; 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 a34si821593ede.278.2018.01.08.09.39.53; Mon, 08 Jan 2018 09:39:53 -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=JiOTCNG2; 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 89C2AC21FBE; Mon, 8 Jan 2018 17:38:52 +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 EFC3CC21FB0; Mon, 8 Jan 2018 17:37:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 64B96C21F74; Mon, 8 Jan 2018 17:37:01 +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 3D9D6C21F7E for ; Mon, 8 Jan 2018 17:36:58 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id n138so15605892wmg.2 for ; Mon, 08 Jan 2018 09:36:58 -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=2A7Qg7hL1w61tBCXGh393HAJ6eSTFQCDCTJeq3SjqoE=; b=JiOTCNG2yQ/nZcxmXUdpSU4SDL91sdbIHdaJOcv2Gx3V3n9K4p6nHnD/zTx7lSYZb3 IN9PCPl6EaxuOuBsZwX7rfZu5u8utF8o0tsIhtpo1Lt/sm4DvrbHYyNXFxGhLlAH+gmV XgSz9gicjIy4cH7bv8RatnCNifsuOYZtWz0vk= 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=2A7Qg7hL1w61tBCXGh393HAJ6eSTFQCDCTJeq3SjqoE=; b=de4fCwoLg8vLQztvg3jG/x13xS99ltHWK4NoIGMGIw3wKGqSMQGZYfmo8OjxO7Erm1 7jH8DzVOAjWAKX0UdAkQuy/xXvjYmxl9qRujQk+kdnLAgfsqvPotAoindq8ukrI4adbS ina2gsBYVJ4UDvns8FSrSUzVQ5A3vVkXsqcYSBl4ogBKSChI07RC0YEc7wfw3fNpzxux Z957J1sspRuA+U7N6L0EXOTKL/w1ywY5S5kY/U6km9IP1HeK24l/igPA26p+nwOlNhRF lkhU3sppuMvLi9EFDa/529ypuEywyP5D6hM/XAWPIzJB8vsGVlZuS4IJRq75t954WK4W enCQ== X-Gm-Message-State: AKGB3mIPqOrE8koXAHRZfnJDTTREojXjQHVLwtT0g4w1LDtH04wNpZ3P 0udIcSs3riTCIIzYEXmjsN4+uCt6q5E= X-Received: by 10.80.173.163 with SMTP id a32mr17849613edd.114.1515433017640; Mon, 08 Jan 2018 09:36:57 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a38sm7160033edf.3.2018.01.08.09.36.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jan 2018 09:36:56 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Mon, 8 Jan 2018 17:36:27 +0000 Message-Id: <1515433001-13857-11-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515433001-13857-1-git-send-email-bryan.odonoghue@linaro.org> References: <1515433001-13857-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v5 10/24] 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 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