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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "net/cert/internal/cert_errors.h" | 9 #include "net/cert/internal/cert_errors.h" |
10 #include "net/cert/internal/certificate_policies.h" | 10 #include "net/cert/internal/certificate_policies.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 void ParseCertificateForFuzzer(const der::Input& in) { | 32 void ParseCertificateForFuzzer(const der::Input& in) { |
33 der::Input tbs_certificate_tlv; | 33 der::Input tbs_certificate_tlv; |
34 der::Input signature_algorithm_tlv; | 34 der::Input signature_algorithm_tlv; |
35 der::BitString signature_value; | 35 der::BitString signature_value; |
36 CertErrors errors; | 36 CertErrors errors; |
37 if (!ParseCertificate(in, &tbs_certificate_tlv, &signature_algorithm_tlv, | 37 if (!ParseCertificate(in, &tbs_certificate_tlv, &signature_algorithm_tlv, |
38 &signature_value, &errors)) | 38 &signature_value, &errors)) |
39 return; | 39 return; |
40 std::unique_ptr<SignatureAlgorithm> sig_alg( | 40 std::unique_ptr<SignatureAlgorithm> sig_alg( |
41 SignatureAlgorithm::CreateFromDer(signature_algorithm_tlv)); | 41 SignatureAlgorithm::Create(signature_algorithm_tlv, &errors)); |
42 | 42 |
43 ParsedTbsCertificate tbs; | 43 ParsedTbsCertificate tbs; |
44 if (!ParseTbsCertificate(tbs_certificate_tlv, {}, &tbs, &errors)) | 44 if (!ParseTbsCertificate(tbs_certificate_tlv, {}, &tbs, &errors)) |
45 return; | 45 return; |
46 | 46 |
47 RDNSequence subject; | 47 RDNSequence subject; |
48 ignore_result(ParseName(tbs.subject_tlv, &subject)); | 48 ignore_result(ParseName(tbs.subject_tlv, &subject)); |
49 | 49 |
50 std::map<der::Input, ParsedExtension> extensions; | 50 std::map<der::Input, ParsedExtension> extensions; |
51 if (tbs.has_extensions && ParseExtensions(tbs.extensions_tlv, &extensions)) { | 51 if (tbs.has_extensions && ParseExtensions(tbs.extensions_tlv, &extensions)) { |
(...skipping 21 matching lines...) Expand all Loading... |
73 } | 73 } |
74 | 74 |
75 } // namespace | 75 } // namespace |
76 } // namespace net | 76 } // namespace net |
77 | 77 |
78 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 78 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
79 net::der::Input in(data, size); | 79 net::der::Input in(data, size); |
80 net::ParseCertificateForFuzzer(in); | 80 net::ParseCertificateForFuzzer(in); |
81 return 0; | 81 return 0; |
82 } | 82 } |
OLD | NEW |