OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 if (reference_host.starts_with(pattern_begin) && | 585 if (reference_host.starts_with(pattern_begin) && |
586 reference_host.ends_with(pattern_end)) | 586 reference_host.ends_with(pattern_end)) |
587 return true; | 587 return true; |
588 } | 588 } |
589 return false; | 589 return false; |
590 } | 590 } |
591 | 591 |
592 int X509Certificate::Verify(const std::string& hostname, int flags, | 592 int X509Certificate::Verify(const std::string& hostname, int flags, |
593 CertVerifyResult* verify_result) const { | 593 CertVerifyResult* verify_result) const { |
594 verify_result->Reset(); | 594 verify_result->Reset(); |
| 595 verify_result->verified_cert = const_cast<X509Certificate*>(this); |
595 | 596 |
596 if (IsBlacklisted()) { | 597 if (IsBlacklisted()) { |
597 verify_result->cert_status |= CERT_STATUS_REVOKED; | 598 verify_result->cert_status |= CERT_STATUS_REVOKED; |
598 return ERR_CERT_REVOKED; | 599 return ERR_CERT_REVOKED; |
599 } | 600 } |
600 | 601 |
601 int rv = VerifyInternal(hostname, flags, verify_result); | 602 int rv = VerifyInternal(hostname, flags, verify_result); |
602 | 603 |
603 // If needed, do any post-validation here. | 604 // If needed, do any post-validation here. |
604 return rv; | 605 return rv; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, | 702 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, |
702 const uint8* array, | 703 const uint8* array, |
703 size_t array_byte_len) { | 704 size_t array_byte_len) { |
704 DCHECK_EQ(0u, array_byte_len % base::SHA1_LENGTH); | 705 DCHECK_EQ(0u, array_byte_len % base::SHA1_LENGTH); |
705 const unsigned arraylen = array_byte_len / base::SHA1_LENGTH; | 706 const unsigned arraylen = array_byte_len / base::SHA1_LENGTH; |
706 return NULL != bsearch(hash.data, array, arraylen, base::SHA1_LENGTH, | 707 return NULL != bsearch(hash.data, array, arraylen, base::SHA1_LENGTH, |
707 CompareSHA1Hashes); | 708 CompareSHA1Hashes); |
708 } | 709 } |
709 | 710 |
710 } // namespace net | 711 } // namespace net |
OLD | NEW |