]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix renegotiation check that was added in https://github.com/openssl/openssl/pull...
authorFrederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>
Wed, 24 Apr 2024 10:03:32 +0000 (12:03 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 9 Jan 2025 16:02:19 +0000 (17:02 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22275)

ssl/statem/extensions_clnt.c

index 5b0144187d9ab60259b0c1c136db6d55747d12c9..d07d2ee187f7866acd24b65b3e28d2efa8a4a4e3 100644 (file)
@@ -17,16 +17,15 @@ EXT_RETURN tls_construct_ctos_renegotiate(SSL_CONNECTION *s, WPACKET *pkt,
                                           size_t chainidx)
 {
     if (!s->renegotiate) {
-        /* If not renegotiating, send an empty RI extension to indicate support */
-
-#if DTLS_MAX_VERSION_INTERNAL != DTLS1_2_VERSION
-# error Internal DTLS version error
-#endif
+        const int version1_3 = SSL_CONNECTION_IS_DTLS(s) ? DTLS1_3_VERSION
+                                                         : TLS1_3_VERSION;
 
-        if (!SSL_CONNECTION_IS_DTLS(s)
-            && (s->min_proto_version >= TLS1_3_VERSION
-                || (ssl_security(s, SSL_SECOP_VERSION, 0, TLS1_VERSION, NULL)
-                    && s->min_proto_version <= TLS1_VERSION))) {
+        /* If not renegotiating, send an empty RI extension to indicate support */
+        if ((s->min_proto_version != 0
+                && ssl_version_cmp(s, s->min_proto_version, version1_3) >= 0)
+            || (!SSL_CONNECTION_IS_DTLS(s)
+                && ssl_security(s, SSL_SECOP_VERSION, 0, TLS1_VERSION, NULL)
+                && s->min_proto_version <= TLS1_VERSION)) {
             /*
              * For TLS <= 1.0 SCSV is used instead, and for TLS 1.3 this
              * extension isn't used at all.