Re: [PATCH v3 0/8] Rework random blocking
From: Stephan Mueller
Date: Thu Dec 26 2019 - 06:41:29 EST
Am Donnerstag, 26. Dezember 2019, 11:03:34 CET schrieb Matthew Garrett:
Hi Matthew,
> On Thu, Dec 26, 2019 at 10:29:00AM +0100, Stephan Müller wrote:
> > What about offering a compile-time option to enable or disable such code?
> > Note, with the existing random.c code base, there is no need to have a
> > separate blocking_pool. The ChaCha20 DRNG could be used for that very same
> > purpose, provided that in case these true random numbers are generated
> > when
> > the Chacha20 DRNG received an equal amount of "unused" entropy.
>
> I think it's reasonable to offer such an option as long as it's made
> clear that it'll break userland and should only be enabled under very
> weird circumstances. We don't want to end up in a situation where
> userland developers feel that they need to code to handle such
> situations - the only people who care about this distinction should be
> in control of their userland stack and able to cope with the
> consequences.
Ok.
>
> > If an unprivileged caller requests true random data, at least 1024 bits of
> > entropy is left in the pool. I.e. all entropy above that point is
> > available
> > for this request type. Note, even namespaces fall into this category
> > considering that unprivileged users can create a user name space in which
> > they can become root.
>
> I also feel like describing any of this as "true random data" is
> misleading. Most of our entropy sources are devices that could, given
> sufficient information, be modelled accurately. We're not sampling
> quantum events here.
I am fine using any terminology that fits.
The terminology I used comes from the German AIS 31:
"""
True RNG: A device or mechanism for which the output values depend on some
unpredictable source (noise source, entropy source) that produces entropy.
Note: The class of TRNGs splits into two subclasses (PTRNGs and NPTRNGs).
"""
Bottom line, a TRNG produces random numbers at an equal rate as the underlying
noise source produces entropy. E.g. if the noise source produces 10 bits of
entropy, the RNG shall only generate 10 bits of random data.
A physical TRNG (PTRNG) uses a physical phenomenon like shot noise of a diode
in a ring oscillator. Commonly, stochastical models can be created for those
noise sources.
A non-physical TRNG (NPTRNG) uses non-physical phenomenons like timing of
events as noise source. The random.c or my LRNG are NPTRNGs. For NPTRNGs it is
unlikely that there is a stochastical model.
Ciao
Stephan