public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "Ondřej Bílka" <neleai@seznam.cz> To: bugdal at aerifal dot cx <sourceware-bugzilla@sourceware.org> Cc: glibc-bugs@sourceware.org Subject: Re: [Bug libc/15615] New: Poor quality output from rand_r Date: Thu, 13 Jun 2013 08:26:00 -0000 [thread overview] Message-ID: <20130613045205.GA28960@domone.kolej.mff.cuni.cz> (raw) In-Reply-To: <bug-15615-131@http.sourceware.org/bugzilla/> On Wed, Jun 12, 2013 at 11:39:09PM +0000, bugdal at aerifal dot cx wrote: > http://sourceware.org/bugzilla/show_bug.cgi?id=15615 > > Bug ID: 15615 > Summary: Poor quality output from rand_r > Product: glibc > Version: unspecified > Status: NEW > Severity: normal > Priority: P2 > Component: libc > Assignee: unassigned at sourceware dot org > Reporter: bugdal at aerifal dot cx > CC: drepper.fsp at gmail dot com > > Created attachment 7075 > --> http://sourceware.org/bugzilla/attachment.cgi?id=7075&action=edit > test program to generate data for analysis by dieharder > > Implementing a decent rand_r is very tricky because the interface requirement > forces the full PRNG state to fit in 32 bits; this rules out pretty much all > good PRNGs. Nonetheless, glibc's rand_r is much worse than it needs to be. > > glibc's rand_r is based on the LCG published in the C standard: > > next = next * 1103515245 + 12345; > return next / 65536 % 32768; > A problem here is that for many users predictability is much more important than quality. Developer expects that when he uses rand_r with state that he controls will not vary. This can cause extra debbuging hastle when code mysteriously fails on one machine but not other or desync issues. > To fully fix rand_r, the approach of concatenating multiple iterations should > be abandoned in favor of a single-LCG-iteration approach followed by an > invertable transformation on the output. Obviously a 32-bit cryptographic block > cipher would give the best statistical properties, but it would be slow. In This is false, I have a replacement of this with four rounds of AES. On intel using aesenc I performance is better than current, I did not propose that due of problems above. I wrote a RFC for random replacement on libc-alpha, browse archives.
next prev parent reply other threads:[~2013-06-13 8:26 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-06-12 23:39 bugdal at aerifal dot cx 2013-06-13 8:26 ` Ondřej Bílka [this message] 2013-06-13 8:26 ` [Bug libc/15615] " neleai at seznam dot cz 2013-06-13 12:38 ` bugdal at aerifal dot cx 2013-06-14 12:11 ` Ondřej Bílka 2013-06-14 12:11 ` neleai at seznam dot cz 2013-06-14 15:37 ` bugdal at aerifal dot cx 2013-06-25 6:58 ` Ondřej Bílka 2013-06-25 12:25 ` bugdal at aerifal dot cx 2014-06-13 15:07 ` fweimer at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20130613045205.GA28960@domone.kolej.mff.cuni.cz \ --to=neleai@seznam.cz \ --cc=glibc-bugs@sourceware.org \ --cc=sourceware-bugzilla@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).