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/ev_root_ca_metadata.h" | 5 #include "net/base/ev_root_ca_metadata.h" |
6 | 6 |
7 #if defined(USE_NSS) | 7 #if defined(USE_NSS) || defined(OS_IOS) |
8 #include <cert.h> | 8 #include <cert.h> |
9 #include <pkcs11n.h> | 9 #include <pkcs11n.h> |
10 #include <secerr.h> | 10 #include <secerr.h> |
11 #include <secoid.h> | 11 #include <secoid.h> |
12 #elif defined(OS_WIN) | 12 #elif defined(OS_WIN) |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #endif | 14 #endif |
15 | 15 |
16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #if defined(USE_NSS) | 18 #if defined(USE_NSS) || defined(OS_IOS) |
19 #include "crypto/nss_util.h" | 19 #include "crypto/nss_util.h" |
20 #endif | 20 #endif |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 | 23 |
24 // Raw metadata. | 24 // Raw metadata. |
25 struct EVMetadata { | 25 struct EVMetadata { |
26 // kMaxOIDsPerCA is the number of OIDs that we can support per root CA. At | 26 // kMaxOIDsPerCA is the number of OIDs that we can support per root CA. At |
27 // least one CA has different EV policies for businuss vs government | 27 // least one CA has different EV policies for businuss vs government |
28 // entities and, in the case of cross-signing, we might need to list another | 28 // entities and, in the case of cross-signing, we might need to list another |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 }; | 312 }; |
313 | 313 |
314 static base::LazyInstance<EVRootCAMetadata>::Leaky | 314 static base::LazyInstance<EVRootCAMetadata>::Leaky |
315 g_ev_root_ca_metadata = LAZY_INSTANCE_INITIALIZER; | 315 g_ev_root_ca_metadata = LAZY_INSTANCE_INITIALIZER; |
316 | 316 |
317 // static | 317 // static |
318 EVRootCAMetadata* EVRootCAMetadata::GetInstance() { | 318 EVRootCAMetadata* EVRootCAMetadata::GetInstance() { |
319 return g_ev_root_ca_metadata.Pointer(); | 319 return g_ev_root_ca_metadata.Pointer(); |
320 } | 320 } |
321 | 321 |
322 #if defined(USE_NSS) | 322 #if defined(USE_NSS) || defined(OS_IOS) |
323 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const { | 323 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const { |
324 return policy_oids_.find(policy_oid) != policy_oids_.end(); | 324 return policy_oids_.find(policy_oid) != policy_oids_.end(); |
325 } | 325 } |
326 | 326 |
327 bool EVRootCAMetadata::HasEVPolicyOID( | 327 bool EVRootCAMetadata::HasEVPolicyOID( |
328 const SHA1HashValue& fingerprint, | 328 const SHA1HashValue& fingerprint, |
329 PolicyOID policy_oid) const { | 329 PolicyOID policy_oid) const { |
330 PolicyOIDMap::const_iterator iter = ev_policy_.find(fingerprint); | 330 PolicyOIDMap::const_iterator iter = ev_policy_.find(fingerprint); |
331 if (iter == ev_policy_.end()) | 331 if (iter == ev_policy_.end()) |
332 return false; | 332 return false; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 ev_policy_[metadata.fingerprint].push_back(policy); | 484 ev_policy_[metadata.fingerprint].push_back(policy); |
485 policy_oids_.insert(policy); | 485 policy_oids_.insert(policy); |
486 } | 486 } |
487 } | 487 } |
488 #endif | 488 #endif |
489 } | 489 } |
490 | 490 |
491 EVRootCAMetadata::~EVRootCAMetadata() { } | 491 EVRootCAMetadata::~EVRootCAMetadata() { } |
492 | 492 |
493 } // namespace net | 493 } // namespace net |
OLD | NEW |