libsoliton/soliton/fuzz/fuzz_targets/fuzz_ed25519_verify.rs
Kamal Tufekcic 1d99048c95
Some checks failed
CI / lint (push) Successful in 1m37s
CI / test-python (push) Successful in 1m49s
CI / test-zig (push) Successful in 1m39s
CI / test-wasm (push) Successful in 1m54s
CI / test (push) Successful in 14m44s
CI / miri (push) Successful in 14m18s
CI / build (push) Successful in 1m9s
CI / fuzz-regression (push) Successful in 9m9s
CI / publish (push) Failing after 1m10s
CI / publish-python (push) Failing after 1m46s
CI / publish-wasm (push) Has been cancelled
initial commit
Signed-off-by: Kamal Tufekcic <kamal@lo.sh>
2026-04-02 23:48:10 +03:00

23 lines
778 B
Rust

#![no_main]
use libfuzzer_sys::fuzz_target;
use soliton::primitives::ed25519;
fuzz_target!(|data: &[u8]| {
// Need at least 32 (pk) + 64 (sig) = 96 bytes.
if data.len() < 96 {
return;
}
let pk_bytes: [u8; 32] = data[..32].try_into().unwrap();
let sig: [u8; 64] = data[32..96].try_into().unwrap();
let msg = &data[96..];
// Attempt to construct a VerifyingKey from the fuzz input — from_bytes
// rejects non-canonical encodings and points not on the curve.
let Ok(vk) = ed25519_dalek::VerifyingKey::from_bytes(&pk_bytes) else {
return;
};
// verify must never panic regardless of input.
// Exercises: Ed25519 point decompression, strict signature verification.
let _ = ed25519::verify(&vk, msg, &sig);
});