Henry de Valence
d41dbb1fe4
Replace some binary constants with named constants
2018-01-03 12:34:25 -08:00
Henry de Valence
dd80421094
Move field constants to constants module
2018-01-03 12:13:52 -08:00
Isis Lovecruft
28f114f127
Combine differential_add and differential_double in Montgomery ladder.
2017-12-24 00:17:15 +00:00
Henry de Valence
ce68b8d72b
Document bounds yoga in doubling
2017-12-18 14:48:44 -08:00
Henry de Valence
af3c2b2821
Document readdition
2017-12-18 13:58:37 -08:00
Henry de Valence
c0f64009a7
Implement readdition using a CachedPoint type
2017-12-18 11:42:53 -08:00
Henry de Valence
80813e81b1
make diff_sum maskable
2017-12-15 15:24:13 -08:00
Henry de Valence
0f6171b788
Try to make stdsimd an optional dependency
2017-12-15 13:57:01 -08:00
Henry de Valence
caf296a546
Try to make target_feature work on stable
2017-12-15 13:57:01 -08:00
Henry de Valence
70f710eafe
Use the LookupTable struct in AVX2 code
2017-12-15 13:57:01 -08:00
Henry de Valence
34f44dcf5d
Merge branch 'develop' into feature/avx2_r8
2017-12-15 11:37:10 -08:00
Henry de Valence
640888198e
Eliminate a carry pass through tighter bounds checks
2017-12-14 14:17:34 -08:00
Henry de Valence
a3f53c9134
Refactor select_precomputed_point into a LookupTable struct.
...
Originally this was for hygiene, so that we could erase points from
heap-allocated memory in multiscalar_mult, but it ends up providing a cleaner
API for scalar multiplication.
It's kept inside curve_models for now, but it could go somewhere else if that's a better place.
2017-12-07 12:46:57 -08:00
Henry de Valence
98a78d7a58
Clear scalar digits from memory in multiscalar_mult
2017-12-07 12:34:40 -08:00
Henry de Valence
d62fc7caf1
Rearrange signs to avoid a subtraction
2017-12-07 10:55:33 -08:00
Henry de Valence
1d39d2ec6e
Implement Default for internal point types
2017-12-06 17:30:19 -08:00
Henry de Valence
7d2d87441b
Connect double_scalar_mult_basepoint to AVX2 backend
2017-12-04 11:05:24 -08:00
Henry de Valence
2c29d9a2ad
tweak docs
2017-12-04 10:37:37 -08:00
Henry de Valence
3814beeafe
Fix typo and add note on AVX512VL
2017-12-04 10:37:37 -08:00
Henry de Valence
bf5e3581d2
Update AVX2 docs
2017-12-04 10:37:37 -08:00
Henry de Valence
1103c5c43a
Implement Sub by pre-negating the point
2017-12-04 10:37:37 -08:00
Henry de Valence
e3579995c0
Add double-base scalar vartime for AVX2
2017-12-04 10:37:37 -08:00
Henry de Valence
9213dc0bbb
Implement point subtraction
2017-12-04 10:37:37 -08:00
Henry de Valence
3094866442
Fix up after Scalar API changes
2017-12-04 10:37:37 -08:00
Henry de Valence
ba071f12aa
Write up notes on the AVX2 backend
2017-12-04 10:37:37 -08:00
Henry de Valence
3d435a1f4f
Fix up tests to use new Scalar API
2017-12-04 10:37:37 -08:00
Henry de Valence
b5305b4e30
Connect multiscalar_mult to the AVX2 backend
2017-12-04 10:37:37 -08:00
Henry de Valence
912fc5d412
Never build avx2 without avx2
2017-12-04 10:37:37 -08:00
Henry de Valence
97fe2f0bf4
Try to connect the AVX2 backend to the ExtendedPoint frontend
2017-12-04 10:37:37 -08:00
Henry de Valence
77766b3422
Add benchmark for conversion to avx2 format
2017-12-04 10:37:37 -08:00
Henry de Valence
208180dc72
Simplify mul, square implementations
2017-12-04 10:37:37 -08:00
Henry de Valence
f28635ab4e
Add a new 'avx2_backend' yolocrypto feature
2017-12-04 10:37:37 -08:00
Henry de Valence
841e0d5b64
Fix wrong feature for benchmarks
2017-12-04 10:37:37 -08:00
Henry de Valence
81ecef89ee
Connect AVX2 and u64 backends
2017-12-04 10:37:37 -08:00
Henry de Valence
ed24d1c5fa
Move AVX2 code into a backend
2017-12-04 10:37:37 -08:00
Henry de Valence
2b37a65d66
Remove debugging code
2017-12-04 10:37:37 -08:00
Henry de Valence
1ba7cb1e2c
Add stub implementations of multiscalar mult
2017-12-04 10:37:37 -08:00
Henry de Valence
7354b569bb
Add 32bit reduction code
2017-12-04 10:37:37 -08:00
Henry de Valence
e7ec5b3dd1
Add basepoint table code
2017-12-04 10:37:37 -08:00
Henry de Valence
34ae1b15e0
Add a squaring implementation
2017-12-04 10:37:37 -08:00
Henry de Valence
2f32f6355c
Add doubling skeleton and scalar mult
2017-12-04 10:37:37 -08:00
Henry de Valence
9e383ffccb
Add doubling test harness
2017-12-04 10:37:37 -08:00
Henry de Valence
e2a2b3a3b5
Add comment to mul draft
2017-12-04 10:37:37 -08:00
Henry de Valence
4f6788c72d
First working version
2017-12-04 10:37:37 -08:00
Henry de Valence
15b88be2d2
Add serial implementation of the algorithm and a test
2017-12-04 10:37:37 -08:00
Henry de Valence
51f04d7cce
first avx2 code
2017-12-04 10:37:37 -08:00
Isis Lovecruft
c71d41ddcc
Whitespace fixes.
2017-12-04 01:17:17 +00:00
Isis Lovecruft
9824894eb1
Merge remote-tracking branch 'hdevalence/feature/texify-formulas' into develop
2017-12-04 01:10:54 +00:00
Henry de Valence
c0633ae2d7
KaTeXify some backend documentation
2017-12-01 11:46:36 -08:00
Henry de Valence
2d6d79dc21
KaTeXify more of edwards.rs
2017-11-30 17:36:56 -08:00
Henry de Valence
10bba1207b
KaTeXify and document basepoint tables
2017-11-30 17:11:25 -08:00
Henry de Valence
786e4b65a8
Add reference to from_bytes_mod_order_wide ctor
2017-11-30 16:48:29 -08:00
Henry de Valence
bb9c171487
fix typo in internal Scalar docs
2017-11-30 16:46:46 -08:00
Henry de Valence
1caed9a4fc
Remove Scalar::multiply_add
2017-11-30 16:44:51 -08:00
Henry de Valence
9e892dd5f3
Rename reduce_wide to from_bytes_mod_order_wide and keep it with the other constructors
2017-11-30 16:44:10 -08:00
Henry de Valence
a6b4467d23
KaTeXify Scalar docs
2017-11-30 16:43:21 -08:00
Isis Lovecruft
d21b74ea36
Line wrap an inline comment.
2017-11-30 22:41:06 +00:00
Henry de Valence
beda5df2f1
Remove "scalar multiplication" since that's more of a scalar*point thing than just a scalar thing
2017-11-29 13:04:04 -08:00
Henry de Valence
2e9a3cba35
Remove reference to field elts since they're private
2017-11-29 13:03:01 -08:00
Henry de Valence
da8b12a62d
Align montgomery summary to match the edwards summary
2017-11-29 13:01:31 -08:00
Henry de Valence
c209b49264
Tweak description and fix formatting
2017-11-29 13:00:50 -08:00
Henry de Valence
442eba57c9
Comment out #[doc(hidden)] to allow impls to appear in internal docs.
...
This is related to https://github.com/rust-lang/rust/issues/46380 upstream.
2017-11-29 12:40:42 -08:00
Henry de Valence
d862912511
KaTeXify struct docs for internal point types
2017-11-29 12:30:51 -08:00
Henry de Valence
b2a85da09d
Edit curve model description to use KaTeX
2017-11-29 12:07:55 -08:00
Isis Lovecruft
88200f9fc9
Fix Scalar.to_bytes() after merging PR#88.
2017-11-26 04:16:12 +00:00
Isis Lovecruft
220c6c1d13
Merge remote-tracking branch 'hdevalence/feature/refactor-scalar-api' into develop
2017-11-26 04:15:04 +00:00
Isis Lovecruft
227acc117b
Whitespace fix.
2017-11-26 03:26:47 +00:00
Isis Lovecruft
7a0c0e9d0d
Change Debug for Scalar output to be valid Rust code.
2017-11-26 03:26:29 +00:00
Isis Lovecruft
87f93a5df2
Add to_bytes() convenience method for Scalar.
2017-11-26 03:23:31 +00:00
Isis Lovecruft
9a49263752
Add to_bytes() convenience method for CompressedRistretto points.
2017-11-26 03:22:28 +00:00
Henry de Valence
f165b63ee9
Encode scalars canonically using Serde.
2017-11-23 12:29:46 -08:00
Henry de Valence
c1f6302879
Add a Scalar::from_bytes_canonical method
2017-11-23 12:29:46 -08:00
Henry de Valence
9855260bfd
Add a method to test if a Scalar is canonical
2017-11-23 12:29:46 -08:00
Henry de Valence
34639725d4
clean up reduction test
2017-11-23 12:29:46 -08:00
Henry de Valence
d32fe9772b
Ensure that all Scalars are bounded by 2^255.
...
This commit defines a Scalar to hold an integer representing an element of
Z/lZ. Applications like X/Ed25519 that care about the bit-patterns of the
scalars they use can set a specific bit-pattern using the `from_bits`
constructor. Applications that want to treat scalars as integers mod l can use
the `from_bytes_mod_order` constructor. Either way, the constructor ensures
that the integer representing each Scalar is bounded by 2^255 so that the high
bit is set. This means that any Scalar object is always safe to use for scalar
multiplication, while maintaining compatibility with both the Ristretto
use-case and the X/Ed25519 usecase.
2017-11-23 12:29:46 -08:00
Henry de Valence
d88f92276a
Add Scalar::reduce method
2017-11-21 11:28:25 -08:00
Henry de Valence
df182b79d0
Rename Scalar::reduce to Scalar::reduce_wide
...
This opens the `Scalar::reduce` name for reduction mod l.
2017-11-21 11:06:54 -08:00
Henry de Valence
033a90890c
Remove Scalar::{add, sub, mul} methods
2017-11-21 10:43:49 -08:00
Henry de Valence
e94c6f0a96
Make more Scalar methods pub(crate)
2017-11-20 16:45:30 -08:00
Henry de Valence
2d69a8a7dc
Eliminate array_ref dependency
2017-11-20 14:53:08 -08:00
Henry de Valence
504a557b33
Hide UnpackedScalars
2017-11-17 15:51:29 -08:00
Henry de Valence
0cb70ae032
Hide the underlying ExtendedPoint from a Ristretto point
2017-11-17 15:50:58 -08:00
Henry de Valence
a9f8789524
hide unimplemented fns from docs
2017-11-17 15:50:04 -08:00
Henry de Valence
9fda4739d0
Hide fns using private types
2017-11-17 15:42:37 -08:00
Henry de Valence
78d9e70071
Move ExtendedPoint->MontgomeryPoint conversion to edwards.rs
...
Need to find a solution to the internal/external docs problem
2017-11-17 15:13:45 -08:00
Henry de Valence
2b0a4979b1
Fix indentation
2017-11-17 14:09:48 -08:00
Henry de Valence
8337a895d4
Only compress ExtendedPoints
2017-11-17 13:32:22 -08:00
Henry de Valence
7f52745770
Remove unused import
2017-11-16 20:11:18 -08:00
Henry de Valence
8d0808a077
Split internal curve models into a private submodule
2017-11-16 17:34:28 -08:00
Henry de Valence
e196f8347c
Move 32/64-bit code into submodules in a backend module.
...
See the doc comment in `backend/mod.rs` for motivation on naming.
2017-11-16 16:07:55 -08:00
Henry de Valence
6ce7a4ee2d
Remove catchall 'utils' module
2017-11-16 12:13:13 -08:00
Henry de Valence
e4f5f23b8d
fixup! Merge branch 'optimzed_scalar_r1' into develop
2017-11-16 12:13:13 -08:00
Henry de Valence
207af566b9
Replace signed constants with unsigned constants
2017-11-16 12:13:13 -08:00
Henry de Valence
83e20b5387
cfg-gate all tests using precomputed tables
2017-11-16 12:13:13 -08:00
Henry de Valence
8952c7f476
initial work on rewriting 32bit arithmetic
2017-11-16 12:13:13 -08:00
Henry de Valence
399a9db478
Generate AFFINE_ODD_MULTIPLES_OF_BASEPOINT at compile time
2017-11-16 12:13:13 -08:00
Henry de Valence
e7387650f6
Remove warnings from build.rs
2017-11-16 12:13:13 -08:00
Henry de Valence
108a690941
First attempt at generating basepoint tables at compile time
2017-11-16 12:13:13 -08:00
Henry de Valence
b966f942a8
Impl Debug for EdwardsBasepointTable
2017-11-16 11:09:45 -08:00
Henry de Valence
6f5f0c51fd
Tweak Debug impls to produce Rust source
2017-11-16 11:09:32 -08:00