initial commit
Signed-off-by: Kamal Tufekcic <kamal@lo.sh>
This commit is contained in:
commit
d73755a275
165830 changed files with 568244 additions and 0 deletions
23
soliton/fuzz/fuzz_targets/fuzz_ed25519_verify.rs
Normal file
23
soliton/fuzz/fuzz_targets/fuzz_ed25519_verify.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#![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);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue