| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |