History log of /freebsd/lib/libc/gen/arc4random_uniform.c (Results 1 – 6 of 6)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/14.2.0
# 127709d3 18-Nov-2024 Robert Clausecker <fuz@FreeBSD.org>

lib/libc/gen: use Lemire's algorithm for arc4random_uniform().

Daniel Lemire has published a more efficient range reduction algorithm
for finding a random number in a given range without bias, reduc

lib/libc/gen: use Lemire's algorithm for arc4random_uniform().

Daniel Lemire has published a more efficient range reduction algorithm
for finding a random number in a given range without bias, reducing the
number of divisions to none in the common case and 1 in case the initial
sample is rejected.

This speeds up performance by 22% on amd64, 15% on i386, and 70% on armv7.

os: FreeBSD
arch: amd64
cpu: Intel(R) Core(TM) i7-4910MQ CPU @ 2.90GHz
│ benchmark.out │
│ sec/op │
Arc4random_uniform 56.53n ± 0%
Fast_uniform 44.00n ± 0%
geomean 49.87n

Reviewed by: cem
Approved by: emaste
Differential Revision: https://reviews.freebsd.org/D47659

show more ...


Revision tags: release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0
# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0
# d25a1430 13-Apr-2020 Xin LI <delphij@FreeBSD.org>

Sync with OpenBSD:

arc4random.c: In the incredibly unbelievable circumstance where
_rs_init() fails to allocate pages, don't call abort() because of
corefile data leakage concerns, but simply _exit(

Sync with OpenBSD:

arc4random.c: In the incredibly unbelievable circumstance where
_rs_init() fails to allocate pages, don't call abort() because of
corefile data leakage concerns, but simply _exit(). The reasoning
is _rs_init() will only fail if someone finds a way to apply
specific pressure against this failure point, for the purpose of
leaking information into a core which they can read. We don't
need a corefile in this instance to debug that. So take this
"lever" away from whoever in the future wants to do that.

arc4random.3: reference random(4)

arc4random_uniform.c: include stdint.h over sys/types.h

show more ...


Revision tags: release/12.1.0, release/11.3.0
# 6b97c2e3 20-Apr-2019 Conrad Meyer <cem@FreeBSD.org>

Revert r346410 and r346411

libkern in .PATH has too many filename conflicts with libc and my -DNO_CLEAN
tinderbox didn't catch that ahead of time. Mea culpa.


Revision tags: release/12.0.0
# 3611ec60 18-Aug-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r337646 through r338014.


# 718863d0 18-Aug-2018 Xin LI <delphij@FreeBSD.org>

Split arc4random_uniform into it's own file and sync with OpenBSD.

PR: 182610
Obtained from: OpenBSD
MFC after: 2 weeks