Skip to contentSkip to conversation

random: inform about bootloader-provided randomness

PATCH In review Dominik Brodowski 3 participants 3 messages Oct 5, 2019 – Oct 15, 2019 Random number driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 random: inform about bootloader-provided randomness

Inform how many bits of randomness were provided by the bootloader, and whether we trust that input.

Cc Ard Biesheuvel <[email protected]>
Cc Hsin-Yi Wang <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Theodore Ts'o <[email protected]>
Cc Will Deacon <[email protected]>
drivers/char/random.c +4 -0
index de434feb873a..673375e05c0d 100644
@@ -2515,6 +2515,10 @@ EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
  */
 void add_bootloader_randomness(const void *buf, unsigned int size)
 {
+	pr_notice("random: adding %u bits of %sbootloader-provided randomness",
+		size * 8,
+		IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER) ? "trusted " : "");
+
 	if (IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER))
 		add_hwgenerator_randomness(buf, size, size * 8);
 	else
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Dominik Brodowski

Inform how many bits of randomness were provided by the bootloader, and whether we trust that input.

Cc Ard Biesheuvel <[email protected]>
Cc Hsin-Yi Wang <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Theodore Ts'o <[email protected]>
Cc Will Deacon <[email protected]>
drivers/char/random.c +0 -0
index de434feb873a..673375e05c0d 100644

drivers/char/random.c EXPORT_SYMBOL_GPL(add_hwgenerator_randomness); · line 2524

Quoted 10 lines
drivers/char/random.c +4 -0
@@ -2515,6 +2515,10 @@ EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
  */
 void add_bootloader_randomness(const void *buf, unsigned int size)
 {
+	pr_notice("random: adding %u bits of %sbootloader-provided randomness",
+		size * 8,
+		IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER) ? "trusted " : "");
+
 	if (IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER))
 		add_hwgenerator_randomness(buf, size, size * 8);
 	else

Looks fine to me:

Will

Acked-by
#2 lore raw
Quoted 31 lines · Will Deacon
Quoted 16 lines · Dominik Brodowski

Inform how many bits of randomness were provided by the bootloader, and whether we trust that input.

Cc Ard Biesheuvel <[email protected]>
Cc Hsin-Yi Wang <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Rob Herring <[email protected]>
Cc Theodore Ts'o <[email protected]>
Cc Will Deacon <[email protected]>
drivers/char/random.c +0 -0
index de434feb873a..673375e05c0d 100644

drivers/char/random.c EXPORT_SYMBOL_GPL(add_hwgenerator_randomness); · line 2524

Quoted 10 lines
drivers/char/random.c +4 -0
@@ -2515,6 +2515,10 @@ EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
  */
 void add_bootloader_randomness(const void *buf, unsigned int size)
 {
+     pr_notice("random: adding %u bits of %sbootloader-provided randomness",
+             size * 8,
+             IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER) ? "trusted " : "");
+
      if (IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER))
              add_hwgenerator_randomness(buf, size, size * 8);
      else

Looks fine to me:

Quoted 3 lines

Will

Thanks.