diff options
Diffstat (limited to 'chromium/net/cert/x509_util.cc')
-rw-r--r-- | chromium/net/cert/x509_util.cc | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/chromium/net/cert/x509_util.cc b/chromium/net/cert/x509_util.cc index 6a823ab9f6b..90b848da6ab 100644 --- a/chromium/net/cert/x509_util.cc +++ b/chromium/net/cert/x509_util.cc @@ -9,6 +9,7 @@ #include <memory> #include "base/lazy_instance.h" +#include "base/logging.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/time/time.h" @@ -144,7 +145,22 @@ bool AddName(CBB* cbb, base::StringPiece name) { return true; } -bool AddTime(CBB* cbb, base::Time time) { +class BufferPoolSingleton { + public: + BufferPoolSingleton() : pool_(CRYPTO_BUFFER_POOL_new()) {} + CRYPTO_BUFFER_POOL* pool() { return pool_; } + + private: + // The singleton is leaky, so there is no need to use a smart pointer. + CRYPTO_BUFFER_POOL* pool_; +}; + +base::LazyInstance<BufferPoolSingleton>::Leaky g_buffer_pool_singleton = + LAZY_INSTANCE_INITIALIZER; + +} // namespace + +bool CBBAddTime(CBB* cbb, base::Time time) { der::GeneralizedTime generalized_time; if (!der::EncodeTimeAsGeneralizedTime(time, &generalized_time)) return false; @@ -164,21 +180,6 @@ bool AddTime(CBB* cbb, base::Time time) { der::EncodeGeneralizedTime(generalized_time, out) && CBB_flush(cbb); } -class BufferPoolSingleton { - public: - BufferPoolSingleton() : pool_(CRYPTO_BUFFER_POOL_new()) {} - CRYPTO_BUFFER_POOL* pool() { return pool_; } - - private: - // The singleton is leaky, so there is no need to use a smart pointer. - CRYPTO_BUFFER_POOL* pool_; -}; - -base::LazyInstance<BufferPoolSingleton>::Leaky g_buffer_pool_singleton = - LAZY_INSTANCE_INITIALIZER; - -} // namespace - bool GetTLSServerEndPointChannelBinding(const X509Certificate& certificate, std::string* token) { static const char kChannelBindingPrefix[] = "tls-server-end-point:"; @@ -296,8 +297,8 @@ bool CreateSelfSignedCert(EVP_PKEY* key, !AddRSASignatureAlgorithm(&tbs_cert, alg) || // signature !AddName(&tbs_cert, subject) || // issuer !CBB_add_asn1(&tbs_cert, &validity, CBS_ASN1_SEQUENCE) || - !AddTime(&validity, not_valid_before) || - !AddTime(&validity, not_valid_after) || + !CBBAddTime(&validity, not_valid_before) || + !CBBAddTime(&validity, not_valid_after) || !AddName(&tbs_cert, subject) || // subject !EVP_marshal_public_key(&tbs_cert, key)) { // subjectPublicKeyInfo return false; |