<s>
In	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
,	O
and	O
are	O
special	B-Application
files	I-Application
that	O
serve	O
as	O
cryptographically	B-Algorithm
secure	I-Algorithm
pseudorandom	I-Algorithm
number	I-Algorithm
generators	I-Algorithm
.	O
</s>
<s>
They	O
allow	O
access	O
to	O
environmental	O
noise	O
collected	O
from	O
device	B-Application
drivers	I-Application
and	O
other	O
sources	O
.	O
</s>
<s>
typically	O
blocked	B-Operating_System
if	O
there	O
was	O
less	O
entropy	B-Algorithm
available	O
than	O
requested	O
;	O
more	O
recently	O
(	O
see	O
below	O
for	O
the	O
differences	O
between	O
operating	B-General_Concept
systems	I-General_Concept
)	O
it	O
usually	O
blocks	O
at	O
startup	O
until	O
sufficient	O
entropy	B-Algorithm
has	O
been	O
gathered	O
,	O
then	O
unblocks	O
permanently	O
.	O
</s>
<s>
The	O
device	O
typically	O
was	O
never	O
a	O
blocking	B-Operating_System
device	O
,	O
even	O
if	O
the	O
pseudorandom	O
number	O
generator	O
seed	O
was	O
not	O
fully	O
initialized	O
with	O
entropy	B-Algorithm
since	O
boot	O
.	O
</s>
<s>
Not	O
all	O
operating	B-General_Concept
systems	I-General_Concept
implement	O
the	O
same	O
methods	O
for	O
and	O
.	O
</s>
<s>
Random	O
number	O
generation	O
in	O
kernel	B-Operating_System
space	I-Operating_System
was	O
implemented	O
for	O
the	O
first	O
time	O
for	O
Linux	B-Operating_System
in	O
1994	O
by	O
Theodore	O
Ts'o	O
.	O
</s>
<s>
The	O
implementation	O
used	O
secure	B-Algorithm
hashes	I-Algorithm
rather	O
than	O
ciphers	B-Application
,	O
to	O
avoid	O
cryptography	O
export	O
restrictions	O
that	O
were	O
in	O
place	O
when	O
the	O
generator	O
was	O
originally	O
designed	O
.	O
</s>
<s>
The	O
implementation	O
was	O
also	O
designed	O
with	O
the	O
assumption	O
that	O
any	O
given	O
hash	B-Algorithm
or	O
cipher	B-Application
might	O
eventually	O
be	O
found	O
to	O
be	O
weak	O
,	O
and	O
so	O
the	O
design	O
is	O
durable	O
in	O
the	O
face	O
of	O
any	O
such	O
weaknesses	O
.	O
</s>
<s>
Fast	O
recovery	O
from	O
pool	O
compromise	O
is	O
not	O
considered	O
a	O
requirement	O
,	O
because	O
the	O
requirements	O
for	O
pool	O
compromise	O
are	O
sufficient	O
for	O
much	O
easier	O
and	O
more	O
direct	O
attacks	O
on	O
unrelated	O
parts	O
of	O
the	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
In	O
o	O
's	O
implementation	O
,	O
the	O
generator	O
keeps	O
an	O
estimate	O
of	O
the	O
number	O
of	O
bits	O
of	O
noise	O
in	O
the	O
entropy	B-Algorithm
pool	O
.	O
</s>
<s>
From	O
this	O
entropy	B-Algorithm
pool	O
random	O
numbers	O
are	O
created	O
.	O
</s>
<s>
When	O
read	O
,	O
the	O
device	O
will	O
only	O
return	O
random	O
bytes	O
within	O
the	O
estimated	O
number	O
of	O
bits	O
of	O
noise	O
in	O
the	O
entropy	B-Algorithm
pool	O
.	O
</s>
<s>
When	O
the	O
entropy	B-Algorithm
pool	O
is	O
empty	O
,	O
reads	O
from	O
will	O
block	B-Architecture
until	O
additional	O
environmental	O
noise	O
is	O
gathered	O
.	O
</s>
<s>
The	O
intent	O
is	O
to	O
serve	O
as	O
a	O
cryptographically	B-Algorithm
secure	I-Algorithm
pseudorandom	I-Algorithm
number	I-Algorithm
generator	I-Algorithm
,	O
delivering	O
output	O
with	O
entropy	B-Algorithm
as	O
large	O
as	O
possible	O
.	O
</s>
<s>
A	O
counterpart	O
to	O
is	O
(	O
"	O
unlimited	O
"	O
/non	O
-blocking	O
random	O
source	O
)	O
which	O
reuses	O
the	O
internal	O
pool	O
to	O
produce	O
more	O
pseudo-random	O
bits	O
.	O
</s>
<s>
This	O
means	O
that	O
the	O
call	O
will	O
not	O
block	B-Architecture
,	O
but	O
the	O
output	O
may	O
contain	O
less	O
entropy	B-Algorithm
than	O
the	O
corresponding	O
read	O
from	O
.	O
</s>
<s>
While	O
is	O
still	O
intended	O
as	O
a	O
pseudorandom	O
number	O
generator	O
suitable	O
for	O
most	O
cryptographic	O
purposes	O
,	O
the	O
authors	O
of	O
the	O
corresponding	O
man	B-Protocol
page	I-Protocol
note	O
that	O
,	O
theoretically	O
,	O
there	O
may	O
exist	O
an	O
as-yet-unpublished	O
attack	O
on	O
the	O
algorithm	O
used	O
by	O
,	O
and	O
that	O
users	O
concerned	O
about	O
such	O
an	O
attack	O
should	O
use	O
instead	O
.	O
</s>
<s>
However	O
such	O
an	O
attack	O
is	O
unlikely	O
to	O
come	O
into	O
existence	O
,	O
because	O
once	O
the	O
entropy	B-Algorithm
pool	O
is	O
unpredictable	O
it	O
does	O
n't	O
leak	O
security	O
by	O
a	O
reduced	O
number	O
of	O
bits	O
.	O
</s>
<s>
Non-random	O
data	O
is	O
harmless	O
,	O
because	O
only	O
a	O
privileged	O
user	O
can	O
issue	O
the	O
ioctl	B-Operating_System
needed	O
to	O
increase	O
the	O
entropy	B-Algorithm
estimate	O
.	O
</s>
<s>
The	O
current	O
amount	O
of	O
entropy	B-Algorithm
and	O
the	O
size	O
of	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
entropy	B-Algorithm
pool	O
,	O
both	O
measured	O
in	O
bits	O
,	O
are	O
available	O
in	O
and	O
can	O
be	O
displayed	O
by	O
the	O
command	O
and	O
respectively	O
.	O
</s>
<s>
Gutterman	O
,	O
Pinkas	O
,	O
&	O
Reinman	O
in	O
March	O
2006	O
published	O
a	O
detailed	O
cryptographic	O
analysis	O
of	O
the	O
Linux	B-Operating_System
random	O
number	O
generator	O
in	O
which	O
they	O
describe	O
several	O
weaknesses	O
.	O
</s>
<s>
Perhaps	O
the	O
most	O
severe	O
issue	O
they	O
report	O
is	O
with	O
embedded	B-Architecture
or	O
Live	O
CD	O
systems	O
,	O
such	O
as	O
routers	O
and	O
diskless	B-Device
clients	I-Device
,	O
for	O
which	O
the	O
bootup	O
state	O
is	O
predictable	O
and	O
the	O
available	O
supply	O
of	O
entropy	B-Algorithm
from	O
the	O
environment	O
may	O
be	O
limited	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
a	O
router	O
for	O
which	O
network	O
traffic	O
represents	O
the	O
primary	O
available	O
source	O
of	O
entropy	B-Algorithm
,	O
they	O
note	O
that	O
saving	O
state	O
across	O
reboots	O
"	O
would	O
require	O
potential	O
attackers	O
to	O
either	O
eavesdrop	O
on	O
all	O
network	O
traffic	O
"	O
from	O
when	O
the	O
router	O
is	O
first	O
put	O
into	O
service	O
,	O
or	O
obtain	O
direct	O
access	O
to	O
the	O
router	O
's	O
internal	O
state	O
.	O
</s>
<s>
The	O
Linux	B-Operating_System
kernel	I-Operating_System
provides	O
support	O
for	O
several	O
hardware	O
random	O
number	O
generators	O
,	O
should	O
they	O
be	O
installed	O
.	O
</s>
<s>
With	O
Linux	B-Operating_System
kernel	I-Operating_System
3.16	O
and	O
newer	O
,	O
the	O
kernel	B-Operating_System
itself	O
mixes	O
data	O
from	O
hardware	O
random	O
number	O
generators	O
into	O
on	O
a	O
sliding	O
scale	O
based	O
on	O
the	O
definable	O
entropy	B-Algorithm
estimation	O
quality	O
of	O
the	O
HWRNG	O
.	O
</s>
<s>
With	O
Linux	B-Operating_System
kernel	I-Operating_System
3.17	O
+	O
,	O
the	O
VirtIO	O
RNG	O
was	O
modified	O
to	O
have	O
a	O
default	O
quality	O
defined	O
above	O
0	O
,	O
and	O
as	O
such	O
,	O
is	O
currently	O
the	O
only	O
HWRNG	O
mixed	O
into	O
by	O
default	O
.	O
</s>
<s>
The	O
entropy	B-Algorithm
pool	O
can	O
be	O
improved	O
by	O
programs	O
like	O
,	O
,	O
etc	O
.	O
</s>
<s>
With	O
,	O
hardware	O
random	O
number	O
generators	O
like	O
Entropy	B-Algorithm
Key	O
,	O
etc	O
.	O
</s>
<s>
In	O
January	O
2014	O
,	O
Daniel	O
J	O
.	O
Bernstein	O
published	O
a	O
critique	O
of	O
how	O
Linux	B-Operating_System
mixes	O
different	O
sources	O
of	O
entropy	B-Algorithm
.	O
</s>
<s>
He	O
outlines	O
an	O
attack	O
in	O
which	O
one	O
source	O
of	O
entropy	B-Algorithm
capable	O
of	O
monitoring	O
the	O
other	O
sources	O
of	O
entropy	B-Algorithm
could	O
modify	O
its	O
output	O
to	O
nullify	O
the	O
randomness	O
of	O
the	O
other	O
sources	O
of	O
entropy	B-Algorithm
.	O
</s>
<s>
Consider	O
the	O
function	O
where	O
H	O
is	O
a	O
hash	B-Algorithm
function	I-Algorithm
and	O
x	O
,	O
y	O
,	O
and	O
z	O
are	O
sources	O
of	O
entropy	B-Algorithm
with	O
z	O
being	O
the	O
output	O
of	O
a	O
CPU	O
based	O
malicious	O
HRNG	O
Z	O
:	O
</s>
<s>
This	O
is	O
possible	O
because	O
Linux	B-Operating_System
reseeds	O
H	O
on	O
an	O
ongoing	O
basis	O
instead	O
of	O
using	O
a	O
single	O
high	O
quality	O
seed	O
.	O
</s>
<s>
In	O
October	O
2016	O
,	O
with	O
the	O
release	O
of	O
Linux	B-Operating_System
kernel	I-Operating_System
version	O
4.8	O
,	O
the	O
kernel	B-Operating_System
's	O
was	O
switched	O
over	O
to	O
a	O
ChaCha20-based	O
cryptographic	B-Algorithm
pseudorandom	I-Algorithm
number	I-Algorithm
generator	I-Algorithm
(	O
CPRNG	B-Algorithm
)	O
implementation	O
by	O
Theodore	O
Ts'o	O
,	O
based	O
on	O
Bernstein	O
's	O
well-regarded	O
stream	B-Algorithm
cipher	I-Algorithm
ChaCha20	O
.	O
</s>
<s>
In	O
2020	O
,	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
version	O
5.6	O
only	O
blocks	O
when	O
the	O
CPRNG	B-Algorithm
has	O
n't	O
initialized	O
.	O
</s>
<s>
The	O
FreeBSD	B-Operating_System
operating	B-General_Concept
system	I-General_Concept
provides	O
a	O
link	O
to	O
.	O
</s>
<s>
Both	O
block	B-Architecture
only	O
until	O
properly	O
seeded	O
.	O
</s>
<s>
FreeBSD	B-Operating_System
's	O
PRNG	O
(	O
Fortuna	B-Algorithm
)	O
reseeds	O
regularly	O
,	O
and	O
does	O
not	O
attempt	O
to	O
estimate	O
entropy	B-Algorithm
.	O
</s>
<s>
Since	O
OpenBSD	B-Operating_System
5.1	O
(	O
May	O
1	O
,	O
2012	O
)	O
and	O
used	O
an	O
algorithm	O
based	O
on	O
RC4	B-Algorithm
but	O
renamed	O
to	O
ARC4	B-Algorithm
because	O
of	O
intellectual	O
property	O
reasons	O
.	O
</s>
<s>
While	O
random	O
number	O
generation	O
here	O
uses	O
system	O
entropy	B-Algorithm
gathered	O
in	O
several	O
ways	O
,	O
the	O
ARC4	B-Algorithm
algorithm	O
provides	O
a	O
fail-safe	O
,	O
ensuring	O
that	O
a	O
rapid	O
and	O
high	O
quality	O
pseudo-random	O
number	O
stream	O
is	O
provided	O
even	O
when	O
the	O
pool	O
is	O
in	O
a	O
low	O
entropy	B-Algorithm
state	O
.	O
</s>
<s>
The	O
system	O
automatically	O
uses	O
hardware	O
random	O
number	O
generators	O
(	O
such	O
as	O
those	O
provided	O
on	O
some	O
Intel	O
PCI	O
hubs	O
)	O
if	O
they	O
are	O
available	O
,	O
through	O
the	O
OpenBSD	B-Operating_System
Cryptographic	O
Framework	O
.	O
</s>
<s>
As	O
of	O
OpenBSD	B-Operating_System
5.5	O
(	O
May	O
1	O
,	O
2014	O
)	O
,	O
the	O
call	O
used	O
for	O
OpenBSD	B-Operating_System
's	O
random	O
devices	O
no	O
longer	O
uses	O
ARC4	B-Algorithm
,	O
but	O
ChaCha20	O
(	O
arc4random	O
name	O
might	O
be	O
reconsidered	O
as	O
A	O
Replacement	O
Call	O
for	O
Random	O
)	O
.	O
</s>
<s>
was	O
removed	O
in	O
OpenBSD	B-Operating_System
6.3	O
(	O
April	O
15	O
,	O
2018	O
)	O
.	O
</s>
<s>
NetBSD	B-Device
's	O
implementation	O
of	O
the	O
legacy	O
API	O
has	O
been	O
switched	O
over	O
to	O
ChaCha20	O
as	O
well	O
.	O
</s>
<s>
All	O
Apple	O
OSes	O
have	O
moved	O
to	O
Fortuna	B-Algorithm
since	O
at	O
least	O
December	O
2019	O
,	O
possibly	O
earlier	O
.	O
</s>
<s>
It	O
is	O
based	O
on	O
SHA-256	B-Algorithm
.	O
</s>
<s>
Multiple	O
entropy	B-Algorithm
sources	O
such	O
as	O
the	O
secure	O
enclave	O
RNG	O
,	O
boot	O
phase	O
timing	O
jitter	O
,	O
hardware	O
interrupt	O
(	O
timing	O
assumed	O
)	O
are	O
used	O
.	O
</s>
<s>
Seed	O
(	O
entropy	B-Algorithm
)	O
data	O
is	O
also	O
stored	O
for	O
subsequent	O
reboots	O
.	O
</s>
<s>
Prior	O
to	O
the	O
change	O
,	O
macOS	B-Application
and	O
iOS	B-Application
used	O
160-bit	O
Yarrow	B-Algorithm
based	O
on	O
SHA-1	B-Algorithm
.	O
</s>
<s>
NetBSD	B-Device
,	O
</s>
<s>
As	O
with	O
FreeBSD	B-Operating_System
,	O
AIX	O
implements	O
its	O
own	O
Yarrow-based	O
design	O
,	O
however	O
AIX	O
uses	O
considerably	O
fewer	O
entropy	B-Algorithm
sources	O
than	O
the	O
standard	O
implementation	O
and	O
stops	O
refilling	O
the	O
pool	O
when	O
it	O
thinks	O
it	O
contains	O
enough	O
entropy	B-Algorithm
.	O
</s>
<s>
In	O
Windows	B-Device
NT	I-Device
,	O
similar	O
functionality	O
is	O
delivered	O
by	O
,	O
but	O
reading	O
the	O
special	B-Application
file	I-Application
does	O
not	O
work	O
as	O
in	O
UNIX	O
.	O
</s>
<s>
The	O
documented	O
methods	O
to	O
generate	O
cryptographically	O
random	O
bytes	O
are	O
CryptGenRandom	B-Algorithm
and	O
RtlGenRandom	B-Algorithm
.	O
</s>
<s>
Windows	B-Application
PowerShell	I-Application
provides	O
access	O
to	O
a	O
cryptographically	B-Algorithm
secure	I-Algorithm
pseudorandom	I-Algorithm
number	I-Algorithm
generator	I-Algorithm
via	O
the	O
cmdlet	O
.	O
</s>
<s>
Cygwin	B-Language
on	O
Windows	O
provides	O
implementations	O
of	O
both	O
and	O
,	O
which	O
can	O
be	O
used	O
in	O
scripts	O
and	O
programs	O
.	O
</s>
