Remove whitespace at end of canonicalized header lines
[citadel.git] / webcit / crypto.c
index 3d9b534692b3b667504b90c282361ac6a3922b1a..845113791c0175a9029941ed8793c214844587bf 100644 (file)
@@ -12,7 +12,7 @@
 #ifdef HAVE_OPENSSL
 
 #include "webcit.h"
-#include "webserver.h"
+
 
 
 SSL_CTX *ssl_ctx;              // Global SSL context
@@ -22,10 +22,6 @@ char *ssl_cipher_list = DEFAULT_SSL_CIPHER_LIST;
 
 pthread_key_t ThreadSSL;       // Per-thread SSL context
 
-void shutdown_ssl(void) {
-       ERR_free_strings();
-}
-
 
 // Set the private key and certificate chain for the global SSL Context.
 // This is called during initialization, and can be called again later if the certificate changes.
@@ -40,7 +36,7 @@ void bind_to_key_and_certificate(void) {
                snprintf(cert_file, sizeof key_file, "%s/keys/citadel.cer", ctdl_dir);
        }
 
-       if (!(new_ctx = SSL_CTX_new(TLS_server_method()))) {
+       if (!(new_ctx = SSL_CTX_new(SSLv23_server_method()))) {
                syslog(LOG_WARNING, "SSL_CTX_new failed: %s", ERR_reason_error_string(ERR_get_error()));
                return;
        }
@@ -70,9 +66,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();