mirror of
https://github.com/saymrwulf/fips205-source.git
synced 2026-09-03 19:53:49 +00:00
0.4.1 RC1
This commit is contained in:
parent
6f0f48eaee
commit
a9b02e92cd
4 changed files with 19 additions and 15 deletions
|
|
@ -102,6 +102,7 @@ unlicensed = "deny"
|
|||
allow = [
|
||||
"MIT",
|
||||
"Apache-2.0",
|
||||
"Unicode-3.0"
|
||||
#"Apache-2.0 WITH LLVM-exception",
|
||||
]
|
||||
# List of explicitly disallowed licenses
|
||||
|
|
|
|||
|
|
@ -11,9 +11,6 @@ $ rustup default nightly
|
|||
$ mkdir -p corpus/fuzz_sign
|
||||
$ dd if=/dev/zero bs=1 count=6292 > corpus/fuzz_sign/seed0
|
||||
$ for i in $(seq 1 9); do head -c 6292 </dev/urandom > corpus/fuzz_sign/seed$i; done
|
||||
$ mkdir -p corpus/fuzz_verify
|
||||
$ dd if=/dev/zero bs=1 count=6292 > corpus/fuzz_verify/seed0
|
||||
$ for i in $(seq 0 9); do head -c 6292 </dev/urandom > corpus/fuzz_verify/seed$i; done
|
||||
|
||||
$ cargo fuzz run fuzz_sign -j 4 -- -max_total_time=1000
|
||||
|
||||
|
|
@ -30,13 +27,13 @@ INFO: exiting: 0 time: 1050s
|
|||
$ cargo fuzz run fuzz_verify -j 4 -- -max_total_time=1000
|
||||
|
||||
...
|
||||
#307: cov: 18818 ft: 12996 corp: 30 exec/s 0 oom/timeout/crash: 0/0/0 time: 915s job: 57 dft_time: 0
|
||||
#314: cov: 18818 ft: 13023 corp: 32 exec/s 0 oom/timeout/crash: 0/0/0 time: 934s job: 58 dft_time: 0
|
||||
#321: cov: 18818 ft: 13040 corp: 33 exec/s 0 oom/timeout/crash: 0/0/0 time: 945s job: 59 dft_time: 0
|
||||
#328: cov: 18818 ft: 13063 corp: 34 exec/s 0 oom/timeout/crash: 0/0/0 time: 964s job: 60 dft_time: 0
|
||||
#336: cov: 18818 ft: 13078 corp: 35 exec/s 0 oom/timeout/crash: 0/0/0 time: 998s job: 61 dft_time: 0
|
||||
INFO: fuzzed for 1018 seconds, wrapping up soon
|
||||
INFO: exiting: 0 time: 1031s
|
||||
#11962: cov: 2075 ft: 2738 corp: 4 exec/s: 0 oom/timeout/crash: 0/0/0 time: 932s job: 27 dft_time: 0
|
||||
#11965: cov: 2075 ft: 2738 corp: 4 exec/s: 0 oom/timeout/crash: 0/0/0 time: 986s job: 28 dft_time: 0
|
||||
#11968: cov: 2075 ft: 2738 corp: 4 exec/s: 0 oom/timeout/crash: 0/0/0 time: 986s job: 29 dft_time: 0
|
||||
#11971: cov: 2075 ft: 2738 corp: 4 exec/s: 0 oom/timeout/crash: 0/0/0 time: 991s job: 30 dft_time: 0
|
||||
#11974: cov: 2075 ft: 2738 corp: 4 exec/s: 0 oom/timeout/crash: 0/0/0 time: 1046s job: 31 dft_time: 0
|
||||
INFO: fuzzed for 1046 seconds, wrapping up soon
|
||||
INFO: exiting: 0 time: 1104s
|
||||
~~~
|
||||
|
||||
Coverage status is a work-in-progress (note that verify also exercises signing); see FIPS 204 code for example runs
|
||||
Coverage status is a work-in-progress; see FIPS 204 code for example runs
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@ fuzz_target!(|data: &[u8]| {
|
|||
return;
|
||||
}
|
||||
|
||||
let ph = match data[0] % 3 {
|
||||
0 => Ph::SHA256,
|
||||
1 => Ph::SHA512,
|
||||
_ => Ph::SHAKE256,
|
||||
};
|
||||
|
||||
// Generate a valid key pair first
|
||||
if let Ok((pk, sk)) = slh_dsa_sha2_128f::try_keygen() {
|
||||
// Split fuzz data into message and context
|
||||
|
|
@ -25,8 +31,8 @@ fuzz_target!(|data: &[u8]| {
|
|||
}
|
||||
|
||||
// Test 2: Hash verification with valid signature
|
||||
if let Ok(valid_hash_sig) = sk.try_hash_sign(message, context, &Ph::SHA256, true) {
|
||||
let _ = pk.hash_verify(message, &valid_hash_sig, context, &Ph::SHA256);
|
||||
if let Ok(valid_hash_sig) = sk.try_hash_sign(message, context, &ph, true) {
|
||||
let _ = pk.hash_verify(message, &valid_hash_sig, context, &ph);
|
||||
}
|
||||
|
||||
// Test 3: Try to deserialize and verify with potentially malformed public key
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ pub trait KeyGen {
|
|||
///
|
||||
/// // Generate both public and secret keys. This only fails when the provided rng fails.
|
||||
/// let (pk1, sk) = slh_dsa_shake_128s::KG::keygen_with_seeds(&[0u8; slh_dsa_shake_128s::N],
|
||||
/// &[1u8; slh_dsa_shake_128s::N], &[1u8; slh_dsa_shake_128s::N]);
|
||||
/// &[1u8; slh_dsa_shake_128s::N], &[2u8; slh_dsa_shake_128s::N]);
|
||||
/// // Use the secret key to generate a signature. The second parameter is the
|
||||
/// // context string (often just an empty &[]), and the last parameter selects
|
||||
/// // the preferred hedged variant. This only fails when the OS rng fails.
|
||||
|
|
@ -143,12 +143,12 @@ pub trait KeyGen {
|
|||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[must_use]
|
||||
fn keygen_with_seeds<const N: usize>(
|
||||
sk_seed: &[u8; N], sk_prf: &[u8; N], pk_seed: &[u8; N]
|
||||
) -> (Self::PublicKey, Self::PrivateKey) {
|
||||
Self::try_keygen_with_rng(&mut DummyRng {data: [*sk_seed, *sk_prf, *pk_seed], i: 0 }).expect("rng will not fail")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// This is for the deterministic keygen functions; will be refactored more nicely
|
||||
|
|
|
|||
Loading…
Reference in a new issue