INNER CODE UNIT · Rust
process_ctap_specific_type
google/OpenSK · libraries/opensk/fuzz/fuzz_helper/src/lib.rs:185
pub fn process_ctap_specific_type(data: &[u8], input_type: InputType) -> arbitrary::Result<()> {
let mut unstructured = Unstructured::new(data);
let mut env = TestEnv::default();
env.seed_rng_from_u64(u64::arbitrary(&mut unstructured)?);
let data = unstructured.take_rest();
if !is_type(data, input_type) {
return Ok(());
}
// Initialize ctap state and hid and get the allocated cid.
let mut ctap = Ctap::new(env);
let cid = initialize(&mut ctap);
// Wrap input as message with allocated cid and command type.
let mut command = cid.to_vec();
match input_type {
InputType::CborMakeCredentialParameter => {
command.extend(&[0x10, 0x01]);