smime.cc (1039B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #include <cstddef> 6 #include <cstdint> 7 8 #include "scoped_ptrs_smime.h" 9 #include "smime.h" 10 11 #include "asn1/mutators.h" 12 #include "base/database.h" 13 #include "base/mutate.h" 14 15 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 16 static NSSDatabase db = NSSDatabase(); 17 18 SECItem buffer = {siBuffer, (unsigned char *)data, (unsigned int)size}; 19 20 ScopedNSSCMSMessage cmsg(NSS_CMSMessage_CreateFromDER( 21 &buffer, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)); 22 (void)NSS_CMSMessage_IsSigned(cmsg.get()); 23 24 return 0; 25 } 26 27 extern "C" size_t LLVMFuzzerCustomMutator(uint8_t *data, size_t size, 28 size_t maxSize, unsigned int seed) { 29 return CustomMutate( 30 Mutators({ASN1Mutators::FlipConstructed, ASN1Mutators::ChangeType}), data, 31 size, maxSize, seed); 32 }