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 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2478 nss_fd_, label.data(), label.size(), has_context, | 2478 nss_fd_, label.data(), label.size(), has_context, |
2479 reinterpret_cast<const unsigned char*>(context.data()), | 2479 reinterpret_cast<const unsigned char*>(context.data()), |
2480 context.length(), out, outlen); | 2480 context.length(), out, outlen); |
2481 if (result != SECSuccess) { | 2481 if (result != SECSuccess) { |
2482 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", ""); | 2482 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", ""); |
2483 return MapNSSError(PORT_GetError()); | 2483 return MapNSSError(PORT_GetError()); |
2484 } | 2484 } |
2485 return OK; | 2485 return OK; |
2486 } | 2486 } |
2487 | 2487 |
2488 int SSLClientSocketNSS::GetTLSUniqueChannelBinding(std::string* out) { | |
2489 if (!IsConnected()) | |
2490 return ERR_SOCKET_NOT_CONNECTED; | |
2491 unsigned char buf[64]; | |
2492 unsigned int len; | |
2493 SECStatus result = SSL_GetChannelBinding(nss_fd_, | |
2494 SSL_CHANNEL_BINDING_TLS_UNIQUE, | |
2495 buf, &len, arraysize(buf)); | |
2496 if (result != SECSuccess) { | |
2497 LogFailedNSSFunction(net_log_, "SSL_GetChannelBinding", ""); | |
2498 return MapNSSError(PORT_GetError()); | |
2499 } | |
2500 out->assign(reinterpret_cast<char*>(buf), len); | |
2501 return OK; | |
2502 } | |
2503 | |
2504 SSLClientSocket::NextProtoStatus SSLClientSocketNSS::GetNextProto( | 2488 SSLClientSocket::NextProtoStatus SSLClientSocketNSS::GetNextProto( |
2505 std::string* proto) const { | 2489 std::string* proto) const { |
2506 *proto = core_->state().next_proto; | 2490 *proto = core_->state().next_proto; |
2507 return core_->state().next_proto_status; | 2491 return core_->state().next_proto_status; |
2508 } | 2492 } |
2509 | 2493 |
2510 int SSLClientSocketNSS::Connect(const CompletionCallback& callback) { | 2494 int SSLClientSocketNSS::Connect(const CompletionCallback& callback) { |
2511 EnterFunction(""); | 2495 EnterFunction(""); |
2512 DCHECK(transport_.get()); | 2496 DCHECK(transport_.get()); |
2513 // It is an error to create an SSLClientSocket whose context has no | 2497 // It is an error to create an SSLClientSocket whose context has no |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 return core_->GetChannelIDKey(); | 3195 return core_->GetChannelIDKey(); |
3212 } | 3196 } |
3213 | 3197 |
3214 SSLFailureState SSLClientSocketNSS::GetSSLFailureState() const { | 3198 SSLFailureState SSLClientSocketNSS::GetSSLFailureState() const { |
3215 if (completed_handshake_) | 3199 if (completed_handshake_) |
3216 return SSL_FAILURE_NONE; | 3200 return SSL_FAILURE_NONE; |
3217 return SSL_FAILURE_UNKNOWN; | 3201 return SSL_FAILURE_UNKNOWN; |
3218 } | 3202 } |
3219 | 3203 |
3220 } // namespace net | 3204 } // namespace net |
OLD | NEW |