Repository navigation
Fix CID server-role handling and send-buffer bounds - #1
Open
svdwalt007 wants to merge 1 commit into
Open
svdwalt007 wants to merge 1 commit into
svdwalt007 wants to merge 1 commit into
Conversation
A ClientHello carrying a connection_id extension was parsed on the server side and its CID stored as write_cid, but the ServerHello never echoes the extension. A server would then send tls12_cid records that were not negotiated (RFC 9146, section 3). Only the client side is implemented, so ignore the extension in a ClientHello. dtls_prepare_record() did not account for the CID in its send-buffer checks: the CID, the inner content type and the AEAD tag were written or counted without cid_length, so a nearly full buffer could be overrun by up to DTLS_MAX_CID_LENGTH bytes. Check before each write.
Author
|
@mrdeep1 - is it possible to accept this PR and merge and push the upstream to do same... ? would be good to get this CID functionality into tinyDTLS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes on top of eclipse-tinydtls#302.
Server role.
dtls_check_tls_extension()is also used for received ClientHellos. A connection_id extension there was parsed and its CID stored aswrite_cid, butdtls_send_server_hello()never echoes the extension, so a server would sendtls12_cidrecords that were never negotiated (RFC 9146, section 3). Only the client side is implemented, so the extension is now ignored in a ClientHello.Send-buffer bounds.
dtls_prepare_record()did not includecid_lengthin its size checks. The CID, the inner content type byte and the AEAD tag could overrun a nearly full buffer by up toDTLS_MAX_CID_LENGTHbytes. Each write is now checked first.Tested: library builds;
dtls-client -zagainstdtls-serverover loopback (PSK) completes the handshake. The server-role fix is not exercised by that test, because the client offers an empty CID; it needs a peer that offers a non-empty CID. I have not tested against a CID-capable third-party server.