Skip to content

Commit 6e4b978

Browse files
committed
TLS: Don't check CCS status for hello_request
1 parent 04e57f9 commit 6e4b978

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

crypto/src/crypto/tls/TlsProtocol.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -391,31 +391,30 @@ private void ProcessHandshakeQueue(ByteQueue queue)
391391
if (queue.Available < totalLength)
392392
break;
393393

394-
CheckReceivedChangeCipherSpec(mConnectionState == CS_END || type == HandshakeType.finished);
395-
396394
/*
397395
* RFC 2246 7.4.9. The value handshake_messages includes all handshake messages
398396
* starting at client hello up to, but not including, this finished message.
399397
* [..] Note: [Also,] Hello Request messages are omitted from handshake hashes.
400398
*/
401-
switch (type)
402-
{
403-
case HandshakeType.hello_request:
404-
break;
405-
case HandshakeType.finished:
406-
default:
399+
if (HandshakeType.hello_request != type)
407400
{
408-
TlsContext ctx = Context;
409-
if (type == HandshakeType.finished
410-
&& this.mExpectedVerifyData == null
411-
&& ctx.SecurityParameters.MasterSecret != null)
401+
if (HandshakeType.finished == type)
412402
{
413-
this.mExpectedVerifyData = CreateVerifyData(!ctx.IsServer);
403+
CheckReceivedChangeCipherSpec(true);
404+
405+
TlsContext ctx = Context;
406+
if (this.mExpectedVerifyData == null
407+
&& ctx.SecurityParameters.MasterSecret != null)
408+
{
409+
this.mExpectedVerifyData = CreateVerifyData(!ctx.IsServer);
410+
}
411+
}
412+
else
413+
{
414+
CheckReceivedChangeCipherSpec(mConnectionState == CS_END);
414415
}
415416

416417
queue.CopyTo(mRecordStream.HandshakeHashUpdater, totalLength);
417-
break;
418-
}
419418
}
420419

421420
queue.RemoveData(4);

0 commit comments

Comments
 (0)