Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring Unexpected cfgs #58

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/o5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ anyhow = "1.0"
# o5 pqc test
# pqc_kyber = {version="0.7.1", features=["kyber1024", "std"]}
ml-kem = "0.1.0"

[lints.rust]
# unexpected_cfgs are used to disable incomplete / WIP features and tests. This is
# not an error for this library. This turns off that specific lint for the "disable" feature.
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_features, values("disabled"))'] }

4 changes: 1 addition & 3 deletions crates/o5/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![doc = include_str!("../README.md")]
// unexpected_cfgs are used to disable incomplete / WIP features and tests. This is
// not an error for this library.
#![allow(unexpected_cfgs)]


mod framing;
// mod handshake;
Expand Down
5 changes: 5 additions & 0 deletions crates/obfs4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,8 @@ tor-basic-utils = "0.20.0"
# pqc_kyber = {version="0.7.1", features=["kyber1024", "std"]}
# ml-kem = "0.1.0"

[lints.rust]
# unexpected_cfgs are used to disable incomplete / WIP features and tests. This is
# not an error for this library. This turns off that specific lint for the "disable" feature.
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_features, values("disabled"))'] }

13 changes: 10 additions & 3 deletions crates/obfs4/src/common/x25519_elligator2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,15 @@ mod test {

#[test]
fn off_subgroup_check_edw() {
let mut count = 0;
let n_trials = 100;
let mut rng = rand::thread_rng();
for _ in 0..100 {
for _ in 0..n_trials {
let (repr, pk) = generate(&mut rng);

// check if the generated public key is off the subgroup
let v = scalar_mult_order(&pk);
let pk_off = !v.is_identity();
let _pk_off = !v.is_identity();

// ----

Expand All @@ -390,7 +392,12 @@ mod test {
let v = scalar_mult_order(&pk_254);
let off_254 = !v.is_identity();

println!("pk_gen: {pk_off}, pk_255: {off_255}, pk_254: {off_254}");
// println!("pk_gen: {pk_off}, pk_255: {off_255}, pk_254: {off_254}");
if off_254 && off_255 {
count += 1;
}
}
assert!(count > 0);
assert!(count < n_trials);
}
}
8 changes: 0 additions & 8 deletions crates/obfs4/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
#![doc = include_str!("../README.md")]
// unexpected_cfgs are used to disable incomplete / WIP features and tests. This is
// not an error for this library.
#![allow(unexpected_cfgs)]

// #![feature(trait_alias)]

// #![allow(dead_code)]
// #![allow(warnings)]

pub mod client;
pub mod common;
Expand Down
Loading