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.

73 lines
2.3 KiB

  1. From fcbf18c92918ce5e81d0aab62a7aed5c2245ea4d Mon Sep 17 00:00:00 2001
  2. From: Eneas U de Queiroz <cote2004-github@yahoo.com>
  3. Date: Fri, 1 Jun 2018 11:17:28 -0300
  4. Subject: [PATCH 1/2] Add compatibility with openssl 1.1.0
  5. Minor adjustments were needed:
  6. * Openssl 1.1 libs do not need to be initialized.
  7. * TLSv*_method became TLS_*_method.
  8. Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
  9. ---
  10. clients/upsclient.c | 5 ++++-
  11. m4/nut_check_libopenssl.m4 | 2 +-
  12. server/netssl.c | 7 +++++--
  13. 3 files changed, 10 insertions(+), 4 deletions(-)
  14. diff --git a/clients/upsclient.c b/clients/upsclient.c
  15. index b90587b0..053d60fb 100644
  16. --- a/clients/upsclient.c
  17. +++ b/clients/upsclient.c
  18. @@ -316,10 +316,13 @@ int upscli_init(int certverify, const char *certpath,
  19. #ifdef WITH_OPENSSL
  20. +# if OPENSSL_VERSION_NUMBER < 0x10100000L
  21. SSL_library_init();
  22. SSL_load_error_strings();
  23. +# define TLS_client_method TLSv1_client_method
  24. +# endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
  25. - ssl_method = TLSv1_client_method();
  26. + ssl_method = TLS_client_method();
  27. if (!ssl_method) {
  28. return 0;
  29. diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4
  30. index 1b875077..7eb401cd 100644
  31. --- a/m4/nut_check_libopenssl.m4
  32. +++ b/m4/nut_check_libopenssl.m4
  33. @@ -58,7 +58,7 @@ if test -z "${nut_have_libopenssl_seen}"; then
  34. dnl check if openssl is usable
  35. AC_CHECK_HEADERS(openssl/ssl.h, [nut_have_openssl=yes], [nut_have_openssl=no], [AC_INCLUDES_DEFAULT])
  36. - AC_CHECK_FUNCS(SSL_library_init, [], [nut_have_openssl=no])
  37. + AC_CHECK_FUNCS(SSL_CTX_new, [], [nut_have_openssl=no])
  38. if test "${nut_have_openssl}" = "yes"; then
  39. nut_with_ssl="yes"
  40. diff --git a/server/netssl.c b/server/netssl.c
  41. index c2f40989..0289e296 100644
  42. --- a/server/netssl.c
  43. +++ b/server/netssl.c
  44. @@ -387,12 +387,15 @@ void ssl_init(void)
  45. #ifdef WITH_OPENSSL
  46. +# if OPENSSL_VERSION_NUMBER < 0x10100000L
  47. SSL_load_error_strings();
  48. SSL_library_init();
  49. +# define TLS_server_method TLSv1_server_method
  50. +# endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
  51. - if ((ssl_method = TLSv1_server_method()) == NULL) {
  52. + if ((ssl_method = TLS_server_method()) == NULL) {
  53. ssl_debug();
  54. - fatalx(EXIT_FAILURE, "TLSv1_server_method failed");
  55. + fatalx(EXIT_FAILURE, "TLS_server_method failed");
  56. }
  57. if ((ssl_ctx = SSL_CTX_new(ssl_method)) == NULL) {
  58. --
  59. 2.16.1