From patchwork Thu Dec 26 17:30:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 1215540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47kH7c4bQlz9sNH for ; Fri, 27 Dec 2019 04:31:40 +1100 (AEDT) Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 250BE8169C; Thu, 26 Dec 2019 18:31:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id AF0828168D; Thu, 26 Dec 2019 18:31:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 63CD4814D6 for ; Thu, 26 Dec 2019 18:31:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6E58CDA7; Thu, 26 Dec 2019 09:31:13 -0800 (PST) Received: from usa.arm.com (a074948-lin.blr.arm.com [10.162.17.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 514393F6CF; Thu, 26 Dec 2019 09:31:11 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Subject: [PATCH v2 3/3] efi_rng_protocol: Install the efi_rng_protocol on the root node Date: Thu, 26 Dec 2019 23:00:56 +0530 Message-Id: <1577381456-6440-4-git-send-email-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1577381456-6440-1-git-send-email-sughosh.ganu@linaro.org> References: <1577381456-6440-1-git-send-email-sughosh.ganu@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Rini , Heinrich Schuchardt , Tuomas Tynkkynen Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean Install the EFI_RNG_PROTOCOL implementation for it's subsequent use by the kernel for features like kaslr. Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt --- Changes since V1: * Handle review comments from Heinrich Schuchardt to change efi_rng_protocol_ops to efi_rng_protocol include/efi_loader.h | 4 ++++ lib/efi_loader/efi_rng.c | 2 ++ lib/efi_loader/efi_root_node.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/include/efi_loader.h b/include/efi_loader.h index bec7873..bfcfa74 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -130,6 +130,7 @@ extern const struct efi_hii_config_routing_protocol efi_hii_config_routing; extern const struct efi_hii_config_access_protocol efi_hii_config_access; extern const struct efi_hii_database_protocol efi_hii_database; extern const struct efi_hii_string_protocol efi_hii_string; +extern const struct efi_rng_protocol efi_rng_protocol; uint16_t *efi_dp_str(struct efi_device_path *dp); @@ -175,6 +176,9 @@ extern const efi_guid_t efi_guid_hii_config_access_protocol; extern const efi_guid_t efi_guid_hii_database_protocol; extern const efi_guid_t efi_guid_hii_string_protocol; +/* GUID of RNG protocol */ +extern const efi_guid_t efi_guid_rng_protocol; + extern unsigned int __efi_runtime_start, __efi_runtime_stop; extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop; diff --git a/lib/efi_loader/efi_rng.c b/lib/efi_loader/efi_rng.c index fdd5f2f..48ff3cc 100644 --- a/lib/efi_loader/efi_rng.c +++ b/lib/efi_loader/efi_rng.c @@ -11,6 +11,8 @@ DECLARE_GLOBAL_DATA_PTR; +const efi_guid_t efi_guid_rng_protocol = EFI_RNG_PROTOCOL_GUID; + static efi_status_t EFIAPI rng_getinfo(struct efi_rng_protocol *this, efi_uintn_t *rng_algorithm_list_size, efi_guid_t *rng_algorithm_list) diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c index f68b0fd..76d18fb 100644 --- a/lib/efi_loader/efi_root_node.c +++ b/lib/efi_loader/efi_root_node.c @@ -81,6 +81,10 @@ efi_status_t efi_root_node_register(void) &efi_guid_hii_config_routing_protocol, (void *)&efi_hii_config_routing, #endif +#if CONFIG_IS_ENABLED(EFI_RNG_PROTOCOL) + &efi_guid_rng_protocol, + (void *)&efi_rng_protocol, +#endif NULL)); efi_root->type = EFI_OBJECT_TYPE_U_BOOT_FIRMWARE; return ret;