Commit graph

1097 commits

Author SHA1 Message Date
Henry de Valence
c841998b07 Extract Ristretto notes into a markdown file 2018-04-05 14:52:00 -07:00
Henry de Valence
ef0dae241a Add an explanatory note that's built on stable
When building on stable, the README.md is not included in the documentation,
leaving a bare entry. This adds a warning stub, pointing people to use nightly
rust.
2018-04-05 14:52:00 -07:00
Henry de Valence
51f9823c91 Create a new docs/ subtree and move assets into it 2018-04-05 14:52:00 -07:00
Henry & Isis
62d43752df
Add NafLookupTable8 and use for pre-computed basepoint table generation. 2018-04-05 05:12:13 +00:00
Henry & Isis
753a0292de
Rename OddLookupTable to NafLookupTable5.
An OddLookupTable corresponds to a non-adjacent form of width 5.
2018-04-05 04:48:28 +00:00
Henry de Valence
7e0ddf6b98 Rewrite NAF code to work with more window sizes
Change Scalar::non_adjacent_form() to take a width parameter.

This rewrite also makes it faster, although it's probably a ways off
from optimal. I don't know how much it matters.

TODO: write up description of why this computes the same thing.

Thanks to @oleganza for pointing out an error reading bits across words
in an earlier version of this code.
2018-04-04 21:13:09 -07:00
Henry de Valence
ece4bd715a Merge branch 'master' into develop 2018-04-04 15:35:16 -07:00
Henry de Valence
bf41bde917 Merge branch 'release/0.16.1' 2018-04-04 15:34:40 -07:00
Henry de Valence
207fbb640e Bump version to 0.16.1 2018-04-04 15:30:12 -07:00
Henry de Valence
05c1d073d1
Merge pull request #123 from hdevalence/feature/drop-bench-travis
Drop benchmarks from Travis
2018-04-04 15:23:50 -07:00
Henry de Valence
46d8f9c45d
Merge pull request #122 from hdevalence/feature/drop-stdsimd
Move from external `stdsimd` crate to `core::{arch, simd}` intrinsics
2018-04-04 11:06:23 -07:00
Henry de Valence
5f136fbd0c Remove some warnings.
Not all of the warnings are removed, since although this code works, it still
needs a significant amount of cleanup, editing, and polish.
2018-04-04 10:25:42 -07:00
Henry de Valence
1048100cd0 Reduce benchmark runs 2018-04-04 10:16:32 -07:00
Henry de Valence
f830268128 Drop benchmarks from Travis 2018-04-04 10:00:18 -07:00
Henry de Valence
b0bda0278c Drop the stdsimd crate in favor of core::{simd, arch}.
This change required some work, because the to-be-stabilized SIMD functions
don't allow non-constant `imm8`s.  Previously, the `stdsimd` functions had a
constifying macro that ensured that the immediates were known.  The dalek code
used this to build helper functions which would be inlined into different
places where the immediates were known.  Unfortunately, since constexprs aren't
fully supported in Rust yet, this is done by a hidden compiler attribute, and
there's no way to propagate "constness".

To deal with this, some of the functions are specialized (e.g.,
`square_and_negate_D` instead of taking a mask), and others use an enum.
2018-04-03 17:58:23 -07:00
Henry de Valence
2465e0f962
Merge pull request #121 from isislovecruft/feature/montgomery-mul-variants
Define mul variants for MontgomeryPoints.
2018-04-03 10:06:48 -07:00
Isis Lovecruft
3281708965
Define mul variants for MontgomeryPoints.
This results in less changes to the x25519-dalek code to upgrade to
the latest version.
2018-04-02 21:09:41 +00:00
Isis Lovecruft
1a8cf7beed
Merge remote-tracking branch 'hdevalence/feature/refactor-scalar-mul_r1' into develop 2018-04-02 21:03:17 +00:00
Henry de Valence
4a648df713 Feature-gate multiscalar impls on alloc 2018-03-26 17:58:31 -07:00
Henry de Valence
7ef6a1e6fa Reorganize AVX2 point code 2018-03-26 17:41:05 -07:00
Henry de Valence
e8b053b281 Remove AVX2 addition formulas
Only the readdition formulas are actually used by scalar multiplication, so
there's no reason to implement vectorized addition.
2018-03-26 17:41:05 -07:00
Henry de Valence
c73a0fd0d6 Remove AVX2 fixed-base code.
This was faster than the non-AVX2 code, but the serial code is already so fast that there's no reason not to use it.
2018-03-26 17:41:05 -07:00
Henry de Valence
0c4e7188a0 Pull out vartime double-base scalar mul code 2018-03-26 17:41:05 -07:00
Henry de Valence
2d99892eab Pull out variable-time straus implementation 2018-03-26 17:41:05 -07:00
Henry de Valence
2864a422bc Pull out constant-time straus implementation 2018-03-26 16:04:17 -07:00
Henry de Valence
ac739a3edd Split out constant-time variable-base scalar mul.
The serial (`u32`/`u64`) implementations use a multiple curve models, passing
between extended and projective coordinates when performing addition and
doubling (respectively). But the AVX2 backend doesn't, so in order to write a
single scalar mult implementation, we have to either abstract over the curve
models or have two implementations.

A generic solution is possible but extremely unreadable: the scalar mul
implementation would be parameterized over the point types used by the serial
implementations, with many where clauses describing how the types relate. The
AVX2 types could then be substituted in the appropriate places.

Instead we just duplicate the code into the `avx2` backend.
2018-03-26 16:01:51 -07:00
Henry de Valence
76a8d43a04 Create a new scalar_mul module hierarchy.
This should contain generic implementations of scalar multiplication algorithms
that can be used with multiple backends.  The goal is to move the existing
scalar multiplication code into this submodule, then call it from the
user-facing API.  This can also contain code for things we can't do now, like
multiscalar multiplication with precomputation.
2018-03-26 14:34:28 -07:00
Henry de Valence
ed4b1c6b6b
Merge pull request #119 from hdevalence/feature/criterion
Use `criterion.rs` instead of libtest for benchmarks.
2018-03-25 19:42:02 -07:00
Henry de Valence
d6b8389428 Use criterion.rs instead of libtest for benchmarks.
Since Criterion can only benchmark public API, these changes just drop
all internal benchmarks (e.g., benchmarks for field operations). But
those are usually microbenchmarks whose meaning is kind of questionable
anyways, so I don't think this is a big loss.

The `bench` feature disappears, since Criterion works on stable Rust.
2018-03-25 17:14:37 -07:00
Henry de Valence
049e338430 Merge branch 'master' into develop 2018-03-22 12:37:41 -07:00
Henry de Valence
ffeb8cfadd Merge branch 'release/0.16.0' 2018-03-22 12:37:09 -07:00
Henry de Valence
ce439458a1 Bump version to 0.16.0 2018-03-22 12:35:41 -07:00
Henry de Valence
c9239f54e9 Merge branch 'fix/warnings' into develop 2018-03-22 12:34:31 -07:00
Henry de Valence
8091609bc1 Merge branch 'fix/avx2-docs' into develop 2018-03-22 12:20:13 -07:00
Henry de Valence
6f9c229e65 Remove Elligator stubs for now, since this isn't the API we want anyways 2018-03-22 12:17:23 -07:00
Henry de Valence
f2e44898ee Suppress warnings about square() on UnpackedScalars 2018-03-22 12:17:23 -07:00
Henry de Valence
0ba5c72122 This variable doesn't need to be mut since it's immediately consumed 2018-03-22 12:17:23 -07:00
Henry de Valence
e73b635fe0 Remove unused constants 2018-03-22 12:17:23 -07:00
Henry de Valence
844da9712b Fix AVX2 docs formatting, remove obsolete AVX512 note 2018-03-22 12:13:39 -07:00
Henry de Valence
d67e895619 Merge branch 'feature/rename-to-multiscalar-mul' into develop 2018-03-22 12:08:49 -07:00
Henry de Valence
132b1a9d77 Merge branch 'feature/ristretto-uniform-hash' into develop 2018-03-22 11:44:52 -07:00
Henry de Valence
7b0e6495e7 Merge branch 'feature/batch-scalar-inversion' into develop 2018-03-22 11:43:31 -07:00
Henry de Valence
2e73b2bc20 Use scalar_mul instead of scalar_mult 2018-03-22 11:40:13 -07:00
Henry de Valence
70eee5208a Rename double_scalar_mult_basepoint to double_scalar_mul_basepoint for consistency 2018-03-22 11:39:47 -07:00
Henry de Valence
296cd16463 Rename mult_by_cofactor to mul_by_cofactor for consistency 2018-03-22 11:36:34 -07:00
Henry de Valence
8de3d7576a Rename mult_by_pow_2 to mul_by_pow_2 for consistency 2018-03-22 11:35:42 -07:00
Henry de Valence
b48d568f47 Add debug_assert that Scalar::batch_invert inputs are nonzero 2018-03-22 11:32:00 -07:00
Henry de Valence
0e7d872ad0 Add batch inversion for Scalars 2018-03-22 11:32:00 -07:00
Henry de Valence
1f0e2d2ed6 Merge branch 'feature/subtle-choice_r1' into develop 2018-03-22 11:20:31 -07:00
Henry de Valence
792ac0775e Change to the updated subtle API. 2018-03-22 11:13:26 -07:00