Commit graph

1399 commits

Author SHA1 Message Date
Henry de Valence
63c19c1dcd Merge branch 'newpavlov-rand_core' into develop 2019-02-14 14:31:28 -08:00
Henry de Valence
cf7a1a4a0f Merge branch 'rand_core' of git://github.com/newpavlov/curve25519-dalek into newpavlov-rand_core 2019-02-14 14:29:58 -08:00
Henry de Valence
a1123e7cd3
Merge pull request #230 from hdevalence/updated-precomputation
Multiscalar multiplication with precomputation.
2019-02-14 12:18:29 -08:00
Henry de Valence
47967b49f0 Use rerandomized inputs for variable-time benchmarks.
This avoids potentially misleading benchmark results where the memory cost of
precomputation becomes "free" as re-running the benchmark loop lifts exactly
the required table entries into the highest-level caches.
2019-02-14 09:38:09 -08:00
Henry de Valence
2c3629b30e Add a separate benchmark for pure-fixed multiscalar mul. 2019-02-14 07:16:20 -08:00
Henry de Valence
092ff52cb0 Remove constant-time multiscalar precomputation.
This doesn't (yet) give any speedup over the non-precomputed multiscalar
multiplication, and it's not clear that it's a good idea to commit to
supporting it in the future.  Removing it means that it's not committed-to as
part of the public API, but the source is still there in the tree if we want to
revisit it later.
2019-02-13 12:26:31 -08:00
Henry de Valence
73eee8a1da
Merge pull request #231 from hdevalence/fix-to-monty-doc
Fix comment on Montgomery conversion.
2019-02-12 19:31:42 -08:00
Henry de Valence
96df60895f Fix comment on Montgomery conversion.
Closes #213.
2019-02-12 19:30:18 -08:00
Henry de Valence
27daa5215e Add Ristretto precomputation facade. 2019-02-12 12:52:02 -08:00
Henry de Valence
8adcfb7fa3 Simplify length checking. 2019-02-12 12:52:02 -08:00
Henry de Valence
727ba86292 Rework the vartime precomputation trait to be Option-al 2019-02-12 12:52:02 -08:00
Henry de Valence
e693d7f020 fixup AVX2 ascii blocks so they don't run as doctests 2019-02-12 12:52:02 -08:00
Henry de Valence
8b0ad2b03d Add vector implementation of precomputation. 2019-02-12 12:52:02 -08:00
Henry de Valence
c6acdfd5e2 Add serial implementation of precomputation. 2019-02-12 12:52:02 -08:00
Henry de Valence
5daff66079 Move cfgs into outer module. 2019-02-12 12:52:02 -08:00
Henry de Valence
00675b4c56 Add benchmarks for precomputed multiscalar multiplication. 2019-02-12 12:52:02 -08:00
Henry de Valence
98e713ef91 Add a trait for multiscalar multiplication with precomputation. 2019-02-12 12:52:02 -08:00
Sean Bowe
d71b6650d6
Check the equality of EdwardsPoints in the projective coordinates to avoid expensive compressions. 2019-02-06 17:45:25 -07:00
Henry de Valence
ff0dc4a3db Merge branch 'master' into develop 2019-01-27 23:19:44 -08:00
Henry de Valence
4bdccd7b7c Merge branch 'release/1.0.3' 2019-01-27 23:18:35 -08:00
Henry de Valence
9cd4551b40 Bump patch version 2019-01-27 23:17:27 -08:00
Henry de Valence
33e7d26513 Merge branch 'add-compressed-cteq-impls' into release/1.0.3 2019-01-27 23:16:48 -08:00
Henry de Valence
5ddc30061c Implement ConstantTimeEq on compressed points. 2019-01-27 23:13:58 -08:00
Henry de Valence
6d7d94372e
Merge pull request #227 from isislovecruft/fix/weird-pub
I found a weird pub, not the kind you get cidre in.
2019-01-24 14:12:10 -08:00
Isis Lovecruft
0d23260a75
I found a weird pub, not the kind you get cidre in. 2019-01-24 21:36:00 +00:00
Henry de Valence
8e5062521f
Merge pull request #225 from isislovecruft/fix/invsqrt-doc-typos
Fix two typos in FieldElement::invsqrt documentation
2019-01-21 18:50:14 -08:00
Isis Lovecruft
4270d4ff5f
Fix two typos in FieldElement::invsqrt documentation. 2019-01-22 01:01:08 +00:00
Henry de Valence
353e3fe81a
Merge pull request #215 from hdevalence/ifma
Restructure vector backends and add a new IFMA backend
2019-01-19 21:51:13 -08:00
Henry de Valence
e3ca8961fc Fix rustdoc feature flags to compile on stable. 2019-01-18 14:19:39 -08:00
Henry de Valence
9ddbf1ba83 Add notes on the IFMA implementation. 2019-01-18 14:19:39 -08:00
Henry de Valence
dc8431429f Refactor documentation to use doc_cfg. 2019-01-18 14:19:39 -08:00
Henry de Valence
5700add507 Clean up warnings. 2019-01-18 14:19:30 -08:00
Henry de Valence
fa42708257 Change naming scheme for multiplication accumulators. 2019-01-18 14:19:30 -08:00
Henry de Valence
a84f9eafe4 Allow non_snake_case in the IFMA field and edwards modules. 2019-01-18 14:19:30 -08:00
Henry de Valence
06766bfdea Delay shuffles that cross the "Great Wall of Intel". 2019-01-18 14:19:30 -08:00
Henry de Valence
33aa544cf4 Add IFMA constants file. 2019-01-18 14:19:30 -08:00
Henry de Valence
f825426ff4 Add impl Default, Identity for ExtendedPoint, CachedPoint. 2019-01-18 14:19:30 -08:00
Henry de Valence
da62569355 Add lookup table support. 2019-01-18 14:19:30 -08:00
Henry de Valence
6cec313f16 Add impl of Sub and Neg for Edwards points. 2019-01-18 14:19:30 -08:00
Henry de Valence
6faaef21df Add mul_by_pow_2 for IFMA 2019-01-18 14:19:30 -08:00
Henry de Valence
8e38ff2859 Add Edwards doubling implementation. 2019-01-18 14:19:30 -08:00
Henry de Valence
c4617b28a9 Add squaring implementation. 2019-01-18 14:19:30 -08:00
Henry de Valence
a62571b003 Reduce field elements during conversion to vector form.
The IFMA types have tighter bounds than the u64 types.
2019-01-18 14:19:30 -08:00
Henry de Valence
3f21bb3b58 Add skeleton of parallel Edwards formulas. 2019-01-18 14:19:30 -08:00
Henry de Valence
5880fced2b Add skeleton of shuffle and blend functions. 2019-01-18 14:19:30 -08:00
Henry de Valence
d90bb779ca Delay all computations using x[0], y[0]
Since computation of the 0 term in reduction requires a multiplication with a
4-cycle latency, this ensures that the rest of the computation can start before
the 0 term is finished
2019-01-18 14:19:30 -08:00
Henry de Valence
c925c76342 Change the strategy for reducing the high half of the product. 2019-01-18 14:19:30 -08:00
Henry de Valence
607b839032 Change size of limbs in the reduction test. 2019-01-18 14:19:30 -08:00
Henry de Valence
14163131f9 Lift the reduction state of the field elements into the type system.
This splits the `FieldElement51x4` type into two types:

- `F51x4Reduced` (with reduced limbs)
- `F51x4Unreduced` (with unreduced limbs)

The reduction is implemented as a `From` impl to convert one type to the other.

The output of a multiplication is now a `F51x4Unreduced`.  The reason is that
the inputs to IFMA operations must be at most 52 bits, so it's not possible to
perform an addition of (51+epsilon)-bit values and still be small enough to be
used as an input to multiplication.  So, it doesn't make sense to perform a
reduction at the end of a multiplication, because the reduced values will be
fed into an addition or subtraction, which then needs to be re-reduced.
2019-01-18 14:19:30 -08:00
Henry de Valence
ff49673214 Add impl Mul<(u32, u32, u32, u32)> for FieldElement51x4. 2019-01-18 14:19:30 -08:00