Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: net/cert/ev_root_ca_metadata.cc

Issue 1082123003: Rename USE_NSS to USE_NSS_CERTS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-nss-certs
Patch Set: rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/cert/ev_root_ca_metadata.h ('k') | net/cert/ev_root_ca_metadata_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cert/ev_root_ca_metadata.h" 5 #include "net/cert/ev_root_ca_metadata.h"
6 6
7 #if defined(USE_NSS) || defined(OS_IOS) 7 #if defined(USE_NSS_CERTS) || 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) || defined(OS_IOS) 18 #if defined(USE_NSS_CERTS) || 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 #if defined(USE_NSS) || defined(OS_IOS) || defined(OS_WIN) 24 #if defined(USE_NSS_CERTS) || defined(OS_IOS) || defined(OS_WIN)
25 // Raw metadata. 25 // Raw metadata.
26 struct EVMetadata { 26 struct EVMetadata {
27 // kMaxOIDsPerCA is the number of OIDs that we can support per root CA. At 27 // kMaxOIDsPerCA is the number of OIDs that we can support per root CA. At
28 // least one CA has different EV policies for businuss vs government 28 // least one CA has different EV policies for businuss vs government
29 // entities and, in the case of cross-signing, we might need to list another 29 // entities and, in the case of cross-signing, we might need to list another
30 // CA's policy OID under the cross-signing root. 30 // CA's policy OID under the cross-signing root.
31 static const size_t kMaxOIDsPerCA = 2; 31 static const size_t kMaxOIDsPerCA = 2;
32 // This is the maximum length of an OID string (including the trailing NUL). 32 // This is the maximum length of an OID string (including the trailing NUL).
33 static const size_t kMaxOIDLength = 32; 33 static const size_t kMaxOIDLength = 32;
34 34
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 0x90, 0xa7, 0x40, 0x1a, 0x3c, 0xf4, 0x7d, 0x4f, 0xe8, 0xee } }, 491 0x90, 0xa7, 0x40, 0x1a, 0x3c, 0xf4, 0x7d, 0x4f, 0xe8, 0xee } },
492 {"2.16.840.1.114171.500.9", ""}, 492 {"2.16.840.1.114171.500.9", ""},
493 }, 493 },
494 // XRamp Global Certification Authority 494 // XRamp Global Certification Authority
495 { { { 0xb8, 0x01, 0x86, 0xd1, 0xeb, 0x9c, 0x86, 0xa5, 0x41, 0x04, 495 { { { 0xb8, 0x01, 0x86, 0xd1, 0xeb, 0x9c, 0x86, 0xa5, 0x41, 0x04,
496 0xcf, 0x30, 0x54, 0xf3, 0x4c, 0x52, 0xb7, 0xe5, 0x58, 0xc6 } }, 496 0xcf, 0x30, 0x54, 0xf3, 0x4c, 0x52, 0xb7, 0xe5, 0x58, 0xc6 } },
497 {"2.16.840.1.114404.1.1.2.4.1", ""}, 497 {"2.16.840.1.114404.1.1.2.4.1", ""},
498 } 498 }
499 }; 499 };
500 500
501 #endif // defined(USE_NSS) || defined(OS_IOS) || defined(OS_WIN) 501 #endif // defined(USE_NSS_CERTS) || defined(OS_IOS) || defined(OS_WIN)
502 502
503 static base::LazyInstance<EVRootCAMetadata>::Leaky 503 static base::LazyInstance<EVRootCAMetadata>::Leaky
504 g_ev_root_ca_metadata = LAZY_INSTANCE_INITIALIZER; 504 g_ev_root_ca_metadata = LAZY_INSTANCE_INITIALIZER;
505 505
506 // static 506 // static
507 EVRootCAMetadata* EVRootCAMetadata::GetInstance() { 507 EVRootCAMetadata* EVRootCAMetadata::GetInstance() {
508 return g_ev_root_ca_metadata.Pointer(); 508 return g_ev_root_ca_metadata.Pointer();
509 } 509 }
510 510
511 #if defined(USE_NSS) || defined(OS_IOS) 511 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
512 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const { 512 bool EVRootCAMetadata::IsEVPolicyOID(PolicyOID policy_oid) const {
513 return policy_oids_.find(policy_oid) != policy_oids_.end(); 513 return policy_oids_.find(policy_oid) != policy_oids_.end();
514 } 514 }
515 515
516 bool EVRootCAMetadata::HasEVPolicyOID( 516 bool EVRootCAMetadata::HasEVPolicyOID(
517 const SHA1HashValue& fingerprint, 517 const SHA1HashValue& fingerprint,
518 PolicyOID policy_oid) const { 518 PolicyOID policy_oid) const {
519 PolicyOIDMap::const_iterator iter = ev_policy_.find(fingerprint); 519 PolicyOIDMap::const_iterator iter = ev_policy_.find(fingerprint);
520 if (iter == ev_policy_.end()) 520 if (iter == ev_policy_.end())
521 return false; 521 return false;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 } 647 }
648 648
649 bool EVRootCAMetadata::RemoveEVCA(const SHA1HashValue& fingerprint) { 649 bool EVRootCAMetadata::RemoveEVCA(const SHA1HashValue& fingerprint) {
650 return true; 650 return true;
651 } 651 }
652 652
653 #endif 653 #endif
654 654
655 EVRootCAMetadata::EVRootCAMetadata() { 655 EVRootCAMetadata::EVRootCAMetadata() {
656 // Constructs the object from the raw metadata in ev_root_ca_metadata. 656 // Constructs the object from the raw metadata in ev_root_ca_metadata.
657 #if defined(USE_NSS) || defined(OS_IOS) 657 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
658 crypto::EnsureNSSInit(); 658 crypto::EnsureNSSInit();
659 659
660 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { 660 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) {
661 const EVMetadata& metadata = ev_root_ca_metadata[i]; 661 const EVMetadata& metadata = ev_root_ca_metadata[i];
662 for (size_t j = 0; j < arraysize(metadata.policy_oids); j++) { 662 for (size_t j = 0; j < arraysize(metadata.policy_oids); j++) {
663 if (metadata.policy_oids[j][0] == '\0') 663 if (metadata.policy_oids[j][0] == '\0')
664 break; 664 break;
665 const char* policy_oid = metadata.policy_oids[j]; 665 const char* policy_oid = metadata.policy_oids[j];
666 666
667 PolicyOID policy; 667 PolicyOID policy;
668 if (!RegisterOID(policy_oid, &policy)) { 668 if (!RegisterOID(policy_oid, &policy)) {
669 LOG(ERROR) << "Failed to register OID: " << policy_oid; 669 LOG(ERROR) << "Failed to register OID: " << policy_oid;
670 continue; 670 continue;
671 } 671 }
672 672
673 ev_policy_[metadata.fingerprint].push_back(policy); 673 ev_policy_[metadata.fingerprint].push_back(policy);
674 policy_oids_.insert(policy); 674 policy_oids_.insert(policy);
675 } 675 }
676 } 676 }
677 #endif 677 #endif
678 } 678 }
679 679
680 EVRootCAMetadata::~EVRootCAMetadata() { } 680 EVRootCAMetadata::~EVRootCAMetadata() { }
681 681
682 } // namespace net 682 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/ev_root_ca_metadata.h ('k') | net/cert/ev_root_ca_metadata_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698