Be more accurate about what we accept as a valid DTLS version
authorMatt Caswell <matt@openssl.org>
Tue, 25 Apr 2023 13:57:02 +0000 (14:57 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 5 May 2023 14:25:37 +0000 (15:25 +0100)
We accepted more version numbers as valid DTLS then we really should do.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20830)

ssl/statem/statem_lib.c

index 4b498cd76f82219f238c72a263c6d40088f5181f..c2fca8bb12989673076623cdcd04a67f872ac5e5 100644 (file)
@@ -2049,8 +2049,10 @@ int ssl_set_version_bound(int method_version, int version, int *bound)
 
     valid_tls = version >= SSL3_VERSION && version <= TLS_MAX_VERSION_INTERNAL;
     valid_dtls =
-        DTLS_VERSION_LE(version, DTLS_MAX_VERSION_INTERNAL) &&
-        DTLS_VERSION_GE(version, DTLS1_BAD_VER);
+        /* We support client side pre-standardisation version of DTLS */
+        (version == DTLS1_BAD_VER)
+        || (DTLS_VERSION_LE(version, DTLS_MAX_VERSION_INTERNAL)
+            && DTLS_VERSION_GE(version, DTLS1_VERSION));
 
     if (!valid_tls && !valid_dtls)
         return 0;