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.
|
2018-07-05 00:24:41 +00:00
|
|
|
// Copyright (c) 2016-2018 Isis Lovecruft, Henry de Valence
|
2017-08-15 05:09:20 +00:00
|
|
|
// 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
|
|
|
|
2018-07-20 21:43:31 +00:00
|
|
|
#![no_std]
|
2018-01-25 21:40:30 +00:00
|
|
|
|
2018-07-20 21:43:31 +00:00
|
|
|
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]
|
2017-11-20 23:27:44 +00:00
|
|
|
#![cfg_attr(feature = "nightly", feature(cfg_target_feature))]
|
2018-01-25 21:40:30 +00:00
|
|
|
#![cfg_attr(feature = "nightly", feature(external_doc))]
|
|
|
|
|
|
|
|
|
|
// Refuse to compile if documentation is missing, but only on nightly.
|
|
|
|
|
//
|
|
|
|
|
// This means that missing docs will still fail CI, but means we can use
|
|
|
|
|
// README.md as the crate documentation.
|
|
|
|
|
#![cfg_attr(feature = "nightly", deny(missing_docs))]
|
2017-04-26 04:55:19 +00:00
|
|
|
|
2018-01-25 21:40:30 +00:00
|
|
|
#![cfg_attr(feature = "nightly", doc(include = "../README.md"))]
|
2018-02-21 19:03:18 +00:00
|
|
|
#![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")]
|
2016-12-08 05:12:00 +00:00
|
|
|
|
2018-03-27 21:24:06 +00:00
|
|
|
//! Note that docs will only build on nightly Rust until
|
|
|
|
|
//! [RFC 1990 stabilizes](https://github.com/rust-lang/rust/issues/44732).
|
|
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
// External dependencies:
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
2018-07-20 21:43:31 +00:00
|
|
|
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
|
|
|
|
#[macro_use]
|
2017-11-17 00:07:55 +00:00
|
|
|
extern crate alloc;
|
|
|
|
|
|
2018-07-20 21:43:31 +00:00
|
|
|
#[cfg(feature = "std")]
|
|
|
|
|
#[macro_use]
|
|
|
|
|
extern crate std;
|
|
|
|
|
|
2018-07-26 19:40:24 +00:00
|
|
|
#[cfg(all(feature = "nightly", feature = "avx2_backend"))]
|
|
|
|
|
extern crate packed_simd;
|
|
|
|
|
|
2018-05-14 20:24:23 +00:00
|
|
|
extern crate rand;
|
2017-11-28 22:40:50 +00:00
|
|
|
extern crate clear_on_drop;
|
2018-04-05 04:13:09 +00:00
|
|
|
extern crate byteorder;
|
|
|
|
|
|
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;
|
|
|
|
|
|
2018-01-24 18:58:22 +00:00
|
|
|
// Internal macros. Must come first!
|
|
|
|
|
#[macro_use]
|
|
|
|
|
pub(crate) mod macros;
|
|
|
|
|
|
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;
|
2018-03-20 19:10:39 +00:00
|
|
|
|
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;
|
2018-03-20 19:10:39 +00:00
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
// Point operations on the Edwards form of Curve25519
|
|
|
|
|
pub mod edwards;
|
2018-03-20 19:10:39 +00:00
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
// Group operations on the Ristretto group
|
2017-07-09 01:22:28 +00:00
|
|
|
pub mod ristretto;
|
2018-03-20 19:10:39 +00:00
|
|
|
|
2017-11-17 00:07:55 +00:00
|
|
|
// Useful constants, like the Ed25519 basepoint
|
|
|
|
|
pub mod constants;
|
2018-03-20 19:10:39 +00:00
|
|
|
|
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;
|
2018-03-20 19:10:39 +00:00
|
|
|
|
2018-07-20 21:43:31 +00:00
|
|
|
// Crate-local prelude (for alloc-dependent features like `Vec`)
|
|
|
|
|
pub(crate) mod prelude;
|
|
|
|
|
|
2018-03-20 19:10:39 +00:00
|
|
|
// Implementations of scalar mul algorithms live here
|
|
|
|
|
pub(crate) mod scalar_mul;
|