Lattice-based cryptography is dangerous.
Fast attacks have been demonstrated breaking, e.g.,
[Compact LWE](https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/_fOnZNYHdE4/m/-WNWqwUFAwAJ),
[HILA5](https://eprint.iacr.org/2017/1214),
and [Round2](https://eprint.iacr.org/2020/241),
all of which were small lattice-based cryptosystems
submitted to the NIST post-quantum competition.
The
[supposedly](https://web.archive.org/web/20231125213807/https://finiterealities.net/kyber512/)
[well-studied](https://web.archive.org/web/20231219201240/https://csrc.nist.gov/csrc/media/Projects/post-quantum-cryptography/documents/faq/Kyber-512-FAQ.pdf)
problems
at the heart of all lattice-based cryptosystems
[continue](https://eprint.iacr.org/2025/1910)
to [lose](https://eprint.iacr.org/2025/2189)
[security](https://eprint.iacr.org/2026/279).
The
[supposedly "constant time"](https://web.archive.org/web/20170709203748/https://eprint.iacr.org/2017/634.pdf)
reference software for Kyber (ML-KEM)
then had three rounds of security patches for three different timing attacks
[demonstrated](https://kyberslash.cr.yp.to)
to be
[exploitable](https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/hqbtIGFKIpU).

Unlike most proposals of lattice-based cryptosystems,
`sntrup`
[acknowledges lattice risks](https://ntruprime.cr.yp.to/warnings.html)
and is
[designed accordingly](https://ntruprime.cr.yp.to).
Furthermore,
the `sntrup` 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
[mathematical](https://s-unit.attacks.cr.yp.to) level
and at the software level.
**When you're deploying post-quantum cryptography,
make sure to deploy it as an
[_extra_ layer of encryption](https://blog.cr.yp.to/20240102-hybrid.html)
on top of your existing use of ECC,
not as a replacement for ECC.**

The rest of this page covers specific software-security issues:
[bugs](#bugs),
[timing attacks](#timing),
[speculative-execution attacks](#speculative),
[further side-channel attacks](#furthersca),
[further attacks](#furtherattacks).

### Bugs {#bugs}

One risk for libntruprime
is the risk of bugs getting past the libntruprime
[tests](test.html).
The main defense in progress is
[software verification](verification.html).
Until verification is complete,
libntruprime is limiting code size:
it includes
[general AVX2 optimizations](speed.html)
but skips the software from
[nine publications with further `sntrup` speedups](speed.html#faster).
Also, libntruprime is limiting compiler optimizations to `-O2` rather than `-O3`.

### Timing attacks {#timing}

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 `valgrind` 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:

* 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
  [code-based cryptography](https://lib.mceliece.org).

* Many CPUs include dynamic frequency-selection mechanisms
  such as
  [Turbo Boost](https://blog.cr.yp.to/20230609-turboboost.html),
  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.

* Cryptographic keys are normally handled by cryptographic software, but
  other user secrets are handled by many different pieces of software.

See [https://timing.attacks.cr.yp.to](https://timing.attacks.cr.yp.to)
for a timing-attack survey and many references.

### Speculative-execution attacks {#speculative}

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.

### Further side-channel attacks {#furthersca}

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](https://tches.iacr.org/index.php/TCHES/article/view/11238),
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.

### Further attacks {#furtherattacks}

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 [fails](https://cr.yp.to/papers.html#ntrw)
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 `sntrup`.
Error correction is in any case recommended
(and often not provided by hardware),
and there is a general-purpose
[libsecded](https://pqsrc.cr.yp.to/downloads.html) library
that applies error correction to any array,
although this does not catch errors that occur during computations.
