]> code.citadel.org Git - citadel.git/blobdiff - webcit-ng/tls.c
Unified the openssl library initialization code
[citadel.git] / webcit-ng / tls.c
index 1f3011d5eb0e0e7d8e5e434514c6eb14baacecba..4a939a90084e35ea93dcea248fdd911f5bdb8460 100644 (file)
@@ -26,7 +26,7 @@ char *ssl_cipher_list = DEFAULT_SSL_CIPHER_LIST;
 void bind_to_key_and_certificate(void) {
        SSL_CTX *old_ctx, *new_ctx;
 
-       if (!(new_ctx = SSL_CTX_new(SSLv23_server_method()))) {
+       if (!(new_ctx = SSL_CTX_new(TLS_server_method()))) {
                syslog(LOG_WARNING, "SSL_CTX_new failed: %s", ERR_reason_error_string(ERR_get_error()));
                return;
        }
@@ -63,9 +63,11 @@ void bind_to_key_and_certificate(void) {
 // Initialize ssl engine, load certs and initialize openssl internals
 void init_ssl(void) {
 
-       // Initialize SSL transport layer
-       SSL_library_init();
+       // Initialize the OpenSSL library
        SSL_load_error_strings();
+       ERR_load_crypto_strings();
+       OpenSSL_add_all_algorithms();
+       SSL_library_init();
 
        // Now try to bind to the key and certificate.
        bind_to_key_and_certificate();