0002-fix-libressl-support.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From aad28d30af6c3a74c522dd61943788e908860c84 Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <aduskett@gmail.com>
  3. Date: Fri, 4 Aug 2017 07:22:47 -0400
  4. Subject: [PATCH] fix libressl support
  5. heirloom-mailx has two small issues when compiling against LibreSSL:
  6. - RAND_egd is used (LibreSSL does not support RAND_egd)
  7. Solution: "Guard" the code calling RAND_egd
  8. - SSLv3_client_method function is used (LibreSSL does not support SSLv3)
  9. Solution: "Guard" the code with #ifndef OPENSSL_NO_SSL3
  10. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  11. ---
  12. openssl.c | 7 +++++++
  13. 1 file changed, 7 insertions(+)
  14. diff --git a/openssl.c b/openssl.c
  15. index 44fe4e5..c4a1bb7 100644
  16. --- a/openssl.c
  17. +++ b/openssl.c
  18. @@ -137,11 +137,13 @@ ssl_rand_init(void)
  19. if ((cp = value("ssl-rand-egd")) != NULL) {
  20. cp = expand(cp);
  21. +#ifndef OPENSSL_NO_EGD
  22. if (RAND_egd(cp) == -1) {
  23. fprintf(stderr, catgets(catd, CATSET, 245,
  24. "entropy daemon at \"%s\" not available\n"),
  25. cp);
  26. } else
  27. +#endif
  28. state = 1;
  29. } else if ((cp = value("ssl-rand-file")) != NULL) {
  30. cp = expand(cp);
  31. @@ -216,10 +218,15 @@ ssl_select_method(const char *uhp)
  32. cp = ssl_method_string(uhp);
  33. if (cp != NULL) {
  34. + #ifndef OPENSSL_NO_SSL3
  35. if (equal(cp, "ssl3"))
  36. method = SSLv3_client_method();
  37. else if (equal(cp, "tls1"))
  38. method = TLSv1_client_method();
  39. + #else
  40. + if (equal(cp, "tls1"))
  41. + method = TLSv1_client_method();
  42. + #endif
  43. else {
  44. fprintf(stderr, catgets(catd, CATSET, 244,
  45. "Invalid SSL method \"%s\"\n"), cp);
  46. --
  47. 2.13.3