[PATCH 4/5] secur32: Perform TLS handshake even if input is empty.

Rémi Bernon rbernon at codeweavers.com
Mon Feb 15 05:47:22 CST 2021


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 <rbernon at codeweavers.com>
---
 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




More information about the wine-devel mailing list