From 66c95b0c159cdb27a9aaf1f8f07f59f9f726bdbd Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 3 Oct 2012 16:36:00 -0700 Subject: [PATCH 1/2] DoAppData sanity check for handshake complete --- src/internal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/internal.c b/src/internal.c index 0b4ad9c1a..78d111e04 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2874,6 +2874,11 @@ int DoApplicationData(CYASSL* ssl, byte* input, word32* inOutIdx) byte verify[SHA256_DIGEST_SIZE]; const byte* mac; + if (ssl->options.handShakeState != HANDSHAKE_DONE) { + CYASSL_MSG("Received App data before handshake complete"); + return OUT_OF_ORDER_E; + } + if (ssl->specs.cipher_type == block) { if (ssl->options.tls1_1) ivExtra = ssl->specs.block_size; From 257d10a69fa2782c35f485200081b45ae4e9702d Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 3 Oct 2012 16:44:08 -0700 Subject: [PATCH 2/2] sanity check for out of order handshake messages --- src/internal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/internal.c b/src/internal.c index 78d111e04..9da5d74f1 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2473,6 +2473,11 @@ static int DoHandShakeMsgType(CYASSL* ssl, byte* input, word32* inOutIdx, } #endif + if (ssl->options.handShakeState == HANDSHAKE_DONE && type != hello_request){ + CYASSL_MSG("HandShake message after handshake complete"); + return OUT_OF_ORDER_E; + } + switch (type) { case hello_request: