From patchwork Fri Jan 12 12:40:08 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: 124333 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2026760qgn; Fri, 12 Jan 2018 04:55:52 -0800 (PST) X-Google-Smtp-Source: ACJfBot4PFGKZOZppPDgIgKx4BrasuR04+R8UZ1h/F+jdON54To2xhZCsy/cavMocN2BQNrPQuTS X-Received: by 10.80.186.55 with SMTP id g52mr12229436edc.25.1515761752445; Fri, 12 Jan 2018 04:55:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515761752; cv=none; d=google.com; s=arc-20160816; b=x1i/RinW3wUBnOFwKzVlSqRQPnOM6GEOXJqJjEZ23w5SmXeCdyDkjfiXY1lgvMkK/S Ek1Um1kdg0ZYklYHrIZqrHvP73AmRPT5qeVOLeADr3bnZ/lK6n0IkhZeNnkfL3ycQQaE 8N7uCH7FhnRfhKlKfzGDMjsaNXtBpMJG60i6wNjErsSC/ya4yP39unGJT34qUt2uV44C /AY285jkfW1KOYl6hKLaHmKuGKoUekQDP3LX6fcFxxluSqSvuLm0sn3wbeyenj3jwYHu /YBEVPf7c2rQHAGWvRHkAKUw80QX42/i3TjhBat0ClS5sLqaTgzgaWO4qDm5ypH+WSof hsOg== 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=d5lq7IN6SMVgZKZjE2VKhJdF8A8B78tC9wwwNDNX/Cs=; b=JxrEiWesABKGSI6+j5vV4g88xdVioCkPxQst182xz5KGD5RCeEQuCbpFNpS+kKjpYm TEcBFVYRSMWJ6aCvz5bEKuCjIX+992WSHkb00CdwQ8xSFg9gxx7tXII/okr9aJsJB/AT DxMnZ9UxF3axfx2litPKfYfhAXcIQuHa7p2KAuId4v8p7SbrLISGrVj1q5XvdSKoPzz7 h81qpdcWE8xGhfhYH6xsrAqp0JRUZq2cpxU8TtB9B8Y5IC7nsgM7CoGNuoTmJuP8/RQm bYI74kZWwSa8fZojXdEmDeZjsm2aGVzE7VrsfwRyWhWf7rD9VponV+n46amBfdKEcavB Wnag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=d5TCsO8t; 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 f18si258864edb.350.2018.01.12.04.55.52; Fri, 12 Jan 2018 04:55:52 -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=d5TCsO8t; 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 016DAC2221F; Fri, 12 Jan 2018 12:46:45 +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 45C81C22211; Fri, 12 Jan 2018 12:41:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4DB26C221FA; Fri, 12 Jan 2018 12:40:45 +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 C0512C22114 for ; Fri, 12 Jan 2018 12:40:40 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id g75so11924554wme.0 for ; Fri, 12 Jan 2018 04:40:40 -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=2m71j0u3DKpVzKZO3SBWaA8zOrn5Z3DQgK5N0NKFXcU=; b=d5TCsO8tlLfhQcGH26tTYwB3w920CRWSLOEIHE0wGXRW2ORieUH/hAxPjk+nhlfbkN wTgNg0r4uvIRwmlwmXwx2db8shY1FTo0464XUiaBhpXWbZSXAqzP7ixJtFFUmjPy4qSh emhYIwMJqFWuaFv5F4ObNYRzLzRebVFyc5VHg= 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=2m71j0u3DKpVzKZO3SBWaA8zOrn5Z3DQgK5N0NKFXcU=; b=WiptBzu8WFPvYwoM/AMkkoGDzvQtMvrNbID2wCmgrwMDBZ0kveHj09mhNoQNqobuhJ vyvf3QhMZYLF+rGA2p68KDxxN3BabWB/+pNGMzJezpdcNG2oYAAwxPyAKHQG4CIHtOpv E93g1cpzzGpzJHKA0x/FyzoeR7wSvrvKukZf9a4R8CmJh+HfyGMNrYdwPuZ6WKBfb7iY MD3OxKznYT1eigGV4p0htcgR+DxU43IrzfyEYwC7dzznXHxuZmjwCdtxRfOLWwDyq6ML AzVoWAzozi64Ho30/mCMEdbJozwli8JEJP7wQHUUo3pemoXfCug4BvxlSK9OWJxuIvNH BbQQ== X-Gm-Message-State: AKwxytdauwJxB9CNFPm7NDRQiI9BPUqyhjLscAFdRLoxIr88Ftn/CYu5 X2m65RJtBRl3COKgHzw5JoE4s5CjUGA= X-Received: by 10.80.137.50 with SMTP id e47mr13234538ede.3.1515760840258; Fri, 12 Jan 2018 04:40:40 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w2sm13893585edb.4.2018.01.12.04.40.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:40:39 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Fri, 12 Jan 2018 12:40:08 +0000 Message-Id: <1515760819-15116-15-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 14/25] arm: imx: hab: Define rvt_check_target() 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 hab_rvt_check_target() callback according to the HABv4 documentation: "This function reports whether or not a given target region is allowed for either peripheral configuration or image loading in memory. It is intended for use by post-ROM boot stage components, via the ROM Vector Table, in order to avoid configuring security-sensitive peripherals, or loading images over sensitive memory regions or outside recognized memory devices in the address map." It is a useful function to support as a precursor to calling into authenticate_image() to validate the target memory region is good. 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/include/asm/mach-imx/hab.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 28cde38..14e1220 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -113,6 +113,12 @@ enum hab_context { HAB_CTX_MAX }; +enum hab_target { + HAB_TGT_MEMORY = 0x0f, + HAB_TGT_PERIPHERAL = 0xf0, + HAB_TGT_ANY = 0x55, +}; + struct imx_sec_config_fuse_t { int bank; int word; @@ -132,6 +138,8 @@ typedef enum hab_status hab_rvt_entry_t(void); typedef enum hab_status hab_rvt_exit_t(void); typedef void *hab_rvt_authenticate_image_t(uint8_t, ptrdiff_t, void **, size_t *, hab_loader_callback_f_t); +typedef enum hab_status hab_rvt_check_target_t(enum hab_target, const void *, + size_t); typedef void hapi_clock_init_t(void); #define HAB_ENG_ANY 0x00 /* Select first compatible engine */ @@ -158,6 +166,7 @@ typedef void hapi_clock_init_t(void); #define HAB_RVT_ENTRY (*(uint32_t *)(HAB_RVT_BASE + 0x04)) #define HAB_RVT_EXIT (*(uint32_t *)(HAB_RVT_BASE + 0x08)) +#define HAB_RVT_CHECK_TARGET (*(uint32_t *)(HAB_RVT_BASE + 0x0C)) #define HAB_RVT_AUTHENTICATE_IMAGE (*(uint32_t *)(HAB_RVT_BASE + 0x10)) #define HAB_RVT_REPORT_EVENT (*(uint32_t *)(HAB_RVT_BASE + 0x20)) #define HAB_RVT_REPORT_STATUS (*(uint32_t *)(HAB_RVT_BASE + 0x24))