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

Side by Side Diff: runtime/bin/secure_socket.cc

Issue 1420923006: Add unique serial numbers to sample X509 certificates. Remove the "sendClientCertificate" parameter… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Delete all certificate signing private keys, so testers aren't vulnerable. Created 5 years, 1 month 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
« no previous file with comments | « runtime/bin/secure_socket.h ('k') | runtime/bin/secure_socket_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/secure_socket.h" 5 #include "bin/secure_socket.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 178
179 void FUNCTION_NAME(SecureSocket_Connect)(Dart_NativeArguments args) { 179 void FUNCTION_NAME(SecureSocket_Connect)(Dart_NativeArguments args) {
180 Dart_Handle host_name_object = ThrowIfError(Dart_GetNativeArgument(args, 1)); 180 Dart_Handle host_name_object = ThrowIfError(Dart_GetNativeArgument(args, 1));
181 Dart_Handle context_object = ThrowIfError(Dart_GetNativeArgument(args, 2)); 181 Dart_Handle context_object = ThrowIfError(Dart_GetNativeArgument(args, 2));
182 bool is_server = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3)); 182 bool is_server = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3));
183 bool request_client_certificate = 183 bool request_client_certificate =
184 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 4)); 184 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 4));
185 bool require_client_certificate = 185 bool require_client_certificate =
186 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 5)); 186 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 5));
187 bool send_client_certificate =
188 DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 6));
189 Dart_Handle protocols_handle = 187 Dart_Handle protocols_handle =
190 ThrowIfError(Dart_GetNativeArgument(args, 7)); 188 ThrowIfError(Dart_GetNativeArgument(args, 6));
191 189
192 const char* host_name = NULL; 190 const char* host_name = NULL;
193 // TODO(whesse): Is truncating a Dart string containing \0 what we want? 191 // TODO(whesse): Is truncating a Dart string containing \0 what we want?
194 ThrowIfError(Dart_StringToCString(host_name_object, &host_name)); 192 ThrowIfError(Dart_StringToCString(host_name_object, &host_name));
195 193
196 SSL_CTX* context = NULL; 194 SSL_CTX* context = NULL;
197 if (!Dart_IsNull(context_object)) { 195 if (!Dart_IsNull(context_object)) {
198 ThrowIfError(Dart_GetNativeInstanceField( 196 ThrowIfError(Dart_GetNativeInstanceField(
199 context_object, 197 context_object,
200 kSecurityContextNativeFieldIndex, 198 kSecurityContextNativeFieldIndex,
201 reinterpret_cast<intptr_t*>(&context))); 199 reinterpret_cast<intptr_t*>(&context)));
202 } 200 }
203 201
204 // The protocols_handle is guaranteed to be a valid Uint8List. 202 // The protocols_handle is guaranteed to be a valid Uint8List.
205 // It will have the correct length encoding of the protocols array. 203 // It will have the correct length encoding of the protocols array.
206 ASSERT(!Dart_IsNull(protocols_handle)); 204 ASSERT(!Dart_IsNull(protocols_handle));
207 205
208 GetFilter(args)->Connect(host_name, 206 GetFilter(args)->Connect(host_name,
209 context, 207 context,
210 is_server, 208 is_server,
211 request_client_certificate, 209 request_client_certificate,
212 require_client_certificate, 210 require_client_certificate,
213 send_client_certificate,
214 protocols_handle); 211 protocols_handle);
215 } 212 }
216 213
217 214
218 void FUNCTION_NAME(SecureSocket_Destroy)(Dart_NativeArguments args) { 215 void FUNCTION_NAME(SecureSocket_Destroy)(Dart_NativeArguments args) {
219 SSLFilter* filter = GetFilter(args); 216 SSLFilter* filter = GetFilter(args);
220 SetFilter(args, NULL); 217 SetFilter(args, NULL);
221 filter->Destroy(); 218 filter->Destroy();
222 delete filter; 219 delete filter;
223 } 220 }
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 } 881 }
885 Dart_TypedDataReleaseData(protocols_handle); 882 Dart_TypedDataReleaseData(protocols_handle);
886 } 883 }
887 884
888 885
889 void SSLFilter::Connect(const char* hostname, 886 void SSLFilter::Connect(const char* hostname,
890 SSL_CTX* context, 887 SSL_CTX* context,
891 bool is_server, 888 bool is_server,
892 bool request_client_certificate, 889 bool request_client_certificate,
893 bool require_client_certificate, 890 bool require_client_certificate,
894 bool send_client_certificate,
895 Dart_Handle protocols_handle) { 891 Dart_Handle protocols_handle) {
896 is_server_ = is_server; 892 is_server_ = is_server;
897 if (in_handshake_) { 893 if (in_handshake_) {
898 FATAL("Connect called twice on the same _SecureFilter."); 894 FATAL("Connect called twice on the same _SecureFilter.");
899 } 895 }
900 896
901 int status; 897 int status;
902 int error; 898 int error;
903 BIO* ssl_side; 899 BIO* ssl_side;
904 status = BIO_new_bio_pair(&ssl_side, 10000, &socket_side_, 10000); 900 status = BIO_new_bio_pair(&ssl_side, 10000, &socket_side_, 10000);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 } else { 1117 } else {
1122 if (SSL_LOG_DATA) Log::Print( 1118 if (SSL_LOG_DATA) Log::Print(
1123 "WriteEncrypted BIO_read wrote %d bytes\n", bytes_processed); 1119 "WriteEncrypted BIO_read wrote %d bytes\n", bytes_processed);
1124 } 1120 }
1125 } 1121 }
1126 return bytes_processed; 1122 return bytes_processed;
1127 } 1123 }
1128 1124
1129 } // namespace bin 1125 } // namespace bin
1130 } // namespace dart 1126 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/secure_socket.h ('k') | runtime/bin/secure_socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698