Rantanen / node-dtls

JavaScript DTLS implementation for Node.js
ISC License
58 stars 15 forks source link

DtlsHandshake packet missing fragment_length #6

Open brycekahle opened 9 years ago

brycekahle commented 9 years ago

The spec for the handshake message mentions a uint24 fragment_length field, which I don't see in the source. Am I missing something? or is the field missing?

brycekahle commented 9 years ago

Ah, I think I see. The var24 spec for the body means it will read the first 24 bits as the fragment_length. Since fragment_length is the length of the entire fragment, and not just the body, won't this result in reading 96 (8+24+16+24+24) bits too far?

Rantanen commented 9 years ago

Thanks to fragmentation, the handshake reading/writing is a bit of a special case and is handled entirely by https://github.com/Rantanen/node-dtls/blob/master/HandshakeBuilder.js

I don't remember the logic in full anymore and given I need to flee to work I don't have time to check it now either - so I won't make the claim that it's completely bugless. :)