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.

66 lines
1.7 KiB

  1. From 0ea55455703eb69d7617968424e4bede59f39b83 Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Fri, 23 Nov 2018 18:03:32 -0800
  4. Subject: [PATCH] ssl: Fix compile without Deprecated APIs and no ECC support
  5. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  6. ---
  7. ssl.c | 11 +++++++++++
  8. 1 file changed, 11 insertions(+)
  9. diff --git a/ssl.c b/ssl.c
  10. index c362983..845f77b 100644
  11. --- a/ssl.c
  12. +++ b/ssl.c
  13. @@ -28,6 +28,9 @@
  14. #include <openssl/err.h>
  15. #include <openssl/rand.h>
  16. #include <openssl/bio.h>
  17. +#ifndef OPENSSL_NO_EC
  18. +#include <openssl/ec.h>
  19. +#endif
  20. #include <errno.h>
  21. #include <limits.h>
  22. @@ -59,8 +62,12 @@ ssl_init(struct vsf_session* p_sess)
  23. SSL_CTX* p_ctx;
  24. long options;
  25. int verify_option = 0;
  26. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  27. SSL_library_init();
  28. p_ctx = SSL_CTX_new(SSLv23_server_method());
  29. +#else
  30. + p_ctx = SSL_CTX_new(TLS_server_method());
  31. +#endif
  32. if (p_ctx == NULL)
  33. {
  34. die("SSL: could not allocate SSL context");
  35. @@ -120,6 +127,7 @@ ssl_init(struct vsf_session* p_sess)
  36. {
  37. die("SSL: RNG is not seeded");
  38. }
  39. +#ifndef OPENSSL_NO_EC
  40. {
  41. EC_KEY* key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
  42. if (key == NULL)
  43. @@ -129,6 +137,7 @@ ssl_init(struct vsf_session* p_sess)
  44. SSL_CTX_set_tmp_ecdh(p_ctx, key);
  45. EC_KEY_free(key);
  46. }
  47. +#endif
  48. if (tunable_ssl_request_cert)
  49. {
  50. verify_option |= SSL_VERIFY_PEER;
  51. @@ -660,7 +669,9 @@ ssl_cert_digest(SSL* p_ssl, struct vsf_session* p_sess, struct mystr* p_str)
  52. static char*
  53. get_ssl_error()
  54. {
  55. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  56. SSL_load_error_strings();
  57. +#endif
  58. return ERR_error_string(ERR_get_error(), NULL);
  59. }
  60. --
  61. 2.19.1