-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
433 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#![no_main] | ||
|
||
use libfuzzer_sys::fuzz_target; | ||
use meadowcap::mc_capability::McCapability; | ||
use ufotofu::local_nb::consumer::TestConsumer; | ||
use willow_data_model::grouping::area::Area; | ||
use willow_data_model_fuzz::encode::relative_encoding_roundtrip; | ||
use willow_data_model_fuzz::silly_sigs::{SillyPublicKey, SillySig}; | ||
|
||
fuzz_target!(|data: ( | ||
McCapability<3, 3, 3, SillyPublicKey, SillySig, SillyPublicKey, SillySig>, | ||
Area<3, 3, 3, SillyPublicKey>, | ||
Vec<SillyPublicKey>, | ||
TestConsumer<u8, u16, ()> | ||
)| { | ||
let (mc_cap, out, delegees, mut consumer) = data; | ||
|
||
if !out.includes_area(&mc_cap.granted_area()) { | ||
return; | ||
} | ||
|
||
let mut cap_with_delegees = mc_cap.clone(); | ||
let mut last_receiver = mc_cap.receiver().clone(); | ||
let granted_area = mc_cap.granted_area(); | ||
|
||
for delegee in delegees { | ||
cap_with_delegees = cap_with_delegees | ||
.delegate( | ||
&last_receiver.corresponding_secret_key(), | ||
&delegee, | ||
&granted_area, | ||
) | ||
.unwrap(); | ||
last_receiver = delegee; | ||
} | ||
|
||
if !out.includes_area(&cap_with_delegees.granted_area()) { | ||
return; | ||
} | ||
|
||
smol::block_on(async { | ||
relative_encoding_roundtrip::< | ||
McCapability<3, 3, 3, SillyPublicKey, SillySig, SillyPublicKey, SillySig>, | ||
Area<3, 3, 3, SillyPublicKey>, | ||
TestConsumer<u8, u16, ()>, | ||
>(cap_with_delegees, out, &mut consumer) | ||
.await; | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
fuzz/fuzz_targets/mc_capability_rel_area_encoding_random.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![no_main] | ||
|
||
use libfuzzer_sys::fuzz_target; | ||
use meadowcap::mc_capability::McCapability; | ||
use willow_data_model::grouping::area::Area; | ||
use willow_data_model_fuzz::encode::relative_encoding_random_less_strict; | ||
use willow_data_model_fuzz::silly_sigs::{SillyPublicKey, SillySig}; | ||
|
||
fuzz_target!(|data: (&[u8], Area<3, 3, 3, SillyPublicKey>,)| { | ||
let (random_bytes, out) = data; | ||
|
||
smol::block_on(async { | ||
relative_encoding_random_less_strict::< | ||
Area<3, 3, 3, SillyPublicKey>, | ||
McCapability<3, 3, 3, SillyPublicKey, SillySig, SillyPublicKey, SillySig>, | ||
>(out, random_bytes) | ||
.await; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.