0003-libshout-tls-compile-with-OpenSSL-1.1.0.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 01fafc449f0de56743d08e7976933c49e2915bfa Mon Sep 17 00:00:00 2001
  2. From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
  3. Date: Wed, 15 Nov 2017 12:46:25 +0000
  4. Subject: [PATCH] tls: compile with OpenSSL 1.1.0
  5. The init functions are not longer required in OpenSSL 1.1 so I dropped
  6. them.
  7. TLSv1_client_method() should not be used because it enables only the
  8. TLSv1.0 protocol. Better is to use SSLv23_client_method() which enable
  9. all the protocols including TLSv1.2. With this functions SSLv2 and SSLv3
  10. is theoretically possible but as of today those protocols are usually
  11. build-time disabled.
  12. To avoid all this OpenSSL 1.1 provides TLS_client_method() which is aim
  13. to provide to highest TLS protocol version (same as
  14. SSLv23_client_method() but it is deprecated in 1.1).
  15. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
  16. Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
  17. ---
  18. src/tls.c | 12 ++++++++----
  19. 1 file changed, 8 insertions(+), 4 deletions(-)
  20. diff --git a/src/tls.c b/src/tls.c
  21. index 4562c7327077..e0e5c1a5f079 100644
  22. --- a/src/tls.c
  23. +++ b/src/tls.c
  24. @@ -24,6 +24,7 @@
  25. #endif
  26. #include <shout/shout.h>
  27. +#include <string.h>
  28. #include "shout_private.h"
  29. #ifndef XXX_HAVE_X509_check_host
  30. @@ -61,14 +62,17 @@ shout_tls_t *shout_tls_new(shout_t *self, sock_t socket)
  31. static inline int tls_setup(shout_tls_t *tls)
  32. {
  33. - SSL_METHOD *meth;
  34. -
  35. + const SSL_METHOD *meth;
  36. +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
  37. SSL_library_init();
  38. SSL_load_error_strings();
  39. SSLeay_add_all_algorithms();
  40. - SSLeay_add_ssl_algorithms();
  41. + SSLeay_add_ssl_algorithms();
  42. - meth = TLSv1_client_method();
  43. + meth = SSLv23_client_method();
  44. +#else
  45. + meth = TLS_client_method();
  46. +#endif
  47. if (!meth)
  48. goto error;
  49. --
  50. 2.15.0