forked from wolfSSL/wolfssl
FreeAsyncCtx should only be called when advancing state
The call to FreeAsyncCtx after SendBuffered was added to clean up state when we are ready to advance state. If we do not advance state, then clean up should be handled in the relevant state.
This commit is contained in:
16
src/ssl.c
16
src/ssl.c
@@ -11908,11 +11908,11 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
|
|||||||
ssl->options.connectState++;
|
ssl->options.connectState++;
|
||||||
WOLFSSL_MSG("connect state: "
|
WOLFSSL_MSG("connect state: "
|
||||||
"Advanced from last buffered fragment send");
|
"Advanced from last buffered fragment send");
|
||||||
|
#ifdef WOLFSSL_ASYNC_IO
|
||||||
|
/* Cleanup async */
|
||||||
|
FreeAsyncCtx(ssl, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef WOLFSSL_ASYNC_IO
|
|
||||||
/* Cleanup async */
|
|
||||||
FreeAsyncCtx(ssl, 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WOLFSSL_MSG("connect state: "
|
WOLFSSL_MSG("connect state: "
|
||||||
@@ -12438,11 +12438,11 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
|
|||||||
ssl->options.acceptState++;
|
ssl->options.acceptState++;
|
||||||
WOLFSSL_MSG("accept state: "
|
WOLFSSL_MSG("accept state: "
|
||||||
"Advanced from last buffered fragment send");
|
"Advanced from last buffered fragment send");
|
||||||
|
#ifdef WOLFSSL_ASYNC_IO
|
||||||
|
/* Cleanup async */
|
||||||
|
FreeAsyncCtx(ssl, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef WOLFSSL_ASYNC_IO
|
|
||||||
/* Cleanup async */
|
|
||||||
FreeAsyncCtx(ssl, 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WOLFSSL_MSG("accept state: "
|
WOLFSSL_MSG("accept state: "
|
||||||
|
54
src/tls13.c
54
src/tls13.c
@@ -8262,33 +8262,31 @@ static int SendTls13KeyUpdate(WOLFSSL* ssl)
|
|||||||
OPAQUE8_LEN + Dtls13GetRlHeaderLength(1) + DTLS_HANDSHAKE_HEADER_SZ,
|
OPAQUE8_LEN + Dtls13GetRlHeaderLength(1) + DTLS_HANDSHAKE_HEADER_SZ,
|
||||||
key_update, 0);
|
key_update, 0);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
#endif /* WOLFSSL_DTLS13 */
|
#endif /* WOLFSSL_DTLS13 */
|
||||||
|
{
|
||||||
|
/* This message is always encrypted. */
|
||||||
|
sendSz = BuildTls13Message(ssl, output, outputSz, input,
|
||||||
|
headerSz + OPAQUE8_LEN, handshake, 0, 0, 0);
|
||||||
|
if (sendSz < 0)
|
||||||
|
return BUILD_MSG_ERROR;
|
||||||
|
|
||||||
/* This message is always encrypted. */
|
#ifdef WOLFSSL_CALLBACKS
|
||||||
sendSz = BuildTls13Message(ssl, output, outputSz, input,
|
if (ssl->hsInfoOn) AddPacketName(ssl, "KeyUpdate");
|
||||||
headerSz + OPAQUE8_LEN, handshake, 0, 0, 0);
|
if (ssl->toInfoOn) {
|
||||||
if (sendSz < 0)
|
AddPacketInfo(ssl, "KeyUpdate", handshake, output, sendSz,
|
||||||
return BUILD_MSG_ERROR;
|
WRITE_PROTO, ssl->heap);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSL_CALLBACKS
|
ssl->buffers.outputBuffer.length += sendSz;
|
||||||
if (ssl->hsInfoOn) AddPacketName(ssl, "KeyUpdate");
|
|
||||||
if (ssl->toInfoOn) {
|
|
||||||
AddPacketInfo(ssl, "KeyUpdate", handshake, output, sendSz,
|
|
||||||
WRITE_PROTO, ssl->heap);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ssl->buffers.outputBuffer.length += sendSz;
|
ret = SendBuffered(ssl);
|
||||||
|
|
||||||
ret = SendBuffered(ssl);
|
|
||||||
|
|
||||||
|
|
||||||
if (ret != 0 && ret != WANT_WRITE)
|
if (ret != 0 && ret != WANT_WRITE)
|
||||||
return ret;
|
return ret;
|
||||||
#ifdef WOLFSSL_DTLS13
|
|
||||||
}
|
}
|
||||||
#endif /* WOLFSSL_DTLS13 */
|
|
||||||
|
|
||||||
/* In DTLS we must wait for the ack before setting up the new keys */
|
/* In DTLS we must wait for the ack before setting up the new keys */
|
||||||
if (!ssl->options.dtls) {
|
if (!ssl->options.dtls) {
|
||||||
@@ -9792,7 +9790,7 @@ int wolfSSL_connect_TLSv13(WOLFSSL* ssl)
|
|||||||
the value of the enum ConnectState is stored in
|
the value of the enum ConnectState is stored in
|
||||||
serialized session. This would make importing serialized
|
serialized session. This would make importing serialized
|
||||||
session from other wolfSSL version incompatible */
|
session from other wolfSSL version incompatible */
|
||||||
ssl->options.connectState = WAIT_FINISHED_ACK;
|
ssl->options.connectState = WAIT_FINISHED_ACK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* WOLFSSL_DTLS13 */
|
#endif /* WOLFSSL_DTLS13 */
|
||||||
@@ -9801,16 +9799,16 @@ int wolfSSL_connect_TLSv13(WOLFSSL* ssl)
|
|||||||
}
|
}
|
||||||
WOLFSSL_MSG("connect state: "
|
WOLFSSL_MSG("connect state: "
|
||||||
"Advanced from last buffered fragment send");
|
"Advanced from last buffered fragment send");
|
||||||
|
#ifdef WOLFSSL_ASYNC_IO
|
||||||
|
FreeAsyncCtx(ssl, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WOLFSSL_MSG("connect state: "
|
WOLFSSL_MSG("connect state: "
|
||||||
"Not advanced, more fragments to send");
|
"Not advanced, more fragments to send");
|
||||||
}
|
}
|
||||||
#ifdef WOLFSSL_ASYNC_IO
|
|
||||||
FreeAsyncCtx(ssl, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WOLFSSL_DTLS13
|
#ifdef WOLFSSL_DTLS13
|
||||||
if (ssl->options.dtls)
|
if (ssl->options.dtls)
|
||||||
ssl->dtls13SendingAckOrRtx =0;
|
ssl->dtls13SendingAckOrRtx =0;
|
||||||
@@ -10878,10 +10876,10 @@ int wolfSSL_accept_TLSv13(WOLFSSL* ssl)
|
|||||||
ssl->options.acceptState++;
|
ssl->options.acceptState++;
|
||||||
WOLFSSL_MSG("accept state: "
|
WOLFSSL_MSG("accept state: "
|
||||||
"Advanced from last buffered fragment send");
|
"Advanced from last buffered fragment send");
|
||||||
|
#ifdef WOLFSSL_ASYNC_IO
|
||||||
|
FreeAsyncCtx(ssl, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef WOLFSSL_ASYNC_IO
|
|
||||||
FreeAsyncCtx(ssl, 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WOLFSSL_MSG("accept state: "
|
WOLFSSL_MSG("accept state: "
|
||||||
|
Reference in New Issue
Block a user