| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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(OS_LINUX) | 7 #if defined(USE_NSS) |
| 8 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=455424 | 8 // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=455424 |
| 9 // until NSS 3.12.2 comes out and we update to it. | 9 // until NSS 3.12.2 comes out and we update to it. |
| 10 #define Lock FOO_NSS_Lock | 10 #define Lock FOO_NSS_Lock |
| 11 #include <cert.h> | 11 #include <cert.h> |
| 12 #include <pkcs11n.h> | 12 #include <pkcs11n.h> |
| 13 #include <secerr.h> | 13 #include <secerr.h> |
| 14 #include <secoid.h> | 14 #include <secoid.h> |
| 15 #undef Lock | 15 #undef Lock |
| 16 #endif | 16 #endif |
| 17 | 17 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 PolicyOID* policy_oid) const { | 223 PolicyOID* policy_oid) const { |
| 224 PolicyOidMap::const_iterator iter = ev_policy_.find(fingerprint); | 224 PolicyOidMap::const_iterator iter = ev_policy_.find(fingerprint); |
| 225 if (iter == ev_policy_.end()) | 225 if (iter == ev_policy_.end()) |
| 226 return false; | 226 return false; |
| 227 *policy_oid = iter->second; | 227 *policy_oid = iter->second; |
| 228 return true; | 228 return true; |
| 229 } | 229 } |
| 230 | 230 |
| 231 EVRootCAMetadata::EVRootCAMetadata() { | 231 EVRootCAMetadata::EVRootCAMetadata() { |
| 232 // Constructs the object from the raw metadata in ev_root_ca_metadata. | 232 // Constructs the object from the raw metadata in ev_root_ca_metadata. |
| 233 #if defined(OS_LINUX) | 233 #if defined(USE_NSS) |
| 234 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { | 234 for (size_t i = 0; i < arraysize(ev_root_ca_metadata); i++) { |
| 235 const EVMetadata& metadata = ev_root_ca_metadata[i]; | 235 const EVMetadata& metadata = ev_root_ca_metadata[i]; |
| 236 PRUint8 buf[1024]; | 236 PRUint8 buf[1024]; |
| 237 SECItem oid_item; | 237 SECItem oid_item; |
| 238 oid_item.data = buf; | 238 oid_item.data = buf; |
| 239 oid_item.len = sizeof(buf); | 239 oid_item.len = sizeof(buf); |
| 240 SECStatus status = SEC_StringToOID(NULL, &oid_item, metadata.policy_oid, 0); | 240 SECStatus status = SEC_StringToOID(NULL, &oid_item, metadata.policy_oid, 0); |
| 241 if (status != SECSuccess) { | 241 if (status != SECSuccess) { |
| 242 LOG(ERROR) << "Failed to convert to OID: " << metadata.policy_oid; | 242 LOG(ERROR) << "Failed to convert to OID: " << metadata.policy_oid; |
| 243 continue; | 243 continue; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 261 ev_policy_[metadata.fingerprint] = metadata.policy_oid; | 261 ev_policy_[metadata.fingerprint] = metadata.policy_oid; |
| 262 // Multiple root CA certs may use the same EV policy OID. Having | 262 // Multiple root CA certs may use the same EV policy OID. Having |
| 263 // duplicates in the policy_oids_ array does no harm, so we don't | 263 // duplicates in the policy_oids_ array does no harm, so we don't |
| 264 // bother detecting duplicates. | 264 // bother detecting duplicates. |
| 265 policy_oids_.push_back(metadata.policy_oid); | 265 policy_oids_.push_back(metadata.policy_oid); |
| 266 } | 266 } |
| 267 #endif | 267 #endif |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace net | 270 } // namespace net |
| OLD | NEW |