<div dir="auto"><div><div data-smartmail="gmail_signature"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On May 2, 2017 21:29, "Trevor Perrin" <<a href="mailto:trevp@trevp.net">trevp@trevp.net</a>> wrote:<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
MixKeyAndHash(psk):<br>
  ck, k, temp = HKDF(ck, psk)<br>
  MixHash(temp)<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Actually, my suggestion and what I placed in that pull request is:</div><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">MixKeyAndHash(psk):</span><br style="font-family:sans-serif"><span style="font-family:sans-serif">  ck, temp, k = HKDF(ck, psk)</span><br style="font-family:sans-serif"><span style="font-family:sans-serif">  MixHash(temp)</span><br></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif">The reason is that there are cases in which k is overwritten again without being used. In that case implementations can optimize by not having to compute that last hmac. Functional languages like Haskell get this for free. C++ implementations can get this for free with smart use of constexpr. C implementations get this for free with careful use of gcc constant propagation. The difference is trivial from a crypto point of view but makes a nice difference in implementations.</span></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
We haven't broken compatibility since 2015, so this would require<br>
updates for existing libraries.  That's unfortunate but this does seem<br>
like a more thoughtful and flexible approach, which would see<br>
real-world use.  I'd like to hear what the library developers think.<br>
Luckily, I don't think PSK had gotten much use outside of WireGuard,<br>
which is willing to change.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">:)</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Trevor<br>
______________________________<wbr>_________________<br>
Noise mailing list<br>
<a href="mailto:Noise@moderncrypto.org">Noise@moderncrypto.org</a><br>
<a href="https://moderncrypto.org/mailman/listinfo/noise" rel="noreferrer" target="_blank">https://moderncrypto.org/<wbr>mailman/listinfo/noise</a><br>
</blockquote></div><br></div></div></div>