From patchwork Thu Dec 28 18:49:33 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: 122869 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3810371qgn; Thu, 28 Dec 2017 11:04:49 -0800 (PST) X-Google-Smtp-Source: ACJfBosdMnHaqcpfHVnN52/eAlTqOzNzYwuokRxHUJZQVhcxC3ZwE5GYpdQgtCANh2aEasJtWt/n X-Received: by 10.80.164.209 with SMTP id x17mr40370618edb.158.1514487889261; Thu, 28 Dec 2017 11:04:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514487889; cv=none; d=google.com; s=arc-20160816; b=If3sGXGr2qLSo7jLaYal1pb2/3PmX+s/eyY4/zxcL5IraAu9uRSvAFXTcMwscXBo2Q 4cYfuJUtHqxcV8dfZy/7UAQ+ut4UdN/6Xm+lWc4UO5E/h6SW3jdeb7l26YAfKWlmP/hb 0tPuhnRbndGyGxqO1W4yZzqRtUSL0k2swRkrjPpoHyOVDR5A3GjNaYYvwfT99y7Jegqn S5dkiIkLrPweHBnTX3Bhj+ZiCPo/SPhjtRcSS5ZH9wN6+v+mVdppsxB7ZzmbgtLtq3nz JiykWFwNJdHin66H2mDEBvsLjOK7cEJQQZKuwnZ8e9vgtrpmyQbGl7b41P2kP4E/K73e wCpw== 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=KpjnOXWPiFVas3cI94zudbEvtH/z0UPXijoTqHO4b8Lt4tiprlqUfe54Pm5o04mVbh t9kvspYn6qtV+6iGnLP0GRZgPLnPciVTD0Zf/ISWlg/xswdMUqJVoGc1Un7rCnrL/bgK +kVXXnYQzi7/WeztFJFBPxUJ/9GRvbO9Ybvg2scw8wkrG8KKj8n/67ThPuQPOu7jzfEs c1Z4RJHB2VgSC/GdNQxssxmxWtTO22oa1IxXzZeaquigZbKdQParSzAFJJTz+MteG0xc Pi67P9dxyDu1nJNDwUMB24NS7he7LJxsZKqgdOLgSH9w7bcAP69eI5IZCQvJOmplvBIm 7ecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dswAKSQ0; 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 h38si2446559ede.369.2017.12.28.11.04.48; Thu, 28 Dec 2017 11:04:49 -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=dswAKSQ0; 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 D3360C21DF1; Thu, 28 Dec 2017 18:57:10 +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 23974C21E43; Thu, 28 Dec 2017 18:51:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E550FC21C59; Thu, 28 Dec 2017 18:50:05 +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 8C2EFC21E09 for ; Thu, 28 Dec 2017 18:50:01 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id 64so44997358wme.3 for ; Thu, 28 Dec 2017 10:50:01 -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=dswAKSQ0HCorKD6JAhG+IYo0wfGZNYRMIfYjaqV2t/XM+MRNufphQimEduoq3kfY+w vHTPrUVvsuXka5QP7MlL9mIcmeFtJvN0JVpt3qqGEtj660TkjuG3qc6eSsZZLZliKcbu l+yUE9IriYdCMIqvDeYsgmYWJB6IBh1UDEK2A= 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=ifj5dKTG17iSVnfZeHkiDe8ZD/3dQTp+ppZcK/9txZjHlVg3Ax6LQxULnlJQCH1gJm p1xH+a58U8ZHXAGPVsdq+8vFFudL4rwWPwQCyyjQDEEpeNKFJv7rkgnW/h2IMv1veNsj NHnxlxaFjNCSbgYtx6mIFEkz557Qs9zWmk9ZyNNGpgorefPQ709M0DAsmYUrUPbSf08T wFwgMU85eXjdANZ535AIyXZMZcSNhzyLFaQ8X5RESI5mHuEzbGqToj97FDfFdjVrYJ3a Wc4VaM+Wzs8ed62Lvv7seviRR6ZJ24yNCHJJ3qFgPqT3dCl1UDS3t4+O61dZLQS1dDav foZg== X-Gm-Message-State: AKGB3mI5un0PB6y7MDkz7K2Pk0IxSRCoLlYI5+4q2yFDkB7E3Xwz/e0d Ad9vGOZg7rvdFsdkMpI4Yk6yhfop8l0= X-Received: by 10.80.135.26 with SMTP id i26mr41179665edb.31.1514487000954; Thu, 28 Dec 2017 10:50:00 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id x28sm35246579edd.0.2017.12.28.10.49.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Dec 2017 10:50:00 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Thu, 28 Dec 2017 18:49:33 +0000 Message-Id: <1514486982-19059-15-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514486982-19059-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514486982-19059-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v2 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 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))