Isis Lovecruft
583a45ddc2
Add test that scalar Montgomery reduction matches reduction.
2017-10-31 01:18:52 +00:00
Isis Lovecruft
e2cbec81fc
Add test that UnpackedScalar::{to,from}_bytes() roundtrips.
2017-10-31 01:02:20 +00:00
Henry de Valence
aaa2315703
add failing test case from fuzzer
2017-10-30 22:25:34 +00:00
Isis Lovecruft
6079b0269f
Revert "Revert "Merge remote-tracking branch 'floodyberry/optimized_scalar' into develop""
...
This reverts commit 90b69c13ee .
Signed-off-by: Isis Lovecruft <isis@torproject.org>
2017-10-30 19:27:44 +00:00
Isis Lovecruft
90b69c13ee
Revert "Merge remote-tracking branch 'floodyberry/optimized_scalar' into develop"
...
This reverts commit 804dab8924 , reversing
changes made to 5d15ca77ff .
This is due to a (previously undocumented) contract on the behaviours of
(potentially unreduced mod \ell) "packed" scalars w.r.t. to the manner in which
their bytes are interpreted.
Upon documentation fixes and corresponding fixes being made on top of the
floodyberry/optimized_scalar branch, this revert will again be reverted and then
the additional changes merged (à la
file:///usr/share/doc/git/html/howto/revert-a-faulty-merge.html).
Signed-off-by: Isis Lovecruft <isis@patternsinthevoid.net>
2017-10-16 21:41:52 +00:00
Andrew Moon
7e53499a10
optimized scalar implementations for 32/64 bit
2017-09-24 22:24:35 -05:00
Brian Smith
7ed9eb8617
Replace one multiplication with a squaring in scalar inversion.
...
This brings the code up to date with the 2017-09-04 version of
the source article.
2017-09-04 09:45:13 -10:00
Brian Smith
028140bb33
Reformat addition chain window building code to better show pattern.
...
Make the 2 digit, `_10`, the first argument to more closely match the
Haskell code in the source article. Align the code into columns to
further clarify the patterns.
2017-09-04 09:23:27 -10:00
Brian Smith
91a7c641c2
Use more efficient addition chain for scalar inversion.
...
Use the addition chain from
https://briansmith.org/ecc-inversion-addition-chains-01#curve25519_scalar_inversion .
In my benchmarking, this consistently runs at least 20% faster.
2017-09-03 17:00:42 -10:00
khyperia
6747133519
Optimize scalar inversion by implementing square()
...
This shows an 11% speedup for invert()
2017-08-21 21:35:26 -07:00
Isis Lovecruft
17290db44c
Update copyright/license headers in source files.
2017-08-15 05:09:20 +00:00
Isis Lovecruft
f2883028dc
Use subtle version 0.2.0.
...
* CLOSES PR#66 https://github.com/isislovecruft/curve25519-dalek/pull/66
2017-08-01 02:22:43 +00:00
Isis Lovecruft
4bcf8bed9d
Move subtle to its own crate.
2017-05-31 21:20:56 +00:00
Isis Lovecruft
674a00df5b
Some rustfmt fixes. I disagreed with all the other ones.
2017-05-28 22:42:09 +00:00
Isis Lovecruft
0c38718346
Rename subtle::arrays_equal_ct() to subtle::arrays_equal().
...
It's already obvious that it's constant-time because it's in the subtle
module.
2017-05-26 22:35:45 +00:00
Henry de Valence
69c62a8a17
Serde Scalar support
2017-05-15 22:40:09 -07:00
Isis Lovecruft
4a646806b8
Merge branch 'feature/scalarmult-lhs' into develop
2017-05-14 09:35:15 +00:00
Isis Lovecruft
61d07693ec
Merge remote-tracking branch 'hdevalence/feature/operator_scalar_mult_r2' into develop
2017-05-14 09:34:45 +00:00
Isis Lovecruft
ae11d4bc76
Merge remote-tracking branch 'hdevalence/feature/vartime-module' into develop
2017-05-14 09:34:14 +00:00
Isis Lovecruft
944e8e1649
Fix and allow some non-snakecased variables in scalar tests.
2017-05-09 00:05:11 +00:00
Isis Lovecruft
9a9959061d
Merge remote-tracking branch 'hdevalence/feature/clippy-fixes' into develop
2017-05-06 00:16:09 +00:00
Isis Lovecruft
8f4114a211
Merge remote-tracking branch 'hdevalence/feature/streamable-hash-to-scalar' into develop
2017-05-05 23:52:59 +00:00
Henry & Isis
c6dc9d318d
Add a helper function to construct a Scalar from a u64
2017-05-03 19:32:31 -07:00
Henry & Isis
7cbb8dd94e
Merge branch 'feature/streamable-hash-to-scalar' into develop
2017-05-03 19:32:09 -07:00
Henry de Valence
b05c897123
Implement operators for Scalars using multiply_add
2017-05-02 22:29:18 -07:00
Henry de Valence
91e11b6318
Change docstring to match the trait bound
2017-05-02 21:22:04 -07:00
Henry de Valence
6ea1d4dad2
Add an implementation of Scalar inversion
2017-04-28 22:59:56 -07:00
Henry de Valence
653f134bc7
Implement Mul, MulAssign, zero(), one() for UnpackedScalar
2017-04-28 22:57:17 -07:00
Henry de Valence
b5ccb42759
Rename lminus1 to l_minus_1
2017-04-28 22:54:00 -07:00
Henry de Valence
057c84abd5
Add a bits() function for scalars
2017-04-28 22:51:32 -07:00
Henry de Valence
7f4b96150d
Remove explicit lifetimes
2017-04-02 23:36:05 +02:00
Henry de Valence
b3041f2adc
Remove unnecessary if statements
2017-04-02 23:27:38 +02:00
Henry de Valence
eca28fd3e8
Refactor Scalar::hash_from_bytes to allow streaming input to the hash.
2017-03-27 04:49:00 -07:00
Isis Lovecruft
5ebbd5dd86
Remove an XXX comment about using something better than array_ref!().
...
It turns out array_ref!() is probably the best way, or, at least, we're
already using it everywhere.
2017-03-17 21:42:58 +00:00
Isis Lovecruft
d549fdc8f9
Whitespace fixes.
2017-03-17 21:42:40 +00:00
Isis Lovecruft
f6930997d2
Make #[feature(test)] depend on #[cfg(all(test, feature = "bench"))].
...
* FIXES Issue #38 :
https://github.com/isislovecruft/curve25519-dalek/pull/38
2017-03-14 01:59:08 +00:00
Isis Lovecruft
3882a41d27
Remove test_ prefix from tests in scalar module.
2017-03-14 01:58:39 +00:00
Isis Lovecruft
4afe4ae37f
Move scalar module benchmarks to separate module.
2017-03-14 01:52:42 +00:00
Henry de Valence
b61ed818b8
Remove all remaining warnings
2017-03-07 01:37:31 -08:00
Isis Lovecruft
f48947fb57
Merge remote-tracking branch 'hdevalence/feature/some-cleanup-tweaks' into develop
2017-02-28 05:50:22 +00:00
Henry de Valence
fe15bc1d0b
Add note on fn main() in doctest
2017-02-27 11:22:07 -08:00
Henry de Valence
a93798d209
Add a function to hash a byte slice to a scalar.
2017-02-27 11:19:06 -08:00
Henry de Valence
e5c0d789fd
Add a Scalar::as_bytes() method.
2017-02-26 15:25:05 -08:00
Henry de Valence
950519b97b
Implement Debug for Scalar
2017-02-26 15:25:05 -08:00
Isis Lovecruft
e4d041836e
Move load3 and load4 to new utils module and remove #[allow(dead_code)].
2017-02-21 06:15:08 +00:00
Isis Lovecruft
6f67a7d716
Rename util module to subtle.
...
* CHANGE subtle module documentation slightly to clarify the module's purpose.
* FIXES issue #25 .
2017-02-21 06:01:22 +00:00
Isis Lovecruft
5308fef210
Add CTEq trait and implement it for Scalar.
2017-02-21 05:44:35 +00:00
Isis Lovecruft
7b57be69fd
Implement constant time equality check for scalars.
2017-02-21 05:41:14 +00:00
Isis Lovecruft
32da4c7d50
Implement Neg for Scalar.
2017-02-21 05:41:14 +00:00
Isis Lovecruft
8c432ef78a
Another obsessive compulsive whitespace fix.
2017-02-21 01:46:01 +00:00