Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2388 return; | 2388 return; |
| 2389 | 2389 |
| 2390 nss_handshake_state_.sct_list_from_tls_extension = std::string( | 2390 nss_handshake_state_.sct_list_from_tls_extension = std::string( |
| 2391 reinterpret_cast<char*>(signed_cert_timestamps->data), | 2391 reinterpret_cast<char*>(signed_cert_timestamps->data), |
| 2392 signed_cert_timestamps->len); | 2392 signed_cert_timestamps->len); |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 void SSLClientSocketNSS::Core::UpdateStapledOCSPResponse() { | 2395 void SSLClientSocketNSS::Core::UpdateStapledOCSPResponse() { |
| 2396 const SECItemArray* ocsp_responses = | 2396 const SECItemArray* ocsp_responses = |
| 2397 SSL_PeerStapledOCSPResponses(nss_fd_); | 2397 SSL_PeerStapledOCSPResponses(nss_fd_); |
| 2398 if (!ocsp_responses || !ocsp_responses->len) | 2398 bool ocsp_requested = |
| 2399 IsOCSPStaplingSupported() || ssl_config_.signed_cert_timestamps_enabled; | |
| 2400 bool ocsp_responses_present = ocsp_responses && ocsp_responses->len; | |
| 2401 UMA_HISTOGRAM_BOOLEAN("Net.OCSPResponseStapled", | |
|
jar (doing other things)
2014/02/19 22:29:16
This looks fine... but considering how little spac
| |
| 2402 ocsp_requested && ocsp_responses_present); | |
|
wtc
2014/02/19 21:09:19
It should be unnecessary to test ocsp_requested. N
wtc
2014/02/19 22:00:30
1. I guess what you have in mind is this:
if (o
Ryan Sleevi
2014/02/19 23:12:18
Thanks for pointing this out. I've instead chosen
| |
| 2403 if (!ocsp_responses_present) | |
| 2399 return; | 2404 return; |
| 2400 | 2405 |
| 2401 nss_handshake_state_.stapled_ocsp_response = std::string( | 2406 nss_handshake_state_.stapled_ocsp_response = std::string( |
| 2402 reinterpret_cast<char*>(ocsp_responses->items[0].data), | 2407 reinterpret_cast<char*>(ocsp_responses->items[0].data), |
| 2403 ocsp_responses->items[0].len); | 2408 ocsp_responses->items[0].len); |
| 2404 | 2409 |
| 2405 // TODO(agl): figure out how to plumb an OCSP response into the Mac | 2410 // TODO(agl): figure out how to plumb an OCSP response into the Mac |
| 2406 // system library and update IsOCSPStaplingSupported for Mac. | 2411 // system library and update IsOCSPStaplingSupported for Mac. |
| 2407 if (IsOCSPStaplingSupported()) { | 2412 if (IsOCSPStaplingSupported()) { |
| 2408 #if defined(OS_WIN) | 2413 #if defined(OS_WIN) |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3190 rv = SSL_OptionSet(nss_fd_, SSL_CBC_RANDOM_IV, PR_TRUE); | 3195 rv = SSL_OptionSet(nss_fd_, SSL_CBC_RANDOM_IV, PR_TRUE); |
| 3191 if (rv != SECSuccess) | 3196 if (rv != SECSuccess) |
| 3192 LogFailedNSSFunction(net_log_, "SSL_OptionSet", "SSL_CBC_RANDOM_IV"); | 3197 LogFailedNSSFunction(net_log_, "SSL_OptionSet", "SSL_CBC_RANDOM_IV"); |
| 3193 | 3198 |
| 3194 // Added in NSS 3.15 | 3199 // Added in NSS 3.15 |
| 3195 #ifdef SSL_ENABLE_OCSP_STAPLING | 3200 #ifdef SSL_ENABLE_OCSP_STAPLING |
| 3196 // Request OCSP stapling even on platforms that don't support it, in | 3201 // Request OCSP stapling even on platforms that don't support it, in |
| 3197 // order to extract Certificate Transparency information. | 3202 // order to extract Certificate Transparency information. |
| 3198 rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_OCSP_STAPLING, | 3203 rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_OCSP_STAPLING, |
| 3199 (IsOCSPStaplingSupported() || | 3204 (IsOCSPStaplingSupported() || |
| 3200 ssl_config_.signed_cert_timestamps_enabled)); | 3205 ssl_config_.signed_cert_timestamps_enabled)); |
|
wtc
2014/02/19 21:09:19
Perhaps we should save this boolean in a data memb
wtc
2014/02/19 22:00:30
Please ignore this comment. I found a better solut
| |
| 3201 if (rv != SECSuccess) { | 3206 if (rv != SECSuccess) { |
| 3202 LogFailedNSSFunction(net_log_, "SSL_OptionSet", | 3207 LogFailedNSSFunction(net_log_, "SSL_OptionSet", |
| 3203 "SSL_ENABLE_OCSP_STAPLING"); | 3208 "SSL_ENABLE_OCSP_STAPLING"); |
| 3204 } | 3209 } |
| 3205 #endif | 3210 #endif |
| 3206 | 3211 |
| 3207 rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_SIGNED_CERT_TIMESTAMPS, | 3212 rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_SIGNED_CERT_TIMESTAMPS, |
| 3208 ssl_config_.signed_cert_timestamps_enabled); | 3213 ssl_config_.signed_cert_timestamps_enabled); |
| 3209 if (rv != SECSuccess) { | 3214 if (rv != SECSuccess) { |
| 3210 LogFailedNSSFunction(net_log_, "SSL_OptionSet", | 3215 LogFailedNSSFunction(net_log_, "SSL_OptionSet", |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3582 SignedCertificateTimestampAndStatus(*iter, | 3587 SignedCertificateTimestampAndStatus(*iter, |
| 3583 ct::SCT_STATUS_LOG_UNKNOWN)); | 3588 ct::SCT_STATUS_LOG_UNKNOWN)); |
| 3584 } | 3589 } |
| 3585 } | 3590 } |
| 3586 | 3591 |
| 3587 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { | 3592 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { |
| 3588 return server_bound_cert_service_; | 3593 return server_bound_cert_service_; |
| 3589 } | 3594 } |
| 3590 | 3595 |
| 3591 } // namespace net | 3596 } // namespace net |
| OLD | NEW |