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 #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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 if (rv == ERR_IO_PENDING) { | 113 if (rv == ERR_IO_PENDING) { |
| 114 user_handshake_callback_ = callback; | 114 user_handshake_callback_ = callback; |
| 115 } else { | 115 } else { |
| 116 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_SERVER_HANDSHAKE, rv); | 116 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_SERVER_HANDSHAKE, rv); |
| 117 } | 117 } |
| 118 | 118 |
| 119 return rv > OK ? OK : rv; | 119 return rv > OK ? OK : rv; |
| 120 } | 120 } |
| 121 | 121 |
| 122 int SSLServerSocketNSS::ExportKeyingMaterial(const base::StringPiece& label, | 122 int SSLServerSocketNSS::ExportKeyingMaterial(const base::StringPiece& label, |
| 123 bool has_context, | |
| 123 const base::StringPiece& context, | 124 const base::StringPiece& context, |
| 124 unsigned char *out, | 125 unsigned char *out, |
|
Ryan Sleevi
2012/03/10 04:23:31
nit: "unsigned char *" -> "unsigned char* "
| |
| 125 unsigned int outlen) { | 126 unsigned int outlen) { |
| 126 if (!IsConnected()) | 127 if (!IsConnected()) |
| 127 return ERR_SOCKET_NOT_CONNECTED; | 128 return ERR_SOCKET_NOT_CONNECTED; |
| 128 SECStatus result = SSL_ExportKeyingMaterial( | 129 SECStatus result = SSL_ExportKeyingMaterial( |
| 129 nss_fd_, label.data(), label.size(), | 130 nss_fd_, label.data(), label.size(), has_context, |
| 130 reinterpret_cast<const unsigned char*>(context.data()), | 131 reinterpret_cast<const unsigned char*>(context.data()), |
| 131 context.length(), out, outlen); | 132 context.length(), out, outlen); |
| 132 if (result != SECSuccess) { | 133 if (result != SECSuccess) { |
| 133 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", ""); | 134 LogFailedNSSFunction(net_log_, "SSL_ExportKeyingMaterial", ""); |
| 134 return MapNSSError(PORT_GetError()); | 135 return MapNSSError(PORT_GetError()); |
| 135 } | 136 } |
| 136 return OK; | 137 return OK; |
| 137 } | 138 } |
| 138 | 139 |
| 139 int SSLServerSocketNSS::Connect(const CompletionCallback& callback) { | 140 int SSLServerSocketNSS::Connect(const CompletionCallback& callback) { |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 763 // Initialize the NSS SSL library in a threadsafe way. This also | 764 // Initialize the NSS SSL library in a threadsafe way. This also |
| 764 // initializes the NSS base library. | 765 // initializes the NSS base library. |
| 765 EnsureNSSSSLInit(); | 766 EnsureNSSSSLInit(); |
| 766 if (!NSS_IsInitialized()) | 767 if (!NSS_IsInitialized()) |
| 767 return ERR_UNEXPECTED; | 768 return ERR_UNEXPECTED; |
| 768 | 769 |
| 769 return OK; | 770 return OK; |
| 770 } | 771 } |
| 771 | 772 |
| 772 } // namespace net | 773 } // namespace net |
| OLD | NEW |