Skip to content

Commit

Permalink
fuzz up
Browse files Browse the repository at this point in the history
  • Loading branch information
eschorn1 committed Sep 9, 2024
1 parent df649cf commit 4b5a75a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fips203-fuzz"
version = "0.2.1"
version = "0.4.0"
publish = false
edition = "2021"
rust-version = "1.70"
Expand Down
7 changes: 4 additions & 3 deletions fuzz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ $ mkdir -p corpus/fuzz_all
$ dd if=/dev/zero bs=1 count=3328 > corpus/fuzz_all/seed0
$ for i in $(seq 1 2); do head -c 3328 </dev/urandom > corpus/fuzz_all/seed$i; done
$ dd if=/dev/zero bs=1 count=3328 | tr '\0x00' '\377' > corpus/fuzz_all/seed3
$ cargo fuzz run fuzz_all -j 4
$ cargo fuzz run fuzz_all -j 4 -- -max_total_time=1000
~~~

Coverage status of ml_kem_512 is robust, see:
Coverage status of ml_kem_512 is robust (run last step above twice), see:

~~~
#30756: cov: 7503 ft: 5982 corp: 73 exec/s 9 oom/timeout/crash: 0/0/0 time: 960s job: 84 dft_time: 0
#60523: cov: 5990 ft: 4165 corp: 65 exec/s 16 oom/timeout/crash: 0/0/0 time: 982s job: 85 dft_time: 0
# Warning: the following tools are tricky to install/configure
$ cargo install cargo-cov
Expand Down
4 changes: 3 additions & 1 deletion fuzz/fuzz_targets/fuzz_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ fuzz_target!(|data: [u8; 3328]| {
let dk2 = ml_kem_512::DecapsKey::try_from_bytes(dk2_bytes.try_into().unwrap());

// Fuzz input -> `KG::validate_keypair_vartime()`
let _ok = ml_kem_512::KG::validate_keypair_vartime(
rng.push(&data[start..start + RND_SIZE]); // reuse for the moment; TODO 'expand'
let _ok = ml_kem_512::KG::validate_keypair_with_rng_vartime(
&mut rng,
&ek2_bytes.try_into().unwrap(),
&dk2_bytes.try_into().unwrap(),
);
Expand Down

0 comments on commit 4b5a75a

Please sign in to comment.