<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Aug 5, 2017 at 4:10 AM, Igor Solovyov <span dir="ltr"><<a href="mailto:igor.solovyov@gmail.com" target="_blank">igor.solovyov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On Fri, Aug 4, 2017 at 7:53 PM, Trevor Perrin <span dir="ltr"><<a href="mailto:trevp@trevp.net" target="_blank">trevp@trevp.net</a>></span> wrote:</span><br><span class="gmail-"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
We've tried to avoid negotiation to keep runtime behavior simple. So<br>
even if we support larger transport messages, it's an open question<br>
whether we should negotiate this versus just having endpoints<br>
configured for it.<br></blockquote><div><br></div></span><div>Agree. In such case some kind of clear error signaling is desirable.<br>One endpoint could be configured to use 16-bit length, another one to use 32-bit by mistake.<br></div><div>After one tried to connect to other some clear error code would be nice to have.<br></div><div>I didn't study current Noise spec scrupulously, so may be it's already there.<br></div></div></div></div></div></blockquote><div><br><div>How about this for an encoding:<br><br></div><div>1. If the message is <= 65535 bytes in size, use a two-byte length.<br></div><div>2.
If the message is > 65535 bytes in size, then send a two-byte length
with the value zero followed by the actual four-byte length. Length field is 6 bytes in size in total. For large messages, the extra overhead probably doesn't matter.<br><br></div><div>Since
a zero-length packet is normally invalid, a 16-bit only implementation will
abort the connection if it sees the zero. An implementation that is 32-bit aware will
switch sizes dynamically. No possibility of misconfiguration.<br><br></div><div>Then it's just a matter of negotiating the maximum size > 65535 to indicate "I am aware of how to decode 32-bit lengths".<br></div><br></div><div>Cheers,<br><br></div><div>Rhys.<br></div><br></div></div></div>