Commit graph

106 commits

Author SHA1 Message Date
Isis Lovecruft
1491f0db36
Update copyright years. 2021-03-25 04:10:55 +00:00
Isis Lovecruft
ab468cd24c
Fix copyright years in some of the files I touched. 2021-03-25 02:29:37 +00:00
Isis Lovecruft
4a1fc3c66e
Implement Zeroize for points as the identity element. 2021-03-25 01:45:54 +00:00
Isis Lovecruft
5482c76d16
Merge remote-tracking branch 'garbageslam/zeroize_ristretto' into develop 2021-03-24 18:35:46 +00:00
Isis Lovecruft
da0c49985c
Merge remote-tracking branch 'gedigi/zeroize_ristrettopoint' into develop 2021-03-24 18:12:22 +00:00
Chris Beck
0154ebbfaf implement Zeroize trait on Ristretto curve point types
This is helpful for hardening some of our cryptographic implementations
that use Ristretto curve points
2021-02-10 12:14:32 -07:00
François Garillot
6afd8ff212
Update sha2, digest to 0.9 2020-06-15 07:16:04 -04:00
gedigi
c9fe6c5533 implemented Zeroize for CompressedRistretto and RistrettoPoint 2020-03-19 14:16:06 -07:00
Rui Morais
d57fb6caeb Derive of Hash trait to CompressedRistretto 2020-02-25 18:16:06 +00:00
Isis Lovecruft
409ebd94c0
Remove dev-dependency on deprecated rand_os crate.
The functionality we were using is now contained in the `rand_core` crate, which
we already depend upon.  As far as testing code goes, only benchmarks still
depend upon `rand`, as they use `thread_rng`.
2019-10-28 18:06:29 +00:00
Henry de Valence
4cc0afdcfc
Merge pull request #302 from isislovecruft/fix/228-remove-ristretto-random-test
Remove test for validity of randomly generated RistrettoPoints.
2019-10-28 10:29:11 -07:00
Trangar
ae4bf40e28 Added constants to reduce recalculations in elligator_risteretto_flavor 2019-10-28 11:48:33 +01:00
Isis Lovecruft
0709a27e46
Remove test for validity of randomly generated RistrettoPoints.
This test is no longer necessary as it originally had a possibility of
failure due to the original implementation of the invsqrt() function
in the decompression algorithm.  The failure with the current API is
nonexistent.

