<div> On Saturday, February 20, 2021 5:00 AM, Kristian Gjøsteen <kristian.gjosteen@ntnu.no> wrote:<br></div><div> <br></div><blockquote class="protonmail_quote" type="cite"><div class> The attacks on GCM-AES and similar constructions that we have seen<br></div><div class>discussed here lately, almost always reduce to either key management<br></div><div class>or nonce management. While these problems are theoretically simple to<br></div><div class>solve, it turns out that this is not easy to solve for engineers<br></div></blockquote><div><br></div><div>The solution is easy.  Don't do that.<br></div><div><br></div><div>The point of nonces is to reuse expensive shared secrets, but shared secrets<br></div><div>are no longer expensive.<br></div><div><br></div><div>Make a new one time secret from a new one time public key every time<br></div><div>you start a stream.<br></div><div><br></div><div>The problem is that the elaborate infrastructure for re-use of of precious <br></div><div>shared secrets is complicated to implement, and easy to implement wrong. <br></div><div>Don't reuse them.<br></div><div><br></div><div>A stream cipher such as ChaCha20 can be though of as enormous widely<br></div><div>known and widely shared one time pad<br></div><div><br></div><div><div>Despite being universally known, the pad is still one time because it is so<br></div><div>enormous, that if you always start at a random secret point in the pad,<br></div><div>no one is ever going to reuse.<br></div></div><div><br></div><div> The pad is composed of 2^384 512 bit blocks, and the 256 bit secret is the<br></div><div>high order part of the position in the pad, the nonce is some part of the<br></div><div>remaining 128 bits of the position, and message position of the 512 bit<br></div><div>block is the remaining position bits after the nonce.<br></div><div><br></div><div>If you do lots of clever stuff handling different parts of the position differently,<br></div><div>you are bound to foul up, and wind up re-using some tiny part of this<br></div><div>enormous pad.  Don't do that.  Don't re-use shared secrets.<br></div><div><br></div><div>Shared secrets are cheap.  If no nonces, if the "nonce" and the start position<br></div><div>are just some more bits of the shared secret, no nonce management.<br></div><div>If no shared secret re-use, no shared secret management.<br></div>