| Index: net/cert/nss_cert_database.cc
|
| diff --git a/net/cert/nss_cert_database.cc b/net/cert/nss_cert_database.cc
|
| index ed861b200bfeb207ee1fa6ff2fe75a9a72bb429c..a54765cba2ce87bf096077983611bac146acf7e8 100644
|
| --- a/net/cert/nss_cert_database.cc
|
| +++ b/net/cert/nss_cert_database.cc
|
| @@ -41,22 +41,24 @@ namespace net {
|
|
|
| namespace {
|
|
|
| -base::LazyInstance<NSSCertDatabase>::Leaky
|
| - g_nss_cert_database = LAZY_INSTANCE_INITIALIZER;
|
| +base::LazyInstance<NSSCertDatabase>::Leaky g_nss_cert_database =
|
| + LAZY_INSTANCE_INITIALIZER;
|
|
|
| } // namespace
|
|
|
| NSSCertDatabase::ImportCertFailure::ImportCertFailure(
|
| const scoped_refptr<X509Certificate>& cert,
|
| int err)
|
| - : certificate(cert), net_error(err) {}
|
| + : certificate(cert), net_error(err) {
|
| +}
|
|
|
| -NSSCertDatabase::ImportCertFailure::~ImportCertFailure() {}
|
| +NSSCertDatabase::ImportCertFailure::~ImportCertFailure() {
|
| +}
|
|
|
| // static
|
| NSSCertDatabase* NSSCertDatabase::GetInstance() {
|
| - // TODO(mattm): Remove this ifdef guard once the linux impl of
|
| - // GetNSSCertDatabaseForResourceContext does not call GetInstance.
|
| +// TODO(mattm): Remove this ifdef guard once the linux impl of
|
| +// GetNSSCertDatabaseForResourceContext does not call GetInstance.
|
| #if defined(OS_CHROMEOS)
|
| LOG(ERROR) << "NSSCertDatabase::GetInstance() is deprecated."
|
| << "See http://crbug.com/329735.";
|
| @@ -72,7 +74,8 @@ NSSCertDatabase::NSSCertDatabase()
|
| psm::EnsurePKCS12Init();
|
| }
|
|
|
| -NSSCertDatabase::~NSSCertDatabase() {}
|
| +NSSCertDatabase::~NSSCertDatabase() {
|
| +}
|
|
|
| void NSSCertDatabase::ListCertsSync(CertificateList* certs) {
|
| ListCertsImpl(certs);
|
| @@ -86,8 +89,7 @@ void NSSCertDatabase::ListCerts(
|
| CertificateList* raw_certs = certs.get();
|
| GetSlowTaskRunner()->PostTaskAndReply(
|
| FROM_HERE,
|
| - base::Bind(&NSSCertDatabase::ListCertsImpl,
|
| - base::Unretained(raw_certs)),
|
| + base::Bind(&NSSCertDatabase::ListCertsImpl, base::Unretained(raw_certs)),
|
| base::Bind(callback, base::Passed(&certs)));
|
| }
|
|
|
| @@ -127,22 +129,22 @@ void NSSCertDatabase::ListModules(CryptoModuleList* modules,
|
| PK11SlotListElement* slot_element = PK11_GetFirstSafe(slot_list.get());
|
| while (slot_element) {
|
| modules->push_back(CryptoModule::CreateFromHandle(slot_element->slot));
|
| - slot_element = PK11_GetNextSafe(slot_list.get(), slot_element,
|
| + slot_element = PK11_GetNextSafe(slot_list.get(),
|
| + slot_element,
|
| PR_FALSE); // restart
|
| }
|
| }
|
|
|
| -int NSSCertDatabase::ImportFromPKCS12(
|
| - CryptoModule* module,
|
| - const std::string& data,
|
| - const base::string16& password,
|
| - bool is_extractable,
|
| - net::CertificateList* imported_certs) {
|
| - DVLOG(1) << __func__ << " "
|
| - << PK11_GetModuleID(module->os_module_handle()) << ":"
|
| - << PK11_GetSlotID(module->os_module_handle());
|
| +int NSSCertDatabase::ImportFromPKCS12(CryptoModule* module,
|
| + const std::string& data,
|
| + const base::string16& password,
|
| + bool is_extractable,
|
| + net::CertificateList* imported_certs) {
|
| + DVLOG(1) << __func__ << " " << PK11_GetModuleID(module->os_module_handle())
|
| + << ":" << PK11_GetSlotID(module->os_module_handle());
|
| int result = psm::nsPKCS12Blob_Import(module->os_module_handle(),
|
| - data.data(), data.size(),
|
| + data.data(),
|
| + data.size(),
|
| password,
|
| is_extractable,
|
| imported_certs);
|
| @@ -152,10 +154,9 @@ int NSSCertDatabase::ImportFromPKCS12(
|
| return result;
|
| }
|
|
|
| -int NSSCertDatabase::ExportToPKCS12(
|
| - const CertificateList& certs,
|
| - const base::string16& password,
|
| - std::string* output) const {
|
| +int NSSCertDatabase::ExportToPKCS12(const CertificateList& certs,
|
| + const base::string16& password,
|
| + std::string* output) const {
|
| return psm::nsPKCS12Blob_Export(output, certs, password);
|
| }
|
|
|
| @@ -304,8 +305,8 @@ bool NSSCertDatabase::IsUntrusted(const X509Certificate* cert) const {
|
| }
|
|
|
| bool NSSCertDatabase::SetCertTrust(const X509Certificate* cert,
|
| - CertType type,
|
| - TrustBits trust_bits) {
|
| + CertType type,
|
| + TrustBits trust_bits) {
|
| bool success = psm::SetCertTrust(cert, type, trust_bits);
|
| if (success)
|
| NotifyObserversOfCACertChanged(cert);
|
| @@ -318,8 +319,8 @@ bool NSSCertDatabase::DeleteCertAndKey(const X509Certificate* cert) {
|
| // SEC_DeletePermCertificate if the private key is found. So, we check
|
| // whether a private key exists before deciding which function to call to
|
| // delete the cert.
|
| - SECKEYPrivateKey *privKey = PK11_FindKeyByAnyCert(cert->os_cert_handle(),
|
| - NULL);
|
| + SECKEYPrivateKey* privKey =
|
| + PK11_FindKeyByAnyCert(cert->os_cert_handle(), NULL);
|
| if (privKey) {
|
| SECKEY_DestroyPrivateKey(privKey);
|
| if (PK11_DeleteTokenCertAndKey(cert->os_cert_handle(), NULL)) {
|
| @@ -367,8 +368,7 @@ void NSSCertDatabase::ListCertsImpl(CertificateList* certs) {
|
|
|
| CERTCertList* cert_list = PK11_ListCerts(PK11CertListUnique, NULL);
|
| CERTCertListNode* node;
|
| - for (node = CERT_LIST_HEAD(cert_list);
|
| - !CERT_LIST_END(node, cert_list);
|
| + for (node = CERT_LIST_HEAD(cert_list); !CERT_LIST_END(node, cert_list);
|
| node = CERT_LIST_NEXT(node)) {
|
| certs->push_back(X509Certificate::CreateFromHandle(
|
| node->cert, X509Certificate::OSCertHandles()));
|
| @@ -393,8 +393,7 @@ void NSSCertDatabase::NotifyObserversOfCertRemoved(
|
|
|
| void NSSCertDatabase::NotifyObserversOfCACertChanged(
|
| const X509Certificate* cert) {
|
| - observer_list_->Notify(
|
| - &Observer::OnCACertChanged, make_scoped_refptr(cert));
|
| + observer_list_->Notify(&Observer::OnCACertChanged, make_scoped_refptr(cert));
|
| }
|
|
|
| } // namespace net
|
|
|