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 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3144 valid_thread_id_ = base::PlatformThread::CurrentId(); | 3144 valid_thread_id_ = base::PlatformThread::CurrentId(); |
3145 } | 3145 } |
3146 | 3146 |
3147 bool SSLClientSocketNSS::CalledOnValidThread() const { | 3147 bool SSLClientSocketNSS::CalledOnValidThread() const { |
3148 EnsureThreadIdAssigned(); | 3148 EnsureThreadIdAssigned(); |
3149 base::AutoLock auto_lock(lock_); | 3149 base::AutoLock auto_lock(lock_); |
3150 return valid_thread_id_ == base::PlatformThread::CurrentId(); | 3150 return valid_thread_id_ == base::PlatformThread::CurrentId(); |
3151 } | 3151 } |
3152 | 3152 |
3153 void SSLClientSocketNSS::AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const { | 3153 void SSLClientSocketNSS::AddSCTInfoToSSLInfo(SSLInfo* ssl_info) const { |
3154 for (ct::SCTList::const_iterator iter = | 3154 ssl_info->UpdateSignedCertificateTimestamps(ct_verify_result_); |
3155 ct_verify_result_.verified_scts.begin(); | |
3156 iter != ct_verify_result_.verified_scts.end(); ++iter) { | |
3157 ssl_info->signed_certificate_timestamps.push_back( | |
3158 SignedCertificateTimestampAndStatus(*iter, ct::SCT_STATUS_OK)); | |
3159 } | |
3160 for (ct::SCTList::const_iterator iter = | |
3161 ct_verify_result_.invalid_scts.begin(); | |
3162 iter != ct_verify_result_.invalid_scts.end(); ++iter) { | |
3163 ssl_info->signed_certificate_timestamps.push_back( | |
3164 SignedCertificateTimestampAndStatus(*iter, ct::SCT_STATUS_INVALID)); | |
3165 } | |
3166 for (ct::SCTList::const_iterator iter = | |
3167 ct_verify_result_.unknown_logs_scts.begin(); | |
3168 iter != ct_verify_result_.unknown_logs_scts.end(); ++iter) { | |
3169 ssl_info->signed_certificate_timestamps.push_back( | |
3170 SignedCertificateTimestampAndStatus(*iter, | |
3171 ct::SCT_STATUS_LOG_UNKNOWN)); | |
3172 } | |
3173 } | 3155 } |
3174 | 3156 |
3175 // static | 3157 // static |
3176 void SSLClientSocketNSS::ReorderNextProtos(NextProtoVector* next_protos) { | 3158 void SSLClientSocketNSS::ReorderNextProtos(NextProtoVector* next_protos) { |
3177 if (next_protos->size() < 2) { | 3159 if (next_protos->size() < 2) { |
3178 return; | 3160 return; |
3179 } | 3161 } |
3180 | 3162 |
3181 NextProto fallback_proto = next_protos->back(); | 3163 NextProto fallback_proto = next_protos->back(); |
3182 for (size_t i = next_protos->size() - 1; i > 0; --i) { | 3164 for (size_t i = next_protos->size() - 1; i > 0; --i) { |
3183 (*next_protos)[i] = (*next_protos)[i - 1]; | 3165 (*next_protos)[i] = (*next_protos)[i - 1]; |
3184 } | 3166 } |
3185 (*next_protos)[0] = fallback_proto; | 3167 (*next_protos)[0] = fallback_proto; |
3186 } | 3168 } |
3187 | 3169 |
3188 ChannelIDService* SSLClientSocketNSS::GetChannelIDService() const { | 3170 ChannelIDService* SSLClientSocketNSS::GetChannelIDService() const { |
3189 return channel_id_service_; | 3171 return channel_id_service_; |
3190 } | 3172 } |
3191 | 3173 |
3192 SSLFailureState SSLClientSocketNSS::GetSSLFailureState() const { | 3174 SSLFailureState SSLClientSocketNSS::GetSSLFailureState() const { |
3193 if (completed_handshake_) | 3175 if (completed_handshake_) |
3194 return SSL_FAILURE_NONE; | 3176 return SSL_FAILURE_NONE; |
3195 return SSL_FAILURE_UNKNOWN; | 3177 return SSL_FAILURE_UNKNOWN; |
3196 } | 3178 } |
3197 | 3179 |
3198 } // namespace net | 3180 } // namespace net |
OLD | NEW |