summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-07-18 09:23:53 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-22 15:41:46 +0200
commit53401b2096a5f57fb2123d3ad9140d762f14889a (patch)
tree73178f65a8d17edcf62624ac896c97c87465e733
parentc1806946f702a2bae81c27f5e76c7575ca7ad740 (diff)
downloadgnutls-53401b2096a5f57fb2123d3ad9140d762f14889a.tar.gz
handshake: always accept TLS 1.2 in client hello if we have later protocols enabled
That is because after TLS 1.3 there is no negotiation of the version using the Client Hello field, but with an extension. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--lib/handshake.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/handshake.c b/lib/handshake.c
index 156ce29fc1..d88ce2affd 100644
--- a/lib/handshake.c
+++ b/lib/handshake.c
@@ -365,8 +365,19 @@ _gnutls_negotiate_legacy_version(gnutls_session_t session,
{
const version_entry_st *vers;
- /* if we do not support that version */
+ /* if we do not support that version, unless that version is TLS 1.2;
+ * TLS 1.2 is handled separately because it is always advertized under TLS 1.3 or later */
if (adv_version == GNUTLS_VERSION_UNKNOWN || _gnutls_version_is_supported(session, adv_version) == 0) {
+
+ if (adv_version == GNUTLS_TLS1_2) {
+ vers = _gnutls_version_max(session);
+ if (vers->id >= GNUTLS_TLS1_2) {
+ if (_gnutls_set_current_version(session, adv_version) < 0)
+ return gnutls_assert_val(GNUTLS_E_UNSUPPORTED_VERSION_PACKET);
+ return adv_version;
+ }
+ }
+
/* if we get an unknown/unsupported version, then fail if the version we
* got is too low to be supported */
if (!_gnutls_version_is_too_high(session, major, minor))