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.

71 lines
1.9 KiB

  1. From d81a18d87d15bbf54ddbd675bfa829cf7dfdce9e Mon Sep 17 00:00:00 2001
  2. From: Edoardo Spadolini <kerio00@gmail.com>
  3. Date: Mon, 8 Feb 2016 14:01:51 +0100
  4. Subject: [PATCH] Add some #ifdef feature checks to fix compilation with
  5. BoringSSL
  6. ---
  7. Csocket.cc | 12 ++++++++++++
  8. 1 file changed, 12 insertions(+)
  9. --- a/src/Csocket.cpp
  10. +++ b/src/Csocket.cpp
  11. @@ -45,9 +45,12 @@
  12. #ifdef HAVE_LIBSSL
  13. #include <stdio.h>
  14. +#include <openssl/ssl.h>
  15. #include <openssl/conf.h>
  16. #include <openssl/engine.h>
  17. +#ifndef OPENSSL_NO_COMP
  18. #include <openssl/comp.h>
  19. +#endif
  20. #endif /* HAVE_LIBSSL */
  21. #ifdef HAVE_ICU
  22. @@ -531,8 +534,12 @@ void ShutdownCsocket()
  23. {
  24. #ifdef HAVE_LIBSSL
  25. ERR_remove_state( 0 );
  26. +#ifndef OPENSSL_NO_ENGINE
  27. ENGINE_cleanup();
  28. +#endif
  29. +#ifndef OPENSSL_IS_BORINGSSL
  30. CONF_modules_unload( 1 );
  31. +#endif
  32. ERR_free_strings();
  33. EVP_cleanup();
  34. CRYPTO_cleanup_all_ex_data();
  35. @@ -573,6 +580,7 @@ bool InitSSL( ECompType eCompressionType
  36. }
  37. #endif /* _WIN32 */
  38. +#ifndef OPENSSL_NO_COMP
  39. COMP_METHOD *cm = NULL;
  40. if( CT_ZLIB & eCompressionType )
  41. @@ -588,6 +596,7 @@ bool InitSSL( ECompType eCompressionType
  42. if( cm )
  43. SSL_COMP_add_compression_method( CT_RLE, cm );
  44. }
  45. +#endif
  46. // setting this up once in the begining
  47. s_iCsockSSLIdx = SSL_get_ex_new_index( 0, NULL, NULL, NULL, NULL );
  48. @@ -1724,6 +1733,8 @@ SSL_CTX * Csock::SetupServerCTX()
  49. #ifndef OPENSSL_NO_ECDH
  50. // Errors for the following block are non-fatal (ECDHE is nice to have
  51. // but not a requirement)
  52. +#ifndef OPENSSL_IS_BORINGSSL
  53. + // BoringSSL does this thing automatically
  54. #if defined( SSL_CTX_set_ecdh_auto )
  55. // Auto-select sensible curve
  56. if( !SSL_CTX_set_ecdh_auto( pCTX , 1 ) )
  57. @@ -1742,6 +1753,7 @@ SSL_CTX * Csock::SetupServerCTX()
  58. ERR_clear_error();
  59. }
  60. #endif /* SSL_CTX_set_tmp_ecdh */
  61. +#endif /* !OPENSSL_IS_BORINGSSL */
  62. #endif /* OPENSSL_NO_ECDH */
  63. if( !ConfigureCTXOptions( pCTX ) )