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(verify, feature(register_tool))]
14#![cfg_attr(verify, register_tool(aeneas))]
15#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg, doc_cfg_hide))]
16#![cfg_attr(docsrs, doc(cfg_hide(docsrs)))]
17//------------------------------------------------------------------------
18// Documentation:
19//------------------------------------------------------------------------
20#![doc(
21    html_logo_url = "https://cdn.jsdelivr.net/gh/dalek-cryptography/curve25519-dalek/docs/assets/dalek-logo-clear.png"
22)]
23#![doc = include_str!("../README.md")]
24//------------------------------------------------------------------------
25// Linting:
26//------------------------------------------------------------------------
27#![cfg_attr(allow_unused_unsafe, allow(unused_unsafe))]
28#![warn(
29    clippy::unwrap_used,
30    missing_docs,
31    rust_2018_idioms,
32    unused_lifetimes,
33    unused_qualifications
34)]
35
36//------------------------------------------------------------------------
37// External dependencies:
38//------------------------------------------------------------------------
39
40#[cfg(feature = "alloc")]
41#[allow(unused_imports)]
42#[macro_use]
43extern crate alloc;
44
45// TODO: move std-dependent tests to `tests/`
46#[cfg(test)]
47#[macro_use]
48extern crate std;
49
50#[cfg(feature = "digest")]
51pub use digest;
52
53// Internal macros. Must come first!
54#[macro_use]
55pub(crate) mod macros;
56
57//------------------------------------------------------------------------
58// curve25519-dalek public modules
59//------------------------------------------------------------------------
60
61// Scalar arithmetic mod l = 2^252 + ..., the order of the Ristretto group
62pub mod scalar;
63
64// Point operations on the Montgomery form of Curve25519
65pub mod montgomery;
66
67// Point operations on the Edwards form of Curve25519
68pub mod edwards;
69
70// Group operations on the Ristretto group
71pub mod ristretto;
72
73// Useful constants, like the Ed25519 basepoint
74pub mod constants;
75
76// External (and internal) traits.
77pub mod traits;
78
79//------------------------------------------------------------------------
80// curve25519-dalek internal modules
81//------------------------------------------------------------------------
82
83// Finite field arithmetic mod p = 2^255 - 19
84pub(crate) mod field;
85
86// Arithmetic backends (using u32, u64, etc) live here
87#[cfg(docsrs)]
88pub mod backend;
89#[cfg(not(docsrs))]
90pub(crate) mod backend;
91
92// Generic code for window lookups
93pub(crate) mod window;
94
95pub use crate::{
96    edwards::EdwardsPoint, montgomery::MontgomeryPoint, ristretto::RistrettoPoint, scalar::Scalar,
97};
98
99// Build time diagnostics for validation
100#[cfg(curve25519_dalek_diagnostics = "build")]
101mod diagnostics;