| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived | 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived |
| 6 // from AuthCertificateCallback() in | 6 // from AuthCertificateCallback() in |
| 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. | 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. |
| 8 | 8 |
| 9 /* ***** BEGIN LICENSE BLOCK ***** | 9 /* ***** BEGIN LICENSE BLOCK ***** |
| 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include <limits> | 64 #include <limits> |
| 65 | 65 |
| 66 #include "base/compiler_specific.h" | 66 #include "base/compiler_specific.h" |
| 67 #include "base/metrics/histogram.h" | 67 #include "base/metrics/histogram.h" |
| 68 #include "base/logging.h" | 68 #include "base/logging.h" |
| 69 #include "base/nss_util.h" | 69 #include "base/nss_util.h" |
| 70 #include "base/singleton.h" | 70 #include "base/singleton.h" |
| 71 #include "base/string_number_conversions.h" | 71 #include "base/string_number_conversions.h" |
| 72 #include "base/string_util.h" | 72 #include "base/string_util.h" |
| 73 #include "base/stringprintf.h" | 73 #include "base/stringprintf.h" |
| 74 #include "base/thread_restrictions.h" |
| 74 #include "base/values.h" | 75 #include "base/values.h" |
| 75 #include "net/base/address_list.h" | 76 #include "net/base/address_list.h" |
| 76 #include "net/base/cert_status_flags.h" | 77 #include "net/base/cert_status_flags.h" |
| 77 #include "net/base/cert_verifier.h" | 78 #include "net/base/cert_verifier.h" |
| 78 #include "net/base/dns_util.h" | 79 #include "net/base/dns_util.h" |
| 79 #include "net/base/dnsrr_resolver.h" | 80 #include "net/base/dnsrr_resolver.h" |
| 80 #include "net/base/dnssec_chain_verifier.h" | 81 #include "net/base/dnssec_chain_verifier.h" |
| 81 #include "net/base/io_buffer.h" | 82 #include "net/base/io_buffer.h" |
| 82 #include "net/base/net_errors.h" | 83 #include "net/base/net_errors.h" |
| 83 #include "net/base/net_log.h" | 84 #include "net/base/net_log.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY. | 170 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY. |
| 170 SSL_ClearSessionCache(); | 171 SSL_ClearSessionCache(); |
| 171 } | 172 } |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 // Initialize the NSS SSL library if it isn't already initialized. This must | 175 // Initialize the NSS SSL library if it isn't already initialized. This must |
| 175 // be called before any other NSS SSL functions. This function is | 176 // be called before any other NSS SSL functions. This function is |
| 176 // thread-safe, and the NSS SSL library will only ever be initialized once. | 177 // thread-safe, and the NSS SSL library will only ever be initialized once. |
| 177 // The NSS SSL library will be properly shut down on program exit. | 178 // The NSS SSL library will be properly shut down on program exit. |
| 178 void EnsureNSSSSLInit() { | 179 void EnsureNSSSSLInit() { |
| 180 // Initializing SSL causes us to do blocking IO. |
| 181 // Temporarily allow it until we fix |
| 182 // http://code.google.com/p/chromium/issues/detail?id=59847 |
| 183 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 184 |
| 179 Singleton<NSSSSLInitSingleton>::get(); | 185 Singleton<NSSSSLInitSingleton>::get(); |
| 180 } | 186 } |
| 181 | 187 |
| 182 // The default error mapping function. | 188 // The default error mapping function. |
| 183 // Maps an NSPR error code to a network error code. | 189 // Maps an NSPR error code to a network error code. |
| 184 int MapNSPRError(PRErrorCode err) { | 190 int MapNSPRError(PRErrorCode err) { |
| 185 // TODO(port): fill this out as we learn what's important | 191 // TODO(port): fill this out as we learn what's important |
| 186 switch (err) { | 192 switch (err) { |
| 187 case PR_WOULD_BLOCK_ERROR: | 193 case PR_WOULD_BLOCK_ERROR: |
| 188 return ERR_IO_PENDING; | 194 return ERR_IO_PENDING; |
| (...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2334 return ERR_IO_PENDING; | 2340 return ERR_IO_PENDING; |
| 2335 } | 2341 } |
| 2336 LeaveFunction(""); | 2342 LeaveFunction(""); |
| 2337 rv = MapNSPRError(prerr); | 2343 rv = MapNSPRError(prerr); |
| 2338 net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, | 2344 net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, |
| 2339 new SSLErrorParams(rv, prerr)); | 2345 new SSLErrorParams(rv, prerr)); |
| 2340 return rv; | 2346 return rv; |
| 2341 } | 2347 } |
| 2342 | 2348 |
| 2343 } // namespace net | 2349 } // namespace net |
| OLD | NEW |