diff --git a/src/server/main.cc b/src/server/main.cc index 0d5ef6a..95a43e6 100644 --- a/src/server/main.cc +++ b/src/server/main.cc @@ -1,7 +1,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -33,8 +35,19 @@ string getCtxError() { int main() { - SSL_library_init(); - SSL_load_error_strings(); + // Inistialize the SSL library + if (OpenSSL_version_num() < 0x10100000L) { + // Old version, deprecated as of version 1.1.0 + SSL_library_init(); + + // Loads human readable error strings + // Automatically inistialized in newer versions + SSL_load_error_strings(); + } else { + // New version + // Initalizes both SSl and crypto and is generally better + OPENSSL_init_ssl(0, nullptr); + } SSL_CTX *ctx = SSL_CTX_new(TLS_server_method()); if (!ctx) {