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.

117 lines
3.4 KiB

  1. --- a/src/main/threads.c
  2. +++ b/src/main/threads.c
  3. @@ -298,6 +298,7 @@ static void ssl_locking_function(int mod
  4. */
  5. int tls_mutexes_init(void)
  6. {
  7. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  8. int i;
  9. ssl_mutexes = rad_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
  10. @@ -316,6 +317,7 @@ int tls_mutexes_init(void)
  11. #ifdef HAVE_CRYPTO_SET_LOCKING_CALLBACK
  12. CRYPTO_set_locking_callback(ssl_locking_function);
  13. #endif
  14. +#endif
  15. return 0;
  16. }
  17. --- a/src/main/tls.c
  18. +++ b/src/main/tls.c
  19. @@ -55,6 +55,7 @@ USES_APPLE_DEPRECATED_API /* OpenSSL API
  20. # include <openssl/evp.h>
  21. # endif
  22. # include <openssl/ssl.h>
  23. +# include <openssl/dh.h>
  24. #define LOG_PREFIX "tls"
  25. @@ -2133,7 +2134,7 @@ int cbtls_verify(int ok, X509_STORE_CTX
  26. int my_ok = ok;
  27. ASN1_INTEGER *sn = NULL;
  28. - ASN1_TIME *asn_time = NULL;
  29. + const ASN1_TIME *asn_time = NULL;
  30. VALUE_PAIR **certs;
  31. char **identity;
  32. #ifdef HAVE_OPENSSL_OCSP_H
  33. @@ -2207,7 +2208,7 @@ int cbtls_verify(int ok, X509_STORE_CTX
  34. * Get the Expiration Date
  35. */
  36. buf[0] = '\0';
  37. - asn_time = X509_get_notAfter(client_cert);
  38. + asn_time = X509_get0_notAfter(client_cert);
  39. if (certs && (lookup <= 1) && asn_time &&
  40. (asn_time->length < (int) sizeof(buf))) {
  41. memcpy(buf, (char*) asn_time->data, asn_time->length);
  42. @@ -2220,7 +2221,7 @@ int cbtls_verify(int ok, X509_STORE_CTX
  43. * Get the Valid Since Date
  44. */
  45. buf[0] = '\0';
  46. - asn_time = X509_get_notBefore(client_cert);
  47. + asn_time = X509_get0_notBefore(client_cert);
  48. if (certs && (lookup <= 1) && asn_time &&
  49. (asn_time->length < (int) sizeof(buf))) {
  50. memcpy(buf, (char*) asn_time->data, asn_time->length);
  51. @@ -2690,10 +2691,12 @@ static int set_ecdh_curve(SSL_CTX *ctx,
  52. */
  53. int tls_global_init(bool spawn_flag, bool check)
  54. {
  55. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  56. SSL_load_error_strings(); /* readable error messages (examples show call before library_init) */
  57. SSL_library_init(); /* initialize library */
  58. OpenSSL_add_all_algorithms(); /* required for SHA2 in OpenSSL < 0.9.8o and 1.0.0.a */
  59. CONF_modules_load_file(NULL, NULL, 0);
  60. +#endif
  61. /*
  62. * Initialize the index for the certificates.
  63. @@ -2769,6 +2772,7 @@ int tls_global_version_check(char const
  64. */
  65. void tls_global_cleanup(void)
  66. {
  67. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  68. #if OPENSSL_VERSION_NUMBER < 0x10000000L
  69. ERR_remove_state(0);
  70. #elif OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  71. @@ -2781,6 +2785,7 @@ void tls_global_cleanup(void)
  72. ERR_free_strings();
  73. EVP_cleanup();
  74. CRYPTO_cleanup_all_ex_data();
  75. +#endif
  76. }
  77. --- a/src/main/version.c
  78. +++ b/src/main/version.c
  79. @@ -54,7 +54,7 @@ int ssl_check_consistency(void)
  80. {
  81. long ssl_linked;
  82. - ssl_linked = SSLeay();
  83. + ssl_linked = OpenSSL_version_num();
  84. /*
  85. * Major and minor versions mismatch, that's bad.
  86. @@ -152,7 +152,7 @@ char const *ssl_version_num(void)
  87. {
  88. long ssl_linked;
  89. - ssl_linked = SSLeay();
  90. + ssl_linked = OpenSSL_version_num();
  91. return ssl_version_by_num((uint32_t)ssl_linked);
  92. }
  93. @@ -188,10 +188,10 @@ char const *ssl_version(void)
  94. {
  95. static char buffer[256];
  96. - uint32_t v = SSLeay();
  97. + uint32_t v = OpenSSL_version_num();
  98. snprintf(buffer, sizeof(buffer), "%s 0x%.8x (%s)",
  99. - SSLeay_version(SSLEAY_VERSION), /* Not all builds include a useful version number */
  100. + OpenSSL_version(OPENSSL_VERSION), /* Not all builds include a useful version number */
  101. v,
  102. ssl_version_by_num(v));