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.

61 lines
1.6 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. --- a/ssl.c
  10. +++ b/ssl.c
  11. @@ -28,6 +28,9 @@
  12. #include <openssl/err.h>
  13. #include <openssl/rand.h>
  14. #include <openssl/bio.h>
  15. +#ifndef OPENSSL_NO_EC
  16. +#include <openssl/ec.h>
  17. +#endif
  18. #include <errno.h>
  19. #include <limits.h>
  20. @@ -59,8 +62,12 @@ ssl_init(struct vsf_session* p_sess)
  21. SSL_CTX* p_ctx;
  22. long options;
  23. int verify_option = 0;
  24. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  25. SSL_library_init();
  26. p_ctx = SSL_CTX_new(SSLv23_server_method());
  27. +#else
  28. + p_ctx = SSL_CTX_new(TLS_server_method());
  29. +#endif
  30. if (p_ctx == NULL)
  31. {
  32. die("SSL: could not allocate SSL context");
  33. @@ -120,6 +127,7 @@ ssl_init(struct vsf_session* p_sess)
  34. {
  35. die("SSL: RNG is not seeded");
  36. }
  37. +#ifndef OPENSSL_NO_EC
  38. {
  39. EC_KEY* key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
  40. if (key == NULL)
  41. @@ -129,6 +137,7 @@ ssl_init(struct vsf_session* p_sess)
  42. SSL_CTX_set_tmp_ecdh(p_ctx, key);
  43. EC_KEY_free(key);
  44. }
  45. +#endif
  46. if (tunable_ssl_request_cert)
  47. {
  48. verify_option |= SSL_VERIFY_PEER;
  49. @@ -660,7 +669,9 @@ ssl_cert_digest(SSL* p_ssl, struct vsf_s
  50. static char*
  51. get_ssl_error()
  52. {
  53. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  54. SSL_load_error_strings();
  55. +#endif
  56. return ERR_error_string(ERR_get_error(), NULL);
  57. }