History log of /freebsd/lib/libc/gen/arc4random.c (Results 1 – 25 of 88)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# d0b74459 13-Jul-2024 Kyle Evans <kevans@FreeBSD.org>

include: ssp: fortify <stdlib.h>

The immediately obvious and attractive targets from <stdlib.h> are
arc4random_buf(3) and realpath(3) -- scraping the header didn't reveal
much else of interest.

Rev

include: ssp: fortify <stdlib.h>

The immediately obvious and attractive targets from <stdlib.h> are
arc4random_buf(3) and realpath(3) -- scraping the header didn't reveal
much else of interest.

Reviewed by: markj
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D45681

show more ...


Revision tags: release/14.1.0, release/13.3.0, release/14.0.0
# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Kee

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


Revision tags: release/13.2.0, release/12.4.0
# e9a2e4d1 10-Aug-2022 Xin LI <delphij@FreeBSD.org>

arc4random(3): Reduce diff with OpenBSD.

The main change was v1.57 by djm@:

Randomise the rekey interval a little. Previously, the chacha20
instance would be rekeyed every 1.6MB. This makes it

arc4random(3): Reduce diff with OpenBSD.

The main change was v1.57 by djm@:

Randomise the rekey interval a little. Previously, the chacha20
instance would be rekeyed every 1.6MB. This makes it happen at a
random point somewhere in the 1-2MB range.

Reviewed by: csprng (markm, cem)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36088

show more ...


Revision tags: release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0
# c2ca0667 12-Oct-2020 Alex Richardson <arichardson@FreeBSD.org>

Fix building on Linux/macOS after r366622

We have to bootstrap arc4random.c, so guard the FenestrasX code to avoid
using it on Linux/macOS.

Reviewed By: cem
Differential Revision: https://reviews.f

Fix building on Linux/macOS after r366622

We have to bootstrap arc4random.c, so guard the FenestrasX code to avoid
using it on Linux/macOS.

Reviewed By: cem
Differential Revision: https://reviews.freebsd.org/D26738

show more ...


# f8e8a06d 10-Oct-2020 Conrad Meyer <cem@FreeBSD.org>

random(4) FenestrasX: Push root seed version to arc4random(3)

Push the root seed version to userspace through the VDSO page, if
the RANDOM_FENESTRASX algorithm is enabled. Otherwise, there is no
fu

random(4) FenestrasX: Push root seed version to arc4random(3)

Push the root seed version to userspace through the VDSO page, if
the RANDOM_FENESTRASX algorithm is enabled. Otherwise, there is no
functional change. The mechanism can be disabled with
debug.fxrng_vdso_enable=0.

arc4random(3) obtains a pointer to the root seed version published by
the kernel in the shared page at allocation time. Like arc4random(9),
it maintains its own per-process copy of the seed version corresponding
to the root seed version at the time it last rekeyed. On read requests,
the process seed version is compared with the version published in the
shared page; if they do not match, arc4random(3) reseeds from the
kernel before providing generated output.

This change does not implement the FenestrasX concept of PCPU userspace
generators seeded from a per-process base generator. That change is
left for future discussion/work.

Reviewed by: kib (previous version)
Approved by: csprng (me -- only touching FXRNG here)
Differential Revision: https://reviews.freebsd.org/D22839

show more ...


Revision tags: 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, release/12.0.0
# c6879c6c 23-Oct-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r339015 through r339669.


# 243e0943 21-Oct-2018 Conrad Meyer <cem@FreeBSD.org>

Embedded chacha: Distinguish via dedicated macro

Set embedding expectations via CHACHA_EMBED macro rather than _KERNEL
definition.

No functional change.

Sponsored by: Dell EMC Isilon


# 7847e041 24-Aug-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r338026 through r338297, and resolve conflicts.


# c1e80940 19-Aug-2018 Xin LI <delphij@FreeBSD.org>

Update userland arc4random() with OpenBSD's Chacha20 based arc4random().

ObsoleteFiles.inc:

Remove manual pages for arc4random_addrandom(3) and
arc4random_stir(3).

contrib/ntp/lib/isc/

Update userland arc4random() with OpenBSD's Chacha20 based arc4random().

ObsoleteFiles.inc:

Remove manual pages for arc4random_addrandom(3) and
arc4random_stir(3).

contrib/ntp/lib/isc/random.c:
contrib/ntp/sntp/libevent/evutil_rand.c:

Eliminate in-tree usage of arc4random_addrandom().

crypto/heimdal/lib/roken/rand.c:
crypto/openssh/config.h:

Eliminate in-tree usage of arc4random_stir().

include/stdlib.h:

Remove arc4random_stir() and arc4random_addrandom() prototypes,
provide temporary shims for transistion period.

lib/libc/gen/Makefile.inc:

Hook arc4random-compat.c to build, add hint for Chacha20 source for
kernel, and remove arc4random_addrandom(3) and arc4random_stir(3)
links.

lib/libc/gen/arc4random.c:

Adopt OpenBSD arc4random.c,v 1.54 with bare minimum changes, use the
sys/crypto/chacha20 implementation of keystream.

lib/libc/gen/Symbol.map:

Remove arc4random_stir and arc4random_addrandom interfaces.

lib/libc/gen/arc4random.h:

Adopt OpenBSD arc4random.h,v 1.4 but provide _ARC4_LOCK of our own.

