]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl: fix 0-RTT for BoringSSL
authorEmmanuel Hocdet <manu@gandi.net>
Mon, 5 Aug 2019 16:04:16 +0000 (18:04 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 7 Aug 2019 16:44:48 +0000 (18:44 +0200)
Since BoringSSL commit 777a2391 "Hold off flushing NewSessionTicket until write.",
0-RTT doesn't work. It appears that half-RTT data (response from 0-RTT) never
worked before the BoringSSL fix. For HAProxy the regression come from 010941f8
"BUG/MEDIUM: ssl: Use the early_data API the right way.": the problem is link to
the logic of CO_FL_EARLY_SSL_HS used for OpenSSL. With BoringSSL, handshake is
done before reading early data, 0-RTT data and half-RTT data are processed as
normal data: CO_FL_EARLY_SSL_HS/CO_FL_EARLY_DATA is not needed, simply remove
it.

This should be backported to all versions till 1.8.

src/ssl_sock.c

index 98f677bea2b27d2fdba012a8287f758994049d19..918671464384d42b4fde5c411de365d4a0e24b52 100644 (file)
@@ -5297,7 +5297,7 @@ static int ssl_sock_init(struct connection *conn, void **xprt_ctx)
 
                /* leave init state and start handshake */
                conn->flags |= CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN;
-#if (HA_OPENSSL_VERSION_NUMBER >= 0x10101000L) || defined(OPENSSL_IS_BORINGSSL)
+#if (HA_OPENSSL_VERSION_NUMBER >= 0x10101000L)
                conn->flags |= CO_FL_EARLY_SSL_HS;
 #endif
 
@@ -5577,10 +5577,6 @@ reneg_ok:
                }
        }
 
-#ifdef OPENSSL_IS_BORINGSSL
-       if ((conn->flags & CO_FL_EARLY_SSL_HS) && !SSL_in_early_data(ctx->ssl))
-               conn->flags &= ~CO_FL_EARLY_SSL_HS;
-#endif
        /* The connection is now established at both layers, it's time to leave */
        conn->flags &= ~(flag | CO_FL_WAIT_L4_CONN | CO_FL_WAIT_L6_CONN);
        return 1;
@@ -5829,16 +5825,7 @@ static size_t ssl_sock_to_buf(struct connection *conn, void *xprt_ctx, struct bu
                } else
 #endif
                ret = SSL_read(ctx->ssl, b_tail(buf), try);
-#ifdef OPENSSL_IS_BORINGSSL
-               if (conn->flags & CO_FL_EARLY_SSL_HS) {
-                       if (SSL_in_early_data(ctx->ssl)) {
-                               if (ret > 0)
-                                       conn->flags |= CO_FL_EARLY_DATA;
-                       } else {
-                               conn->flags &= ~(CO_FL_EARLY_SSL_HS);
-                       }
-               }
-#endif
+
                if (conn->flags & CO_FL_ERROR) {
                        /* CO_FL_ERROR may be set by ssl_sock_infocbk */
                        goto out_error;