@@ -7387,7 +7387,7 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
73877387 ret = wolfSSL_UseSecureRenegotiation(ssl);
73887388 if (ret != WOLFSSL_SUCCESS)
73897389 return ret;
7390- }
7390+ }
73917391 }
73927392#endif /* HAVE_SECURE_RENEGOTIATION */
73937393
@@ -15410,6 +15410,9 @@ int DoFinished(WOLFSSL* ssl, const byte* input, word32* inOutIdx, word32 size,
1541015410#endif
1541115411 ssl->options.handShakeState = HANDSHAKE_DONE;
1541215412 ssl->options.handShakeDone = 1;
15413+ #ifdef HAVE_SECURE_RENEGOTIATION
15414+ ssl->options.resumed = ssl->options.resuming;
15415+ #endif
1541315416 }
1541415417 }
1541515418 else {
@@ -15426,6 +15429,9 @@ int DoFinished(WOLFSSL* ssl, const byte* input, word32* inOutIdx, word32 size,
1542615429#endif
1542715430 ssl->options.handShakeState = HANDSHAKE_DONE;
1542815431 ssl->options.handShakeDone = 1;
15432+ #ifdef HAVE_SECURE_RENEGOTIATION
15433+ ssl->options.resumed = ssl->options.resuming;
15434+ #endif
1542915435 }
1543015436 }
1543115437#ifdef WOLFSSL_DTLS
@@ -15975,8 +15981,10 @@ static int DoHandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx,
1597515981 }
1597615982
1597715983 if (ssl->options.side == WOLFSSL_CLIENT_END && ssl->options.dtls == 0 &&
15978- ssl->options.serverState == NULL_STATE && type != server_hello) {
15979- WOLFSSL_MSG("First server message not server hello");
15984+ ssl->options.serverState == NULL_STATE && type != server_hello &&
15985+ type != hello_request) {
15986+ WOLFSSL_MSG("First server message not server hello or "
15987+ "hello request");
1598015988 SendAlert(ssl, alert_fatal, unexpected_message);
1598115989 WOLFSSL_ERROR_VERBOSE(OUT_OF_ORDER_E);
1598215990 return OUT_OF_ORDER_E;
@@ -21927,6 +21935,9 @@ int SendFinished(WOLFSSL* ssl)
2192721935 #endif
2192821936 ssl->options.handShakeState = HANDSHAKE_DONE;
2192921937 ssl->options.handShakeDone = 1;
21938+ #ifdef HAVE_SECURE_RENEGOTIATION
21939+ ssl->options.resumed = ssl->options.resuming;
21940+ #endif
2193021941 }
2193121942 }
2193221943 else {
@@ -21939,6 +21950,9 @@ int SendFinished(WOLFSSL* ssl)
2193921950 #endif
2194021951 ssl->options.handShakeState = HANDSHAKE_DONE;
2194121952 ssl->options.handShakeDone = 1;
21953+ #ifdef HAVE_SECURE_RENEGOTIATION
21954+ ssl->options.resumed = ssl->options.resuming;
21955+ #endif
2194221956 }
2194321957 }
2194421958
@@ -27143,13 +27157,20 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType,
2714327157 return BAD_FUNC_ARG;
2714427158 }
2714527159
27146- idSz = ssl->options.resuming ? ssl->session->sessionIDSz : 0;
27147-
2714827160#ifdef WOLFSSL_TLS13
2714927161 if (IsAtLeastTLSv1_3(ssl->version))
2715027162 return SendTls13ClientHello(ssl);
2715127163#endif
2715227164
27165+ #ifdef HAVE_SECURE_RENEGOTIATION
27166+ /* We don't want to resume in SCR */
27167+ if (IsSCR(ssl))
27168+ ssl->options.resuming = 0;
27169+ #endif
27170+
27171+ idSz = ssl->options.resuming ? ssl->session->sessionIDSz : 0;
27172+
27173+
2715327174 WOLFSSL_START(WC_FUNC_CLIENT_HELLO_SEND);
2715427175 WOLFSSL_ENTER("SendClientHello");
2715527176
@@ -34310,6 +34331,10 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3431034331 ssl->options.dtlsStateful = 1;
3431134332#endif /* WOLFSSL_DTLS */
3431234333
34334+ /* Reset to sane value for SCR */
34335+ ssl->options.resuming = 0;
34336+ ssl->arrays->sessionIDSz = 0;
34337+
3431334338 /* protocol version, random and session id length check */
3431434339 if (OPAQUE16_LEN + RAN_LEN + OPAQUE8_LEN > helloSz)
3431534340 return BUFFER_ERROR;
@@ -34503,7 +34528,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3450334528 ret = BUFFER_ERROR; /* session ID greater than 32 bytes long */
3450434529 goto out;
3450534530 }
34506- else if (b > 0) {
34531+ else if (b > 0 && !IsSCR(ssl) ) {
3450734532 if ((i - begin) + b > helloSz) {
3450834533 ret = BUFFER_ERROR;
3450934534 goto out;
@@ -34516,8 +34541,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3451634541 if (b == ID_LEN)
3451734542 ssl->options.resuming = 1; /* client wants to resume */
3451834543 WOLFSSL_MSG("Client wants to resume session");
34519- i += b;
3452034544 }
34545+ i += b;
3452134546
3452234547#ifdef WOLFSSL_DTLS
3452334548 /* cookie */
0 commit comments