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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/sha1.h" | 7 #include "base/sha1.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "crypto/sha2.h" | 9 #include "crypto/sha2.h" |
10 #include "net/cert/internal/cert_errors.h" | 10 #include "net/cert/internal/cert_errors.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 bool CheckCertID(const der::Input& id_tlv, | 451 bool CheckCertID(const der::Input& id_tlv, |
452 const ParsedTbsCertificate& certificate, | 452 const ParsedTbsCertificate& certificate, |
453 const ParsedTbsCertificate& issuer, | 453 const ParsedTbsCertificate& issuer, |
454 const der::Input& serial_number) { | 454 const der::Input& serial_number) { |
455 OCSPCertID id; | 455 OCSPCertID id; |
456 if (!ParseOCSPCertID(id_tlv, &id)) | 456 if (!ParseOCSPCertID(id_tlv, &id)) |
457 return false; | 457 return false; |
458 | 458 |
459 HashValueTag type = HASH_VALUE_SHA1; | 459 HashValueTag type = HASH_VALUE_SHA1; |
460 switch (id.hash_algorithm) { | 460 switch (id.hash_algorithm) { |
| 461 case DigestAlgorithm::Md2: |
| 462 case DigestAlgorithm::Md4: |
| 463 case DigestAlgorithm::Md5: |
| 464 // Unsupported. |
| 465 return false; |
461 case DigestAlgorithm::Sha1: | 466 case DigestAlgorithm::Sha1: |
462 type = HASH_VALUE_SHA1; | 467 type = HASH_VALUE_SHA1; |
463 break; | 468 break; |
464 case DigestAlgorithm::Sha256: | 469 case DigestAlgorithm::Sha256: |
465 type = HASH_VALUE_SHA256; | 470 type = HASH_VALUE_SHA256; |
466 break; | 471 break; |
467 case DigestAlgorithm::Sha384: | 472 case DigestAlgorithm::Sha384: |
468 case DigestAlgorithm::Sha512: | 473 case DigestAlgorithm::Sha512: |
469 NOTIMPLEMENTED(); | 474 NOTIMPLEMENTED(); |
470 return false; | 475 return false; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 &earliest_this_update)) { | 560 &earliest_this_update)) { |
556 return false; | 561 return false; |
557 } | 562 } |
558 if (response.this_update < earliest_this_update) | 563 if (response.this_update < earliest_this_update) |
559 return false; // Response is too old. | 564 return false; // Response is too old. |
560 | 565 |
561 return true; | 566 return true; |
562 } | 567 } |
563 | 568 |
564 } // namespace net | 569 } // namespace net |
OLD | NEW |