Skip to content

Commit 5f53479

Browse files
committed
Adjust SendClientKeyExchange to use exact cipher overhead for DTLS MTU checks
1 parent 6f83d75 commit 5f53479

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
@@ -34095,7 +34095,15 @@ int SendClientKeyExchange(WOLFSSL* ssl)
3409534095
#endif
3409634096

3409734097
if (IsEncryptionOn(ssl, 1)) {
34098-
args->sendSz += MAX_MSG_EXTRA;
34098+
#if defined(WOLFSSL_DTLS) && defined(WOLFSSL_DTLS_MTU)
34099+
/* Use exact cipher overhead for the MTU pre-flight check.
34100+
* MAX_MSG_EXTRA is an upper bound that can exceed a small MTU,
34101+
* while the actual message fits within it. */
34102+
if (ssl->options.dtls)
34103+
args->sendSz += cipherExtraData(ssl);
34104+
else
34105+
#endif
34106+
args->sendSz += MAX_MSG_EXTRA;
3409934107
}
3410034108

3410134109
/* check for available size */

0 commit comments

Comments
 (0)