OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
6 | 6 |
7 #define PRArenaPool PLArenaPool // Required by <blapi.h>. | 7 #define PRArenaPool PLArenaPool // Required by <blapi.h>. |
8 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. | 8 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 CertCloseStore(cert_store_, 0 /* flags */); | 713 CertCloseStore(cert_store_, 0 /* flags */); |
714 } | 714 } |
715 | 715 |
716 const HCERTSTORE cert_store_; | 716 const HCERTSTORE cert_store_; |
717 | 717 |
718 DISALLOW_COPY_AND_ASSIGN(GlobalCertStore); | 718 DISALLOW_COPY_AND_ASSIGN(GlobalCertStore); |
719 }; | 719 }; |
720 | 720 |
721 static base::LazyInstance<GlobalCertStore, | 721 static base::LazyInstance<GlobalCertStore, |
722 base::LeakyLazyInstanceTraits<GlobalCertStore> > | 722 base::LeakyLazyInstanceTraits<GlobalCertStore> > |
723 g_cert_store(base::LINKER_INITIALIZED); | 723 g_cert_store = LAZY_INSTANCE_INITIALIZER; |
724 | 724 |
725 // static | 725 // static |
726 HCERTSTORE X509Certificate::cert_store() { | 726 HCERTSTORE X509Certificate::cert_store() { |
727 return g_cert_store.Get().cert_store(); | 727 return g_cert_store.Get().cert_store(); |
728 } | 728 } |
729 | 729 |
730 PCCERT_CONTEXT X509Certificate::CreateOSCertChainForCert() const { | 730 PCCERT_CONTEXT X509Certificate::CreateOSCertChainForCert() const { |
731 // Create an in-memory certificate store to hold this certificate and | 731 // Create an in-memory certificate store to hold this certificate and |
732 // any intermediate certificates in |intermediate_ca_certs_|. The store | 732 // any intermediate certificates in |intermediate_ca_certs_|. The store |
733 // will be referenced in the returned PCCERT_CONTEXT, and will not be freed | 733 // will be referenced in the returned PCCERT_CONTEXT, and will not be freed |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 if (!CertSerializeCertificateStoreElement(cert_handle, 0, &buffer[0], | 1147 if (!CertSerializeCertificateStoreElement(cert_handle, 0, &buffer[0], |
1148 &length)) { | 1148 &length)) { |
1149 return false; | 1149 return false; |
1150 } | 1150 } |
1151 | 1151 |
1152 return pickle->WriteData(reinterpret_cast<const char*>(&buffer[0]), | 1152 return pickle->WriteData(reinterpret_cast<const char*>(&buffer[0]), |
1153 length); | 1153 length); |
1154 } | 1154 } |
1155 | 1155 |
1156 } // namespace net | 1156 } // namespace net |
OLD | NEW |