-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify: Doc comments on functions (#96)
* Modify: Doc comments on functions * Remove: Redundant comments * Modify: Run cargo fmt on fuzz/ * Cleanup: function visibility * Skip cargo fmt on build.rs, default adds whitespace to error msg * Add rustfmt.toml file for posterity Doc comments plays nicer with rust-analyzer, better DX
- Loading branch information
Showing
29 changed files
with
874 additions
and
1,010 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
use honggfuzz::fuzz; | ||
use pqc_kyber::*; | ||
use rand_xoshiro::rand_core::{SeedableRng, RngCore}; | ||
use rand_xoshiro::rand_core::{RngCore, SeedableRng}; | ||
use rand_xoshiro::Xoshiro256Plus; | ||
|
||
fn main() -> Result<(), KyberError> { | ||
let mut _rng = rand::thread_rng(); //placeholder | ||
let mut rng = Xoshiro256Plus::seed_from_u64(0); | ||
let mut ct = [0u8; KYBER_CIPHERTEXTBYTES]; | ||
let mut ss = [0u8; KYBER_SSBYTES]; | ||
let mut s1 = [0u8; 32]; | ||
loop { | ||
rng.fill_bytes(&mut s1); | ||
fuzz!(|data: &[u8] | { | ||
if data.len() != KYBER_PUBLICKEYBYTES {return}; | ||
crypto_kem_enc(&mut ct, &mut ss, data, &mut _rng, Some(&s1))?; | ||
}); | ||
}; | ||
} | ||
let mut _rng = rand::thread_rng(); //placeholder | ||
let mut rng = Xoshiro256Plus::seed_from_u64(0); | ||
let mut ct = [0u8; KYBER_CIPHERTEXTBYTES]; | ||
let mut ss = [0u8; KYBER_SSBYTES]; | ||
let mut s1 = [0u8; 32]; | ||
loop { | ||
rng.fill_bytes(&mut s1); | ||
fuzz!(|data: &[u8]| { | ||
if data.len() != KYBER_PUBLICKEYBYTES { | ||
return; | ||
}; | ||
crypto_kem_enc(&mut ct, &mut ss, data, &mut _rng, Some(&s1))?; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
use honggfuzz::fuzz; | ||
use pqc_kyber::*; | ||
use rand_xoshiro::rand_core::{SeedableRng, RngCore}; | ||
use rand_xoshiro::rand_core::{RngCore, SeedableRng}; | ||
use rand_xoshiro::Xoshiro256Plus; | ||
|
||
fn main() -> Result<(), KyberError> { | ||
let mut _rng = rand::thread_rng(); //placeholder | ||
let mut rng = Xoshiro256Plus::seed_from_u64(0); | ||
let mut public = [0u8; KYBER_PUBLICKEYBYTES]; | ||
let mut secret = [0u8; KYBER_SECRETKEYBYTES]; | ||
let mut s1 = [0u8; 32]; | ||
let mut s2 = [0u8; 32]; | ||
loop { | ||
rng.fill_bytes(&mut s1); | ||
rng.fill_bytes(&mut s2); | ||
fuzz!(|data: ()| { | ||
crypto_kem_keypair(&mut public, &mut secret, &mut _rng, Some((&s1, &s2)))?; | ||
}); | ||
}; | ||
} | ||
let mut _rng = rand::thread_rng(); //placeholder | ||
let mut rng = Xoshiro256Plus::seed_from_u64(0); | ||
let mut public = [0u8; KYBER_PUBLICKEYBYTES]; | ||
let mut secret = [0u8; KYBER_SECRETKEYBYTES]; | ||
let mut s1 = [0u8; 32]; | ||
let mut s2 = [0u8; 32]; | ||
loop { | ||
rng.fill_bytes(&mut s1); | ||
rng.fill_bytes(&mut s2); | ||
fuzz!(|data: ()| { | ||
crypto_kem_keypair(&mut public, &mut secret, &mut _rng, Some((&s1, &s2)))?; | ||
}); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.