mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-07 20:30:39 +00:00
Don't generate unused constants in build.rs.
This commit is contained in:
parent
47a164da4d
commit
e91cc685b1
1 changed files with 35 additions and 23 deletions
58
build.rs
58
build.rs
|
|
@ -44,33 +44,31 @@ mod macros;
|
||||||
|
|
||||||
// Public modules
|
// Public modules
|
||||||
|
|
||||||
#[path = "src/scalar.rs"]
|
|
||||||
mod scalar;
|
|
||||||
#[path = "src/montgomery.rs"]
|
|
||||||
mod montgomery;
|
|
||||||
#[path = "src/edwards.rs"]
|
|
||||||
mod edwards;
|
|
||||||
#[path = "src/ristretto.rs"]
|
|
||||||
mod ristretto;
|
|
||||||
#[path = "src/constants.rs"]
|
#[path = "src/constants.rs"]
|
||||||
mod constants;
|
mod constants;
|
||||||
|
#[path = "src/edwards.rs"]
|
||||||
|
mod edwards;
|
||||||
|
#[path = "src/montgomery.rs"]
|
||||||
|
mod montgomery;
|
||||||
|
#[path = "src/ristretto.rs"]
|
||||||
|
mod ristretto;
|
||||||
|
#[path = "src/scalar.rs"]
|
||||||
|
mod scalar;
|
||||||
#[path = "src/traits.rs"]
|
#[path = "src/traits.rs"]
|
||||||
mod traits;
|
mod traits;
|
||||||
|
|
||||||
// Internal modules
|
// Internal modules
|
||||||
|
|
||||||
#[path = "src/field.rs"]
|
|
||||||
mod field;
|
|
||||||
#[path = "src/backend/mod.rs"]
|
#[path = "src/backend/mod.rs"]
|
||||||
mod backend;
|
mod backend;
|
||||||
|
#[path = "src/field.rs"]
|
||||||
|
mod field;
|
||||||
#[path = "src/prelude.rs"]
|
#[path = "src/prelude.rs"]
|
||||||
mod prelude;
|
mod prelude;
|
||||||
#[path = "src/window.rs"]
|
#[path = "src/window.rs"]
|
||||||
mod window;
|
mod window;
|
||||||
|
|
||||||
use edwards::EdwardsBasepointTable;
|
use edwards::EdwardsBasepointTable;
|
||||||
use backend::serial::curve_models::AffineNielsPoint;
|
|
||||||
use window::NafLookupTable8;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Enable the "stage2_build" feature in the main build stage
|
// Enable the "stage2_build" feature in the main build stage
|
||||||
|
|
@ -97,7 +95,6 @@ use edwards::EdwardsBasepointTable;
|
||||||
use backend::serial::curve_models::AffineNielsPoint;
|
use backend::serial::curve_models::AffineNielsPoint;
|
||||||
|
|
||||||
use window::LookupTable;
|
use window::LookupTable;
|
||||||
use window::NafLookupTable8;
|
|
||||||
|
|
||||||
/// Table containing precomputed multiples of the Ed25519 basepoint \\\\(B = (x, 4/5)\\\\).
|
/// Table containing precomputed multiples of the Ed25519 basepoint \\\\(B = (x, 4/5)\\\\).
|
||||||
pub const ED25519_BASEPOINT_TABLE: EdwardsBasepointTable = ED25519_BASEPOINT_TABLE_INNER_DOC_HIDDEN;
|
pub const ED25519_BASEPOINT_TABLE: EdwardsBasepointTable = ED25519_BASEPOINT_TABLE_INNER_DOC_HIDDEN;
|
||||||
|
|
@ -107,20 +104,35 @@ pub const ED25519_BASEPOINT_TABLE: EdwardsBasepointTable = ED25519_BASEPOINT_TAB
|
||||||
pub const ED25519_BASEPOINT_TABLE_INNER_DOC_HIDDEN: EdwardsBasepointTable = {:?};
|
pub const ED25519_BASEPOINT_TABLE_INNER_DOC_HIDDEN: EdwardsBasepointTable = {:?};
|
||||||
\n\n",
|
\n\n",
|
||||||
&table
|
&table
|
||||||
).as_bytes(),
|
)
|
||||||
).unwrap();
|
.as_bytes(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
// Now generate AFFINE_ODD_MULTIPLES_OF_BASEPOINT
|
// Now generate AFFINE_ODD_MULTIPLES_OF_BASEPOINT
|
||||||
let B = &constants::ED25519_BASEPOINT_POINT;
|
// if we are going to build the serial scalar_mul backend
|
||||||
let odd_multiples = NafLookupTable8::<AffineNielsPoint>::from(B);
|
#[cfg(not(all(
|
||||||
|
feature = "simd_backend",
|
||||||
|
any(target_feature = "avx2", target_feature = "avx512ifma")
|
||||||
|
)))]
|
||||||
|
{
|
||||||
|
use backend::serial::curve_models::AffineNielsPoint;
|
||||||
|
use window::NafLookupTable8;
|
||||||
|
|
||||||
f.write_all(
|
let B = &constants::ED25519_BASEPOINT_POINT;
|
||||||
format!(
|
let odd_multiples = NafLookupTable8::<AffineNielsPoint>::from(B);
|
||||||
"\n
|
|
||||||
|
f.write_all(
|
||||||
|
format!(
|
||||||
|
"\n
|
||||||
|
use window::NafLookupTable8;
|
||||||
/// Odd multiples of the basepoint `[B, 3B, 5B, 7B, 9B, 11B, 13B, 15B, ..., 127B]`.
|
/// Odd multiples of the basepoint `[B, 3B, 5B, 7B, 9B, 11B, 13B, 15B, ..., 127B]`.
|
||||||
pub(crate) const AFFINE_ODD_MULTIPLES_OF_BASEPOINT: NafLookupTable8<AffineNielsPoint> = {:?};
|
pub(crate) const AFFINE_ODD_MULTIPLES_OF_BASEPOINT: NafLookupTable8<AffineNielsPoint> = {:?};
|
||||||
\n\n",
|
\n\n",
|
||||||
&odd_multiples
|
&odd_multiples
|
||||||
).as_bytes(),
|
)
|
||||||
).unwrap();
|
.as_bytes(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue