<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/stdlib/random.c, branch releng/12.4</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.4</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F12.4'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2017-11-20T19:49:47Z</updated>
<entry>
<title>General further adoption of SPDX licensing ID tags.</title>
<updated>2017-11-20T19:49:47Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2017-11-20T19:49:47Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8a16b7a18f5d0b031f09832fd7752fba717e2a97'/>
<id>urn:sha1:8a16b7a18f5d0b031f09832fd7752fba717e2a97</id>
<content type='text'>
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
</content>
</entry>
<entry>
<title>Add comment on use of abort() in libc</title>
<updated>2016-10-12T13:56:14Z</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2016-10-12T13:56:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=49a6e1ba328e7d0d9c3743c3d0a9306c7f188edd'/>
<id>urn:sha1:49a6e1ba328e7d0d9c3743c3d0a9306c7f188edd</id>
<content type='text'>
Suggested by:	jonathan (in review D8133)
</content>
</entry>
<entry>
<title>abort in srandomdev if kern.arandom sysctl fails</title>
<updated>2016-10-05T17:03:22Z</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2016-10-05T17:03:22Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=7e81ad1292587ce32b3a95291bc4e1fccd0de967'/>
<id>urn:sha1:7e81ad1292587ce32b3a95291bc4e1fccd0de967</id>
<content type='text'>
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.

While abort() is not normally suitable for a library, it makes sense
here.

This is akin to r306636 for arc4random.

Reviewed by:	ed
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8077
</content>
</entry>
<entry>
<title>Fix typing of srandom() and initstate().</title>
<updated>2016-07-26T20:11:29Z</updated>
<author>
<name>Ed Schouten</name>
<email>ed@FreeBSD.org</email>
</author>
<published>2016-07-26T20:11:29Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8de6c267117c2eb423b1a940601d8e4d525c5f4d'/>
<id>urn:sha1:8de6c267117c2eb423b1a940601d8e4d525c5f4d</id>
<content type='text'>
POSIX requires that these functions have an unsigned int for their first
argument; not an unsigned long.

My reasoning is that we can safely change these functions without
breaking the ABI. As far as I know, our supported architectures either
use registers for passing function arguments that are at least as big as
long (e.g., amd64), or int and long are of the same size (e.g., i386).

Reviewed by:	ache
Differential Revision:	https://reviews.freebsd.org/D6644
</content>
</entry>
<entry>
<title>Micro optimize: C standard guarantees that right shift for unsigned value</title>
<updated>2016-05-29T16:39:28Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2016-05-29T16:39:28Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b8ac3f201ddfd20c820ae46f7a96a1b1812b02a4'/>
<id>urn:sha1:b8ac3f201ddfd20c820ae46f7a96a1b1812b02a4</id>
<content type='text'>
fills left bits with zero, and we have exact 32bit unsigned value
(uint32_t), so there is no reason to add "&amp; 0x7fffffff" here.

MFC after:      1 week
</content>
</entry>
<entry>
<title>1) Unifdef USE_WEAK_SEEDING it is too obsolete to support and makes reading</title>
<updated>2016-05-29T11:54:09Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2016-05-29T11:54:09Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e44ffdb207bdefe1d84dcffeca0bf34cb2f1e024'/>
<id>urn:sha1:e44ffdb207bdefe1d84dcffeca0bf34cb2f1e024</id>
<content type='text'>
harder.

2) ACM paper require seed to be in [1, 2^31-2] range, so use the same range
shifting as already done for rand(3). Also protect srandomdev() + TYPE_0 case
(non default) from negative seeds.

3) Don't check for valid "type" range in setstate(), it is always valid as
calculated. Instead add a check that rear pointer not exceeed end pointer.

MFC after:      1 week
</content>
</entry>
<entry>
<title>1) POSIX prohibits printing errors to stderr here and require</title>
<updated>2016-05-22T06:18:59Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2016-05-22T06:18:59Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=fbd6b95ef90ca90801c9a1db400ed9288d3eed42'/>
<id>urn:sha1:fbd6b95ef90ca90801c9a1db400ed9288d3eed42</id>
<content type='text'>
returning NULL:

"Upon successful completion, initstate() and setstate() shall return a
pointer to the previous state array; otherwise, a null pointer shall
be returned.

Although some implementations of random() have written messages to
standard error, such implementations do not conform to POSIX.1-2008."

2) Move error detections earlier to prevent state modifying.

MFC after:      1 week
</content>
</entry>
<entry>
<title>Renumber clauses to reduce diffs to other versions</title>
<updated>2013-06-13T00:19:30Z</updated>
<author>
<name>Ed Maste</name>
<email>emaste@FreeBSD.org</email>
</author>
<published>2013-06-13T00:19:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=580b4d185bc1d20da91429229920ce590309cbf6'/>
<id>urn:sha1:580b4d185bc1d20da91429229920ce590309cbf6</id>
<content type='text'>
NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3,
so follow suit to make comparison easier.
</content>
</entry>
<entry>
<title>Replace access to /dev/random with the kernel pseudo-random number</title>
<updated>2013-04-02T23:41:20Z</updated>
<author>
<name>Xin LI</name>
<email>delphij@FreeBSD.org</email>
</author>
<published>2013-04-02T23:41:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=12a6865090ad2f88c671256c53a8fed4d5424424'/>
<id>urn:sha1:12a6865090ad2f88c671256c53a8fed4d5424424</id>
<content type='text'>
source sysctl(KERN_ARND) and remove the fallback code.

Obtained from:	OpenBSD
Reviewed by:	secteam
MFC after:	1 month
</content>
</entry>
<entry>
<title>Remove undefined behavior from sranddev() and</title>
<updated>2012-10-09T14:25:14Z</updated>
<author>
<name>Eitan Adler</name>
<email>eadler@FreeBSD.org</email>
</author>
<published>2012-10-09T14:25:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=6a762eb23ea5f31e65cfa12602937f39a14e9b0c'/>
<id>urn:sha1:6a762eb23ea5f31e65cfa12602937f39a14e9b0c</id>
<content type='text'>
srandomdev(). This doesn't actually work
with any modern C compiler:

In particular, both clang and modern gcc
verisons silently elide any xor operation
with 'junk'.

Approved by:	secteam
MFC after:	3 days
</content>
</entry>
</feed>
