From: Matt Caswell Date: Thu, 27 Jul 2023 13:27:17 +0000 (+0100) Subject: Still advance handshake even on an empty write X-Git-Tag: openssl-3.2.0-alpha1~331 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33f6ad1724b2f32a370d01b61ef12120a75d8049;p=thirdparty%2Fopenssl.git Still advance handshake even on an empty write A call to SSL_write() with a zero length buffer should still advance the handshake. Applications (including s_client) may rely on this. Reviewed-by: Tomas Mraz Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/21578) --- diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 848b1b4f523..f6bd738793f 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -2076,9 +2076,6 @@ int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written) *written = 0; - if (len == 0) - return 1; - if (!expect_quic_with_stream_lock(s, /*remote_init=*/0, &ctx)) return 0; @@ -2104,6 +2101,11 @@ int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written) goto out; } + if (len == 0) { + ret = 1; + goto out; + } + if (xso_blocking_mode(ctx.xso)) ret = quic_write_blocking(&ctx, buf, len, written); else if (partial_write)