Skip to content

Commit 341024e

Browse files
committed
Adjust SendClientKeyExchange to use exact cipher overhead for DTLS MTU checks
1 parent 87d89d8 commit 341024e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/internal.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34118,7 +34118,15 @@ int SendClientKeyExchange(WOLFSSL* ssl)
3411834118
#endif
3411934119

3412034120
if (IsEncryptionOn(ssl, 1)) {
34121-
args->sendSz += MAX_MSG_EXTRA;
34121+
#if defined(WOLFSSL_DTLS) && defined(WOLFSSL_DTLS_MTU)
34122+
/* Use exact cipher overhead for the MTU pre-flight check.
34123+
* MAX_MSG_EXTRA is an upper bound that can exceed a small MTU,
34124+
* while the actual message fits within it. */
34125+
if (ssl->options.dtls)
34126+
args->sendSz += cipherExtraData(ssl);
34127+
else
34128+
#endif
34129+
args->sendSz += MAX_MSG_EXTRA;
3412234130
}
3412334131

3412434132
/* check for available size */

0 commit comments

Comments
 (0)