diff --git a/src/tls13.c b/src/tls13.c index 3da3bb0e2e..ef2c1dfd91 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -10867,12 +10867,12 @@ int DoTls13Finished(WOLFSSL* ssl, const byte* input, word32* inOutIdx, } if (sniff == NO_SNIFF) { - ret = BuildTls13HandshakeHmac(ssl, secret, mac, &finishedSz); - if (finishedSz > WOLFSSL_MAX_8BIT) { + ret = BuildTls13HandshakeHmac(ssl, secret, mac, &finishedSz); + #ifdef WOLFSSL_HAVE_TLS_UNIQUE + if (finishedSz > TLS_FINISHED_SZ_MAX) { return BUFFER_ERROR; } - #ifdef WOLFSSL_HAVE_TLS_UNIQUE if (ssl->options.side == WOLFSSL_CLIENT_END) { XMEMCPY(ssl->serverFinished, mac, finishedSz); ssl->serverFinished_len = (byte)finishedSz;