curve25519_dalek/lib.rs
1// -*- mode: rust; -*-
2//
3// This file is part of curve25519-dalek.
4// Copyright (c) 2016-2021 isis lovecruft
5// Copyright (c) 2016-2019 Henry de Valence
6// See LICENSE for licensing information.
7//
8// Authors:
9// - isis agora lovecruft <[email protected]>
10// - Henry de Valence <[email protected]>
11
12#![no_std]
13#![cfg_attr(docsrs, feature(doc_cfg))]
14#![cfg_attr(docsrs, doc(auto_cfg(hide(docsrs))))]
15//------------------------------------------------------------------------
16// Documentation:
17//------------------------------------------------------------------------
18#![doc(
19 html_logo_url = "https://cdn.jsdelivr.net/gh/dalek-cryptography/curve25519-dalek/docs/assets/dalek-logo-clear.png"
20)]
21#![doc = include_str!("../README.md")]
22//------------------------------------------------------------------------
23// Linting:
24//------------------------------------------------------------------------
25#![cfg_attr(allow_unused_unsafe, allow(unused_unsafe))]
26#![warn(
27 clippy::mod_module_files,
28 clippy::unwrap_used,
29 missing_docs,
30 rust_2018_idioms,
31 unused_lifetimes,
32 unused_qualifications
33)]
34
35//------------------------------------------------------------------------
36// External dependencies:
37//------------------------------------------------------------------------
38
39#[cfg(feature = "alloc")]
40#[allow(unused_imports)]
41#[macro_use]
42extern crate alloc;
43
44// TODO: move std-dependent tests to `tests/`
45#[cfg(test)]
46#[macro_use]
47extern crate std;
48
49#[cfg(feature = "rand_core")]
50pub use rand_core;
51
52#[cfg(feature = "digest")]
53pub use digest;
54
55// Internal macros. Must come first!
56#[macro_use]
57pub(crate) mod macros;
58
59//------------------------------------------------------------------------
60// curve25519-dalek public modules
61//------------------------------------------------------------------------
62
63// Scalar arithmetic mod l = 2^252 + ..., the order of the Ristretto group
64pub mod scalar;
65
66// Point operations on the Montgomery form of Curve25519
67pub mod montgomery;
68
69// Point operations on the Edwards form of Curve25519
70pub mod edwards;
71
72// Group operations on the Ristretto group
73pub mod ristretto;
74
75// Useful constants, like the Ed25519 basepoint
76pub mod constants;
77
78// External (and internal) traits.
79pub mod traits;
80
81//------------------------------------------------------------------------
82// curve25519-dalek internal modules
83//------------------------------------------------------------------------
84
85// Finite field arithmetic mod p = 2^255 - 19
86pub(crate) mod field;
87
88// Arithmetic backends (using u32, u64, etc) live here
89#[cfg(docsrs)]
90pub mod backend;
91#[cfg(not(docsrs))]
92pub(crate) mod backend;
93
94// Generic code for window lookups
95pub(crate) mod window;
96
97#[cfg(feature = "lizard")]
98mod lizard;
99
100pub use crate::{
101 edwards::EdwardsPoint, montgomery::MontgomeryPoint, ristretto::RistrettoPoint, scalar::Scalar,
102};
103
104// Build time diagnostics for validation
105#[cfg(curve25519_dalek_diagnostics = "build")]
106mod diagnostics;