linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: ard.biesheuvel@linaro.org, hsinyi@chromium.org,
	swboyd@chromium.org, robh@kernel.org, tytso@mit.edu,
	keescook@chromium.org, joeyli.kernel@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org
Subject: [RFC] random: UEFI RNG input is bootloader randomness
Date: Sat, 28 Sep 2019 12:14:28 +0200	[thread overview]
Message-ID: <20190928101428.GA222453@light.dominikbrodowski.net> (raw)

Depending on RANDOM_TRUST_BOOTLOADER, bootloader-provided randomness
is credited as entropy. As the UEFI seeding entropy pool is seeded by
the UEFI firmware/bootloader, add its content as bootloader randomness.

Note that this UEFI (v2.4 or newer) feature is currently only
implemented for EFI stub booting on ARM, and further note that
RANDOM_TRUST_BOOTLOADER must only be enabled if there indeed is
sufficient trust in the bootloader _and_ its source of randomness.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Lee, Chun-Yi <joeyli.kernel@gmail.com>

---

Untested patch, as efi_random_get_seed() is only hooked up on ARM,
and the firmware on my old x86 laptop only has UEFI v2.31 anyway.

Thanks,
	Dominik

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 8f1ab04f6743..db0bffce754e 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -545,7 +545,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
 					      sizeof(*seed) + size);
 			if (seed != NULL) {
 				pr_notice("seeding entropy pool\n");
-				add_device_randomness(seed->bits, seed->size);
+				add_bootloader_randomness(seed->bits, seed->size);
 				early_memunmap(seed, sizeof(*seed) + size);
 			} else {
 				pr_err("Could not map UEFI random seed!\n");

             reply	other threads:[~2019-09-28 10:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-28 10:14 Dominik Brodowski [this message]
2019-09-28 17:09 ` [RFC] random: UEFI RNG input is bootloader randomness Kees Cook
2019-09-30 11:11 ` Bhupesh Sharma
2019-09-30 11:57 ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190928101428.GA222453@light.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=ard.biesheuvel@linaro.org \
    --cc=hsinyi@chromium.org \
    --cc=joeyli.kernel@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=swboyd@chromium.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).