[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9ocjS11ugpKKwmosqb2HUBf4_N74a056=OOoj06yD6wmQ@mail.gmail.com>
Date: Fri, 23 Sep 2022 14:26:36 +0200
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] m68k: virt: generate new RNG seed on reboot
On Fri, Sep 23, 2022 at 2:23 PM Geert Uytterhoeven <geert@...ux-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
Powered by blists - more mailing lists