From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32457C5DF64 for ; Wed, 6 Nov 2019 07:09:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9AE2217F4 for ; Wed, 6 Nov 2019 07:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731443AbfKFHJT (ORCPT ); Wed, 6 Nov 2019 02:09:19 -0500 Received: from isilmar-4.linta.de ([136.243.71.142]:58738 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726772AbfKFHJS (ORCPT ); Wed, 6 Nov 2019 02:09:18 -0500 X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl-tcp.brodo.linta [10.1.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id D805820096E; Wed, 6 Nov 2019 07:09:16 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id 8A4AF8045C; Wed, 6 Nov 2019 08:06:32 +0100 (CET) From: Dominik Brodowski To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , Matt Fleming , Catalin Marinas , Ingo Molnar , Peter Zijlstra , Kees Cook , Linus Torvalds , Hsin-Yi Wang , Stephen Boyd , Rob Herring , Theodore Ts'o , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, linux-efi@vger.kernel.org, Mario Limonciello Subject: [PATCH 0/2] x86, efi/random: invoke EFI_RNG_PROTOCOL in the x86 EFI stub Date: Wed, 6 Nov 2019 08:06:11 +0100 Message-Id: <20191106070613.227833-1-linux@dominikbrodowski.net> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org EFI v2.4 and later may provide for a EFI_RNG_PROTOCOL, which can be called from the EFI stubs to seed the kernel entropy pool. So far, this feature has only been implemented on arm/arm64. This series makes the relevant EFI libstub code arch-independent and enables the feature also on x86. Please note that this feature only works if Linux is booted as an EFI stub, and that the EFI-provided randomness is not credited as entropy unless RANDOM_TRUST_BOOTLOADER is set. Thanks to Ard Biesheuvel for his hints on how to test the EFI_RNG_PROTOCOL from the UEFI shell ( RngTest-X64.efi ), and especially to Mario Limonciello: he gave me highly useful hints on the implementation of the EFI_RNG_PROTOCOL which ultimately helped me to determine why the earlier RFC patch did not work out as expected. The patches are also available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux.git/ random Dominik Brodowski (2): efi/random: use arch-independent efi_call_proto() x86: efi/random: Invoke EFI_RNG_PROTOCOL to seed the UEFI RNG table arch/x86/boot/compressed/eboot.c | 3 +++ drivers/firmware/efi/libstub/Makefile | 5 +++-- drivers/firmware/efi/libstub/efistub.h | 2 -- drivers/firmware/efi/libstub/random.c | 21 ++++++++++++++++----- include/linux/efi.h | 2 ++ 5 files changed, 24 insertions(+), 9 deletions(-) -- 2.24.0