Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: net/cert/internal/parse_certificate.cc

Issue 2327973002: Add CertErrors* parameter to the main Certificate parsing functions. (Closed)
Patch Set: StringPiece is kind of dangerous... Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/cert/internal/parse_certificate.h ('k') | net/cert/internal/parse_certificate_fuzzer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "net/cert/internal/parse_certificate.h" 5 #include "net/cert/internal/parse_certificate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "net/der/input.h" 10 #include "net/der/input.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Check if the serial number is too long per RFC 5280. 163 // Check if the serial number is too long per RFC 5280.
164 if (value.Length() > 20) 164 if (value.Length() > 20)
165 return false; 165 return false;
166 166
167 return true; 167 return true;
168 } 168 }
169 169
170 bool ParseCertificate(const der::Input& certificate_tlv, 170 bool ParseCertificate(const der::Input& certificate_tlv,
171 der::Input* out_tbs_certificate_tlv, 171 der::Input* out_tbs_certificate_tlv,
172 der::Input* out_signature_algorithm_tlv, 172 der::Input* out_signature_algorithm_tlv,
173 der::BitString* out_signature_value) { 173 der::BitString* out_signature_value,
174 CertErrors* out_errors) {
175 // TODO(crbug.com/634443): Fill |out_errors| (which may be null) with error
176 // information.
174 der::Parser parser(certificate_tlv); 177 der::Parser parser(certificate_tlv);
175 178
176 // Certificate ::= SEQUENCE { 179 // Certificate ::= SEQUENCE {
177 der::Parser certificate_parser; 180 der::Parser certificate_parser;
178 if (!parser.ReadSequence(&certificate_parser)) 181 if (!parser.ReadSequence(&certificate_parser))
179 return false; 182 return false;
180 183
181 // tbsCertificate TBSCertificate, 184 // tbsCertificate TBSCertificate,
182 if (!ReadSequenceTLV(&certificate_parser, out_tbs_certificate_tlv)) 185 if (!ReadSequenceTLV(&certificate_parser, out_tbs_certificate_tlv))
183 return false; 186 return false;
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 out_ca_issuers_uris->push_back(uri); 675 out_ca_issuers_uris->push_back(uri);
673 else if (access_method_oid == AdOcspOid()) 676 else if (access_method_oid == AdOcspOid())
674 out_ocsp_uris->push_back(uri); 677 out_ocsp_uris->push_back(uri);
675 } 678 }
676 } 679 }
677 680
678 return true; 681 return true;
679 } 682 }
680 683
681 } // namespace net 684 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/parse_certificate.h ('k') | net/cert/internal/parse_certificate_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698