mirror of
https://github.com/rosenpass/rosenpass.git
synced 2025-12-12 15:49:22 -08:00
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>
20 lines
470 B
Rust
20 lines
470 B
Rust
#![no_main]
|
|
extern crate rosenpass;
|
|
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
use rosenpass::coloring::Secret;
|
|
use rosenpass::protocol::CryptoServer;
|
|
use rosenpass_sodium::init as sodium_init;
|
|
|
|
fuzz_target!(|rx_buf: &[u8]| {
|
|
sodium_init().unwrap();
|
|
|
|
let sk = Secret::from_slice(&[0; 13568]);
|
|
let pk = Secret::from_slice(&[0; 524160]);
|
|
|
|
let mut cs = CryptoServer::new(sk, pk);
|
|
let mut tx_buf = [0; 10240];
|
|
cs.handle_msg(rx_buf, &mut tx_buf).unwrap();
|
|
});
|