mirror of
https://github.com/saymrwulf/betrusted-curve25519-dalek-source.git
synced 2026-09-10 21:21:08 +00:00
wip: adding features back
This commit is contained in:
parent
e5f5371a9c
commit
22a6f18388
2 changed files with 14 additions and 4 deletions
|
|
@ -56,8 +56,7 @@ subtle = { version = "2.3.0", default-features = false }
|
||||||
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
|
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
|
||||||
zeroize = { version = "1", default-features = false, optional = true }
|
zeroize = { version = "1", default-features = false, optional = true }
|
||||||
|
|
||||||
# Betrusted/Precursor dependency set
|
# Betrusted/Precursor dependency set, enabled by backend_u32e feature
|
||||||
[target.'cfg(curve25519_dalek_backend = "u32e_backend")'.dependencies]
|
|
||||||
engine25519-as = {git = "https://github.com/betrusted-io/engine25519-as.git", rev = "d249c967556b02ab5439eacb5078fa00c60b93d6", default-features = false, features = [], optional = true}
|
engine25519-as = {git = "https://github.com/betrusted-io/engine25519-as.git", rev = "d249c967556b02ab5439eacb5078fa00c60b93d6", default-features = false, features = [], optional = true}
|
||||||
engine-25519 = { git = "https://github.com/betrusted-io/xous-engine-25519.git", rev = "63d3d1f30736022e791deaacf4dd62c00b42fe2e", optional = true}
|
engine-25519 = { git = "https://github.com/betrusted-io/xous-engine-25519.git", rev = "63d3d1f30736022e791deaacf4dd62c00b42fe2e", optional = true}
|
||||||
utralib = {version = "0.1.0", optional = true} # this is bogus -- must be patched in the invoking build environment TODO: if this builds, it seems a crate has been released as version 0.1.23 that could replace this
|
utralib = {version = "0.1.0", optional = true} # this is bogus -- must be patched in the invoking build environment TODO: if this builds, it seems a crate has been released as version 0.1.23 that could replace this
|
||||||
|
|
@ -65,16 +64,18 @@ utralib = {version = "0.1.0", optional = true} # this is bogus -- must be patche
|
||||||
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
||||||
cpufeatures = "0.2.6"
|
cpufeatures = "0.2.6"
|
||||||
|
|
||||||
[target.'cfg(curve25519_dalek_backend = "fiat")'.dependencies]
|
fiat-crypto = { version = "0.2.1", default-features = false , optional = true}
|
||||||
fiat-crypto = { version = "0.2.1", default-features = false }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["alloc", "precomputed-tables", "zeroize"]
|
default = ["alloc", "precomputed-tables", "zeroize"]
|
||||||
alloc = ["zeroize?/alloc"]
|
alloc = ["zeroize?/alloc"]
|
||||||
precomputed-tables = []
|
precomputed-tables = []
|
||||||
legacy_compatibility = []
|
legacy_compatibility = []
|
||||||
|
backend_fiat = ["dep:fiat-crypto"]
|
||||||
|
backend_u32e = ["dep:engine25519-as","dep:engine-25519","dep:utralib"]
|
||||||
group = ["dep:group", "rand_core"]
|
group = ["dep:group", "rand_core"]
|
||||||
group-bits = ["group", "ff/bits"]
|
group-bits = ["group", "ff/bits"]
|
||||||
|
|
||||||
|
# TODO: clean this up as you can't select deps like this
|
||||||
[target.'cfg(all(not(curve25519_dalek_backend = "fiat"), not(curve25519_dalek_backend = "serial"), target_arch = "x86_64"))'.dependencies]
|
[target.'cfg(all(not(curve25519_dalek_backend = "fiat"), not(curve25519_dalek_backend = "serial"), target_arch = "x86_64"))'.dependencies]
|
||||||
curve25519-dalek-derive = { version = "0.1", path = "../curve25519-dalek-derive" }
|
curve25519-dalek-derive = { version = "0.1", path = "../curve25519-dalek-derive" }
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,20 @@ enum DalekBits {
|
||||||
Dalek64,
|
Dalek64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! build_debug {
|
||||||
|
($($tokens: tt)*) => {
|
||||||
|
println!("cargo:warning={}", format!($($tokens)*))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let curve25519_dalek_bits = match std::env::var("CARGO_CFG_CURVE25519_DALEK_BITS").as_deref() {
|
let curve25519_dalek_bits = match std::env::var("CARGO_CFG_CURVE25519_DALEK_BITS").as_deref() {
|
||||||
Ok("32") => DalekBits::Dalek32,
|
Ok("32") => DalekBits::Dalek32,
|
||||||
Ok("64") => DalekBits::Dalek64,
|
Ok("64") => DalekBits::Dalek64,
|
||||||
_ => deterministic::determine_curve25519_dalek_bits(),
|
_ => deterministic::determine_curve25519_dalek_bits(),
|
||||||
};
|
};
|
||||||
|
build_debug!("CARGO_CFG_CURVE25519_DALEK_BITS: {:?}", std::env::var("CARGO_CFG_CURVE25519_DALEK_BITS").as_deref());
|
||||||
|
build_debug!("curve25519_dalek_bits {:?}", curve25519_dalek_bits);
|
||||||
|
|
||||||
match curve25519_dalek_bits {
|
match curve25519_dalek_bits {
|
||||||
DalekBits::Dalek64 => println!("cargo:rustc-cfg=curve25519_dalek_bits=\"64\""),
|
DalekBits::Dalek64 => println!("cargo:rustc-cfg=curve25519_dalek_bits=\"64\""),
|
||||||
|
|
@ -61,6 +69,7 @@ fn main() {
|
||||||
false => "serial",
|
false => "serial",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
build_debug!("curve25519_dalek_backend {:?}", curve25519_dalek_backend);
|
||||||
println!("cargo:rustc-cfg=curve25519_dalek_backend=\"{curve25519_dalek_backend}\"");
|
println!("cargo:rustc-cfg=curve25519_dalek_backend=\"{curve25519_dalek_backend}\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue