diff --git a/src/tls13.c b/src/tls13.c index 1a5adbe71..72bcf2ab2 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -2127,15 +2127,15 @@ int BuildTls13Message(WOLFSSL* ssl, byte* output, int outSz, const byte* input, goto exit_buildmsg; } + /* The real record content type goes at the end of the data. */ + output[args->idx++] = (byte)type; + ssl->options.buildMsgState = BUILD_MSG_ENCRYPT; } FALL_THROUGH; case BUILD_MSG_ENCRYPT: { - /* The real record content type goes at the end of the data. */ - output[args->idx++] = (byte)type; - #ifdef ATOMIC_USER if (ssl->ctx->MacEncryptCb) { /* User Record Layer Callback handling */ @@ -2183,6 +2183,9 @@ exit_buildmsg: /* Final cleanup */ FreeBuildMsg13Args(ssl, args); +#ifdef WOLFSSL_ASYNC_CRYPT + ssl->async.freeArgs = NULL; +#endif return ret; }