Henry de Valence
2e9a3cba35
Remove reference to field elts since they're private
2017-11-29 13:03:01 -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
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
207af566b9
Replace signed constants with unsigned constants
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
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
8f68b7a3ed
Remove MSQRT_M1 constant
2017-10-31 14:10:33 -07:00
Henry de Valence
a7835a1246
UPPERCASE_GLOBALS and add documentation
2017-10-30 17:33:23 -07:00
Henry de Valence
089efbbbbe
Prune constants that are no longer used anywhere
2017-10-30 16:53:39 -07:00
Henry de Valence
8c3ae7f010
Remove 'yolocrypto' from Ristretto
2017-10-30 16:34:36 -07:00
Henry de Valence
b6bfc79cd1
Fix up Elligator tests to match ristretto.sage
2017-10-30 16:34:36 -07:00
Henry de Valence
58a55117be
Rename Decaf to Ristretto
2017-10-30 16:34:36 -07:00
Isis Lovecruft
acd3826fe2
Implement Montgomery arithmetic and laddering.
...
* ADDs part of https://github.com/isislovecruft/curve25519-dalek/issues/47
2017-09-14 02:09:14 +00:00
Isis Lovecruft
17290db44c
Update copyright/license headers in source files.
2017-08-15 05:09:20 +00:00
Henry de Valence
c29103d109
Rename _BASEPOINT to _BASEPOINT_POINT.
...
Having _BASEPOINT_TABLE and _BASEPOINT_POINT means that it's not possible to
use the slow, generic scalar mult in place of the fast, precomputed scalar
mults.
2017-08-14 00:20:18 -07:00
Henry de Valence
8ad02e2f57
Move curve.rs to edwards.rs
2017-08-02 22:35:12 -07:00
Henry de Valence
f72de04003
Remove unneeded imports to suppress warnings
2017-07-30 16:29:37 -07:00
Henry de Valence
77103986a3
Split field arithmetic into per-implementation files
...
Split the field arithmetic implementations into `FieldElement`,
`FieldElement32`, and `FieldElement64`. `FieldElement` is a type alias for one
of `FieldElement32` or `FieldElement64`, depending on feature selection.
`field.rs` contains tests and code which is generic with respect to the
implementation (e.g., inversions), while `field_32bit.rs` and `field_64bit.rs`
contain the implementation-specific code.
The implementation is not completely hidden, since `FieldElement32` and
`FieldElement64` are tuple structs whose elements are public; `pub(crate)`
doesn't seem to work for tuple structs.
Similarly, the constants file is split over multiple files, depending on the
implementation.
2017-07-30 16:25:42 -07:00
Henry de Valence
52e51bdb16
Add constants for 1/sqrt(a-d) and 1/(a-d)
2017-05-20 21:39:58 -07:00
Henry de Valence
0678e619cc
Implement Mul for basepoint tables
2017-05-03 19:32:30 -07:00
Henry de Valence
6ea1d4dad2
Add an implementation of Scalar inversion
2017-04-28 22:59:56 -07:00
Henry de Valence
b5ccb42759
Rename lminus1 to l_minus_1
2017-04-28 22:54:00 -07:00
Henry de Valence
73e172484c
Add tick marks around code items in docs
2017-04-02 23:12:18 +02:00
Henry de Valence
cf9f9aa402
Enable radix_51 on nightly
2017-03-13 17:04:37 -07:00
Henry de Valence
d6465ccd5e
Fix remaining compile errors for radix_51
2017-03-13 16:38:05 -07:00
Henry de Valence
3eab4acbd8
Add p constant for subtraction
2017-03-13 16:38:05 -07:00
Henry de Valence
08ef9e5d1e
Add constants in radix_51 form
2017-03-13 16:38:05 -07:00
Henry de Valence
afd42a4628
More feature-gating
2017-03-13 16:38:05 -07:00
Henry & Isis
c873f725a5
Rename BasepointTable as EdwardsBasepointTable.
2017-03-13 15:50:43 -07:00
Henry de Valence
640f40287f
Wrap the existing basepoint table as a BasepointTable
2017-03-13 15:50:43 -07:00
Henry de Valence
b61ed818b8
Remove all remaining warnings
2017-03-07 01:37:31 -08:00
Henry de Valence
0585af6c68
Move sqrt(-(A+2)) test to constants.rs
2017-03-07 00:03:59 -08:00
Henry & Isis
e5f5dea444
Rename to_{cached,precomputed} to to_{projective,affine}_niels
2017-03-05 15:27:26 -08:00
Henry de Valence
45fbcb45f6
First notes and code on Montgomery conversion
2017-02-27 13:41:50 -08:00
Isis Lovecruft
e6b7192d5e
Merge branch 'feature/rename-niels-point' into develop
2017-02-25 01:26:33 +00:00
Isis Lovecruft
a649ea38ee
Rename {PreComputed,Cached}Point → {Affine,Projective}NielsPoint.
...
* FIXES Issue #28 : https://github.com/isislovecruft/curve25519-dalek/issues/28
2017-02-25 00:47:06 +00:00
Henry de Valence
a202f36916
Rewrite invsqrt to avoid using an Option type.
2017-02-22 16:24:11 -08:00
Henry de Valence
f93dd4ccf5
Use is_identity() in the torsion subgroup tests.
...
ht @dconnolly for pointing this out
2017-02-21 15:13:18 -08:00
Henry & Isis
f52e2ee37e
Create BasepointMult and ScalarMult traits.
2017-02-21 13:38:59 -08:00
Henry de Valence
a415caa9fb
Add a seperate invsqrt function.
...
This code isn't constant-time, but maybe should be. However that would
prevent a bunch of nice things (e.g., Option types). Probably good to
think about this.
2017-02-21 13:38:58 -08:00
Henry de Valence
5720e249ab
Add constants for points of the eight-torsion subgroup.
2017-02-21 13:23:57 -08:00
Henry de Valence
82041c2c67
Add constant for bytes of (p-1)/2.
2017-02-21 13:23:11 -08:00
Henry de Valence
363ea405d4
Add constant for a-d = -1-d
2017-02-21 13:23:11 -08:00
Henry de Valence
6fd3028956
Add constant for 4*d
2017-02-21 13:23:10 -08:00
Henry de Valence
fb0c431184
Add constant for MSQRT_M1, equal to -SQRT_M1
2017-02-21 13:23:10 -08:00
Henry de Valence
e1feb653be
Add constant value of 1/2 (mod p)
2017-02-21 13:23:10 -08:00
Isis Lovecruft
32da4c7d50
Implement Neg for Scalar.
2017-02-21 05:41:14 +00:00
Isis Lovecruft
d4cccbc4d8
Whitespace cleanup in constants module.
2017-01-27 01:38:56 +00:00