openssl/include/internal
Dr. Matthias St. Pierre c16de9d832 Fix reseeding issues of the public RAND_DRBG
Reseeding is handled very differently by the classic RAND_METHOD API
and the new RAND_DRBG api. These differences led to some problems when
the new RAND_DRBG was made the default OpenSSL RNG. In particular,
RAND_add() did not work as expected anymore. These issues are discussed
on the thread '[openssl-dev] Plea for a new public OpenSSL RNG API'
and in Pull Request #4328. This commit fixes the mentioned issues,
introducing the following changes:

- Replace the fixed size RAND_BYTES_BUFFER by a new RAND_POOL API which
  facilitates collecting entropy by the get_entropy() callback.
- Don't use RAND_poll()/RAND_add() for collecting entropy from the
  get_entropy() callback anymore. Instead, replace RAND_poll() by
  RAND_POOL_acquire_entropy().
- Add a new function rand_drbg_restart() which tries to get the DRBG
  in an instantiated state by all means, regardless of the current
  state (uninstantiated, error, ...) the DRBG is in. If the caller
  provides entropy or additional input, it will be used for reseeding.
- Restore the original documented behaviour of RAND_add() and RAND_poll()
  (namely to reseed the DRBG immediately) by a new implementation based
  on rand_drbg_restart().
- Add automatic error recovery from temporary failures of the entropy
  source to RAND_DRBG_generate() using the rand_drbg_restart() function.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/4328)
2017-10-18 08:39:20 -05:00
..
__DECC_INCLUDE_EPILOGUE.H VMS: Copy DECC inclusion epi- and prologues to internals 2017-04-20 13:10:06 +02:00
__DECC_INCLUDE_PROLOGUE.H VMS: Copy DECC inclusion epi- and prologues to internals 2017-04-20 13:10:06 +02:00
bio.h More parameter naming of BIO_read*/BIO_write* related functions 2016-10-28 09:48:54 +01:00
comp.h Copyright consolidation 03/10 2016-05-17 14:24:17 -04:00
conf.h RT4562: Fix misleading doc on OPENSSL_config 2016-06-14 12:30:37 -04:00
constant_time_locl.h Add constant-time 64 2017-06-21 09:19:42 -04:00
cryptlib.h Add CRYPTO_get_alloc_counts. 2017-10-12 22:04:12 -04:00
dane.h Perform DANE-EE(3) name checks by default 2016-07-12 10:16:34 -04:00
dso.h Use "" not <> for internal/ includes 2017-08-22 09:54:20 -04:00
dsoerr.h make error tables const and separate header file 2017-06-07 15:12:03 -04:00
err.h Copyright consolidation 03/10 2016-05-17 14:24:17 -04:00
nelem.h Remove tests dependence on e_os.h 2017-08-18 09:50:25 +10:00
numbers.h Copyright consolidation 03/10 2016-05-17 14:24:17 -04:00
o_dir.h Fix some Typos and indents 2017-08-11 10:16:33 -04:00
o_str.h Remove internal functions OPENSSL_strcasecmp and OPENSSL_strncasecmp 2016-05-28 02:15:04 +02:00
rand.h Fix reseeding issues of the public RAND_DRBG 2017-10-18 08:39:20 -05:00
refcount.h Move the REF_PRINT support from e_os.h to internal/refcount.h. 2017-08-30 07:20:44 +10:00
sockets.h Fix guarding macro in include/internal/sockets.h 2017-08-25 23:59:30 +02:00
thread_once.h Clarify what RUN_ONCE returns 2017-01-13 13:10:21 +01:00