feat(fuzzing): Add initial set of fuzzing targets

These targets can be used with rust nightly and cargo-fuzz to fuzz
several bits of Rosenpass's API. Fuzzing is an automated way of
exploring code paths that may not be hit in unit tests or normal
operation. For example the `handle_msg` target exposed the DoS condition
fixed in 0.2.1.

The other targets focus on the FFI with libsodium and liboqs.

Co-authored-by: Karolin Varner <karo@cupdev.net>
This commit is contained in:
Morgan Hill
2023-11-19 16:52:44 +01:00
committed by Karolin Varner
parent 86300ca936
commit a49254a021
10 changed files with 1501 additions and 0 deletions

52
fuzzing/Cargo.toml Normal file
View File

@@ -0,0 +1,52 @@
[package]
name = "rosenpass-fuzzing"
version = "0.0.1"
publish = false
edition = "2021"
[package.metadata]
cargo-fuzz = true
[dependencies]
arbitrary = { version = "1.3.2", features = ["derive"]}
libfuzzer-sys = "0.4"
stacker = "0.1.15"
[dependencies.rosenpass]
path = "../rosenpass"
[dependencies.rosenpass-sodium]
path = "../sodium"
[dependencies.rosenpass-ciphers]
path = "../ciphers"
[[bin]]
name = "fuzz_handle_msg"
path = "fuzz_targets/handle_msg.rs"
test = false
doc = false
[[bin]]
name = "fuzz_blake2b"
path = "fuzz_targets/blake2b.rs"
test = false
doc = false
[[bin]]
name = "fuzz_aead_enc_into"
path = "fuzz_targets/aead_enc_into.rs"
test = false
doc = false
[[bin]]
name = "fuzz_mceliece_encaps"
path = "fuzz_targets/mceliece_encaps.rs"
test = false
doc = false
[[bin]]
name = "fuzz_kyber_encaps"
path = "fuzz_targets/kyber_encaps.rs"
test = false
doc = false