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 <isis@patternsinthevoid.net>
10// - Henry de Valence <hdevalence@hdevalence.ca>
11
12#![no_std]
13#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg, doc_cfg_hide))]
14#![cfg_attr(docsrs, doc(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::unwrap_used,
28 missing_docs,
29 rust_2018_idioms,
30 unused_lifetimes,
31 unused_qualifications
32)]
33
34//------------------------------------------------------------------------
35// External dependencies:
36//------------------------------------------------------------------------
37
38#[cfg(feature = "alloc")]
39#[allow(unused_imports)]
40#[macro_use]
41extern crate alloc;
42
43// TODO: move std-dependent tests to `tests/`
44#[cfg(test)]
45#[macro_use]
46extern crate std;
47
48#[cfg(feature = "digest")]
49pub use digest;
50
51// Internal macros. Must come first!
52#[macro_use]
53pub(crate) mod macros;
54
55//------------------------------------------------------------------------
56// curve25519-dalek public modules
57//------------------------------------------------------------------------
58
59// Scalar arithmetic mod l = 2^252 + ..., the order of the Ristretto group
60pub mod scalar;
61
62// Point operations on the Montgomery form of Curve25519
63pub mod montgomery;
64
65// Point operations on the Edwards form of Curve25519
66pub mod edwards;
67
68// Group operations on the Ristretto group
69pub mod ristretto;
70
71// Useful constants, like the Ed25519 basepoint
72pub mod constants;
73
74// External (and internal) traits.
75pub mod traits;
76
77//------------------------------------------------------------------------
78// curve25519-dalek internal modules
79//------------------------------------------------------------------------
80
81// Finite field arithmetic mod p = 2^255 - 19
82pub(crate) mod field;
83
84// Arithmetic backends (using u32, u64, etc) live here
85#[cfg(docsrs)]
86pub mod backend;
87#[cfg(not(docsrs))]
88pub(crate) mod backend;
89
90// Generic code for window lookups
91pub(crate) mod window;
92
93pub use crate::{
94 edwards::EdwardsPoint, montgomery::MontgomeryPoint, ristretto::RistrettoPoint, scalar::Scalar,
95};
96
97// Build time diagnostics for validation
98#[cfg(curve25519_dalek_diagnostics = "build")]
99mod diagnostics;