From patchwork Wed Dec 27 12:25:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122794 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2134400qgn; Wed, 27 Dec 2017 04:46:16 -0800 (PST) X-Google-Smtp-Source: ACJfBovPnOaJLC2a1MM1scIb+d/k4DmHr356JengpS6UbNI1Nf0e5U+BiQkYbvM+qUg3IIpdOgSh X-Received: by 10.80.240.80 with SMTP id u16mr35935832edl.5.1514378776690; Wed, 27 Dec 2017 04:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514378776; cv=none; d=google.com; s=arc-20160816; b=nwcLAE6F/jOFURyhH0w6Q1q4SUgoJaMOZWdf5t9U3PSymyy0iAGs+perqTd9MqYYfG SSpRPZZ8iPdkQzyGAbcfGs8RtG2zbLQ43BkLZwuIjVWdjFg+bihwDrXWrIP3BIkIXvt2 p2yA+CIrT4ZiDVfeUyA8Mct/PyU2Z72ruI08CwC3WK4bAnp5ZbRsKhL/suD3/cKEG10e N44+1XjV3Tg4tvCButS+ZMrXsFD1cMkuJB78zxA98tdCg/MRvaE4V29TKOe6K8NlIWjy 4Nas2EHUTTfJTCwcXSr3McUXkOetEUeK9H5UikjP6EC0jiTV/AaWu7MBR9kvRC1U1kNB Lwtw== 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=jzi+Fl7UNvrmWJ6gvDCHykHSMNrylJpzJrZPubUDVAA=; b=EENzK8CR7YDEOzTTI7Wyb3ipN+fIGQEZvh0vyh99+aAkBT99XKCEYaDEq0N19YKJn+ Tj7LyaGP9qftL96PKvvDUCdc1DHDHMrYVlNEznVKq0RPFnXvzr9SKi/qWkMjOrxQ5pZR NfJJvMEP/DWTjbAIwJdzk+UiqUd40aACzp+hbtF1RV+uz780eIkaWRqbihs9KTPVtbrt hoj0FHg1Y2OoUb0+k3Ujz39d0X86s2pPkMmpC8J8YEHpooUsX2CrZGhmRMUyiuITo6ds jqoWsiFf2q7UGwMLLC/zCjmSUgtwbSx6VKxVQqQH71guFxo35/8zTZyZAUnpXXK14T25 3hcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Hv0ZDgnF; 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 m22si3860940edj.259.2017.12.27.04.46.16; Wed, 27 Dec 2017 04:46:16 -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=Hv0ZDgnF; 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 528E3C21E43; Wed, 27 Dec 2017 12:37:33 +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 5A46BC21EE3; Wed, 27 Dec 2017 12:33:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 640EBC21C59; Wed, 27 Dec 2017 12:26:36 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id 15902C21C8F for ; Wed, 27 Dec 2017 12:26:36 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id i11so39007595wmf.4 for ; Wed, 27 Dec 2017 04:26:36 -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=GeiZmZX2nScxmDUpRh8UokEut4q68jlh3ZkQsHw16+Y=; b=Hv0ZDgnFJKtaRiyfHiZjeS4Xs5egx6RTD3LHFZRj+UWYvHu6fS2SFH/TcluMdpNY1/ 4ZF7TiXqFr9Nm2CBJ8S9NqzSuGGyG71jrBCue/FUswzMawzEbJmPIRj3/LwTKru4WVZb 8RqM/mvG8DPZ38XHMuDw0PF9oFAvqEdFCM9Fg= 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=GeiZmZX2nScxmDUpRh8UokEut4q68jlh3ZkQsHw16+Y=; b=Qvy29c2t8bTtQLCeD0r0/H82YqQlXe2V1OlnhWGAPht68GYTdAiTE3OyE4sbPih/HF O53QSm8cVtKRAawIrJ3oOf8RoY0QHb5f2Uen2hz6q+u8q5DU/9kZQvMGc50Z4m33YBTa agvr1VCWtOvcoZvO/UuJgf+KIZ6gyFE/H7CQIwutEbUBOYy7zTiu5paqw6AD8gjJt3xW cjlxy6toscVPEaWMC8ZS4GNGoPHCjiS2lF+7SFnVLY0uXMPd6ELVrxmuh/UT2//mHVD0 l7v6BYVSSlw+QC6MJAjcZXLYySr0S6f1rBYi5B6XAFOu8ZWC5bSjNdwuHWogyjxrBN4+ qlJw== X-Gm-Message-State: AKGB3mKUW/KHesNal8iZc1jG0yRzy/AJMRYPQfko2mlT38Z1RsOHPx4f 9oFmtZpm7qYwDU0UdiFO6tPZtks0p10= X-Received: by 10.80.164.27 with SMTP id u27mr33996998edb.11.1514377595507; Wed, 27 Dec 2017 04:26:35 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a5sm28388838edm.47.2017.12.27.04.26.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Dec 2017 04:26:34 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de Date: Wed, 27 Dec 2017 12:25:57 +0000 Message-Id: <1514377566-28512-15-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514377566-28512-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514377566-28512-1-git-send-email-bryan.odonoghue@linaro.org> X-Mailman-Approved-At: Wed, 27 Dec 2017 12:32:58 +0000 Cc: Fabio Estevam Subject: [U-Boot] [PATCH 14/23] 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 --- 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))