History log of /openbsd/sys/dev/rnd.c (Results 1 – 25 of 229)
Revision Date Author Comments
# c1d8b5d1 02-Aug-2024 guenther <guenther@openbsd.org>

getentropy(2) is in POSIX-2024, so adjust the #include visibility,
change the "too much" error to EINVAL, add GETENTROPY_MAX to
<limits.h> (via sys/syslimits.h), and update the manpage.

ok deraadt@


# a7abde85 14-Jun-2024 claudio <claudio@openbsd.org>

Make arc4random() depend on less subsystems by decoupling extract_entropy()
from the enqueue_randomness() logic.

Add add_event_data() which just enqueues some data into the event buffer
which can be

Make arc4random() depend on less subsystems by decoupling extract_entropy()
from the enqueue_randomness() logic.

Add add_event_data() which just enqueues some data into the event buffer
which can be used by extract_entropy(). On top of this remove the
timeout_del() call in dequeue_randomness() it does serve any meaningful
reason.
OK kettenis@ deraadt@ mpi@

show more ...


# 609c45bc 04-Jun-2024 claudio <claudio@openbsd.org>

In dequeue_randomness() use an atomic instruction to increase the
rnd_event_cons. This way even concurrent calls to dequeue_randomness()
will use some different events.
OK deraadt@ djm@


# 5b133f3f 08-Mar-2023 guenther <guenther@openbsd.org>

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@


# d32eaf92 03-Nov-2022 guenther <guenther@openbsd.org>

Style: always use *retval and never retval[0] in syscalls,
to reflect that retval is just a single return value.

ok miod@


# 7d52e696 13-Oct-2022 tb <tb@openbsd.org>

Make comment match the code.

Since rnd.c r1.127, there is only one stirring polynomial.


# 9e63e9d9 06-Feb-2022 rob <rob@openbsd.org>

s/poll/pool


# 0bca52fc 06-Mar-2021 jsg <jsg@openbsd.org>

ansi


# 9d729ff9 15-Jun-2020 deraadt <deraadt@openbsd.org>

slight copyright update regarding recent work


# 01802d2c 31-May-2020 dlg <dlg@openbsd.org>

introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.

rnd.c uses nanotime to get access to some bits that change quickly
between events that it can mix into the entropy pool. it do

introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.

rnd.c uses nanotime to get access to some bits that change quickly
between events that it can mix into the entropy pool. it doesn't
use nanotime to get a monotonically increasing set or ordered and
accurate timestamps, it just wants something with bits that change.

there's been discussions for years about letting rnd use a clock
that's super fast to read, but not necessarily accurate, but it
wasn't until recently that i figured out it wasn't interested in
time at all, so things like keeping a fast clock coherent between
cpu cores or correct according to ntp is unecessary. this means we
can just let rnd read the cycle counters on cpus and things will
be fine. cpus with cycle counters that vary in their speed and
arent kept consistent between cores may even be desirable in this
context.

so this is the first step in converting rnd.c to reading cycle
counter. it copies the nanotime backend to each arch, and they can
replace it with something MD as a second step later on.

djm@ suggested rnd_messybytes, but we landed on cpu_rnd_messybits.
thanks to visa for his eyes.
ok deraadt@ visa@
deraadt@ says he will help handle any MD fallout that occurs.

show more ...


# c8f27247 29-May-2020 deraadt <deraadt@openbsd.org>

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, whi

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.

show more ...


# 10e9e1f8 29-May-2020 deraadt <deraadt@openbsd.org>

3 includes not needed


# dd65b8c4 27-May-2020 deraadt <deraadt@openbsd.org>

Update comment block at the top to describe (a) the ring damage logic,
and (b) the boot-time acceleration.


# 618bc41b 26-May-2020 deraadt <deraadt@openbsd.org>

Rewrite the entropy enqueue ring to collect damage asyncronously, and adapt the
dequeue to mix a selection of "best" ring entries. Change the dequeue timeout
to exponentially backoff because excessi

Rewrite the entropy enqueue ring to collect damage asyncronously, and adapt the
dequeue to mix a selection of "best" ring entries. Change the dequeue timeout
to exponentially backoff because excessive pool buffer generation is pointless
-- rekey's generally happen at 1.6MB and a long timeout, a lot of cpu cycles
were being wasted.

During boot-up (before timeouts work) aggressively consume enqueue damage
and rekey every time, to accelerate entropy injection into the chacha ring.

The goal is to compensate rapidly for weak seeding in unidentifiable
conditions, and ensure quality to arc4random() calls early in boot.
ok kettenis visa

show more ...


# dfbab732 25-May-2020 naddy <naddy@openbsd.org>

For large reads from /dev/random, use the arc4random_ctx_*() functions
instead of hand-rolling the same code to set up a temporary ChaCha
instance.
tweak/ok semarie@, ok deraadt@


# 14fbdcd4 25-May-2020 deraadt <deraadt@openbsd.org>

Pass bootblock indicator RB_GOODRANDOM to random_start(). Future work
will frantically compensate.
ok kettenis


# f581b7a6 18-May-2020 deraadt <deraadt@openbsd.org>

During the rekey operation, we feedback 1 word to the lowest level.
But it was a constant, that is really silly. Pass back the first
word from the middle layer.
ok visa


# 61547866 16-May-2020 deraadt <deraadt@openbsd.org>

entropy_add_ptr and entropy_input_rotate are only used inside
enqueue_randomness(), so make them local static instead of global.


# e289b4af 16-May-2020 deraadt <deraadt@openbsd.org>

be more consistant about with using sizeof(object) rather than the constant
defining the [size]


# 9b84cf1a 15-May-2020 deraadt <deraadt@openbsd.org>

Describe the purpose of add_entropy_words() in simpler terms.


# f63c40d9 15-May-2020 deraadt <deraadt@openbsd.org>

The description of the enqueue_randomness() input parameter was crazy untrue.


# dbd90212 15-May-2020 deraadt <deraadt@openbsd.org>

Explain enqueue_randomness() better. It is the supply-entropy function,
and change wording from 'entropy queue', what we have is a ring which
collects 'damage' from successive calls until drawn down


# 9757ae2e 15-May-2020 deraadt <deraadt@openbsd.org>

The long explanation for CRC stirring isn't helping. If anything
it suggests we should reconsider this mechanism and do something
simpler... delete the explanation for now.


# f28e8fe4 15-May-2020 deraadt <deraadt@openbsd.org>

The main comment block from 1996 has become highly inaccurate and
misleading, so rewrite it.

The interesting parts are bootblock-seeding from file + hwrng,
arc4random() being available incredibly ea

The main comment block from 1996 has become highly inaccurate and
misleading, so rewrite it.

The interesting parts are bootblock-seeding from file + hwrng,
arc4random() being available incredibly early, and seperate timeouts
to pull entropy data forward into a stir of the chacha state (one for
entropy ring crc whitening into a buffer, the 2nd for buffer folding
into the chacha)

Now that it is better documented, I can try to improve each component.

show more ...


# 57945b94 15-May-2020 deraadt <deraadt@openbsd.org>

remove unneccessary include files


12345678910