From patchwork Mon Jan 8 17:36:31 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: 123783 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3018598qgn; Mon, 8 Jan 2018 09:49:58 -0800 (PST) X-Google-Smtp-Source: ACJfBotDwBre7WfVjlgGLAykWJMNRWn6lNsxKn2AubrAjH6FUnTJHLNRfHazgSSzP7svqUKXZbu0 X-Received: by 10.80.245.92 with SMTP id w28mr17305458edm.297.1515433798277; Mon, 08 Jan 2018 09:49:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515433798; cv=none; d=google.com; s=arc-20160816; b=BUn3Aa3stMvTvGzTgeOVJbTdzYZODoXLOZN+ob/+tH1MhN7ql4+eLISXOiEcxpUP6i t40RT544CAkzc1CJs8ekh7KtmqCSCDM4f/LFeoXgcrJthhGVjsn1CVGsdVISvSZyfJXQ qEaDkL7VS6niEz8p1HvbSAMTiDDc+Q1VPfYIqvdQCeeluZblwsGeFRUjTR2TJDLkXFR7 y6Vhc1ugj02JNWLjzJn42bVGKhi2tjag3JpTaZ3oIrFyVABcuNbhYYEmtYEB4vJfDrIR VZnUcqSWlOMhH7rIywZ/L/4I/CX8FVpzmkFFpGnRxGWRad/6OmHmSRepUKSAWRc834ob bsAQ== 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=k5X/ItTmKzhWMdp0uZ8EBVqBbJj/pKMrT4QgVq8r6rY=; b=GvZ3c54tKFHfLhQHHbgwxqA7geb4/ukDv21NGOmWbMTfCSDtgNNJm9vv/fthW5Pv1g gqMv4IKkQ5rdXFj/8X60NuqwOR+b4fyJmVfvfLl8m2vVStHDTanaUbdf/e7GFWKlcMr+ Dxup4itI5u29U8UzkdmsrTrRVtTYvQOLIzNzI81RJMG3xM1jO/Lbg/3e3nwlwVeKepEk UReDd7qEvw9s3P6wZ2gyOoRZL7IrXWlekg84x6CssUn8oz7ccv566bwvxHGoDUcal6sN NwAhmecD4tJ+c5LNLCnMcRMasX6rB9hHyNstSPAOvWcOy47Mzh82QUGHR5Z/QZSr1lWv ab0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NwuZOSSF; 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 l88si3096337edl.104.2018.01.08.09.49.58; Mon, 08 Jan 2018 09:49:58 -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=NwuZOSSF; 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 E1D15C21FFF; Mon, 8 Jan 2018 17:44:03 +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 6D11CC21FC0; Mon, 8 Jan 2018 17:39:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 63C97C21FC0; Mon, 8 Jan 2018 17:37:06 +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 EC1CAC21F1D for ; Mon, 8 Jan 2018 17:37:02 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id y82so16765862wmg.1 for ; Mon, 08 Jan 2018 09:37:02 -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=GOymI+l1h69sKsRpkjL0ZhctMF1/wS3/aTxVjfkswBY=; b=NwuZOSSFudZC3SOAab4jAhhqJS0VzPG981cdAeHTOZy/F4vq2Bi/PEYe7xr9x/NT+r 2onkMZCUM0MtGi4P49cKwTGCjmO5O0XYLaNjF2Ec5HjMxKxMUhcRe6jDoAnVFd44eclj ZF1Jkcw2wcm5l8ncbMnWa62/kZtPdi5jmqcT8= 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=GOymI+l1h69sKsRpkjL0ZhctMF1/wS3/aTxVjfkswBY=; b=r0cT0O5Ygv8DP6HSxX7fzFtWf+B4fiq0Li7C+lqJ7XIyvSTykmXmoP1Y5gRJnRcDer niLoylPb6i30B1NuCw0891rPQvTHXeGFe/W+yY9Mmvc/ILg496AgInLZYvVcGNvVRs5p SBqC4fcQ29ufNLXgCdDtSy2nM5Vc9Th4rKfg2m1TJbGC2bNnb3ARgi4g4X8R2C5l9MV7 JoDDYE1D2CzEe5k3thZ9ZLHh9z+JWz5ZJ/lYcdooAq0MgMXZWGzf4r9asyxnEfQeTcir nWsYfwg8imZiiww7bLMVvYUdHzogyMBCBjbXje1zzOGMHPeukRDb+jtnbcFv7l7/QThV yTUw== X-Gm-Message-State: AKGB3mKODxE39HvINLCKr2G82BKk3lYZl7HpNVquCPYenUUb0SN+wh8w 1uGMFKq32vXdzM4nmon2z7iyJrv/MaM= X-Received: by 10.80.186.207 with SMTP id x73mr17829026ede.67.1515433022370; Mon, 08 Jan 2018 09:37:02 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id a38sm7160033edf.3.2018.01.08.09.37.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jan 2018 09:37:01 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Mon, 8 Jan 2018 17:36:31 +0000 Message-Id: <1515433001-13857-15-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 14/24] 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 --- 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))