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.

38 lines
1.4 KiB

  1. From 97cafd182f5a5c2d13f57d7faeac8432aea9bbf8 Mon Sep 17 00:00:00 2001
  2. From: David Woodhouse <dwmw2@infradead.org>
  3. Date: Mon, 10 Jun 2019 12:34:43 +0100
  4. Subject: [PATCH] Disable encrypt-then-mac where possible with DTLS and OpenSSL
  5. There is pain here. Just don't bother.
  6. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  7. ---
  8. openssl-dtls.c | 12 +++++++++++-
  9. 1 file changed, 11 insertions(+), 1 deletion(-)
  10. diff --git a/openssl-dtls.c b/openssl-dtls.c
  11. index 9e3c5d46..646bf71c 100644
  12. --- a/openssl-dtls.c
  13. +++ b/openssl-dtls.c
  14. @@ -406,7 +406,17 @@ int start_dtls_handshake(struct openconnect_info *vpninfo, int dtls_fd)
  15. cipher = "PSK";
  16. }
  17. #endif /* OPENSSL_NO_PSK */
  18. -
  19. +#ifdef SSL_OP_NO_ENCRYPT_THEN_MAC
  20. + /* I'm fairly sure I wasn't lying when I said I had tested
  21. + * https://github.com/openssl/openssl/commit/e23d5071ec4c7aa6bb2b
  22. + * against GnuTLS both with and without EtM in 2016.
  23. + * Nevertheless, in 2019 it seems to be failing to negotiate
  24. + * at least for DTLS1_BAD_VER against ocserv with GnuTLS 3.6.7.
  25. + * Just turn it off. Real Cisco servers don't do it for
  26. + * DTLS1_BAD_VER, and we should be using GCM ciphersuites in
  27. + * newer versions of DTLS anyway so it's irrelevant. */
  28. + SSL_CTX_set_options(vpninfo->dtls_ctx, SSL_OP_NO_ENCRYPT_THEN_MAC);
  29. +#endif
  30. /* If we don't readahead, then we do short reads and throw
  31. away the tail of data packets. */
  32. SSL_CTX_set_read_ahead(vpninfo->dtls_ctx, 1);
  33. --
  34. 2.17.1