* FIXES #288.
2019-10-26 04:27:30 +00:00
Henry de Valence
0fc534d989 Use "tuples" instead of "bytes" in the Serde datamodel.
This is a breaking change to the serialization format.  It fixes it so that the
Serde encoding can match the conventional encoding of each type of object, and
so that Serde can be used with no overhead -- when using serde-bincode, the
Serde encoding now matches the manual encoding.
2019-10-23 15:40:50 -07:00
Henry de Valence
29ce0d4fe9 Add length checks to serde-bincode tests.
This ensures that the serde Serialize and Deserialize implementations use
fixed-length Serde tuples, rather than variable-length byte arrays.  This flaw
in data modeling was pointed out by Trevor Perrin.
2019-10-23 15:28:48 -07:00
Henry de Valence
620d17ef40
Merge pull request #293 from dalek-cryptography/remove-build-rs
Remove build.rs constants generation.
2019-10-23 14:44:46 -07:00
Henry de Valence
574217694e Remove build.rs.
This was more useful at the time when we were determining, e.g., optimal lookup
table sizes and could regenerate them more easily, but it came at a massive
complexity cost.  It also meant that we were unable to implement backend
autoselection.  This commit removes the `build.rs` entirely.  In the future, a
different `build.rs` could be added that auto-selects a backend, but it seems
like the current default-u64 setup has been working fine.
2019-10-23 14:20:38 -07:00
Isis Lovecruft
7c5ba69491
Update copyright year. 2019-10-23 19:43:56 +00:00
François Garillot
9785f56c0f
Rust fixes for some clippy warnings
Clippy lints with instances in the project but NOT applied here, since they seem consistently at odds with the projects' style:
- [unreadable literal](https://rust-lang.github.io/rust-clippy/master/#unreadable_literal)
- [cast lossless](https://rust-lang.github.io/rust-clippy/master/#cast_lossless)
- [assign op pattern](https://rust-lang.github.io/rust-clippy/master/#assign_op_pattern)
2019-10-05 12:02:08 -07:00
Henry de Valence
9a623868c5 Revert #219.
See discussion at https://github.com/dalek-cryptography/curve25519-dalek/issues/232 , copied below:

`1.1` changed the trait bounds for `RistrettoPoint::random` and `Scalar::random`, see #222 and #219.

These changes have two benefits:
* they unlink us from the `rand` crate and make us depend only on `rand_core`;
* they allow passing both owned and borrowed RNGs.

The change was not supposed to be a breaking change, since the new bounds are strictly more general than the old ones (as every `RngCore` is an `Rng` and every `&mut RngCore` is an `RngCore`), so the new bound is satisfied in every situation where the old bound applied.

The `1.1.0-pre.0` version didn't cause problems on the crates I tested it on, but there was an unexpected problem: ce71c93a9a/spacesuit/src/value.rs (L160-L161) broke, since it took a borrow as input and used it twice. So there was slight breakage.

One option is to revert the changes (probably just the ones from #219) and release 1.1.3; another would be to fix up `slingshot` and leave the new bound.
2019-02-15 13:30:05 -08:00
Henry de Valence
66b38ce5fc Merge branch 'rng_ref' of git://github.com/burdges/curve25519-dalek into burdges-rng_ref 2019-02-14 14:38:14 -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
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
27daa5215e Add Ristretto precomputation facade. 2019-02-12 12:52:02 -08:00
Henry de Valence
ff0dc4a3db Merge branch 'master' into develop 2019-01-27 23:19:44 -08:00
Henry de Valence
5ddc30061c Implement ConstantTimeEq on compressed points. 2019-01-27 23:13:58 -08:00
Henry de Valence
f1d2b5182b Restructure source tree into serial and vector backends.
This begins to attempt to restructure the source tree so that the common parts
are common and the different parts are different.

The backend is now split into two parts:
- serial (containing the implementation using serial formulas and mixed-model arithmetic).
- vector (containing the implementation using parallel formulas and single-model arithmetic).

The serial scalar_mul tree is now under backend::serial::scalar_mul.
The avx2 scalar_mul tree is now under backend::avx2::scalar_mul.
2019-01-18 01:49:40 -08:00
Henry de Valence
e6f27ca996 Fix Ristretto variable naming in decoding function
The code swaps u_1 and u_2 relative to the formulas (probably when doing the change for a=-1)
2019-01-13 18:01:00 -08:00
Артём Павлов [Artyom Pavlov]
d6ca36fa0b replace rand with rand_core+rand_os 2019-01-05 14:27:24 +03:00
Jeff Burdges
20fd561482 Support passing both borrowed and owned Rngs 2018-12-26 17:09:20 +01:00
isis agora lovecruft
5d0bdf2f21
Merge pull request #205 from dalek-cryptography/fix-subtle-traits
Change to subtle::ConditionallySelectable
2018-11-05 23:50:35 +00:00
isis agora lovecruft
0a1dc053d1
Merge pull request #203 from dalek-cryptography/sqrt_i
Refactor square root computations and Elligator
2018-11-05 23:16:59 +00:00
Henry de Valence
a116fd9679 test subtle 2.0 2018-11-05 12:06:23 -08:00
Henry de Valence
b0a190bd63 Change externally-exposed API to implement ConditionallySelectable 2018-11-02 14:16:51 -07:00
Henry de Valence
8f605dce6d Tweak ristretto elligator to match ristretto.group description 2018-11-01 17:41:56 -07:00
Henry de Valence
4e2fc53e5b Refactor sqrt_ratio to return either sqrt(u/v) or sqrt(iu/v)
Also removes the chi function since Ristretto elligator merges it with the square root.
2018-11-01 17:37:18 -07:00
Tony Arcieri
31e8626133 Update to digest 0.8 and sha2 0.8
Vicariously updates to `generic-array` 0.12, however this change also
removes `generic-array` as a direct dependency, as it can be sourced
from the `digest` crate.
2018-10-19 10:44:42 -07:00
Henry de Valence
e6c9243e46 Merge branch 'develop' into serde-compressed 2018-09-26 15:54:06 -07:00
Henry de Valence
18391bfc5f Add Serde support for compressed points; use bincode for tests. 2018-09-26 15:46:37 -07:00
Isis Lovecruft
b8fa5ec3e0
Add constructors for compressed points from slices. 2018-09-26 02:07:15 +00:00
Isis Lovecruft
0c8a046340
Cleanup and comment Ristretto decoding to match explicit formulae. 2018-08-20 21:01:01 +00:00
Henry de Valence
3bed3ef787
Merge pull request #176 from hdevalence/more-pre-1.0-cleanups
More pre 1.0 cleanups
2018-07-26 20:27:11 -07:00
Henry de Valence
259e2cd188 Expose a Ristretto::from_uniform_bytes function.
Why expose this instead of `from_hash`? Because it allows constructing
arbitrary-length chains of orthogonal generators from a XOF.
2018-07-26 19:04:56 -07:00
Sam Scott
a1e2c83d31 Fix distribution of curve points for hashing to Ristretto points. 2018-07-25 18:52:52 -04:00
Henry de Valence
e4ad0ec60a Remove outdated note about powers-of-two 2018-07-25 12:23:08 -07:00
Henry de Valence
82a5e18c29 Update docs to point to multiscalar traits 2018-07-25 10:54:31 -07:00
Tony Arcieri
10e8abf926 Unify alloc and std cargo features
This change provides a common convention for using allocator-dependent
features with:

    #![cfg(feature = "alloc")]

When available, `Vec` is imported consistently as `prelude::Vec`, which
means modules that need access to `Vec` can simply do:

    use prelude::*;

and if an allocator is available, `Vec` will be in the crate prelude.

This allows all `alloc` vs `std` gating to be handled in `lib.rs`,
`build.rs`, and `prelude.rs` so the rest of the codebase doesn't have to
do any gating whatsoever.
2018-07-23 10:50:21 -07:00
Isis Lovecruft
73b3a9617b
Merge remote-tracking branch 'hdevalence/remove-ristretto-notes' into develop 2018-07-20 19:56:55 +00:00
Isis Lovecruft
4d527cae4b
Merge branch 'feature/154-defaults' into develop 2018-07-20 19:52:34 +00:00
Isis Lovecruft
16f00cac16
Merge branch 'fix/166-scalar-random-nostd' into develop 2018-07-20 19:27:37 +00:00