<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 8, 2018 at 3:14 PM, Tony Arcieri <span dir="ltr"><<a href="mailto:bascule@gmail.com" target="_blank">bascule@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class=""><div dir="ltr">On Thu, Jun 7, 2018 at 12:26 PM Rhys Weatherley <<a href="mailto:rhys.weatherley@gmail.com" target="_blank">rhys.weatherley@gmail.com</a>> wrote:<br></div><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"><div>In the low end space, it is common for devices to lack sufficient memory or CPU resources to implement DH functions like Curve25519.  Symmetric crypto and PSK's are fine, but DH is too resource-intensive.  ARM devices can usually handle it, but AVR devices no.</div></div></blockquote><div><br></div></span><div>There are AVR-optimized implementations of X25519:</div><div><br></div><div><a href="https://eprint.iacr.org/2015/343.pdf" target="_blank">https://eprint.iacr.org/2015/<wbr>343.pdf</a></div></div></div></blockquote><div><br></div><div>Which are still borderline for practical use.  From the paper: 13900397 cycles.  At the typical AVR Arduino CPU speed of 16 MHz, one curve operation takes 0.869s.</div><div><br></div><div>XX requires 4 curve operations (assuming that the local static key pair is precomputed).  3.476s at least to complete the handshake.  IK is 5 curve operations in 4.345s.  NN has better performance with 2 curve operations = 1.738s, but now there's no identity checking.</div><div><br></div><div>And we haven't even mentioned memory usage: every byte of flash and RAM is one less byte for the device to perform its core function that the user wishes to secure.<br></div><div><br></div><div>Possible?  Yes.  Practical?  Maybe not.  I have enough trouble convincing the newbies to use AEAD instead of ECB (yes, ECB!).  An extra 2s to 5s for the security of Diffie-Hellman is a tough ask.<br></div><div><br></div><div></div><div>Cheers,</div><div><br></div><div>Rhys.</div><div><br></div></div></div></div>