| 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 #include "net/socket/ssl_server_socket_nss.h" | 5 #include "net/socket/ssl_server_socket_nss.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 nss_fd_, label.data(), label.size(), has_context, | 162 nss_fd_, label.data(), label.size(), has_context, |
| 163 reinterpret_cast<const unsigned char*>(context.data()), | 163 reinterpret_cast<const unsigned char*>(context.data()), |
| 164 context.length(), out, outlen); | 164 context.length(), out, outlen); |
| 165 if (result != SECSuccess) { | 165 if (result != SECSuccess) { |
| 166 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", ""); | 166 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", ""); |
| 167 return MapNSSError(PORT_GetError()); | 167 return MapNSSError(PORT_GetError()); |
| 168 } | 168 } |
| 169 return OK; | 169 return OK; |
| 170 } | 170 } |
| 171 | 171 |
| 172 int SSLServerSocketNSS::GetTLSUniqueChannelBinding(std::string* out) { |
| 173 if (!IsConnected()) |
| 174 return ERR_SOCKET_NOT_CONNECTED; |
| 175 unsigned char buf[64]; |
| 176 unsigned int len; |
| 177 SECStatus result = SSL_GetChannelBinding(nss_fd_, |
| 178 SSL_CHANNEL_BINDING_TLS_UNIQUE, |
| 179 buf, &len, arraysize(buf)); |
| 180 if (result != SECSuccess) { |
| 181 LogFailedNSSFunction(net_log_, "SSL_GetChannelBinding", ""); |
| 182 return MapNSSError(PORT_GetError()); |
| 183 } |
| 184 out->assign(reinterpret_cast<char*>(buf), len); |
| 185 return OK; |
| 186 } |
| 187 |
| 172 int SSLServerSocketNSS::Connect(const CompletionCallback& callback) { | 188 int SSLServerSocketNSS::Connect(const CompletionCallback& callback) { |
| 173 NOTIMPLEMENTED(); | 189 NOTIMPLEMENTED(); |
| 174 return ERR_NOT_IMPLEMENTED; | 190 return ERR_NOT_IMPLEMENTED; |
| 175 } | 191 } |
| 176 | 192 |
| 177 int SSLServerSocketNSS::Read(IOBuffer* buf, int buf_len, | 193 int SSLServerSocketNSS::Read(IOBuffer* buf, int buf_len, |
| 178 const CompletionCallback& callback) { | 194 const CompletionCallback& callback) { |
| 179 DCHECK(user_read_callback_.is_null()); | 195 DCHECK(user_read_callback_.is_null()); |
| 180 DCHECK(user_handshake_callback_.is_null()); | 196 DCHECK(user_handshake_callback_.is_null()); |
| 181 DCHECK(!user_read_buf_); | 197 DCHECK(!user_read_buf_); |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 // initializes the NSS base library. | 819 // initializes the NSS base library. |
| 804 EnsureNSSSSLInit(); | 820 EnsureNSSSSLInit(); |
| 805 if (!NSS_IsInitialized()) | 821 if (!NSS_IsInitialized()) |
| 806 return ERR_UNEXPECTED; | 822 return ERR_UNEXPECTED; |
| 807 | 823 |
| 808 EnableSSLServerSockets(); | 824 EnableSSLServerSockets(); |
| 809 return OK; | 825 return OK; |
| 810 } | 826 } |
| 811 | 827 |
| 812 } // namespace net | 828 } // namespace net |
| OLD | NEW |