[PATCH] ARM: implement support for SMCCC TRNG entropy source

Ard Biesheuvel ardb at kernel.org
Wed Oct 7 06:30:45 EDT 2020


On Tue, 6 Oct 2020 at 14:55, Linus Walleij <linus.walleij at linaro.org> wrote:
>
> On Tue, Oct 6, 2020 at 12:40 PM Ard Biesheuvel <ardb at kernel.org> wrote:
>
> > Implement arch_get_random_seed_*() for ARM based on the firmware
> > or hypervisor provided entropy source described in ARM DEN0098.
> >
> > This will make the kernel's random number generator consume entropy
> > provided by this interface, at early boot, and periodically at
> > runtime when reseeding.
> >
> > Cc: Andre Przywara <andre.przywara at arm.com>
> > Cc: Linus Walleij <linus.walleij at linaro.org>
> > Cc: Russell King <linux at armlinux.org.uk>
> > Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
>
> This is a good place to start for sure.
> Reviewed-by: Linus Walleij <linus.walleij at linaro.org>
>

Thanks,

> Ideally (if I can dream) I would like to see an interface similar to
> "earlycon", where some drivers have special callbacks that can
> be used really early to get some debug prints, something like
> that but named "earlyrandom", so that any drivers under
> drivers/char/hw_random.c
> could optionally implement these early callbacks and provide
> random seed right out of some register reads or so before the
> kernel driver core is up. I do not know how
> realistic that is, but for e.g. the nomadik-rng.c it is a simple
> register read from a physical address which should be simple
> to achieve.
>

This only works for peripherals that are always clocked, powered, etc,
which you cannot rely on in the general case. This means you would
need some cooperation from the bootloader/firmware to signal that the
RNG is accessible early, and at which address. It might just as well
pass you a random seed instead ...



More information about the linux-arm-kernel mailing list