From patchwork Fri Jan 12 12:40:05 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: 859864 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="fkNZRV5r"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zJ2Z62Mszz9t3x for ; Fri, 12 Jan 2018 23:46:54 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D3C36C22197; Fri, 12 Jan 2018 12:42:55 +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 B0A78C221D1; Fri, 12 Jan 2018 12:40:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EBD0DC221D9; Fri, 12 Jan 2018 12:40:40 +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 1A5C2C22186 for ; Fri, 12 Jan 2018 12:40:37 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id 81so2226911wmb.1 for ; Fri, 12 Jan 2018 04:40:37 -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=pzZNs5mDpoh1R9RVKRDzhFbnnduJwpCQ0tmJJUroTDc=; b=fkNZRV5rGhr6u6Hvj8ZsU/azH39fK3NcYv9YuRadEX2k9l69JyxJW6hI6nZfBDJgz2 8Ct4QnXrZV8BgF5aoccQgLuEHlPCQmcNPCeKeLoLuoqeC526pc/wFROgjHzAvI2b3hh2 Fld0kbBZvnmaFMzm1JS8fzwaIZICVbTwOSLd0= 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=pzZNs5mDpoh1R9RVKRDzhFbnnduJwpCQ0tmJJUroTDc=; b=UtB6mBR2q6sftaMLYTwNQ8nmcWai3dU+T/wWjXc7+f5OVjsb/WxfiPHJ4J/jNcMgzP +BYGAMEKmrLnVd30iQo2yWoYSYkTUKeuSbdBwQbkbfMQ9djHW4vHp+NHBibxBbLlY1MZ Nbf0hJeUq8RZAbWkDXHLrHgwjMOybGasJKRx0doryJ3viGpwRVpgsXDKkguMGWntoID1 2NQISCkmr5J/P3XcQ3qwRYkapm3XSuOMGYVRkL7i5xPPg+Bqn2yz/+z16v/RIGTqfUgt +GMt/83FsWNyGfo2XHmzb4of27iAFGq2R0DVFxzeKdeoCRHRK9GGmZOTepRSy3BQOIB+ VLkg== X-Gm-Message-State: AKwxytcYDt8WNLZ3r08A4fcdqBfvVs4qo65++zpTWPW2eegzf18qwS/+ y8ddpzX5hiPgJ3/lQvY9229Y9s4+bds= X-Google-Smtp-Source: ACJfBovb72KvzA2/9hGR3uM8u4tosBbw02Emh2fnHGHranj5CKljYJi/ITf7YSKrQI/CyX53kjX8SQ== X-Received: by 10.80.135.205 with SMTP id 13mr6822230edz.253.1515760836424; Fri, 12 Jan 2018 04:40:36 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w2sm13893585edb.4.2018.01.12.04.40.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:40:35 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Fri, 12 Jan 2018 12:40:05 +0000 Message-Id: <1515760819-15116-12-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 11/25] arm: imx: hab: Only call ROM once headers are verified 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" Previous patches added IVT header verification steps. We shouldn't call hab_rvt_entry() until we have done the basic header verification steps. This patch changes the time we make the hab_rvt_entry() call so that it only takes place if we are happy with the IVT header sanity checks. 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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 39f8f2d..a8e3e79 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -436,11 +436,6 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, hab_caam_clock_enable(1); - if (hab_rvt_entry() != HAB_SUCCESS) { - puts("hab entry function fail\n"); - goto hab_caam_clock_disable; - } - /* Calculate IVT address header */ ivt_addr = ddr_start + ivt_offset; ivt = (struct ivt *)ivt_addr; @@ -459,6 +454,12 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, start = ddr_start; bytes = image_size; + + if (hab_rvt_entry() != HAB_SUCCESS) { + puts("hab entry function fail\n"); + goto hab_caam_clock_disable; + } + #ifdef DEBUG printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr); puts("Dumping IVT\n");