Re: arch_random_refill

From: H. Peter Anvin
Date: Sun May 11 2014 - 23:44:57 EST


On 05/11/2014 08:36 PM, Stephan Mueller wrote:
>
> Ohh, ok, thanks for fixing that. :-)
>
> Though what makes me wonder is the following: why are some RNGs forced to use
> the hw_random framework whereas some others are not? What is the driver for
> that?
>
> The current state of random.c vs. drivers/char/hw_random and the strong in-
> kernel separation between both makes me wonder. Isn't that all kind of
> inconsistent?
>

The main differences are speed of access, trivial interface, and
architectural guarantees. You also don't have to deal with enumeration,
DMA engines, interrupts, indirect access, or bus drivers, which all are
utterly unacceptable on a synchronous path.

That being said, it is getting clear that we most likely would be better
off with the kernel directly feeding from at least a subset of the
hw_random drivers, rather than waiting for user space to come along and
launch a daemon... after $DEITY knows how many other processes have
already been launched. There are patches being worked on to make that
happen, although there are a fair number of potential issues, including
the fact that some of the hw_random drivers are believed to be dodgy --
for example, the TPM driver: some TPMs are believed to not contain any
entropy element and simply rely on a factory-seeded nonvolatile counter
(since the TPM has to have support for nonvolatile counters anyway, this
hardware is already present.)

-hpa



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/