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.

48 lines
1.5 KiB

  1. From 214736dce643ce3ee257da017373e88cc19d2d3b Mon Sep 17 00:00:00 2001
  2. From: Frediano Ziglio <fziglio@redhat.com>
  3. Date: Thu, 20 Jun 2019 13:26:11 +0100
  4. Subject: [PATCH] reds: Fix SSL_CTX_set_ecdh_auto call for some old OpenSSL
  5. SSL_CTX_set_ecdh_auto is not defined in some old versions of OpenSSL
  6. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
  7. Acked-by: Jeremy White <jwhite@codeweavers.com>
  8. ---
  9. configure.ac | 9 +++++++++
  10. server/reds.c | 2 ++
  11. 2 files changed, 11 insertions(+)
  12. diff --git a/configure.ac b/configure.ac
  13. index e12d7e85..49c009d4 100644
  14. --- a/configure.ac
  15. +++ b/configure.ac
  16. @@ -209,6 +209,15 @@ AC_SUBST(SSL_CFLAGS)
  17. AC_SUBST(SSL_LIBS)
  18. AS_VAR_APPEND([SPICE_REQUIRES], [" openssl"])
  19. +save_CFLAGS="$CFLAGS"
  20. +CFLAGS="$CFLAGS $SSL_CFLAGS"
  21. +AC_CHECK_DECLS([SSL_CTX_set_ecdh_auto], [], [], [
  22. +AC_INCLUDES_DEFAULT
  23. +#include <openssl/err.h>
  24. +#include <openssl/ssl.h>
  25. +])
  26. +CFLAGS="$save_CFLAGS"
  27. +
  28. AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
  29. AC_MSG_CHECKING([for jpeglib.h])
  30. AC_TRY_CPP(
  31. diff --git a/server/reds.c b/server/reds.c
  32. index 792e9838..b4061fbc 100644
  33. --- a/server/reds.c
  34. +++ b/server/reds.c
  35. @@ -2937,7 +2937,9 @@ static int reds_init_ssl(RedsState *reds)
  36. }
  37. SSL_CTX_set_options(reds->ctx, ssl_options);
  38. +#if HAVE_DECL_SSL_CTX_SET_ECDH_AUTO || defined(SSL_CTX_set_ecdh_auto)
  39. SSL_CTX_set_ecdh_auto(reds->ctx, 1);
  40. +#endif
  41. /* Load our keys and certificates*/
  42. return_code = SSL_CTX_use_certificate_chain_file(reds->ctx, reds->config->ssl_parameters.certs_file);