2017-08-15 05:09:20 +00:00
|
|
|
// -*- mode: rust; -*-
|
2016-12-08 05:12:00 +00:00
|
|
|
//
|
2017-08-15 05:09:20 +00:00
|
|
|
// This file is part of curve25519-dalek.
|
|
|
|
|
// Copyright (c) 2016-2017 Isis Lovecruft, Henry de Valence
|
|
|
|
|
// See LICENSE for licensing information.
|
2016-12-08 05:12:00 +00:00
|
|
|
//
|
|
|
|
|
// Authors:
|
2017-08-15 05:09:20 +00:00
|
|
|
// - Isis Agora Lovecruft <isis@patternsinthevoid.net>
|
|
|
|
|
// - Henry de Valence <hdevalence@hdevalence.ca>
|
2016-12-08 05:12:00 +00:00
|
|
|
|
2017-03-08 08:19:08 +00:00
|
|
|
#![cfg_attr(not(feature = "std"), no_std)]
|
2017-06-19 23:59:45 +00:00
|
|
|
#![cfg_attr(feature = "alloc", feature(alloc))]
|
2017-03-14 03:24:59 +00:00
|
|
|
#![cfg_attr(feature = "nightly", feature(i128_type))]
|
2017-03-14 01:59:08 +00:00
|
|
|
#![cfg_attr(feature = "bench", feature(test))]
|
2017-05-26 22:37:36 +00:00
|
|
|
#![cfg_attr(all(feature = "nightly", feature = "std"), feature(zero_one))]
|
2017-04-26 04:55:19 +00:00
|
|
|
|
|
|
|
|
#![allow(unused_features)]
|
2017-10-23 21:03:23 +00:00
|
|
|
//#![deny(missing_docs)] // refuse to compile if documentation is missing
|
2016-12-08 05:12:00 +00:00
|
|
|
|
|
|
|
|
//! # curve25519-dalek
|
|
|
|
|
//!
|
2017-11-29 21:00:50 +00:00
|
|
|
//! **A high-performance, pure-Rust implementation of group operations for Ristretto and Curve25519.**
|
2016-12-08 05:12:00 +00:00
|
|
|
//!
|
|
|
|
|
//! **[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.
|
|
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
// External dependencies:
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "std")]
|
|
|
|
|
extern crate core;
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "std")]
|
|
|
|
|
extern crate rand;
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "alloc")]
|
|
|
|
|
extern crate alloc;
|
|
|
|
|
|
2017-03-14 01:59:08 +00:00
|
|
|
#[cfg(all(test, feature = "bench"))]
|
2016-12-08 05:12:00 +00:00
|
|
|
extern crate test;
|
2017-03-14 01:59:08 +00:00
|
|
|
|
2017-10-23 21:03:23 +00:00
|
|
|
#[cfg(feature = "yolocrypto")]
|
|
|
|
|
extern crate stdsimd;
|
|
|
|
|
|
2017-11-30 22:41:06 +00:00
|
|
|
// The `Digest` trait is implemented using `generic_array`, so we need it
|
|
|
|
|
// too. Hopefully we can eliminate `generic_array` from `Digest` once const
|
|
|
|
|
// generics land.
|
2017-02-27 19:19:06 +00:00
|
|
|
extern crate digest;
|
2017-11-17 00:07:55 +00:00
|
|
|
extern crate generic_array;
|
|
|
|
|
|
|
|
|
|
// Used for traits related to constant-time code.
|
2017-05-31 04:37:16 +00:00
|
|
|
extern crate subtle;
|
2017-02-27 19:19:06 +00:00
|
|
|
|
2017-05-15 01:06:59 +00:00
|
|
|
#[cfg(feature = "serde")]
|
2017-05-14 05:40:51 +00:00
|
|
|
extern crate serde;
|
2017-05-15 01:06:59 +00:00
|
|
|
#[cfg(all(test, feature = "serde"))]
|
2017-05-14 05:40:51 +00:00
|
|
|
extern crate serde_cbor;
|
|
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
// curve25519-dalek public modules
|
|
|
|
|
//------------------------------------------------------------------------
|
2017-07-30 21:35:12 +00:00
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
// Scalar arithmetic mod l = 2^252 + ..., the order of the Ristretto group
|
2016-12-08 05:12:00 +00:00
|
|
|
pub mod scalar;
|
2017-11-17 00:07:55 +00:00
|
|
|
// Point operations on the Montgomery form of Curve25519
|
2017-08-03 05:58:15 +00:00
|
|
|
pub mod montgomery;
|
2017-11-17 00:07:55 +00:00
|
|
|
// Point operations on the Edwards form of Curve25519
|
|
|
|
|
pub mod edwards;
|
|
|
|
|
// Group operations on the Ristretto group
|
2017-07-09 01:22:28 +00:00
|
|
|
pub mod ristretto;
|
2017-11-17 00:07:55 +00:00
|
|
|
// Useful constants, like the Ed25519 basepoint
|
|
|
|
|
pub mod constants;
|
2017-11-17 01:34:28 +00:00
|
|
|
// External (and internal) traits.
|
|
|
|
|
pub mod traits;
|
2016-12-08 05:12:00 +00:00
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
// curve25519-dalek internal modules
|
|
|
|
|
//------------------------------------------------------------------------
|
2016-12-08 05:12:00 +00:00
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
// Finite field arithmetic mod p = 2^255 - 19
|
|
|
|
|
pub(crate) mod field;
|
|
|
|
|
|
|
|
|
|
// Arithmetic backends (using u32, u64, etc) live here
|
|
|
|
|
pub(crate) mod backend;
|
|
|
|
|
|
|
|
|
|
// Internal curve models which are not part of the public API.
|
2017-11-17 01:34:28 +00:00
|
|
|
pub(crate) mod curve_models;
|