diff --git a/build.rs b/build.rs index 1c8be62..5eb523b 100644 --- a/build.rs +++ b/build.rs @@ -54,6 +54,8 @@ mod field; mod curve_models; #[path="src/backend/mod.rs"] mod backend; +#[path="src/scalar_mul/mod.rs"] +mod scalar_mul; use edwards::EdwardsBasepointTable; @@ -77,9 +79,9 @@ use backend::u32::field::FieldElement32; use edwards::EdwardsBasepointTable; -use curve_models::window::LookupTable; use curve_models::AffineNielsPoint; +use scalar_mul::window::LookupTable; /// Table containing precomputed multiples of the Ed25519 basepoint \\\\(B = (x, 4/5)\\\\). pub const ED25519_BASEPOINT_TABLE: EdwardsBasepointTable = ED25519_BASEPOINT_TABLE_INNER_DOC_HIDDEN; diff --git a/src/backend/avx2/edwards.rs b/src/backend/avx2/edwards.rs index 7f564d7..74b0797 100644 --- a/src/backend/avx2/edwards.rs +++ b/src/backend/avx2/edwards.rs @@ -24,7 +24,7 @@ use subtle::Choice; use edwards; use scalar::Scalar; -use curve_models::window::LookupTable; +use scalar_mul::window::LookupTable; use traits::Identity; diff --git a/src/curve_models/mod.rs b/src/curve_models/mod.rs index 59426fa..a88c37d 100644 --- a/src/curve_models/mod.rs +++ b/src/curve_models/mod.rs @@ -135,8 +135,6 @@ use field::FieldElement; use edwards::EdwardsPoint; use traits::ValidityCheck; -pub mod window; - // ------------------------------------------------------------------------ // Internal point representations // ------------------------------------------------------------------------ diff --git a/src/edwards.rs b/src/edwards.rs index bcc4db6..439d6e6 100644 --- a/src/edwards.rs +++ b/src/edwards.rs @@ -117,7 +117,7 @@ use curve_models::CompletedPoint; use curve_models::AffineNielsPoint; use curve_models::ProjectiveNielsPoint; -use curve_models::window::LookupTable; +use scalar_mul::window::LookupTable; use traits::{Identity, IsIdentity}; use traits::ValidityCheck; diff --git a/src/lib.rs b/src/lib.rs index bb788c4..ffe0009 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,14 +67,19 @@ pub(crate) mod macros; // Scalar arithmetic mod l = 2^252 + ..., the order of the Ristretto group pub mod scalar; + // Point operations on the Montgomery form of Curve25519 pub mod montgomery; + // Point operations on the Edwards form of Curve25519 pub mod edwards; + // Group operations on the Ristretto group pub mod ristretto; + // Useful constants, like the Ed25519 basepoint pub mod constants; + // External (and internal) traits. pub mod traits; @@ -90,3 +95,6 @@ pub(crate) mod backend; // Internal curve models which are not part of the public API. pub(crate) mod curve_models; + +// Implementations of scalar mul algorithms live here +pub(crate) mod scalar_mul; diff --git a/src/scalar_mul/mod.rs b/src/scalar_mul/mod.rs new file mode 100644 index 0000000..bc3ef90 --- /dev/null +++ b/src/scalar_mul/mod.rs @@ -0,0 +1,11 @@ +// -*- mode: rust; -*- +// +// This file is part of curve25519-dalek. +// Copyright (c) 2016-2018 Isis Lovecruft, Henry de Valence +// See LICENSE for licensing information. +// +// Authors: +// - Isis Agora Lovecruft +// - Henry de Valence + +pub mod window; diff --git a/src/curve_models/window.rs b/src/scalar_mul/window.rs similarity index 100% rename from src/curve_models/window.rs rename to src/scalar_mul/window.rs