|
|
- From 460c060dda115bc8066bb4b955453c673459b6cc Mon Sep 17 00:00:00 2001
- From: Rosen Penev <rosenp@gmail.com>
- Date: Sun, 9 Jun 2019 23:36:53 -0700
- Subject: [PATCH] Fix compilation without deprecated OpenSSL 1.1 APIs
-
- Initialization and deinitialization is deprecated.
-
- Signed-off-by: Rosen Penev <rosenp@gmail.com>
- ---
- library.c | 4 ++++
- openssl.c | 2 ++
- tests/bad_dtls_test.c | 4 ++++
- 3 files changed, 10 insertions(+)
-
- diff --git a/library.c b/library.c
- index 0e3d05e6..e45e93a2 100644
- --- a/library.c
- +++ b/library.c
- @@ -38,6 +38,10 @@
- #include "gnutls.h"
- #endif
-
- +#if defined(OPENCONNECT_OPENSSL)
- +#include <openssl/bio.h>
- +#endif
- +
- struct openconnect_info *openconnect_vpninfo_new(const char *useragent,
- openconnect_validate_peer_cert_vfn validate_peer_cert,
- openconnect_write_new_config_vfn write_new_config,
- diff --git a/openssl.c b/openssl.c
- index 2b1f07bd..e505f49a 100644
- --- a/openssl.c
- +++ b/openssl.c
- @@ -1879,10 +1879,12 @@ int openconnect_init_ssl(void)
- if (ret)
- return ret;
- #endif
- +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- SSL_library_init();
- ERR_clear_error();
- SSL_load_error_strings();
- OpenSSL_add_all_algorithms();
- +#endif
- return 0;
- }
-
- diff --git a/tests/bad_dtls_test.c b/tests/bad_dtls_test.c
- index ac8d3f1e..c123c8f8 100644
- --- a/tests/bad_dtls_test.c
- +++ b/tests/bad_dtls_test.c
- @@ -752,8 +752,10 @@ int main(int argc, char *argv[])
- int ret;
- int i;
-
- +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- SSL_library_init();
- SSL_load_error_strings();
- +#endif
-
- RAND_bytes(session_id, sizeof(session_id));
- RAND_bytes(master_secret, sizeof(master_secret));
- @@ -910,8 +912,10 @@ int main(int argc, char *argv[])
- printf("Cisco BadDTLS test: FAILED\n");
- }
-
- +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- ERR_free_strings();
- EVP_cleanup();
- +#endif
-
- return testresult?0:1;
- }
- --
- 2.17.1
-
|