0004-src-ssl-openssl-add-libressl-compatibility.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 87c44b4ebc64c15f6324ed40852224b61fbe77a7 Mon Sep 17 00:00:00 2001
  2. From: Matt Weber <matthew.weber@rockwellcollins.com>
  3. Date: Tue, 5 Feb 2019 06:10:16 -0600
  4. Subject: [PATCH] src/ssl/openssl: add libressl compatibility
  5. Similar to https://github.com/FreeRDP/FreeRDP/issues/5049
  6. libressl has `#define OPENSSL_VERSION_NUMBER ` defined the same as
  7. openssl 1.1.x which results in SSL_CTX_set_security_level() getting used.
  8. This patch prevents SSL_CTX_set_security_level() from being used with
  9. libressl.
  10. Upstream: https://github.com/apache/qpid-proton/pull/175
  11. Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
  12. ---
  13. c/src/ssl/openssl.c | 6 +++---
  14. 1 file changed, 3 insertions(+), 3 deletions(-)
  15. diff --git a/proton-c/src/ssl/openssl.c b/proton-c/src/ssl/openssl.c
  16. index c2b5869..541d0ae 100644
  17. --- a/proton-c/src/ssl/openssl.c
  18. +++ b/proton-c/src/ssl/openssl.c
  19. @@ -522,7 +522,7 @@ pn_ssl_domain_t *pn_ssl_domain( pn_ssl_mode_t mode )
  20. // Mitigate the CRIME vulnerability
  21. SSL_CTX_set_options(domain->ctx, SSL_OP_NO_COMPRESSION);
  22. #endif
  23. -#if OPENSSL_VERSION_NUMBER >= 0x10100000
  24. +#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
  25. domain->default_seclevel = SSL_CTX_get_security_level(domain->ctx);
  26. #endif
  27. @@ -709,7 +709,7 @@ int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
  28. case PN_SSL_VERIFY_PEER:
  29. case PN_SSL_VERIFY_PEER_NAME:
  30. -#if OPENSSL_VERSION_NUMBER >= 0x10100000
  31. +#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
  32. SSL_CTX_set_security_level(domain->ctx, domain->default_seclevel);
  33. #endif
  34. @@ -749,7 +749,7 @@ int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
  35. break;
  36. case PN_SSL_ANONYMOUS_PEER: // hippie free love mode... :)
  37. -#if OPENSSL_VERSION_NUMBER >= 0x10100000
  38. +#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)
  39. // Must use lowest OpenSSL security level to enable anonymous ciphers.
  40. SSL_CTX_set_security_level(domain->ctx, 0);
  41. #endif
  42. --
  43. 1.9.1