From patchwork Tue Jan 2 16:43:57 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: 123161 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9172520qgn; Tue, 2 Jan 2018 08:48:34 -0800 (PST) X-Google-Smtp-Source: ACJfBouG2FK+lqkU7BOxvIrK2ymVeL7BniAn+JTM7LvJcg65VVdEY/+dn3WAKCi14MUrZ5uLmLF+ X-Received: by 10.80.136.228 with SMTP id d91mr62319597edd.296.1514911714467; Tue, 02 Jan 2018 08:48:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514911714; cv=none; d=google.com; s=arc-20160816; b=e2CrO79vXVe9eyJmd3lTWz6kPFMMSqt8V7BPHpvpJ2NQ9lgemcSK8UZb6uFRHBudg9 55Cf2dEtF/BrIBD5vptMj6m+NYLIjdj0JBS36SO6m6uv5W+SBFEuRilVY7daK17qS6bA rhN3C8+XOkRC/yn0dsseUG07Y2Z1K7tOpk2SzS+iHWcpQW5d6QQ/91PKoTqE1URQ8TjF UftHol4fCP75BpsPt3rUfbrORACddHDjw5kS0NvnrkItH6V33OoNZxZtWz0tMy3K+ENH umcBjjBrrn9vXSTfR9MCOsjHfrD+/OyNEyNNrriZ7fkJTFJFohOi+6sJSxoo3Qu76UD/ MnTQ== 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=zwkeQUpEDXn/at25y5WVmaOwqNDa+1La6ptV1L6pJiRpiO2QAV1ZV4zU9sp6qbDCXQ yUBkQslA5ovu19KkRILGwOE58PrKCIZFZ85U5zOqa6kcu+bFQtBK54u/WnBEgxkIyRuK oZbZBr4EPdiOBkd6n/rhPiTKCPhJbaW4bfOFpRdtdKcLDaAELQIA9rBqHqKpeK7IHt4h aR2WseTlAKLRog0055M1kaepUaS4Y+GyA+bKLTZqKlL6Q5L3VHRvSIDIt84CVOWjpS79 k42nGuUgh2zSx205ULFnBqYmOtiLf7Att/0VbIlypnMUsp+0+MdD6y1lC0mlGY9JS8FJ z48w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cKZISgVH; 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 v17si9092718edl.496.2018.01.02.08.48.34; Tue, 02 Jan 2018 08:48:34 -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=cKZISgVH; 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 EB6C6C21DE4; Tue, 2 Jan 2018 16:46: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 69E9DC21DF3; Tue, 2 Jan 2018 16:44:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C82F5C21DD9; Tue, 2 Jan 2018 16:44:42 +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 A6F8EC21DE8 for ; Tue, 2 Jan 2018 16:44:38 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id g75so62447186wme.0 for ; Tue, 02 Jan 2018 08:44:38 -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=cKZISgVHdP4/ugC6e9r2zVqIEfbgyKPWwZkJ2o5+3kMC+wIfJCDHvDMCGuPbGeO9U4 cJ2pn3aS8igvI3EEFhWNBQ6eySiHDvL2DFbztIGudPWArOSSaWLeHhzbuJjQbAhOLg/3 XDFONFhFZsDW8gvy5fkn78GEU8VUzOMIy8aRU= 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=VZdqeZBmK+RqevVYZ/Rx/6nQgSf1mxwZ6Wo5Tzlva1leWJVEV6xpH9mHTY/daKj9uE eec1L07itbZvCNgukRVGeAmU3z5TQSONiILkClO+3kDVf8JKJNCC2mY65V3SviU2yd17 vNxP7G0gAVYu9wO71ftrXdVNKEzMfCohwVTtBICgREQxGkeWhaIRvfw8Pm+RmC8mpl2l GGjeQIRAvQaJLeh39LvGamYU6DDRexHIxFzhAt3uGnuPs6YM9vQyE5Svo/z/O3ppswnG pEPvJBx+CtEG4S0jz3ozcC2Lvb5cRGiG3qx21cc9DINpQg+7qV5IA116a37TGa5NugJR uKnA== X-Gm-Message-State: AKGB3mIJa+xvyjemENe1Jmu2zemHYCmKZv+bPSnm2nHnLeKOSXlb4M8j 1Kb9i7iG4HNyaov2I7owgWXJVLLVqn4= X-Received: by 10.80.225.3 with SMTP id h3mr63227665edl.128.1514911478072; Tue, 02 Jan 2018 08:44:38 -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.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 08:44:37 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Tue, 2 Jan 2018 16:43:57 +0000 Message-Id: <1514911451-4520-12-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 11/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 --- 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