#ifdef HAVE_LIBSSL
#include <openssl/err.h>
#include <openssl/rand.h>
+#include <openssl/dh.h>
static SSL_CTX * ssl_ctx;
static DH *dh_params;
#ifdef HAVE_LIBSSL
SSL_CTX *newctx;
+#if OPENSSL_API_COMPAT < 0x10100000L
if (!ssl_ctx) {
SSL_library_init();
SSL_load_error_strings();
}
+#endif
if (!RAND_status()) {
Log(LOG_ERR, "OpenSSL PRNG not seeded: /dev/urandom missing?");
return false;
}
- if (!ConnSSL_LoadServerKey_openssl(newctx))
+ if (!ConnSSL_LoadServerKey_openssl(newctx)) {
+ /* Failed to read new key but an old ssl context
+ * already exists -> reuse old context */
+ if (ssl_ctx) {
+ SSL_CTX_free(newctx);
+ Log(LOG_WARNING,
+ "Re-Initializing of SSL failed, using old keys!");
+ return true;
+ }
+ /* No preexisting old context -> error. */
goto out;
+ }
if (SSL_CTX_set_cipher_list(newctx, Conf_SSLOptions.CipherList) == 0) {
Log(LOG_ERR, "Failed to apply OpenSSL cipher list \"%s\"!",
Verify_openssl);
SSL_CTX_free(ssl_ctx);
ssl_ctx = newctx;
- Log(LOG_INFO, "%s initialized.", SSLeay_version(SSLEAY_VERSION));
+ Log(LOG_INFO, "%s initialized.", OpenSSL_version(OPENSSL_VERSION));
return true;
out:
SSL_CTX_free(newctx);
gnutls_x509_crt_deinit(cert);
return 0;
}
-
+
if (gnutls_x509_crt_import(cert, &cert_list[0],
GNUTLS_X509_FMT_DER) != GNUTLS_E_SUCCESS) {
gnutls_x509_crt_deinit(cert);
#endif /* SSL_SUPPORT */
/* -eof- */
-
-