[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 02/11] device-tree: add re-randomization helper function
From: |
Jason A. Donenfeld |
Subject: |
Re: [PATCH v4 02/11] device-tree: add re-randomization helper function |
Date: |
Tue, 25 Oct 2022 15:32:33 +0200 |
On Tue, Oct 25, 2022 at 3:30 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> On 25/10/22 02:43, Jason A. Donenfeld wrote:
> > When the system reboots, the rng-seed that the FDT has should be
> > re-randomized, so that the new boot gets a new seed. Several
> > architectures require this functionality, so export a function for
> > injecting a new seed into the given FDT.
> >
> > Cc: Alistair Francis <alistair.francis@wdc.com>
> > Cc: David Gibson <david@gibson.dropbear.id.au>
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> > include/sysemu/device_tree.h | 9 +++++++++
> > softmmu/device_tree.c | 21 +++++++++++++++++++++
> > 2 files changed, 30 insertions(+)
>
> > +void qemu_fdt_randomize_seeds(void *fdt)
> > +{
> > + int noffset, poffset, len;
> > + const char *name;
> > + uint8_t *data;
> > +
> > + for (noffset = fdt_next_node(fdt, 0, NULL);
> > + noffset >= 0;
> > + noffset = fdt_next_node(fdt, noffset, NULL)) {
> > + for (poffset = fdt_first_property_offset(fdt, noffset);
> > + poffset >= 0;
> > + poffset = fdt_next_property_offset(fdt, poffset)) {
> > + data = (uint8_t *)fdt_getprop_by_offset(fdt, poffset, &name,
> > &len);
>
> Is this non-const cast is safe?
This is how the libfdt/fdt_rw.c helpers of libfdt do it, so I think so.
Jason
- Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading, (continued)
- Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading, Jason A. Donenfeld, 2022/10/25
- Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading, Peter Maydell, 2022/10/25
- Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading, Jason A. Donenfeld, 2022/10/25
- Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading, Jason A. Donenfeld, 2022/10/25
- Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading, Peter Maydell, 2022/10/25
- Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading, Jason A. Donenfeld, 2022/10/25
- Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading, Jason A. Donenfeld, 2022/10/25
[PATCH v4 02/11] device-tree: add re-randomization helper function, Jason A. Donenfeld, 2022/10/24
[PATCH v4 03/11] x86: do not re-randomize RNG seed on snapshot load, Jason A. Donenfeld, 2022/10/24
[PATCH v4 04/11] arm: re-randomize rng-seed on reboot, Jason A. Donenfeld, 2022/10/24
[PATCH v4 05/11] riscv: re-randomize rng-seed on reboot, Jason A. Donenfeld, 2022/10/24
[PATCH v4 07/11] m68k/q800: do not re-randomize RNG seed on snapshot load, Jason A. Donenfeld, 2022/10/24
[PATCH v4 08/11] mips/boston: re-randomize rng-seed on reboot, Jason A. Donenfeld, 2022/10/24
[PATCH v4 09/11] mips/malta: pass RNG seed via env var and re-randomize on reboot, Jason A. Donenfeld, 2022/10/24