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

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

Issue 2353333003: Rename CreateFromDer() to Create(). (Closed)
Patch Set: rebase Created 4 years, 2 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/name_constraints.h ('k') | net/cert/internal/name_constraints_unittest.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/name_constraints.h" 5 #include "net/cert/internal/name_constraints.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 return true; 293 return true;
294 } 294 }
295 295
296 } // namespace 296 } // namespace
297 297
298 GeneralNames::GeneralNames() {} 298 GeneralNames::GeneralNames() {}
299 299
300 GeneralNames::~GeneralNames() {} 300 GeneralNames::~GeneralNames() {}
301 301
302 // static 302 // static
303 std::unique_ptr<GeneralNames> GeneralNames::CreateFromDer( 303 std::unique_ptr<GeneralNames> GeneralNames::Create(
304 const der::Input& general_names_tlv) { 304 const der::Input& general_names_tlv) {
305 // RFC 5280 section 4.2.1.6: 305 // RFC 5280 section 4.2.1.6:
306 // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName 306 // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
307 std::unique_ptr<GeneralNames> general_names(new GeneralNames()); 307 std::unique_ptr<GeneralNames> general_names(new GeneralNames());
308 der::Parser parser(general_names_tlv); 308 der::Parser parser(general_names_tlv);
309 der::Parser sequence_parser; 309 der::Parser sequence_parser;
310 if (!parser.ReadSequence(&sequence_parser)) 310 if (!parser.ReadSequence(&sequence_parser))
311 return nullptr; 311 return nullptr;
312 // Should not have trailing data after GeneralNames sequence. 312 // Should not have trailing data after GeneralNames sequence.
313 if (parser.HasMore()) 313 if (parser.HasMore())
(...skipping 11 matching lines...) Expand all
325 general_names.get())) 325 general_names.get()))
326 return nullptr; 326 return nullptr;
327 } 327 }
328 328
329 return general_names; 329 return general_names;
330 } 330 }
331 331
332 NameConstraints::~NameConstraints() {} 332 NameConstraints::~NameConstraints() {}
333 333
334 // static 334 // static
335 std::unique_ptr<NameConstraints> NameConstraints::CreateFromDer( 335 std::unique_ptr<NameConstraints> NameConstraints::Create(
336 const der::Input& extension_value, 336 const der::Input& extension_value,
337 bool is_critical) { 337 bool is_critical) {
338 std::unique_ptr<NameConstraints> name_constraints(new NameConstraints()); 338 std::unique_ptr<NameConstraints> name_constraints(new NameConstraints());
339 if (!name_constraints->Parse(extension_value, is_critical)) 339 if (!name_constraints->Parse(extension_value, is_critical))
340 return nullptr; 340 return nullptr;
341 return name_constraints; 341 return name_constraints;
342 } 342 }
343 343
344 bool NameConstraints::Parse(const der::Input& extension_value, 344 bool NameConstraints::Parse(const der::Input& extension_value,
345 bool is_critical) { 345 bool is_critical) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 543
544 return false; 544 return false;
545 } 545 }
546 546
547 int NameConstraints::ConstrainedNameTypes() const { 547 int NameConstraints::ConstrainedNameTypes() const {
548 return (permitted_subtrees_.present_name_types | 548 return (permitted_subtrees_.present_name_types |
549 excluded_subtrees_.present_name_types); 549 excluded_subtrees_.present_name_types);
550 } 550 }
551 551
552 } // namespace net 552 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/name_constraints.h ('k') | net/cert/internal/name_constraints_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698