Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
quic: move to ngtcp2_crypto
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Oct 9, 2019
1 parent 1365365 commit 4e79e93
Show file tree
Hide file tree
Showing 13 changed files with 731 additions and 2,171 deletions.
103 changes: 73 additions & 30 deletions deps/ngtcp2/ngtcp2.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
{
'target_name': 'ngtcp2',
'type': 'static_library',
'include_dirs': ['lib/includes'],
'include_dirs': [
'lib/includes',
'crypto/includes',
'lib',
],
'defines': [
'BUILDING_NGTCP2',
'NGTCP2_STATICLIB',
],
'dependencies': [
'../openssl/openssl.gyp:openssl'
],
'conditions': [
['OS=="win"', {
'defines': [
Expand All @@ -29,37 +36,73 @@
],
'direct_dependent_settings': {
'defines': [ 'NGTCP2_STATICLIB' ],
'include_dirs': [ 'lib/includes' ]
'include_dirs': [
'lib/includes',
'crypto/includes'
]
},
'sources': [
'lib/ngtcp2_acktr.c',
'lib/ngtcp2_addr.c',
'lib/ngtcp2_buf.c',
'lib/ngtcp2_cc.c',
'lib/ngtcp2_cid.c',
'lib/ngtcp2_conn.c',
'lib/ngtcp2_conv.c',
'lib/ngtcp2_crypto.c',
'lib/ngtcp2_err.c',
'lib/ngtcp2_gaptr.c',
'lib/ngtcp2_idtr.c',
'lib/ngtcp2_ksl.c',
'lib/ngtcp2_log.c',
'lib/ngtcp2_map.c',
'lib/ngtcp2_mem.c',
'lib/ngtcp2_path.c',
'lib/ngtcp2_pkt.c',
'lib/ngtcp2_ppe.c',
'lib/ngtcp2_pq.c',
'lib/ngtcp2_psl.c',
'lib/ngtcp2_pv.c',
'lib/ngtcp2_range.c',
'lib/ngtcp2_ringbuf.c',
'lib/ngtcp2_rob.c',
'lib/ngtcp2_rtb.c',
'lib/ngtcp2_str.c',
'lib/ngtcp2_strm.c',
'lib/ngtcp2_vec.c',
'lib/ngtcp2_acktr.c',
'lib/ngtcp2_acktr.h',
'lib/ngtcp2_addr.c',
'lib/ngtcp2_addr.h',
'lib/ngtcp2_buf.c',
'lib/ngtcp2_buf.h',
'lib/ngtcp2_cc.c',
'lib/ngtcp2_cc.h',
'lib/ngtcp2_cid.c',
'lib/ngtcp2_cid.h',
'lib/ngtcp2_conn.c',
'lib/ngtcp2_conn.h',
'lib/ngtcp2_conv.c',
'lib/ngtcp2_conv.h',
'lib/ngtcp2_crypto.c',
'lib/ngtcp2_crypto.h',
'lib/ngtcp2_err.c',
'lib/ngtcp2_err.h',
'lib/ngtcp2_gaptr.c',
'lib/ngtcp2_gaptr.h',
'lib/ngtcp2_idtr.c',
'lib/ngtcp2_idtr.h',
'lib/ngtcp2_ksl.c',
'lib/ngtcp2_ksl.h',
'lib/ngtcp2_log.c',
'lib/ngtcp2_log.h',
'lib/ngtcp2_macro.h',
'lib/ngtcp2_map.c',
'lib/ngtcp2_map.h',
'lib/ngtcp2_mem.c',
'lib/ngtcp2_mem.h',
'lib/ngtcp2_net.h',
'lib/ngtcp2_path.c',
'lib/ngtcp2_path.h',
'lib/ngtcp2_pkt.c',
'lib/ngtcp2_pkt.h',
'lib/ngtcp2_ppe.c',
'lib/ngtcp2_ppe.h',
'lib/ngtcp2_pq.c',
'lib/ngtcp2_pq.h',
'lib/ngtcp2_psl.c',
'lib/ngtcp2_psl.h',
'lib/ngtcp2_pv.c',
'lib/ngtcp2_pv.h',
'lib/ngtcp2_range.c',
'lib/ngtcp2_range.h',
'lib/ngtcp2_ringbuf.c',
'lib/ngtcp2_ringbuf.h',
'lib/ngtcp2_rob.c',
'lib/ngtcp2_rob.h',
'lib/ngtcp2_rtb.c',
'lib/ngtcp2_rtb.h',
'lib/ngtcp2_str.c',
'lib/ngtcp2_str.h',
'lib/ngtcp2_strm.c',
'lib/ngtcp2_strm.h',
'lib/ngtcp2_vec.c',
'lib/ngtcp2_vec.h',
'lib/ngtcp2_version.c',
'crypto/shared.c',
'crypto/openssl/openssl.c',
]
}
]
Expand Down
2 changes: 1 addition & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@
'src/node_quic_socket.cc',
'src/node_quic_stream.cc',
'src/node_quic_util.cc',
'src/node_quic.cc',
'src/node_quic.cc'
]
}
],
Expand Down
31 changes: 7 additions & 24 deletions src/node_quic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,16 @@ void QuicInitSecureContext(const FunctionCallbackInfo<Value>& args) {
SSL_OP_CIPHER_SERVER_PREFERENCE |
SSL_OP_NO_ANTI_REPLAY;
SSL_CTX_set_options(**sc, ssl_opts);
SSL_CTX_clear_options(**sc, SSL_OP_ENABLE_MIDDLEBOX_COMPAT);
SSL_CTX_set_mode(**sc, SSL_MODE_RELEASE_BUFFERS | SSL_MODE_QUIC_HACK);
SSL_CTX_set_mode(**sc, SSL_MODE_RELEASE_BUFFERS);
SSL_CTX_set_min_proto_version(**sc, TLS1_3_VERSION);
SSL_CTX_set_max_proto_version(**sc, TLS1_3_VERSION);
SSL_CTX_set_default_verify_paths(**sc);
SSL_CTX_set_max_early_data(**sc, std::numeric_limits<uint32_t>::max());
SSL_CTX_set_alpn_select_cb(**sc, ALPN_Select_Proto_CB, nullptr);
SSL_CTX_set_client_hello_cb(**sc, Client_Hello_CB, nullptr);
SSL_CTX_set_tlsext_status_cb(**sc, TLS_Status_Callback);
SSL_CTX_set_tlsext_status_arg(**sc, nullptr);
CHECK_EQ(
SSL_CTX_add_custom_ext(
**sc,
NGTCP2_TLSEXT_QUIC_TRANSPORT_PARAMETERS,
SSL_EXT_CLIENT_HELLO | SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS,
Server_Transport_Params_Add_CB,
Transport_Params_Free_CB, nullptr,
Server_Transport_Params_Parse_CB,
nullptr), 1);
SetQuicMethod(**sc);

const node::Utf8Value groups(env->isolate(), args[1]);
if (!SSL_CTX_set1_groups_list(**sc, *groups)) {
Expand All @@ -123,22 +116,12 @@ void QuicInitSecureContextClient(const FunctionCallbackInfo<Value>& args) {
ASSIGN_OR_RETURN_UNWRAP(&sc, args[0].As<Object>(),
args.GetReturnValue().Set(UV_EBADF));

SSL_CTX_set_mode(**sc, SSL_MODE_QUIC_HACK);
SSL_CTX_clear_options(**sc, SSL_OP_ENABLE_MIDDLEBOX_COMPAT);
SSL_CTX_set_min_proto_version(**sc, TLS1_3_VERSION);
SSL_CTX_set_max_proto_version(**sc, TLS1_3_VERSION);
SSL_CTX_set_default_verify_paths(**sc);
SSL_CTX_set_tlsext_status_cb(**sc, TLS_Status_Callback);
SSL_CTX_set_tlsext_status_arg(**sc, nullptr);

CHECK_EQ(SSL_CTX_add_custom_ext(
**sc,
NGTCP2_TLSEXT_QUIC_TRANSPORT_PARAMETERS,
SSL_EXT_CLIENT_HELLO | SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS,
Client_Transport_Params_Add_CB,
Transport_Params_Free_CB,
nullptr,
Client_Transport_Params_Parse_CB,
nullptr), 1);

SetQuicMethod(**sc);

const node::Utf8Value groups(env->isolate(), args[1]);
if (!SSL_CTX_set1_groups_list(**sc, *groups)) {
Expand Down
Loading

0 comments on commit 4e79e93

Please sign in to comment.