Linux EFI development
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Lennart Poettering <lennart@poettering.net>
Subject: Re: [PATCH v4] efi: random: combine bootloader provided RNG seed with RNG protocol output
Date: Wed, 9 Nov 2022 11:34:50 +0100	[thread overview]
Message-ID: <Y2uCSvoAguYsWotP@zx2c4.com> (raw)
In-Reply-To: <20221109095558.2572896-1-ardb@kernel.org>

Hi Ard,

Looking good! Thanks. A few brief comments.

On Wed, Nov 09, 2022 at 10:55:58AM +0100, Ard Biesheuvel wrote:
> The recommended seed
> size is 32 bytes, anything beyond that is disregarded when the seeds are
> concatenated.

This should read, "The recommended seed size is 32 bytes, and seeds
larger than 512 bytes are considered corrupted and ignored entirely."

> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Jason A. Donenfeld <Jason@zx2c4.com>
> Cc: Lennart Poettering <lennart@poettering.net>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

I was thinking it might be best to add:

   Cc: stable@vger.kernel.org

"Don't clobber existing GUID" seems like it's arguably a fix.

>  	status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
> -			     sizeof(*seed) + EFI_RANDOM_SEED_SIZE,
> +			     struct_size(seed, bits, seed_size),
>  			     (void **)&seed);
>  	if (status != EFI_SUCCESS)
>  		return status;

Should this print "Failed to something something, retaining
bootloader-supplied seed only", like the err_freepool case?

> +	efi_warn("Failed to obtain seed from EFI_RNG_PROTOCOL%s\n",
> +		 prev_seed ? ", retaining bootloader supplied seed only" : "");

"bootloader-supplied" with the hyphen, right?

If you make any of the above changes, feel free to do it when you commit
this. IOW, my comments are nits, so:

    Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>

Also, I verified that kexec correctly sets everything back to 32 bytes
with this line:
    size = min(seed->size, EFI_RANDOM_SEED_SIZE);
So that's good.

Jason

  reply	other threads:[~2022-11-09 10:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09  9:55 [PATCH v4] efi: random: combine bootloader provided RNG seed with RNG protocol output Ard Biesheuvel
2022-11-09 10:34 ` Jason A. Donenfeld [this message]
2022-11-09 11:09   ` 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=Y2uCSvoAguYsWotP@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=lennart@poettering.net \
    --cc=linux-efi@vger.kernel.org \
    /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