Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: net/socket/ssl_server_socket_nss.cc

Issue 10823084: Add a new GetTlsUniqueChannelBinding method to SSLSocket, and implement nss version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(unsigned char* out,
173 unsigned int *outlen,
174 unsigned int outlen_max) {
175 if (!IsConnected())
176 return ERR_SOCKET_NOT_CONNECTED;
177 SECStatus result = SSL_GetChannelBinding(nss_fd_,
178 SSL_CHANNEL_BINDING_TLS_UNIQUE,
179 out, outlen, outlen_max);
180 if (result != SECSuccess) {
181 LogFailedNSSFunction(net_log_, "SSL_GetChannelBinding", "");
182 return MapNSSError(PORT_GetError());
183 }
184 return OK;
185 }
186
172 int SSLServerSocketNSS::Connect(const CompletionCallback& callback) { 187 int SSLServerSocketNSS::Connect(const CompletionCallback& callback) {
173 NOTIMPLEMENTED(); 188 NOTIMPLEMENTED();
174 return ERR_NOT_IMPLEMENTED; 189 return ERR_NOT_IMPLEMENTED;
175 } 190 }
176 191
177 int SSLServerSocketNSS::Read(IOBuffer* buf, int buf_len, 192 int SSLServerSocketNSS::Read(IOBuffer* buf, int buf_len,
178 const CompletionCallback& callback) { 193 const CompletionCallback& callback) {
179 DCHECK(user_read_callback_.is_null()); 194 DCHECK(user_read_callback_.is_null());
180 DCHECK(user_handshake_callback_.is_null()); 195 DCHECK(user_handshake_callback_.is_null());
181 DCHECK(!user_read_buf_); 196 DCHECK(!user_read_buf_);
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 // initializes the NSS base library. 818 // initializes the NSS base library.
804 EnsureNSSSSLInit(); 819 EnsureNSSSSLInit();
805 if (!NSS_IsInitialized()) 820 if (!NSS_IsInitialized())
806 return ERR_UNEXPECTED; 821 return ERR_UNEXPECTED;
807 822
808 EnableSSLServerSockets(); 823 EnableSSLServerSockets();
809 return OK; 824 return OK;
810 } 825 }
811 826
812 } // namespace net 827 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698