From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] m68k: virt: generate new RNG seed on reboot
Date: Fri, 23 Sep 2022 14:26:36 +0200 [thread overview]
Message-ID: <CAHmME9ocjS11ugpKKwmosqb2HUBf4_N74a056=OOoj06yD6wmQ@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdUSF=ARvKTP33psHNWEqvSeUUDuWLRsUUA7LHa+12agng@mail.gmail.com>
On Fri, Sep 23, 2022 at 2:23 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > > + if (rng_seed_record && rng_seed_record->size > sizeof(*rng_seed_record) + 2) {
> > > > + u16 len = rng_seed_record->size - sizeof(*rng_seed_record) - 2;
> > > > + get_random_bytes((u8 *)rng_seed_record->data + 2, len);
> > > > + *(u16 *)rng_seed_record->data = len;
>
> Storing the length should use the proper cpu_to_be16 accessor.
Okay, I'll do that for v2.
(Simply out of curiosity, why? Isn't m68k always big endian and this
is arch/ code?)
> > The way I tested this is by having my initramfs just call
> > `reboot(RB_AUTOBOOT);`, and having add_bootloader_randomness() print
> > its contents to the console. I checked that it was both present and
> > different every time.
>
> Are you sure the new kernel did receive the same randomness as prepared
> by get_random_bytes()? I would expect it to just reboot into qemu,
> reload the kernel from disk, and recreate a new bootinfo from scratch,
> including generating a new random seed.
Yes I'm sure. Without this patch, the new kernel sees the zeroed state.
Jason
next prev parent reply other threads:[~2022-09-23 12:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 18:52 [PATCH 1/2] m68k: process bootinfo records before saving them Jason A. Donenfeld
2022-09-21 18:52 ` [PATCH 2/2] m68k: virt: generate new RNG seed on reboot Jason A. Donenfeld
2022-09-23 11:30 ` Geert Uytterhoeven
2022-09-23 11:53 ` Jason A. Donenfeld
2022-09-23 12:23 ` Geert Uytterhoeven
2022-09-23 12:26 ` Jason A. Donenfeld [this message]
2022-09-23 12:50 ` Geert Uytterhoeven
2022-09-23 13:10 ` Laurent Vivier
2022-09-26 12:02 ` Jason A. Donenfeld
2022-09-26 12:52 ` Laurent Vivier
2022-09-26 12:56 ` Jason A. Donenfeld
2022-09-26 13:02 ` Laurent Vivier
2022-09-26 13:04 ` Jason A. Donenfeld
2022-09-26 13:10 ` Laurent Vivier
2022-09-26 13:12 ` Jason A. Donenfeld
2022-09-26 13:13 ` Geert Uytterhoeven
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='CAHmME9ocjS11ugpKKwmosqb2HUBf4_N74a056=OOoj06yD6wmQ@mail.gmail.com' \
--to=jason@zx2c4.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.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;
as well as URLs for NNTP newsgroup(s).