1*9860b763SAndroid Build Coastguard Worker // Copyright 2022, The Android Open Source Project 2*9860b763SAndroid Build Coastguard Worker // 3*9860b763SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License"); 4*9860b763SAndroid Build Coastguard Worker // you may not use this file except in compliance with the License. 5*9860b763SAndroid Build Coastguard Worker // You may obtain a copy of the License at 6*9860b763SAndroid Build Coastguard Worker // 7*9860b763SAndroid Build Coastguard Worker // http://www.apache.org/licenses/LICENSE-2.0 8*9860b763SAndroid Build Coastguard Worker // 9*9860b763SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software 10*9860b763SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS, 11*9860b763SAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*9860b763SAndroid Build Coastguard Worker // See the License for the specific language governing permissions and 13*9860b763SAndroid Build Coastguard Worker // limitations under the License. 14*9860b763SAndroid Build Coastguard Worker 15*9860b763SAndroid Build Coastguard Worker //! Fuzzer for keyblob parsing. 16*9860b763SAndroid Build Coastguard Worker 17*9860b763SAndroid Build Coastguard Worker #![no_main] 18*9860b763SAndroid Build Coastguard Worker use libfuzzer_sys::fuzz_target; 19*9860b763SAndroid Build Coastguard Worker 20*9860b763SAndroid Build Coastguard Worker fuzz_target!(|data: &[u8]| { 21*9860b763SAndroid Build Coastguard Worker // `data` allegedly holds a CBOR-serialized keyblob that has arrived from userspace. Do we 22*9860b763SAndroid Build Coastguard Worker // trust it? I don't think so... 23*9860b763SAndroid Build Coastguard Worker let _ = kmr_common::keyblob::EncryptedKeyBlob::new(data); 24*9860b763SAndroid Build Coastguard Worker }); 25