Skip to content

Commit 13bf8ff

Browse files
committed
Breaking Change: merge BoringSSL branch into master
This replaces the NSS secure networking library from Mozilla with the BoringSSL library from Google. This library, based on OpenSSL, reads certificates from files in PEM format, rather than storing certificates and keys in a SQLite database, the way NSS does. There will be a blog post, changelog entries, and other documentation of the breaking changes. Review URL: https://codereview.chromium.org//1319703002 .
1 parent 9a3b561 commit 13bf8ff

File tree

192 files changed

+165713
-4379
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+165713
-4379
lines changed

DEPS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ vars = {
4242
"args_tag": "@0.13.0",
4343
"async_tag": "@1.2.0",
4444
"barback_tag" : "@0.15.2+6",
45+
"boringssl_rev" : "@daeafc22c66ad48f6b32fc8d3362eb9ba31b774e",
4546
"charcode_tag": "@1.1.0",
4647
"chrome_rev" : "@19997",
4748
"clang_rev" : "@28450",
@@ -89,6 +90,7 @@ vars = {
8990
"pub_cache_tag": "@v0.1.0",
9091
"pub_semver_tag": "@1.2.1",
9192
"quiver_tag": "@0.21.4",
93+
"root_certificates_rev": "@c3a41df63afacec62fcb8135196177e35fe72f71",
9294
"scheduled_test_tag": "@0.12.1+2",
9395
"shelf_rev": "@1e87b79b21ac5e6fa2f93576d6c06eaa65285ef4",
9496
"smoke_rev" : "@f3361191cc2a85ebc1e4d4c33aec672d7915aba9",
@@ -143,6 +145,14 @@ deps = {
143145
Var("chromium_git") + "/chromium/src/net/third_party/nss.git" +
144146
Var("net_nss_rev"),
145147

148+
Var("dart_root") + "/third_party/boringssl/src":
149+
"https://boringssl.googlesource.com/boringssl.git" +
150+
Var("boringssl_rev"),
151+
152+
Var("dart_root") + "/third_party/root_certificates":
153+
"https://github.com/dart-lang/root_certificates.git" +
154+
Var("root_certificates_rev"),
155+
146156
Var("dart_root") + "/third_party/jinja2":
147157
Var("chromium_git") + "/chromium/src/third_party/jinja2.git" +
148158
Var("jinja2_rev"),

runtime/bin/bin.gypi

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@
222222
['exclude', '_test\\.(cc|h)$'],
223223
],
224224
'conditions': [
225-
['dart_io_support==1 and dart_io_secure_socket==1', {
226-
'dependencies': [
227-
'bin/net/ssl.gyp:libssl_dart',
228-
],
229-
}],
230225
['dart_io_secure_socket==0', {
231226
'defines': [
232227
'DART_IO_SECURE_SOCKET_DISABLED'
@@ -292,14 +287,14 @@
292287
'io_natives.cc',
293288
],
294289
'conditions': [
295-
['dart_io_support==1 and dart_io_secure_socket==1', {
290+
['dart_io_support==1', {
296291
'dependencies': [
297-
'bin/net/ssl.gyp:libssl_dart',
292+
'bin/net/zlib.gyp:zlib_dart',
298293
],
299294
}],
300-
['dart_io_support==1 and dart_io_secure_socket==0', {
295+
['dart_io_support==1 and dart_io_secure_socket==1', {
301296
'dependencies': [
302-
'bin/net/zlib.gyp:zlib_dart',
297+
'../third_party/boringssl/boringssl_dart.gyp:boringssl',
303298
],
304299
}],
305300
['dart_io_secure_socket==0', {
@@ -333,19 +328,6 @@
333328
},
334329
}],
335330
],
336-
'configurations': {
337-
'Dart_Android_Base': {
338-
'target_conditions': [
339-
['_toolset=="target"', {
340-
'defines': [
341-
# Needed for sources outside of nss that include pr and ssl
342-
# header files.
343-
'MDCPUCFG="md/_linux.cfg"',
344-
],
345-
}],
346-
],
347-
},
348-
},
349331
},
350332
{
351333
'target_name': 'libdart_nosnapshot',

runtime/bin/io_impl_sources.gypi

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
'filter_unsupported.cc',
2727
'io_service.cc',
2828
'io_service.h',
29+
'io_service_no_ssl.cc',
30+
'io_service_no_ssl.h',
2931
'io_service_unsupported.cc',
30-
'net/nss_memio.cc',
31-
'net/nss_memio.h',
3232
'platform.cc',
3333
'platform.h',
3434
'platform_android.cc',
@@ -41,6 +41,7 @@
4141
'process_linux.cc',
4242
'process_macos.cc',
4343
'process_win.cc',
44+
'../../third_party/root_certificates/root_certificates.cc',
4445
'secure_socket.cc',
4546
'secure_socket.h',
4647
'secure_socket_unsupported.cc',
@@ -62,12 +63,15 @@
6263
'conditions': [
6364
['dart_io_secure_socket==1', {
6465
'sources!' : [
66+
'io_service_no_ssl.cc',
67+
'io_service_no_ssl.h',
6568
'secure_socket_unsupported.cc',
6669
],
6770
}, { # else dart_io_secure_socket == 0
6871
'sources!' : [
69-
'net/nss_memio.cc',
70-
'net/nss_memio.h',
72+
'../../third_party/root_certificates/root_certificates.cc',
73+
'io_service.cc',
74+
'io_service.h',
7175
'secure_socket.cc',
7276
'secure_socket.h',
7377
],
@@ -83,8 +87,9 @@
8387
'filter.h',
8488
'io_service.cc',
8589
'io_service.h',
86-
'net/nss_memio.cc',
87-
'net/nss_memio.h',
90+
'io_service_no_ssl.cc',
91+
'io_service_no_ssl.h',
92+
'../../third_party/root_certificates/root_certificates.cc',
8893
'secure_socket.cc',
8994
'secure_socket.h',
9095
],

runtime/bin/io_natives.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,23 @@ namespace bin {
9696
V(Process_Pid, 1) \
9797
V(Process_SetSignalHandler, 1) \
9898
V(Process_ClearSignalHandler, 1) \
99-
V(SecureSocket_Connect, 10) \
99+
V(SecureSocket_Connect, 8) \
100100
V(SecureSocket_Destroy, 1) \
101101
V(SecureSocket_FilterPointer, 1) \
102102
V(SecureSocket_GetSelectedProtocol, 1) \
103103
V(SecureSocket_Handshake, 1) \
104104
V(SecureSocket_Init, 1) \
105-
V(SecureSocket_InitializeLibrary, 3) \
106105
V(SecureSocket_PeerCertificate, 1) \
107106
V(SecureSocket_RegisterBadCertificateCallback, 2) \
108107
V(SecureSocket_RegisterHandshakeCompleteCallback, 2) \
109108
V(SecureSocket_Renegotiate, 4) \
109+
V(SecurityContext_Allocate, 1) \
110+
V(SecurityContext_UsePrivateKey, 3) \
111+
V(SecurityContext_SetAlpnProtocols, 3) \
112+
V(SecurityContext_SetClientAuthorities, 2) \
113+
V(SecurityContext_SetTrustedCertificates, 3) \
114+
V(SecurityContext_TrustBuiltinRoots, 1) \
115+
V(SecurityContext_UseCertificateChain, 2) \
110116
V(ServerSocket_Accept, 2) \
111117
V(ServerSocket_CreateBindListen, 6) \
112118
V(Socket_CreateConnect, 3) \
@@ -136,8 +142,11 @@ namespace bin {
136142
V(Stdin_SetLineMode, 1) \
137143
V(Stdout_GetTerminalSize, 1) \
138144
V(StringToSystemEncoding, 1) \
139-
V(SystemEncodingToString, 1)
140-
145+
V(SystemEncodingToString, 1) \
146+
V(X509_Subject, 1) \
147+
V(X509_Issuer, 1) \
148+
V(X509_StartValidity, 1) \
149+
V(X509_EndValidity, 1)
141150

142151
IO_NATIVE_LIST(DECLARE_FUNCTION);
143152

runtime/bin/io_service_no_ssl.cc

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4+
5+
#include "bin/dartutils.h"
6+
#include "bin/directory.h"
7+
#include "bin/file.h"
8+
#include "bin/io_buffer.h"
9+
#include "bin/io_service_no_ssl.h"
10+
#include "bin/socket.h"
11+
#include "bin/utils.h"
12+
13+
#include "platform/globals.h"
14+
#include "platform/utils.h"
15+
16+
#include "include/dart_api.h"
17+
18+
19+
namespace dart {
20+
namespace bin {
21+
22+
#define CASE_REQUEST(type, method, id) \
23+
case IOService::k##type##method##Request: \
24+
response = type::method##Request(data); \
25+
break;
26+
27+
void IOServiceCallback(Dart_Port dest_port_id,
28+
Dart_CObject* message) {
29+
Dart_Port reply_port_id = ILLEGAL_PORT;
30+
CObject* response = CObject::IllegalArgumentError();
31+
CObjectArray request(message);
32+
if (message->type == Dart_CObject_kArray &&
33+
request.Length() == 4 &&
34+
request[0]->IsInt32() &&
35+
request[1]->IsSendPort() &&
36+
request[2]->IsInt32() &&
37+
request[3]->IsArray()) {
38+
CObjectInt32 message_id(request[0]);
39+
CObjectSendPort reply_port(request[1]);
40+
CObjectInt32 request_id(request[2]);
41+
CObjectArray data(request[3]);
42+
reply_port_id = reply_port.Value();
43+
switch (request_id.Value()) {
44+
IO_SERVICE_REQUEST_LIST(CASE_REQUEST);
45+
default:
46+
UNREACHABLE();
47+
}
48+
}
49+
50+
CObjectArray result(CObject::NewArray(2));
51+
result.SetAt(0, request[0]);
52+
result.SetAt(1, response);
53+
ASSERT(reply_port_id != ILLEGAL_PORT);
54+
Dart_PostCObject(reply_port_id, result.AsApiCObject());
55+
}
56+
57+
58+
Dart_Port IOService::GetServicePort() {
59+
Dart_Port result = Dart_NewNativePort("IOService",
60+
IOServiceCallback,
61+
true);
62+
return result;
63+
}
64+
65+
66+
void FUNCTION_NAME(IOService_NewServicePort)(Dart_NativeArguments args) {
67+
Dart_SetReturnValue(args, Dart_Null());
68+
Dart_Port service_port = IOService::GetServicePort();
69+
if (service_port != ILLEGAL_PORT) {
70+
// Return a send port for the service port.
71+
Dart_Handle send_port = Dart_NewSendPort(service_port);
72+
Dart_SetReturnValue(args, send_port);
73+
}
74+
}
75+
76+
77+
} // namespace bin
78+
} // namespace dart

runtime/bin/io_service_no_ssl.h

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4+
5+
#ifndef BIN_IO_SERVICE_NO_SSL_H_
6+
#define BIN_IO_SERVICE_NO_SSL_H_
7+
8+
#include "bin/builtin.h"
9+
#include "bin/utils.h"
10+
11+
12+
namespace dart {
13+
namespace bin {
14+
15+
// This list must be kept in sync with the list in sdk/lib/io/io_service.dart
16+
// In this modified version, though, the request 39 for SSLFilter::ProcessFilter
17+
// is removed, for use in contexts in which secure sockets are not enabled.
18+
#define IO_SERVICE_REQUEST_LIST(V) \
19+
V(File, Exists, 0) \
20+
V(File, Create, 1) \
21+
V(File, Delete, 2) \
22+
V(File, Rename, 3) \
23+
V(File, Copy, 4) \
24+
V(File, Open, 5) \
25+
V(File, ResolveSymbolicLinks, 6) \
26+
V(File, Close, 7) \
27+
V(File, Position, 8) \
28+
V(File, SetPosition, 9) \
29+
V(File, Truncate, 10) \
30+
V(File, Length, 11) \
31+
V(File, LengthFromPath, 12) \
32+
V(File, LastModified, 13) \
33+
V(File, Flush, 14) \
34+
V(File, ReadByte, 15) \
35+
V(File, WriteByte, 16) \
36+
V(File, Read, 17) \
37+
V(File, ReadInto, 18) \
38+
V(File, WriteFrom, 19) \
39+
V(File, CreateLink, 20) \
40+
V(File, DeleteLink, 21) \
41+
V(File, RenameLink, 22) \
42+
V(File, LinkTarget, 23) \
43+
V(File, Type, 24) \
44+
V(File, Identical, 25) \
45+
V(File, Stat, 26) \
46+
V(File, Lock, 27) \
47+
V(Socket, Lookup, 28) \
48+
V(Socket, ListInterfaces, 29) \
49+
V(Socket, ReverseLookup, 30) \
50+
V(Directory, Create, 31) \
51+
V(Directory, Delete, 32) \
52+
V(Directory, Exists, 33) \
53+
V(Directory, CreateTemp, 34) \
54+
V(Directory, ListStart, 35) \
55+
V(Directory, ListNext, 36) \
56+
V(Directory, ListStop, 37) \
57+
V(Directory, Rename, 38)
58+
59+
#define DECLARE_REQUEST(type, method, id) \
60+
k##type##method##Request = id,
61+
62+
class IOService {
63+
public:
64+
enum {
65+
IO_SERVICE_REQUEST_LIST(DECLARE_REQUEST)
66+
};
67+
68+
static Dart_Port GetServicePort();
69+
};
70+
71+
} // namespace bin
72+
} // namespace dart
73+
74+
#endif // BIN_IO_SERVICE_NO_SSL_H_

runtime/bin/net/README-updating

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)