0001-support-openssl-1.1.x.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From 7db6d8a657d13bb562a27c6181accaf3e53c0efd Mon Sep 17 00:00:00 2001
  2. From: Hongxu Jia <hongxu.jia@windriver.com>
  3. Date: Tue, 25 Sep 2018 14:03:10 +0800
  4. Subject: [PATCH] support openssl 1.1.x
  5. Long time no maintain from upstream since 2013-06-04
  6. (https://sourceforge.net/projects/nail/), backport a
  7. fix from openSUSE
  8. Upstream-Status: Backport [openSUSE]
  9. https://build.opensuse.org/package/view_file/openSUSE:Leap:15.0/mailx/mailx-12.5-openssl-1.1.0f.patch?expand=1
  10. Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
  11. ---
  12. openssl.c | 25 ++++++++++++++++++++++++-
  13. 1 file changed, 24 insertions(+), 1 deletion(-)
  14. diff --git a/openssl.c b/openssl.c
  15. index 44fe4e5..0ccc517 100644
  16. --- a/openssl.c
  17. +++ b/openssl.c
  18. @@ -137,7 +137,12 @@ ssl_rand_init(void)
  19. if ((cp = value("ssl-rand-egd")) != NULL) {
  20. cp = expand(cp);
  21. - if (RAND_egd(cp) == -1) {
  22. +#ifndef OPENSSL_NO_EGD
  23. + if (RAND_egd(cp) == -1)
  24. +#else
  25. + if (1)
  26. +#endif
  27. + {
  28. fprintf(stderr, catgets(catd, CATSET, 245,
  29. "entropy daemon at \"%s\" not available\n"),
  30. cp);
  31. @@ -216,6 +221,7 @@ ssl_select_method(const char *uhp)
  32. cp = ssl_method_string(uhp);
  33. if (cp != NULL) {
  34. +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010006fL
  35. if (equal(cp, "ssl3"))
  36. method = SSLv3_client_method();
  37. else if (equal(cp, "tls1"))
  38. @@ -225,8 +231,25 @@ ssl_select_method(const char *uhp)
  39. "Invalid SSL method \"%s\"\n"), cp);
  40. method = SSLv23_client_method();
  41. }
  42. +#else
  43. + method = NULL;
  44. + if (equal(cp, "tls"))
  45. + method = TLS_client_method();
  46. + else if (equal(cp, "dtls"))
  47. + method = DTLS_client_method();
  48. +
  49. + if (!method) {
  50. + fprintf(stderr, catgets(catd, CATSET, 244,
  51. + "Invalid SSL method \"%s\"\n"), cp);
  52. + method = TLS_client_method();
  53. + }
  54. +#endif
  55. } else
  56. +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010006fL
  57. method = SSLv23_client_method();
  58. +#else
  59. + method = TLS_client_method();
  60. +#endif
  61. return method;
  62. }
  63. --
  64. 2.7.4