| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "net/cert/internal/certificate_policies.h" | 6 #include "net/cert/internal/certificate_policies.h" |
| 7 #include "net/cert/internal/extended_key_usage.h" | 7 #include "net/cert/internal/extended_key_usage.h" |
| 8 #include "net/cert/internal/name_constraints.h" | 8 #include "net/cert/internal/name_constraints.h" |
| 9 #include "net/cert/internal/parse_certificate.h" | 9 #include "net/cert/internal/parse_certificate.h" |
| 10 #include "net/cert/internal/parse_name.h" | 10 #include "net/cert/internal/parse_name.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 der::Input tbs_certificate_tlv; | 29 der::Input tbs_certificate_tlv; |
| 30 der::Input signature_algorithm_tlv; | 30 der::Input signature_algorithm_tlv; |
| 31 der::BitString signature_value; | 31 der::BitString signature_value; |
| 32 if (!ParseCertificate(in, &tbs_certificate_tlv, &signature_algorithm_tlv, | 32 if (!ParseCertificate(in, &tbs_certificate_tlv, &signature_algorithm_tlv, |
| 33 &signature_value)) | 33 &signature_value)) |
| 34 return; | 34 return; |
| 35 std::unique_ptr<SignatureAlgorithm> sig_alg( | 35 std::unique_ptr<SignatureAlgorithm> sig_alg( |
| 36 SignatureAlgorithm::CreateFromDer(signature_algorithm_tlv)); | 36 SignatureAlgorithm::CreateFromDer(signature_algorithm_tlv)); |
| 37 | 37 |
| 38 ParsedTbsCertificate tbs; | 38 ParsedTbsCertificate tbs; |
| 39 if (!ParseTbsCertificate(tbs_certificate_tlv, &tbs)) | 39 if (!ParseTbsCertificate(tbs_certificate_tlv, {}, &tbs)) |
| 40 return; | 40 return; |
| 41 | 41 |
| 42 ignore_result(VerifySerialNumber(tbs.serial_number)); | |
| 43 RDNSequence subject; | 42 RDNSequence subject; |
| 44 ignore_result(ParseName(tbs.subject_tlv, &subject)); | 43 ignore_result(ParseName(tbs.subject_tlv, &subject)); |
| 45 | 44 |
| 46 std::map<der::Input, ParsedExtension> extensions; | 45 std::map<der::Input, ParsedExtension> extensions; |
| 47 if (tbs.has_extensions && ParseExtensions(tbs.extensions_tlv, &extensions)) { | 46 if (tbs.has_extensions && ParseExtensions(tbs.extensions_tlv, &extensions)) { |
| 48 ParsedExtension extension; | 47 ParsedExtension extension; |
| 49 ParsedBasicConstraints basic_constraints; | 48 ParsedBasicConstraints basic_constraints; |
| 50 der::BitString key_usage; | 49 der::BitString key_usage; |
| 51 std::vector<der::Input> policies; | 50 std::vector<der::Input> policies; |
| 52 std::vector<der::Input> eku_oids; | 51 std::vector<der::Input> eku_oids; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 } | 63 } |
| 65 | 64 |
| 66 } // namespace | 65 } // namespace |
| 67 } // namespace net | 66 } // namespace net |
| 68 | 67 |
| 69 extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { | 68 extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { |
| 70 net::der::Input in(data, size); | 69 net::der::Input in(data, size); |
| 71 net::ParseCertificateForFuzzer(in); | 70 net::ParseCertificateForFuzzer(in); |
| 72 return 0; | 71 return 0; |
| 73 } | 72 } |
| OLD | NEW |