disable-sslv2-and-sslv3.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 1acfebd966e8804e6573cbe9287b8b6f028a646c Mon Sep 17 00:00:00 2001
  2. From: Michael Orlitzky <michael@orlitzky.com>
  3. Date: Tue, 23 Aug 2016 18:13:47 -0400
  4. Subject: [PATCH 1/1] sslstream.c: ignore the user's choice of ssl_method.
  5. The SSLv2 and SSLv3 protocols are insecure, and people have begun to
  6. operate without them. LibreSSL, for example, does not have them
  7. enabled, and it is possible to build OpenSSL in the same manner.
  8. If SSLv[23] are disabled, the user would not be able to choose "ssl2"
  9. or "ssl3" as his "ssl_method", an option that was undocumented
  10. anywhere. Therefore there is not much lost, and some security to gain,
  11. by removing the option completely. This commit does that, and uses the
  12. automatic protocol choice that is capable of negotiating TLSv1,
  13. TLSv1.1 and TLSv1.2.
  14. Gentoo-Bug: 591940
  15. ---
  16. lib5250/sslstream.c | 26 ++++++++++----------------
  17. 1 file changed, 10 insertions(+), 16 deletions(-)
  18. diff --git a/lib5250/sslstream.c b/lib5250/sslstream.c
  19. index 7181566..2f91d1a 100644
  20. --- a/lib5250/sslstream.c
  21. +++ b/lib5250/sslstream.c
  22. @@ -362,22 +362,16 @@ int tn5250_ssl_stream_init (Tn5250Stream *This)
  23. /* which SSL method do we use? */
  24. - strcpy(methstr,"auto");
  25. - if (This->config!=NULL && tn5250_config_get (This->config, "ssl_method")) {
  26. - strncpy(methstr, tn5250_config_get (This->config, "ssl_method"), 4);
  27. - methstr[4] = '\0';
  28. - }
  29. -
  30. - if (!strcmp(methstr, "ssl2")) {
  31. - meth = SSLv2_client_method();
  32. - TN5250_LOG(("SSL Method = SSLv2_client_method()\n"));
  33. - } else if (!strcmp(methstr, "ssl3")) {
  34. - meth = SSLv3_client_method();
  35. - TN5250_LOG(("SSL Method = SSLv3_client_method()\n"));
  36. - } else {
  37. - meth = SSLv23_client_method();
  38. - TN5250_LOG(("SSL Method = SSLv23_client_method()\n"));
  39. - }
  40. + /* Ignore the user's choice of ssl_method (which isn't documented
  41. + * anyway...) if it was either "ssl2" or "ssl3". Both are insecure,
  42. + * and this is only safe supported method left.
  43. + *
  44. + * This is a Gentoo-specific modification that lets us build
  45. + * against LibreSSL and newer OpenSSL with its insecure protocols
  46. + * disabled.
  47. + */
  48. + meth = SSLv23_client_method();
  49. + TN5250_LOG(("SSL Method = SSLv23_client_method()\n"));
  50. /* create a new SSL context */
  51. --
  52. 2.7.3