lib/libc/gen/arc4random.3:

Adopt OpenBSD arc4random.3,v 1.35 but keep FreeBSD r114444 and
r118247.

lib/libc/gen/arc4random-compat.c:

Compatibility shims for arc4random_stir and arc4random_addrandom
functions to preserve ABI. Log once when called but do nothing
otherwise.

lib/libc/gen/getentropy.c:
lib/libc/include/libc_private.h:

Fold __arc4_sysctl into getentropy.c (renamed to arnd_sysctl).
Remove from libc_private.h as a result.

sys/crypto/chacha20/chacha.c:
sys/crypto/chacha20/chacha.h:

Make it possible to use the kernel implementation in libc.

PR: 182610
Reviewed by: cem, markm
Obtained from: OpenBSD
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D16760

show more ...


# 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


Revision tags: release/11.2.0
# 08a7e74c 22-Mar-2018 Conrad Meyer <cem@FreeBSD.org>

getentropy(3): Fallback to kern.arandom sysctl on older kernels

On older kernels, when userspace program disables SIGSYS, catch ENOSYS and
emulate getrandom(2) syscall with the kern.arandom sysctl (

getentropy(3): Fallback to kern.arandom sysctl on older kernels

On older kernels, when userspace program disables SIGSYS, catch ENOSYS and
emulate getrandom(2) syscall with the kern.arandom sysctl (via existing
arc4_sysctl wrapper).

Special care is taken to faithfully emulate EFAULT on NULL pointers, because
sysctl(3) as used by kern.arandom ignores NULL oldp. (This was caught by
getentropy(3) ATF tests.)

Reported by: kib
Reviewed by: kib
Discussed with: delphij
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14785

show more ...


# aab3e059 24-Feb-2018 Conrad Meyer <cem@FreeBSD.org>

libc: Remove unused definition

RANDOMDEV isn't used after r306636. Remove the unneeded definition.

No functional change.

Sponsored by: Dell EMC Isilon


Revision tags: release/10.4.0, release/11.1.0
# 91868665 14-Mar-2017 Xin LI <delphij@FreeBSD.org>

Discard first 3072 bytes of RC4 keystream, this is a bandaid
that allows us to work on switching to a more modern PRNG.

Submitted by: Steven Chamberlain <steven pyro eu org>
Approved by: so


# a0e610c4 16-Oct-2016 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r306906 through r307382.


# 49a6e1ba 12-Oct-2016 Ed Maste <emaste@FreeBSD.org>

Add comment on use of abort() in libc

Suggested by: jonathan (in review D8133)


# 242b2482 09-Oct-2016 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r306412 through r306905.


# 5c1ea1fc 03-Oct-2016 Ed Maste <emaste@FreeBSD.org>

libc arc4_stir: use only kern.arandom sysctl

The sysctl cannot fail. If it does fail on some FreeBSD derivative or
after some future change, just abort() so that the problem will be found
and fixed.

libc arc4_stir: use only kern.arandom sysctl

The sysctl cannot fail. If it does fail on some FreeBSD derivative or
after some future change, just abort() so that the problem will be found
and fixed.

It's preferable to provide an arc4random() function that cannot fail and
cannot return poor quality random data. While abort() is not normally
suitable for a library, it makes sense here.

Reviewed by: ed, jonathan, markm
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8077

show more ...


Revision tags: release/11.0.1, release/11.0.0
# 2cf5e936 18-Apr-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

libc: do not include <sys/types.h> where <sys/param.h> was already included

According to style(9):
> normally, include <sys/types.h> OR <sys/param.h>, but not both.
(<sys/param.h> already includes <

libc: do not include <sys/types.h> where <sys/param.h> was already included

According to style(9):
> normally, include <sys/types.h> OR <sys/param.h>, but not both.
(<sys/param.h> already includes <sys/types.h> when LOCORE is not defined).

show more ...


Revision tags: release/10.3.0, release/10.2.0, release/10.1.0
# 246e7a2b 02-Sep-2014 Neel Natu <neel@FreeBSD.org>

IFC @r269962

Submitted by: Anish Gupta (akgupt3@gmail.com)


# ee7b0571 19-Aug-2014 Simon J. Gerraty <sjg@FreeBSD.org>

Merge head from 7/28


# 1b833d53 13-Aug-2014 Alexander V. Chernikov <melifaro@FreeBSD.org>

Sync to HEAD@r269943.


# dad64c97 15-Jul-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

libc/gen: small updates to code originating at OpenBSD

arc4random.c
- CVS rev. 1.22
Change arc4random_uniform() to calculate ``2**32 % upper_bound'' as
``-upper_bound % upper_bound''. Simplifies the

libc/gen: small updates to code originating at OpenBSD

arc4random.c
- CVS rev. 1.22
Change arc4random_uniform() to calculate ``2**32 % upper_bound'' as
``-upper_bound % upper_bound''. Simplifies the code and makes it the
same on both ILP32 and LP64 architectures, and also slightly faster on
LP64 architectures by using a 32-bit remainder instead of a 64-bit
remainder.
- CVS rev. 1.23
Spacing

readpassphrase.c
-CVS rev. v 1.24
most obvious unsigned char casts for ctype

Obtained from: OpenBSD
MFC after: 5 days

show more ...


1234