You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.0 KiB

  1. From 460c060dda115bc8066bb4b955453c673459b6cc Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Sun, 9 Jun 2019 23:36:53 -0700
  4. Subject: [PATCH] Fix compilation without deprecated OpenSSL 1.1 APIs
  5. Initialization and deinitialization is deprecated.
  6. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  7. ---
  8. library.c | 4 ++++
  9. openssl.c | 2 ++
  10. tests/bad_dtls_test.c | 4 ++++
  11. 3 files changed, 10 insertions(+)
  12. diff --git a/library.c b/library.c
  13. index 0e3d05e6..e45e93a2 100644
  14. --- a/library.c
  15. +++ b/library.c
  16. @@ -38,6 +38,10 @@
  17. #include "gnutls.h"
  18. #endif
  19. +#if defined(OPENCONNECT_OPENSSL)
  20. +#include <openssl/bio.h>
  21. +#endif
  22. +
  23. struct openconnect_info *openconnect_vpninfo_new(const char *useragent,
  24. openconnect_validate_peer_cert_vfn validate_peer_cert,
  25. openconnect_write_new_config_vfn write_new_config,
  26. diff --git a/openssl.c b/openssl.c
  27. index 2b1f07bd..e505f49a 100644
  28. --- a/openssl.c
  29. +++ b/openssl.c
  30. @@ -1879,10 +1879,12 @@ int openconnect_init_ssl(void)
  31. if (ret)
  32. return ret;
  33. #endif
  34. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  35. SSL_library_init();
  36. ERR_clear_error();
  37. SSL_load_error_strings();
  38. OpenSSL_add_all_algorithms();
  39. +#endif
  40. return 0;
  41. }
  42. diff --git a/tests/bad_dtls_test.c b/tests/bad_dtls_test.c
  43. index ac8d3f1e..c123c8f8 100644
  44. --- a/tests/bad_dtls_test.c
  45. +++ b/tests/bad_dtls_test.c
  46. @@ -752,8 +752,10 @@ int main(int argc, char *argv[])
  47. int ret;
  48. int i;
  49. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  50. SSL_library_init();
  51. SSL_load_error_strings();
  52. +#endif
  53. RAND_bytes(session_id, sizeof(session_id));
  54. RAND_bytes(master_secret, sizeof(master_secret));
  55. @@ -910,8 +912,10 @@ int main(int argc, char *argv[])
  56. printf("Cisco BadDTLS test: FAILED\n");
  57. }
  58. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  59. ERR_free_strings();
  60. EVP_cleanup();
  61. +#endif
  62. return testresult?0:1;
  63. }
  64. --
  65. 2.17.1