| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_cert_types.h" | 5 #include "net/base/x509_cert_types.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // CompareSHA1Hashes is a helper function for using bsearch() with an array of | 32 // CompareSHA1Hashes is a helper function for using bsearch() with an array of |
| 33 // SHA1 hashes. | 33 // SHA1 hashes. |
| 34 int CompareSHA1Hashes(const void* a, const void* b) { | 34 int CompareSHA1Hashes(const void* a, const void* b) { |
| 35 return memcmp(a, b, base::kSHA1Length); | 35 return memcmp(a, b, base::kSHA1Length); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 bool IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, | 41 bool IsSHA1HashInSortedArray(const SHA1HashValue& hash, |
| 42 const uint8* array, | 42 const uint8* array, |
| 43 size_t array_byte_len) { | 43 size_t array_byte_len) { |
| 44 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); | 44 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); |
| 45 const size_t arraylen = array_byte_len / base::kSHA1Length; | 45 const size_t arraylen = array_byte_len / base::kSHA1Length; |
| 46 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, | 46 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, |
| 47 CompareSHA1Hashes); | 47 CompareSHA1Hashes); |
| 48 } | 48 } |
| 49 | 49 |
| 50 CertPrincipal::CertPrincipal() { | 50 CertPrincipal::CertPrincipal() { |
| 51 } | 51 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 valid &= exploded.HasValidValues(); | 137 valid &= exploded.HasValidValues(); |
| 138 | 138 |
| 139 if (!valid) | 139 if (!valid) |
| 140 return false; | 140 return false; |
| 141 | 141 |
| 142 *time = base::Time::FromUTCExploded(exploded); | 142 *time = base::Time::FromUTCExploded(exploded); |
| 143 return true; | 143 return true; |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace net | 146 } // namespace net |
| OLD | NEW |