diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2017-01-25 18:06:42 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2017-01-25 18:12:18 +0100 |
commit | 66f1a6afa363c5495c38548298f2aeb87014b3cc (patch) | |
tree | ea6c18f3642f200d407721300f46151fd6a29613 | |
parent | 72a7cbdb1f5017475a331af3bba5169e56cc6a79 (diff) | |
download | json-rpc-shell-66f1a6afa363c5495c38548298f2aeb87014b3cc.tar.gz json-rpc-shell-66f1a6afa363c5495c38548298f2aeb87014b3cc.tar.xz json-rpc-shell-66f1a6afa363c5495c38548298f2aeb87014b3cc.zip |
Fix OpenSSL 1.1 compatibility
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | json-rpc-shell.c | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 52b691d..465d8b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,8 @@ set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) find_package (Curses) find_package (PkgConfig REQUIRED) pkg_check_modules (dependencies REQUIRED libcurl jansson) +# Note that cURL can link to a different version of libssl than we do, +# in which case the results are undefined pkg_check_modules (libssl REQUIRED libssl libcrypto) find_package (LibEV REQUIRED) pkg_check_modules (ncursesw ncursesw) diff --git a/json-rpc-shell.c b/json-rpc-shell.c index 8b6da1b..cf6523b 100644 --- a/json-rpc-shell.c +++ b/json-rpc-shell.c @@ -2241,10 +2241,15 @@ backend_ws_new (struct app_context *ctx, self->endpoint = xstrdup (endpoint); self->url = *url; +#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER SSL_library_init (); atexit (EVP_cleanup); SSL_load_error_strings (); atexit (ERR_free_strings); +#else + // Cleanup is done automatically via atexit() + OPENSSL_init_ssl (0, NULL); +#endif return &self->super; } |