Patched source for Aeneas/Charon formal verification transpilation
Find a file
2018-07-20 00:04:25 +00:00
benches Merge remote-tracking branch 'dalek/multiscalar-trait-without-precomputation_r1' into develop 2018-05-15 20:23:05 +00:00
docs Rewrite notes and documentation. 2018-06-18 13:22:03 -07:00
src Change the wording on the Scalar::as_bytes() docstring. 2018-07-20 00:04:25 +00:00
vendor Update ristretto.sage to match goldilocks b0af87 2018-01-19 17:22:28 -08:00
.gitignore Initial commit. 2016-12-08 05:12:00 +00:00
.travis.yml Remove yolocrypto from avx2_backend 2018-06-18 13:32:04 -07:00
build.rs Remove yolocrypto from avx2_backend 2018-06-18 13:32:04 -07:00
Cargo.toml Merge pull request #152 from isislovecruft/feature/update-rand-0.5.3 2018-07-05 11:52:46 -07:00
CONTRIBUTING.md Update more links to point to the official CI and repos. 2018-01-20 00:56:26 +00:00
LICENSE Update year in copyright notices to 2018. 2018-07-05 00:30:27 +00:00
Makefile Add avx2_backend to make doc FEATURES 2018-06-21 12:01:09 -07:00
README.md Add note on backend selection requirement 2018-07-05 13:39:29 -07:00

curve25519-dalek

A pure-Rust implementation of group operations on Ristretto and Curve25519.

curve25519-dalek is a library providing group operations on the Edwards and Montgomery forms of Curve25519, and on the prime-order Ristretto group.

curve25519-dalek is not intended to provide implementations of any particular crypto protocol. Rather, implementations of those protocols (such as x25519-dalek and ed25519-dalek) should use curve25519-dalek as a library.

curve25519-dalek is intended to provide a clean and safe mid-level API for use implementing a wide range of ECC-based crypto protocols, such as key agreement, signatures, anonymous credentials, rangeproofs, and zero-knowledge proof systems.

In particular, curve25519-dalek implements Ristretto, which constructs a prime-order group from a non-prime-order Edwards curve. This provides the speed and safety benefits of Edwards curve arithmetic, without the pitfalls of cofactor-related abstraction mismatches.

Stability

We have recently released a 1.0.0-pre.0 version of curve25519-dalek and would greatly appreciate testing and feedback on our API and performance.

Documentation

The semver-stable, public-facing curve25519-dalek API is documented here. In addition, the unstable internal implementation details are documented here.

The curve25519-dalek documentation requires a custom HTML header to include KaTeX for math support. Unfortunately cargo doc does not currently support this, but docs can be built using

make doc
make doc-internal

Use

To import curve25519-dalek, add the following to the dependencies section of your project's Cargo.toml:

curve25519-dalek = "^0.18"

Then import the crate as:

extern crate curve25519_dalek;

Backends and Features

The nightly feature enables features available only when using a Rust nightly compiler. It is recommended for security.

Curve arithmetic is implemented using one of the following backends:

  • a u32 backend using u64 products;
  • a u64 backend using u128 products;
  • an avx2 backend using parallel formulas, available when compiling for a target with target_feature=+avx2.

By default the u64 backend is selected. To select a specific backend, use:

cargo build --no-default-features --features "std u32_backend"
cargo build --no-default-features --features "std u64_backend"
cargo build --no-default-features --features "std avx2_backend"

Crates using curve25519-dalek can either select a backend on behalf of their users, or expose feature flags that control the curve25519-dalek backend.

The std feature is enabled by default, but it can be disabled for no-std builds using --no-default-features. Note that this requires explicitly selecting an arithmetic backend using one of the _backend features. If no backend is selected, compilation will fail.

Benchmarks are run using criterion.rs:

# You must set RUSTFLAGS to enable AVX2 support.
export RUSTFLAGS="-C target_cpu=native"
cargo bench --no-default-features --features "std u32_backend"
cargo bench --no-default-features --features "std u64_backend"
cargo bench --no-default-features --features "std avx2_backend"

The yolocrypto feature enables experimental features. The name yolocrypto is meant to indicate that it is not considered production-ready, and we do not consider yolocrypto features to be covered by semver guarantees. This is designed to make it easier to test intended new features without having to stabilise them first. Use yolocrypto at your own, obvious, risk.

Contributing

Please see CONTRIBUTING.md.

Patches and pull requests should be make against the develop branch, not master.

About

SPOILER ALERT: The Twelfth Doctor's first encounter with the Daleks is in his second full episode, "Into the Dalek". A beleaguered ship of the "Combined Galactic Resistance" has discovered a broken Dalek that has turned "good", desiring to kill all other Daleks. The Doctor, Clara and a team of soldiers are miniaturized and enter the Dalek, which the Doctor names Rusty. They repair the damage, but accidentally restore it to its original nature, causing it to go on the rampage and alert the Dalek fleet to the whereabouts of the rebel ship. However, the Doctor manages to return Rusty to its previous state by linking his mind with the Dalek's: Rusty shares the Doctor's view of the universe's beauty, but also his deep hatred of the Daleks. Rusty destroys the other Daleks and departs the ship, determined to track down and bring an end to the Dalek race.

curve25519-dalek is authored by Isis Agora Lovecruft and Henry de Valence.

Portions of this library were originally a port of Adam Langley's Golang ed25519 library, which was in turn a port of the reference ref10 implementation. Most of this code, including the 32-bit field arithmetic, has since been rewritten.

The fast u32 and u64 scalar arithmetic was implemented by Andrew Moon, and the addition chain for scalar inversion was provided by Brian Smith. The optimised batch inversion was contributed by Sean Bowe and Daira Hopwood.

The no_std support was contributed by Tony Arcieri.

Thanks also to Ashley Hauck, Lucas Salibian, and Manish Goregaokar for their contributions.