aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2014-04-01Release version 5.HEADv5masterJeff Garzik2-1/+10
2014-03-04rdrand: Enable the RDSEED instructionH. Peter Anvin2-28/+150
Enable the use of the RDSEED instruction. Since RDSEED can more easily be starved of entropy due to use on other threads, allow it to fall back to RDRAND by having a function which for every RDSEED failure executes RDRAND and stores a sample in a separate buffer. The RDRAND buffer and its high water mark are made static so that they can accumulate data across multiple invocations. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-03-04rdrand: Fix the RDRAND data reductionH. Peter Anvin2-51/+71
The RDRAND data reduction function was not correct. Specifically: 1. When using AESni, in order to guarantee at least one reseed event per reduction stripe we need to process the data in a different order. This means writing it out all the data to a buffer before processing it, and then process it in much larger stripes. 2. When using gcrypt, we are only performing one reduction at a time, so only process enough input for one reduction and only generate that amount of output. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-03-04rdrand: Simplify by changing x86_rdrand_nlong to x86_rdrand_bytesH. Peter Anvin2-27/+42
Make the code simpler by making x86_rdrand_nlong instead take a count in bytes and return the number of bytes written (the latter will matter for upcoming RDSEED enabling.) The function may still round up the size of the output buffer to a 4- or 8-byte boundary. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-03-04rngd_rdrand: Support compiling for x32 by adding unative_tH. Peter Anvin1-5/+11
On the x32 ABI for x86-64, sizeof(long) == 4, but we still use the 8-byte randomness instructions and flags. In order to support compilation for x32, introduce a new type "unative_t" which is typedef'd to the appropriate type for the architecture. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-03-04rdrand_asm.S: On x86-64 we have enough registers, avoid repeated loadsH. Peter Anvin1-0/+26
On x86-64 there are enough registers that there really is no point in using a repeated memory operand for the key material. Load it into a register instead, hopefully it will be slightly faster. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-03-04rdrand_asm.S: Use #ifdef instead of #if defined()H. Peter Anvin1-7/+8
Use #ifdef rather than #if defined() when we are testing for only one symbol. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-02-26rngd_rdrand: Don't use a fixed AES key for data reductionH. Peter Anvin2-33/+98
If we're going to run the data through AES anyway, there is no point in using the same key every time. Grab a key from /dev/urandom, although of course it is unknown how much entropy actually *is* in /dev/urandom at this point, it is presumably better than nothing, which is what we have now and XOR with rdrand output. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2014-02-24rngd_rdrand: Code style cleanupsH. Peter Anvin1-91/+104
Break up the code into smaller functions for readability, make the code conform a little closer to Linux standard, and try to reduce the number of #ifdefs. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-04-18Add BUGS file.Jeff Garzik1-0/+7
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2013-04-18rngd.8: Delete obsolete FIXMEJeff Garzik1-1/+0
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2013-04-18Provide support for RDRAND capable systems that don't have AES-NI.John Mechalas2-6/+129
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2013-04-18Fix the AES keys so that they are correct and match the comments.John Mechalas1-11/+11
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-06Update FSF mailing address in license.Jeff Garzik14-15/+15
Caught by rpmlint. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-06rngtest.1.in: Import spelling fixes from FedoraJeff Garzik1-2/+2
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02Release version 4.v4Jeff Garzik2-1/+11
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02Polish README a bit.Jeff Garzik1-2/+7
2012-08-02rngd: As long as FIPS error rates are low, re-try the same sourceH. Peter Anvin1-1/+5
Allow for a small number of FIPS errors before advancing to the next source. This prevents a high bandwidth source from stalling out by shifting to a low bandwidth source (e.g. DRNG->TPM) just because of a single FIPS failure. FIPS failures are frequent enough (1:1250) that this happens on a regular basis. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02rngd: Initialize RNGs in order of preferenceH. Peter Anvin1-1/+1
The DRNG entropy source, if present, is going to be orders of magnitudes faster than most other sources, so initialize it first so that it shows up first in the list. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02rngd: Allow up to a 1:1000 false error rate on FIPS testsH. Peter Anvin2-5/+11
The FIPS tests have a measured false positive error rate of approximately 1:1250. In order to not permanently disable a functioning random number source under high traffic, allow one failure per 1000 successful blocks. However, never allow more than 25 subsequent failures; this is handled by not allowing the failures counter to go below zero. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02rngd: don't open the TPM if hwrng is availableH. Peter Anvin1-2/+2
If /dev/hwrng is avaiable, do not open the TPM. Newer kernels export TPM randomness via /dev/hwrng; this properly handles multiplexing of the TPM so that we don't interfere with TrouSerS. Thus, we don't want to open /dev/tpm0 if we can open /dev/hwrng. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02rngd_linux: Log a warning if write_wakeup_threshold can't be adjustedH. Peter Anvin1-2/+11
If we fail to write write_wakeup_threshold, log a warning but continue. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02rngd_rdrand: Actually perform the correct AES data reductionH. Peter Anvin1-42/+23
The pointers were confused in such a way that the AES data reduction wasn't actually being performed. Furthermore, architecturally we need a 512:1 data reduction, rather than 128:1. Finally, initialize the IV to random value during startup and remove some unnecessary buffer shuffling. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02drng: Move DRNG code to a separate file and make safe on non-x86H. Peter Anvin4-149/+200
Move all the DRNG code to a separate file, and make sure it is properly stubbed out on non-x86. Furthermore, fix the CPUID bits we check for; in particular we need AES-ni for the whitening code. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-08-02rdrand_asm.S: Mark stack non-executableH. Peter Anvin1-0/+6
There is no reason for the stack to be executable. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-07-31Change the default device from /dev/hw_random to /dev/hwrngH. Peter Anvin1-2/+2
Change the default device name for the hardware random number device from /dev/hw_random to /dev/hwrng, which is the filename documented in devices.txt and appears to be the device name created by udev and devtmpfs. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-07-31rngd_linux: Modify write_wakeup_threshold to the fill thresholdH. Peter Anvin3-1/+45
The kernel.random.write_wakeup_threshold sysctl needs to be set to the point where we want poll() on the random device to wake up. This replaces the level check in ioctl() used during polling. Set it by default to 3/4 to the value of kernel.random.poolsize. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-07-31rngd_linux: Fix () used in prototypeH. Peter Anvin2-2/+2
() is an acceptable prototype in C++, but C requires (void). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-07-31Add RDRAND supportBrad Hill9-14/+390
2012-07-26Removed timeout option, leaving poll unlimitedBrad Hill5-31/+8
Removed timeout variables, parameters, and argument. Poll is now called with -1 as the timeout.
2012-07-17Prefer 'bool' to 'int', for boolean valuesJeff Garzik2-16/+16
2012-07-17Create PID file at startup, in daemon modeJeff Garzik5-3/+146
Code imported from Project Hail
2012-07-17Added -q and -v flags, updated help and man pageBrad Hill4-16/+74
-q and --quiet flags to suppress error messages from rngd.c -v and --verbose flags to list available entropy sources help and man page reflect these changes and have minor fixes
2010-08-17Fix -Wshadow warning.Jeff Garzik1-2/+2
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-08-17Disable entropy source, if facing continued failures.Jeff Garzik2-9/+40
If all entropy sources are disabled, exit. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-07-03Release version 3.v3Jeff Garzik3-2/+21
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-07-03s/list_add/src_list_add/Jeff Garzik3-4/+4
Avoid global namespace clashes. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-07-03Add TPM RNG support.Jeff Garzik12-95/+266
also, trim trailing whitespace. Contributed by Dell, with bug fixes by David Howells @ Red Hat. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-07-03Default to /dev/hw_random for RNG device name.Jeff Garzik1-2/+2
This matches the most prevalent, current Linux usage. Imported from RHEL 6 rng-tools. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-24rngd: fix build warningJeff Garzik1-2/+0
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-24Explicitly ship GPLv2 license.Jeff Garzik3-1/+343
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-12-03Fix uint64_t/unsigned long long printf(3) warnings.Jeff Garzik2-3/+6
2005-10-25Update .gitignore.Jeff Garzik1-0/+9
2005-10-25Import rng-tools from private subversion repo.Jeff Garzik25-0/+2179