| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_BASE_X509_CERT_TYPES_H_ | 5 #ifndef NET_BASE_X509_CERT_TYPES_H_ |
| 6 #define NET_BASE_X509_CERT_TYPES_H_ | 6 #define NET_BASE_X509_CERT_TYPES_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // SHA-1 fingerprint (160 bits) of a certificate. | 36 // SHA-1 fingerprint (160 bits) of a certificate. |
| 37 struct SHA1Fingerprint { | 37 struct SHA1Fingerprint { |
| 38 bool Equals(const SHA1Fingerprint& other) const { | 38 bool Equals(const SHA1Fingerprint& other) const { |
| 39 return memcmp(data, other.data, sizeof(data)) == 0; | 39 return memcmp(data, other.data, sizeof(data)) == 0; |
| 40 } | 40 } |
| 41 | 41 |
| 42 unsigned char data[20]; | 42 unsigned char data[20]; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class SHA1FingerprintLessThan | 45 class SHA1FingerprintLessThan { |
| 46 : public std::binary_function<SHA1Fingerprint, SHA1Fingerprint, bool> { | |
| 47 public: | 46 public: |
| 48 bool operator() (const SHA1Fingerprint& lhs, | 47 bool operator() (const SHA1Fingerprint& lhs, |
| 49 const SHA1Fingerprint& rhs) const { | 48 const SHA1Fingerprint& rhs) const { |
| 50 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; | 49 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; |
| 51 } | 50 } |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 // CertPrincipal represents the issuer or subject field of an X.509 certificate. | 53 // CertPrincipal represents the issuer or subject field of an X.509 certificate. |
| 55 struct CertPrincipal { | 54 struct CertPrincipal { |
| 56 CertPrincipal(); | 55 CertPrincipal(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Compares two OIDs by value. | 135 // Compares two OIDs by value. |
| 137 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { | 136 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { |
| 138 return oid1->Length == oid2->Length && | 137 return oid1->Length == oid2->Length && |
| 139 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); | 138 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); |
| 140 } | 139 } |
| 141 #endif | 140 #endif |
| 142 | 141 |
| 143 } // namespace net | 142 } // namespace net |
| 144 | 143 |
| 145 #endif // NET_BASE_X509_CERT_TYPES_H_ | 144 #endif // NET_BASE_X509_CERT_TYPES_H_ |
| OLD | NEW |