From 018dec88c43d8f15f995520c2b5abf1869d5889b Mon Sep 17 00:00:00 2001 From: Nathan French Date: Tue, 21 Nov 2017 14:03:21 -0500 Subject: [PATCH] check for errors in SSL RAND_(poll|bytes) calls --- evhtp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/evhtp.c b/evhtp.c index 295f864..8c5e0d6 100644 --- a/evhtp.c +++ b/evhtp.c @@ -4770,7 +4770,16 @@ evhtp_ssl_init(evhtp_t * htp, evhtp_ssl_cfg_t * cfg) ERR_load_crypto_strings(); SSL_load_error_strings(); OpenSSL_add_all_algorithms(); - RAND_poll(); + + if (RAND_poll() != 1) { + log_error("RAND_poll"); + return -1; + } + + if (RAND_bytes(&c, 1) != 1) { + log_error("RAND_bytes"); + return -1; + } #if OPENSSL_VERSION_NUMBER < 0x10000000L STACK_OF(SSL_COMP) * comp_methods = SSL_COMP_get_compression_methods();