-r--r--r-- 8979 libntruprime-20240910/doc/html/security.html raw
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type="text/css"> html{overflow-y:scroll;background-color:#004591} body{font-family:"Noto Sans","Droid Sans","DejaVu Sans","Arial",sans-serif;line-height:1.5} tt,code{background-color:#f0f0f0;font-family:"Noto Sans Mono","Droid Sans Mono","DejaVu Sans Mono","Courier New",monospace,sans-serif;font-size:1em;} pre{margin-left:3em} p,ul,ol,blockquote,pre{font-size:1.0em;line-height:1.6} li p{font-size:1.0em} blockquote p{font-size:1.0em} h1{font-size:1.5em} h2{font-size:1.3em} h3{font-size:1.0em} h1 a{text-decoration:none} table{border-collapse:collapse} th,td{border:1px solid black} table a{text-decoration:none} table tr{font-size:1.0em;line-height:1.6em} table tr{font-size:1.0em;line-height:1.5} tbody tr:nth-child(12n+1){background-color:#f0ffff} tbody tr:nth-child(12n+2){background-color:#f0ffff} tbody tr:nth-child(12n+3){background-color:#f0ffff} tbody tr:nth-child(12n+4){background-color:#f0ffff} tbody tr:nth-child(12n+5){background-color:#f0ffff} tbody tr:nth-child(12n+6){background-color:#f0ffff} tbody tr:nth-child(12n+7){background-color:#fffff0} tbody tr:nth-child(12n+8){background-color:#fffff0} tbody tr:nth-child(12n+9){background-color:#fffff0} tbody tr:nth-child(12n+10){background-color:#fffff0} tbody tr:nth-child(12n+11){background-color:#fffff0} tbody tr:nth-child(12n+12){background-color:#fffff0} .headline{padding:0;font-weight:bold;font-size:1.0em;vertical-align:top;padding-bottom:0.5em;color:#ffffff;background-color:#004591} .navt{display:block;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin:0;padding:0;vertical-align:center;font-size:1.0em} .here{background-color:#004591} .here{color:#ffffff} .away{background-color:#004591} .away a{text-decoration:none;display:block;color:#ffffff} .away a:hover,.away a:active{text-decoration:underline} .main{padding:5px} .main{background-color:#ffffff} .pagetitle{font-size:1.4em;font-weight:bold} @media only screen and (min-width:512px) { .fixed{margin:0;padding:0;width:160px;height:100%;position:fixed;overflow:auto} .main{margin-left:170px} } </style> <title> libntruprime: Security</title> </head> <body> <div class=fixed> <div class=headline> libntruprime</div> <div class="navt away"><a href=index.html>Intro</a> </div><div class="navt away"><a href=download.html>Download</a> </div><div class="navt away"><a href=install.html>Install</a> </div><div class="navt away"><a href=test.html>Test</a> </div><div class="navt away"><a href=api.html>API</a> </div><div class="navt away"><a href=cli.html>CLI</a> </div><div class="navt here">Security </div><div class="navt away"><a href=verification.html>Verification</a> </div><div class="navt away"><a href=speed.html>Speed</a> </div><div class="navt away"><a href=internals.html>Internals</a> </div><div class="navt away"><a href=people.html>People</a> </div><div class="navt away"><a href=license.html>License</a> </div></div> <div class=main> <div class=pagetitle>libntruprime: Security</div> <p>Lattice-based cryptography is dangerous. Fast attacks have been demonstrated breaking, e.g., <a href="https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/_fOnZNYHdE4/m/-WNWqwUFAwAJ">Compact LWE</a>, <a href="https://eprint.iacr.org/2017/1214">HILA5</a>, and <a href="https://eprint.iacr.org/2020/241">Round2</a>, all of which were small lattice-based cryptosystems submitted to the NIST post-quantum competition. The <a href="https://web.archive.org/web/20231125213807/https://finiterealities.net/kyber512/">supposedly</a> <a href="https://web.archive.org/web/20231219201240/https://csrc.nist.gov/csrc/media/Projects/post-quantum-cryptography/documents/faq/Kyber-512-FAQ.pdf">well-studied</a> problems at the heart of all lattice-based cryptosystems <a href="https://cr.yp.to/papers.html#hybrid">continue</a> to <a href="https://eprint.iacr.org/2024/80">lose</a> <a href="https://eprint.iacr.org/2024/739">security</a>. The "constant-time" reference software for Kyber (ML-KEM) has had two rounds of security patches for two different timing attacks <a href="https://kyberslash.cr.yp.to">demonstrated</a> to be <a href="https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/hqbtIGFKIpU">exploitable</a>.</p> <p>Unlike most proposals of lattice-based cryptosystems, <code>sntrup</code> <a href="https://ntruprime.cr.yp.to/warnings.html">acknowledges lattice risks</a> and is <a href="https://ntruprime.cr.yp.to">designed accordingly</a>. Furthermore, the <code>sntrup</code> software in libntruprime includes state-of-the-art defenses against timing attacks. But small lattice-based cryptosystems, even when carefully designed, remain dangerous, both at the <a href="https://s-unit.attacks.cr.yp.to">mathematical</a> level and at the software level. <strong>When you're deploying post-quantum cryptography, make sure to deploy it as an <a href="https://blog.cr.yp.to/20240102-hybrid.html"><em>extra</em> layer of encryption</a> on top of your existing use of ECC, not as a replacement for ECC.</strong></p> <p>One risk for libntruprime is the risk of bugs getting past the libntruprime tests. The main defense in progress is <a href="verification.html">software verification</a>. Until verification is complete, libntruprime is limiting code size: it includes <a href="speed.html">general AVX2 optimizations</a> but skips the software from <a href="speed.html#faster">nine publications with further <code>sntrup</code> speedups</a>.</p> <p>Regarding timing attacks: libntruprime is designed to avoid all data flow from secret data to memory addresses and branch conditions. libntruprime uses operations that naturally avoid such data flow, and includes <code>valgrind</code> tests (based on TIMECOP from SUPERCOP) designed to catch any such data flow introduced by compilers. Fully protecting the user against timing attacks requires addressing more issues, such as the following:</p> <ul> <li> <p>Other CPU instructions can take variable time. For example, there are some CPUs, especially embedded CPUs, where integer multiplication takes variable time. Most software for public-key cryptography relies on integer multiplication, although there are exceptions such as <a href="https://lib.mceliece.org">code-based cryptography</a>.</p> </li> <li> <p>Many CPUs include dynamic frequency-selection mechanisms such as <a href="https://blog.cr.yp.to/20230609-turboboost.html">Turbo Boost</a>, exposing power information via timing information. Fortunately, these CPUs are normally shipped with simple options to disable Turbo Boost etc., closing this leak; unfortunately, Turbo Boost is enabled by default on CPUs that support it.</p> </li> <li> <p>Cryptographic keys are normally handled by cryptographic software, but other user secrets are handled by many different pieces of software.</p> </li> </ul> <p>See <a href="https://timing.attacks.cr.yp.to">https://timing.attacks.cr.yp.to</a> for a timing-attack survey and many references.</p> <p>Speculative-execution attacks: Some countermeasures against speculative-execution attacks are planned but are not included in the current version of libntruprime. Full protection again requires addressing issues at other system layers.</p> <p>Further side-channel attacks: Even if all legitimate user sensors are successfully kept isolated from attackers, attackers can set up their own power sensors, electromagnetic sensors, acoustic sensors, etc. Keeping cryptographic operations physically separated from sensors tends to make such attacks much more expensive but is often infeasible. "Masking" cryptographic computations seems to help and can be affordable, although the security of masking is difficult to evaluate and there are many broken masked implementations. Currently libntruprime does not include any masked implementations, so presumably it is easily breakable by power attacks in environments where attackers can see power consumption.</p> <p>Further attacks: Presumably libntruprime is easily breakable by fault attacks in environments where attackers can trigger faults. Beyond attacker-triggered faults, natural DRAM faults occur surprisingly often. Implicit rejection <a href="https://cr.yp.to/papers.html#ntrw">fails</a> to provide IND-CCA2 security when DRAM faults corrupt the secret key used for implicit rejection, although attacks can be stopped by "plaintext confirmation", another layer of defense included in <code>sntrup</code>. Error correction is in any case recommended (and often not provided by hardware), and there is a general-purpose <a href="https://pqsrc.cr.yp.to/downloads.html">libsecded</a> library that applies error correction to any array, although this does not catch errors that occur during computations.</p><hr><font size=1><b>Version:</b> This is version 2024.08.15 of the "Security" web page. </font> </div> </body> </html>