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.

118 lines
3.5 KiB

  1. --- a/configure.ac
  2. +++ b/configure.ac
  3. @@ -368,8 +368,9 @@ if test "x$SSL" != "xno"; then
  4. AC_LINK_IFELSE([
  5. AC_LANG_PROGRAM([[
  6. #include <openssl/ssl.h>
  7. + #include <openssl/dh.h>
  8. ]], [[
  9. - SSL_CTX* ctx = SSL_CTX_new(TLSv1_method());
  10. + SSL_CTX* ctx = SSL_CTX_new(SSLv23_method());
  11. SSL* ssl = SSL_new(ctx);
  12. DH* dh = DH_new();
  13. DH_free(dh);
  14. --- a/include/znc/Utils.h
  15. +++ b/include/znc/Utils.h
  16. @@ -219,6 +219,11 @@ class CTable : protected std::vector<std::vector<CString>> {
  17. #include <openssl/aes.h>
  18. #include <openssl/blowfish.h>
  19. #include <openssl/md5.h>
  20. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  21. +#define X509_getm_notBefore X509_get_notBefore
  22. +#define X509_getm_notAfter X509_get_notAfter
  23. +#endif
  24. +
  25. //! does Blowfish w/64 bit feedback, no padding
  26. class CBlowfish {
  27. public:
  28. --- a/src/Utils.cpp
  29. +++ b/src/Utils.cpp
  30. @@ -27,6 +27,8 @@
  31. #include <znc/Message.h>
  32. #ifdef HAVE_LIBSSL
  33. #include <openssl/ssl.h>
  34. +#include <openssl/bn.h>
  35. +#include <openssl/rsa.h>
  36. #endif /* HAVE_LIBSSL */
  37. #include <memory>
  38. #include <unistd.h>
  39. @@ -93,8 +95,8 @@ void CUtils::GenerateCert(FILE* pOut, const CString& sHost) {
  40. X509_set_version(pCert.get(), 2);
  41. ASN1_INTEGER_set(X509_get_serialNumber(pCert.get()), serial);
  42. - X509_gmtime_adj(X509_get_notBefore(pCert.get()), 0);
  43. - X509_gmtime_adj(X509_get_notAfter(pCert.get()),
  44. + X509_gmtime_adj(X509_getm_notBefore(pCert.get()), 0);
  45. + X509_gmtime_adj(X509_getm_notAfter(pCert.get()),
  46. (long)60 * 60 * 24 * days * years);
  47. X509_set_pubkey(pCert.get(), pKey.get());
  48. --- a/src/main.cpp
  49. +++ b/src/main.cpp
  50. @@ -46,8 +46,8 @@ static void locking_callback(int mode, int type, const char* file, int line) {
  51. }
  52. }
  53. -static unsigned long thread_id_callback() {
  54. - return (unsigned long)pthread_self();
  55. +static void thread_id_callback(CRYPTO_THREADID *id) {
  56. + CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self());
  57. }
  58. static CRYPTO_dynlock_value* dyn_create_callback(const char* file, int line) {
  59. @@ -78,7 +78,7 @@ static void thread_setup() {
  60. for (std::unique_ptr<CMutex>& mtx : lock_cs)
  61. mtx = std::unique_ptr<CMutex>(new CMutex());
  62. - CRYPTO_set_id_callback(&thread_id_callback);
  63. + CRYPTO_THREADID_set_callback(&thread_id_callback);
  64. CRYPTO_set_locking_callback(&locking_callback);
  65. CRYPTO_set_dynlock_create_callback(&dyn_create_callback);
  66. --- a/third_party/Csocket/Csocket.cc
  67. +++ b/third_party/Csocket/Csocket.cc
  68. @@ -47,10 +47,16 @@
  69. #include <stdio.h>
  70. #include <openssl/ssl.h>
  71. #include <openssl/conf.h>
  72. -#include <openssl/engine.h>
  73. +#include <openssl/bn.h>
  74. +#include <openssl/dh.h>
  75. +#include <openssl/dsa.h>
  76. +#include <openssl/rsa.h>
  77. #ifndef OPENSSL_NO_COMP
  78. #include <openssl/comp.h>
  79. #endif
  80. +#ifndef OPENSSL_NO_ENGINE
  81. +#include <openssl/engine.h>
  82. +#endif
  83. #define HAVE_ERR_REMOVE_STATE
  84. #ifdef OPENSSL_VERSION_NUMBER
  85. # if OPENSSL_VERSION_NUMBER >= 0x10000000
  86. @@ -594,9 +600,11 @@ void ShutdownCsocket()
  87. #ifndef OPENSSL_IS_BORINGSSL
  88. CONF_modules_unload( 1 );
  89. #endif
  90. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  91. ERR_free_strings();
  92. EVP_cleanup();
  93. CRYPTO_cleanup_all_ex_data();
  94. +#endif
  95. #endif /* HAVE_LIBSSL */
  96. #ifdef HAVE_C_ARES
  97. #if ARES_VERSION >= CREATE_ARES_VER( 1, 6, 1 )
  98. @@ -611,12 +619,14 @@ void ShutdownCsocket()
  99. #ifdef HAVE_LIBSSL
  100. bool InitSSL( ECompType eCompressionType )
  101. {
  102. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  103. SSL_load_error_strings();
  104. if( SSL_library_init() != 1 )
  105. {
  106. CS_DEBUG( "SSL_library_init() failed!" );
  107. return( false );
  108. }
  109. +#endif
  110. #ifndef _WIN32
  111. if( access( "/dev/urandom", R_OK ) == 0 )