From: Lennart Poettering <lennart@poettering.net>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH 3/3] efi: random: combine bootloader provided RNG seed with RNG protocol output
Date: Tue, 20 Sep 2022 18:28:14 +0200 [thread overview]
Message-ID: <YynqHm//QwEBzBWr@gardel-login> (raw)
In-Reply-To: <20220919160931.2945427-4-ardb@kernel.org>
On Mo, 19.09.22 18:09, Ard Biesheuvel (ardb@kernel.org) wrote:
Heya!
Looks excellent!
I was wondering though, shouldn't the memory the seed data is stored
in be zeroed out when you dispose of it, just for safety?
> + if (rng) {
> + const int sz = EFI_RANDOM_SEED_SIZE;
> + u8 bits[EFI_RANDOM_SEED_SIZE];
>
> - if (status == EFI_UNSUPPORTED)
> - /*
> - * Use whatever algorithm we have available if the raw algorithm
> - * is not implemented.
> - */
> - status = efi_call_proto(rng, get_rng, NULL,
> - EFI_RANDOM_SEED_SIZE, seed->bits);
> + status = efi_call_proto(rng, get_rng, &rng_algo_raw, sz, bits);
> + if (status == EFI_UNSUPPORTED)
> + /*
> + * Use whatever algorithm we have available if the raw algorithm
> + * is not implemented.
> + */
> + status = efi_call_proto(rng, get_rng, NULL, sz, bits);
>
> + if (status == EFI_SUCCESS) {
> + blake2s_update(&state, (void *)&sz, sizeof(sz));
> + blake2s_update(&state, bits, sz);
So, here, shouldn't bitſ[] be zeroed out?
> - seed->size = EFI_RANDOM_SEED_SIZE;
> + blake2s_final(&state, seed->bits);
And here, shouldn't the state struct be zeroed out? (or does
blake2s_final() do that implicitly?
Looks excellent otherwise!
Will-be-used-by: systemd
Reviewed-by: Lennart Poettering <mzxreary@0pointer.net>
next prev parent reply other threads:[~2022-09-20 16:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-19 16:09 [PATCH 0/3] efi: consume random seed provided by loader Ard Biesheuvel
2022-09-19 16:09 ` [PATCH 1/3] efi: random: reduce seed size to 32 bytes Ard Biesheuvel
2022-09-19 16:27 ` Jason A. Donenfeld
2022-09-19 16:09 ` [PATCH 2/3] efi: random: Use 'ACPI reclaim' memory for random seed Ard Biesheuvel
2022-09-19 16:09 ` [PATCH 3/3] efi: random: combine bootloader provided RNG seed with RNG protocol output Ard Biesheuvel
2022-09-19 16:28 ` Jason A. Donenfeld
2022-09-19 16:35 ` Jason A. Donenfeld
2022-09-20 16:28 ` Lennart Poettering [this message]
2022-09-20 16:35 ` Ard Biesheuvel
2022-09-20 16:41 ` Jason A. Donenfeld
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=YynqHm//QwEBzBWr@gardel-login \
--to=lennart@poettering.net \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=ilias.apalodimas@linaro.org \
--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