From: "Rémi Bernon" Subject: [PATCH 4/5] secur32: Perform TLS handshake even if input is empty. Message-Id: <20210215114723.3898056-4-rbernon@codeweavers.com> Date: Mon, 15 Feb 2021 12:47:22 +0100 In-Reply-To: <20210215114723.3898056-1-rbernon@codeweavers.com> References: <20210215114723.3898056-1-rbernon@codeweavers.com> Instead of immediately returning even if we don't know how much. This may be the case if we received SEC_I_RENEGOTIATE status, and in any case the handshake will tell us if more data is needed. Signed-off-by: Rémi Bernon --- dlls/secur32/schannel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index 2d135a85227..07d3ea5216a 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -881,7 +881,7 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW( ptr += record_size; } - if (!expected_size) + if (!expected_size && record_size) { TRACE("Expected at least %lu bytes, but buffer only contains %u bytes.\n", max(6, record_size), buffer->cbBuffer); @@ -912,6 +912,8 @@ static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW( { SecBuffer *buffer = &out_buffers->desc->pBuffers[0]; buffer->cbBuffer = 0; + /* Nothing to read or to send, but we got SEC_I_CONTINUE_NEEDED, it means missing input */ + if (!expected_size && ret == SEC_I_CONTINUE_NEEDED) ret = SEC_E_INCOMPLETE_MESSAGE; } if(ctx->transport.in.offset && ctx->transport.in.offset != pInput->pBuffers[0].cbBuffer) { -- 2.30.0