1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
lokinet/crypto/libntrup/src/ref
2019-09-03 08:02:35 -05:00
..
api.h restructure original code into libntrup 2018-08-13 11:43:27 -04:00
dec.c make android compile 2019-04-08 11:54:19 -04:00
enc.c bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
implementors restructure original code into libntrup 2018-08-13 11:43:27 -04:00
int32_sort.c bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
int32_sort.h bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
keypair.c bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
mod3.h bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
modq.h bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
params.h make format crypto/ 2019-09-03 08:02:35 -05:00
r3.h make format crypto/ 2019-09-03 08:02:35 -05:00
r3_mult.c make format crypto/ 2019-09-03 08:02:35 -05:00
r3_recip.c purge VLAs from the codebase 2018-11-09 07:25:14 -05:00
random32.c fix typo 2019-02-18 05:12:13 -08:00
randomsmall.c bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
randomweightw.c bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
README restructure original code into libntrup 2018-08-13 11:43:27 -04:00
rq.c sun fix 2019-08-27 06:53:08 -05:00
rq.h make format crypto/ 2019-09-03 08:02:35 -05:00
rq_mult.c make format crypto/ 2019-09-03 08:02:35 -05:00
rq_recip3.c purge VLAs from the codebase 2018-11-09 07:25:14 -05:00
rq_round3.c make format crypto/ 2019-09-03 08:02:35 -05:00
rq_rounded.c bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
small.c make format crypto/ 2019-09-03 08:02:35 -05:00
small.h bundle relevent libsodium parts 2018-10-23 07:29:37 -04:00
swap.c make format crypto/ 2019-09-03 08:02:35 -05:00
swap.h make format crypto/ 2019-09-03 08:02:35 -05:00

This is a reference implementation of Streamlined NTRU Prime 4591^761.
This implementation is designed primarily for clarity, subject to the
following constraints:

   * The implementation is written in C. The Sage implementation in the
     NTRU Prime paper is considerably more concise (and compatible).

   * The implementation avoids data-dependent branches and array
     indices. For example, conditional swaps are computed by arithmetic
     rather than by branches.

   * The implementation avoids other C operations that often take
     variable time. For example, divisions by 3 are computed via
     multiplications and shifts.
     
This implementation does _not_ sacrifice clarity for speed.

This implementation has not yet been reviewed for correctness or for
constant-time behavior. It does pass various tests and has no known
bugs, but there are at least some platforms where multiplications take
variable time, and fixing this requires platform-specific effort; see
https://www.bearssl.org/ctmul.html and http://repository.tue.nl/800603.

This implementation allows "benign malleability" of ciphertexts, as
defined in http://www.shoup.net/papers/iso-2_1.pdf. Specifically, each
32-bit ciphertext word encodes three integers between 0 and 1530; if
larger integers appear then they are silently reduced modulo 1531.
Similar comments apply to public keys.

There is a separate "avx" implementation where similar comments apply,
except that "avx" _does_ sacrifice clarity for speed on CPUs with AVX2
instructions.