Repository navigation
Fix DTLS CID being dropped when a 1.3 client is downgraded to 1.2 - #12237
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change preserving CID state during DTLS 1.3-to-1.2 downgrades.
No open issues 🎉
What changed in this PR
Fixes #12208 by preserving the client’s DTLS connection ID (CID) state during a downgrade from DTLS 1.3 to 1.2, allowing the DTLS 1.2 handler to process the server’s CID response.
Changes:
- Limits early CID cleanup to connections that negotiate DTLS 1.3.
- Adds downgrade regression tests for servers that accept or decline CID negotiation.
- Clarifies the existing DTLS 1.2 cleanup path in a comment.
| File | Description |
|---|---|
tests/api/test_dtls.h |
Declares and registers both downgrade tests. |
tests/api/test_dtls.c |
Tests CID acceptance and rejection during downgrade, including application data exchange. |
src/tls13.c |
Prevents premature CID cleanup when downgrading to DTLS 1.2. |
src/internal.c |
Updates a comment explaining CID cleanup for downgraded clients. |
Review effort: Balanced
|
retest this please |
|
julek-wolfssl
left a comment
There was a problem hiding this comment.
What do you think of taking this approach instead? Maybe its cleaner.
--- a/src/tls13.c
+++ b/src/tls13.c
@@ -6223,17 +6223,16 @@
ssl->msgsReceived.got_hello_retry_request = 1;
ssl->msgsReceived.got_server_hello = 0;
}
+#ifdef WOLFSSL_DTLS_CID
+ else if (ssl->options.useDtlsCID)
+ DtlsCIDOnExtensionsParsed(ssl);
+#endif /* WOLFSSL_DTLS_CID */
}
if (args->totalExtSz > 0) {
args->idx += args->totalExtSz;
}
-#ifdef WOLFSSL_DTLS_CID
- if (ssl->options.useDtlsCID && *extMsgType == server_hello)
- DtlsCIDOnExtensionsParsed(ssl);
-#endif /* WOLFSSL_DTLS_CID */
-
if (IsAtLeastTLSv1_3(ssl->version)) {
*inOutIdx = args->idx;
}
yeah, thanks! that's much cleaner. |
|
Jenkins retest this please |
|
tests good with skoll, and with multi-test with various |
Description
A client offering DTLS 1.3 with a connection ID aborted when a 1.2 server answered with its own connection ID. The 1.3 code removed the client's connection ID before the 1.2 code had read the reply. It now only does that when 1.3 is actually negotiated.
Fixes #12208
Testing
Adds tests for a downgrade where the server accepts the connection ID and one where it doesn't.
Checklist