1 // Copyright 2019 The Chromium Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <stddef.h>
16 #include <stdint.h>
17 #include <stdlib.h>
18 
19 #include "../pki/crl.h"
20 #include "../pki/input.h"
21 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)22 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
23   bssl::der::Input idp_der(data, size);
24 
25   std::unique_ptr<bssl::GeneralNames> distribution_point_names;
26   bssl::ContainedCertsType only_contains_cert_type;
27 
28   if (bssl::ParseIssuingDistributionPoint(idp_der, &distribution_point_names,
29                                          &only_contains_cert_type)) {
30     bool has_distribution_point_names =
31         distribution_point_names &&
32         distribution_point_names->present_name_types != bssl::GENERAL_NAME_NONE;
33     if (!has_distribution_point_names &&
34         only_contains_cert_type == bssl::ContainedCertsType::ANY_CERTS) {
35       abort();
36     }
37   }
38   return 0;
39 }
40