summaryrefslogtreecommitdiffstats
path: root/crypto/rand/rand_lib.c
AgeCommit message (Collapse)Author
2017-02-28Clean up references to FIPSEmilia Kasper
This removes the fips configure option. This option is broken as the required FIPS code is not available. FIPS_mode() and FIPS_mode_set() are retained for compatibility, but FIPS_mode() always returns 0, and FIPS_mode_set() can only be used to turn FIPS mode off. Reviewed-by: Stephen Henson <steve@openssl.org>
2016-05-17Copyright consolidation 09/10Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Rename int_*() functions to *_int()Matt Caswell
There is a preference for suffixes to indicate that a function is internal rather than prefixes. Note: the suffix is only required to disambiguate internal functions and public symbols with the same name (but different case) Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Rename lots of *_intern or *_internal function to int_*Matt Caswell
There was a lot of naming inconsistency, so we try and standardise on one form. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate RAND_cleanup() and make it a no-opMatt Caswell
RAND_cleanup() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-20Remove #error from include files.Rich Salz
Don't have #error statements in header files, but instead wrap the contents of that file in #ifndef OPENSSL_NO_xxx This means it is now always safe to include the header file. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-25GH715: ENGINE_finish can take NULLRich Salz
Simplifies calling code. Also fixed up any !ptr tests that were nearby, turning them into NULL tests. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-26Remove /* foo.c */ commentsRich Salz
This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-01-07Backwards-compatibility subject to OPENSSL_API_COMPATViktor Dukhovni
Provide backwards-compatiblity for functions, macros and include files if OPENSSL_API_COMPAT is either not defined or defined less than the version number of the release in which the feature was deprecated. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-06Remove more (rest?) of FIPS build stuff.Rich Salz
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2015-11-09Continue standardising malloc style for libcryptoMatt Caswell
Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-10-30Replace "SSLeay" in API with OpenSSLRich Salz
All instances of SSLeay (any combination of case) were replaced with the case-equivalent OpenSSL. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-14Identify and move common internal libcrypto header filesRichard Levitte
There are header files in crypto/ that are used by a number of crypto/ submodules. Move those to crypto/include/internal and adapt the affected source code and Makefiles. The header files that got moved are: crypto/cryptolib.h crypto/md32_common.h Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-04-30free cleanup almost the finaleRich Salz
Add OPENSSL_clear_free which merges cleanse and free. (Names was picked to be similar to BN_clear_free, etc.) Removed OPENSSL_freeFunc macro. Fixed the small simple ones that are left: CRYPTO_free CRYPTO_free_locked OPENSSL_free_locked Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-25Deprecate RAND_pseudo_bytesMatt Caswell
The justification for RAND_pseudo_bytes is somewhat dubious, and the reality is that it is frequently being misused. RAND_bytes and RAND_pseudo_bytes in the default implementation both end up calling ssleay_rand_bytes. Both may return -1 in an error condition. If there is insufficient entropy then both will return 0, but RAND_bytes will additionally add an error to the error queue. They both return 1 on success. Therefore the fundamental difference between the two is that one will add an error to the error queue with insufficient entory whilst the other will not. Frequently there are constructions of this form: if(RAND_pseudo_bytes(...) <= 1) goto err; In the above form insufficient entropy is treated as an error anyway, so RAND_bytes is probably the better form to use. This form is also seen: if(!RAND_pseudo_bytes(...)) goto err; This is technically not correct at all since a -1 return value is incorrectly handled - but this form will also treat insufficient entropy as an error. Within libssl it is required that you have correctly seeded your entropy pool and so there seems little benefit in using RAND_pseudo_bytes. Similarly in libcrypto many operations also require a correctly seeded entropy pool and so in most interesting cases you would be better off using RAND_bytes anyway. There is a significant risk of RAND_pseudo_bytes being incorrectly used in scenarios where security can be compromised by insufficient entropy. If you are not using the default implementation, then most engines use the same function to implement RAND_bytes and RAND_pseudo_bytes in any case. Given its misuse, limited benefit, and potential to compromise security, RAND_pseudo_bytes has been deprecated. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-01-22Run util/openssl-format-source -v -c .Matt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-01-11Use rdrand as additional entropy source.Dr. Stephen Henson
If available rdrand is used as an additional entropy source for the PRNG and for additional input in FIPS mode.
2012-08-22PR: 2786Dr. Stephen Henson
Reported by: Tomas Mraz <tmraz@redhat.com> Treat a NULL value passed to drbg_free_entropy callback as non-op. This can happen if the call to fips_get_entropy fails.
2011-06-21Don't set FIPS rand method at same time as RAND method as this can cause theDr. Stephen Henson
FIPS library to fail. Applications that want to set the FIPS rand method can do so explicitly and presumably they know what they are doing...
2011-04-23Oops, work out expanded buffer length before allocating it...Dr. Stephen Henson
2011-04-23Always return multiple of block length bytes from default DRBG seedDr. Stephen Henson
callback. Handle case where no multiple of the block size is in the interval [min_len, max_len].
2011-04-21Add continuous RNG test to entropy source. Entropy callbacks now needDr. Stephen Henson
to specify a "block length".
2011-04-06Update OpenSSL DRBG support code. Use date time vector as additional data.Dr. Stephen Henson
Set FIPS RAND_METHOD at same time as OpenSSL RAND_METHOD.
2011-04-05Extensive reorganisation of PRNG handling in FIPS module: all callsDr. Stephen Henson
now use an internal RAND_METHOD. All dependencies to OpenSSL standard PRNG are now removed: it is the applications resposibility to setup the FIPS PRNG and initalise it. Initial OpenSSL RAND_init_fips() function that will setup the DRBG for the "FIPS capable OpenSSL".
2011-01-26FIPS mode changes to make RNG compile (this will need updating later as weDr. Stephen Henson
need a whole new PRNG for FIPS). 1. avoid use of ERR_peek(). 2. If compiling with FIPS use small FIPS EVP and disable ENGINE
2008-11-12Revert the size_t modifications from HEAD that had led to moreGeoff Thorpe
knock-on work than expected - they've been extracted into a patch series that can be completed elsewhere, or in a different branch, before merging back to HEAD.
2008-11-01More size_tification.Ben Laurie
2007-09-24Port from 0.9.8-stableLutz Jänicke
2007-03-02Initialize "buf" to 0 to make valgrind happy :-)Lutz Jänicke
Note: the RAND_bytes() manual page says: RAND_bytes() puts num cryptographically strong pseudo-random bytes into buf. It does not talk about using the previous contents of buf so we are working as documented.
2003-01-30Add the possibility to build without the ENGINE framework.Richard Levitte
PR: 287
2001-09-25This commits changes to various parts of libcrypto required by the recentGeoff Thorpe
ENGINE surgery. DH, DSA, RAND, and RSA now use *both* "method" and ENGINE pointers to manage their hooking with ENGINE. Previously their use of "method" pointers was replaced by use of ENGINE references. See crypto/engine/README for details. Also, remove the ENGINE iterations from evp_test - even when the cipher/digest code is committed in, this functionality would require a different set of API calls.
2001-06-21Fix memory leak when RAND is used: need to cleanupDr. Stephen Henson
RANDs ENGINE reference in ENGINE_cleanup().
2001-04-30In RSA, DSA, DH, and RAND - if the "***_new()" function fails because theGeoff Thorpe
ENGINE code does not return a default, set an error.
2001-04-18Some more tweaks from ENGINE code.Geoff Thorpe
Previously RAND_get_rand_method was returning a non-const pointer, but it should be const. As with all other such cases, METHOD pointers are stored and returned as "const". The only methods one should be able to alter are methods "local" to the relevant code, in which case a non-const handle to the methods should already exist. This change has been forced by the constifying of the ENGINE code (before which RAND_METHOD was the only method pointer in an ENGINE structure that was not constant).
2000-10-26Merge the engine branch into the main trunk. All conflicts resolved.Richard Levitte
At the same time, add VMS support for Rijndael.
2000-03-02Use RAND_METHOD for implementing RAND_status.Bodo Möller
2000-02-19Allow for higher granularity of entropy estimates by using 'double'Bodo Möller
instead of 'unsigned' counters. Seed PRNG in MacOS/GetHTTPS.src/GetHTTPS.cpp. Partially submitted by Yoram Meroz <yoram@mail.idrive.com>.
2000-01-16New function RAND_pseudo_bytes() generated pseudorandom numbers thatUlf Möller
are not guaranteed to be unpredictable.
2000-01-13Precautions against using the PRNG uninitialized: RAND_bytes() nowUlf Möller
returns int (1 = ok, 0 = not seeded). New function RAND_add() is the same as RAND_seed() but takes an estimate of the entropy as an additional argument.
1999-09-11Initial support for MacOS.Andy Polyakov
This will soon be complemented with MacOS specific source code files and INSTALL.MacOS. I (Andy) have decided to get rid of a number of #include <sys/types.h>. I've verified it's ok (both by examining /usr/include/*.h and compiling) on a number of Unix platforms. Unfortunately I don't have Windows box to verify this on. I really appreciate if somebody could try to compile it and contact me a.s.a.p. in case a problem occurs. Submitted by: Roy Wood <roy@centricsystems.ca> Reviewed by: Andy Polyakov <appro@fy.chalmers.se>
1999-04-23Change #include filenames from <foo.h> to <openssl.h>.Bodo Möller
Submitted by: Reviewed by: PR:
1999-04-19Change functions to ANSI C.Ulf Möller
1999-02-09More exactitude with function arguments.Ben Laurie
1998-12-22Various cleanups and fixed by Marc and Ralf to start the OpenTLS projectRalf S. Engelschall
1998-12-21Import of old SSLeay release: SSLeay 0.9.1b (unreleased)SSLeayRalf S. Engelschall