grpc 1.10.0 → 1.11.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +2098 -501
- data/include/grpc/byte_buffer.h +2 -0
- data/include/grpc/byte_buffer_reader.h +2 -0
- data/include/grpc/census.h +2 -0
- data/include/grpc/fork.h +2 -0
- data/include/grpc/grpc.h +10 -0
- data/include/grpc/grpc_cronet.h +2 -0
- data/include/grpc/grpc_posix.h +2 -1
- data/include/grpc/grpc_security.h +21 -0
- data/include/grpc/grpc_security_constants.h +1 -0
- data/include/grpc/impl/codegen/byte_buffer.h +2 -0
- data/include/grpc/impl/codegen/grpc_types.h +24 -0
- data/include/grpc/impl/codegen/slice.h +1 -1
- data/include/grpc/impl/codegen/sync.h +1 -0
- data/include/grpc/impl/codegen/sync_custom.h +2 -0
- data/include/grpc/impl/codegen/sync_generic.h +2 -0
- data/include/grpc/impl/codegen/sync_posix.h +2 -0
- data/include/grpc/impl/codegen/sync_windows.h +2 -0
- data/include/grpc/slice.h +2 -0
- data/include/grpc/slice_buffer.h +2 -0
- data/include/grpc/status.h +2 -0
- data/include/grpc/support/alloc.h +2 -2
- data/include/grpc/support/atm.h +2 -0
- data/include/grpc/support/atm_gcc_atomic.h +2 -0
- data/include/grpc/support/atm_gcc_sync.h +2 -0
- data/include/grpc/support/atm_windows.h +2 -0
- data/include/grpc/support/log.h +1 -1
- data/include/grpc/support/sync.h +2 -0
- data/include/grpc/support/sync_custom.h +2 -0
- data/include/grpc/support/sync_generic.h +2 -0
- data/include/grpc/support/sync_posix.h +2 -0
- data/include/grpc/support/sync_windows.h +2 -0
- data/include/grpc/support/time.h +2 -0
- data/src/boringssl/err_data.c +444 -438
- data/src/core/ext/census/grpc_context.cc +2 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +13 -8
- data/src/core/ext/filters/client_channel/backup_poller.h +3 -2
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +2 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +1988 -433
- data/src/core/ext/filters/client_channel/client_channel.h +2 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +2 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +2 -27
- data/src/core/ext/filters/client_channel/connector.cc +2 -0
- data/src/core/ext/filters/client_channel/connector.h +2 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -0
- data/src/core/ext/filters/client_channel/http_proxy.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +96 -78
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +9 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +70 -62
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +4 -2
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +4 -2
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +3 -1
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -1
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +2 -1
- data/src/core/ext/filters/client_channel/method_params.cc +178 -0
- data/src/core/ext/filters/client_channel/method_params.h +74 -0
- data/src/core/ext/filters/client_channel/parse_address.cc +17 -13
- data/src/core/ext/filters/client_channel/parse_address.h +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.cc +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.h +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +2 -0
- data/src/core/ext/filters/client_channel/resolver.cc +2 -0
- data/src/core/ext/filters/client_channel/resolver.h +6 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +24 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +55 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +8 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +30 -3
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +7 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -0
- data/src/core/ext/filters/client_channel/resolver_registry.cc +2 -0
- data/src/core/ext/filters/client_channel/resolver_registry.h +2 -0
- data/src/core/ext/filters/client_channel/retry_throttle.cc +102 -120
- data/src/core/ext/filters/client_channel/retry_throttle.h +52 -25
- data/src/core/ext/filters/client_channel/subchannel.cc +14 -4
- data/src/core/ext/filters/client_channel/subchannel.h +10 -1
- data/src/core/ext/filters/client_channel/subchannel_index.cc +2 -0
- data/src/core/ext/filters/client_channel/subchannel_index.h +2 -0
- data/src/core/ext/filters/client_channel/uri_parser.cc +2 -1
- data/src/core/ext/filters/client_channel/uri_parser.h +2 -1
- data/src/core/ext/filters/deadline/deadline_filter.cc +2 -1
- data/src/core/ext/filters/deadline/deadline_filter.h +2 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +27 -25
- data/src/core/ext/filters/http/client/http_client_filter.h +2 -0
- data/src/core/ext/filters/http/client_authority_filter.cc +156 -0
- data/src/core/ext/filters/http/client_authority_filter.h +34 -0
- data/src/core/ext/filters/http/http_filters_plugin.cc +2 -0
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +21 -22
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +2 -0
- data/src/core/ext/filters/http/server/http_server_filter.cc +11 -8
- data/src/core/ext/filters/http/server/http_server_filter.h +2 -0
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +2 -0
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +2 -0
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +2 -0
- data/src/core/ext/filters/max_age/max_age_filter.cc +2 -0
- data/src/core/ext/filters/max_age/max_age_filter.h +2 -0
- data/src/core/ext/filters/message_size/message_size_filter.cc +52 -49
- data/src/core/ext/filters/message_size/message_size_filter.h +2 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +5 -1
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +2 -0
- data/src/core/ext/filters/workarounds/workaround_utils.cc +2 -0
- data/src/core/ext/filters/workarounds/workaround_utils.h +2 -0
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +3 -1
- data/src/core/ext/transport/chttp2/alpn/alpn.h +2 -0
- data/src/core/ext/transport/chttp2/client/authority.cc +42 -0
- data/src/core/ext/transport/chttp2/client/authority.h +36 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +2 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +10 -3
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +2 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +37 -25
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +2 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +3 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +2 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +2 -1
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +3 -1
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -0
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +2 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +152 -182
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +15 -19
- data/src/core/ext/transport/chttp2/transport/frame_data.h +7 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +2 -0
- data/src/core/ext/transport/chttp2/transport/huffsyms.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +2 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +60 -24
- data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -4
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/varint.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +10 -6
- data/src/core/ext/transport/inproc/inproc_plugin.cc +2 -0
- data/src/core/ext/transport/inproc/inproc_transport.cc +20 -23
- data/src/core/ext/transport/inproc/inproc_transport.h +2 -0
- data/src/core/lib/avl/avl.cc +2 -0
- data/src/core/lib/avl/avl.h +2 -0
- data/src/core/lib/backoff/backoff.cc +2 -0
- data/src/core/lib/backoff/backoff.h +2 -0
- data/src/core/lib/channel/channel_args.h +2 -0
- data/src/core/lib/channel/channel_stack.cc +3 -1
- data/src/core/lib/channel/channel_stack.h +2 -0
- data/src/core/lib/channel/channel_stack_builder.cc +2 -0
- data/src/core/lib/channel/channel_stack_builder.h +2 -0
- data/src/core/lib/channel/channel_trace.cc +239 -0
- data/src/core/lib/channel/channel_trace.h +133 -0
- data/src/core/lib/channel/channel_trace_registry.cc +80 -0
- data/src/core/lib/channel/channel_trace_registry.h +43 -0
- data/src/core/lib/channel/connected_channel.cc +2 -0
- data/src/core/lib/channel/connected_channel.h +2 -0
- data/src/core/lib/channel/handshaker.cc +2 -0
- data/src/core/lib/channel/handshaker.h +2 -0
- data/src/core/lib/channel/handshaker_factory.cc +2 -0
- data/src/core/lib/channel/handshaker_factory.h +2 -1
- data/src/core/lib/channel/handshaker_registry.cc +2 -0
- data/src/core/lib/channel/handshaker_registry.h +2 -1
- data/src/core/lib/channel/status_util.cc +100 -0
- data/src/core/lib/channel/status_util.h +58 -0
- data/src/core/lib/compression/algorithm_metadata.h +2 -0
- data/src/core/lib/compression/compression.cc +2 -0
- data/src/core/lib/compression/compression_internal.cc +2 -0
- data/src/core/lib/compression/compression_internal.h +2 -0
- data/src/core/lib/compression/message_compress.cc +2 -0
- data/src/core/lib/compression/message_compress.h +2 -0
- data/src/core/lib/compression/stream_compression.cc +2 -0
- data/src/core/lib/compression/stream_compression.h +2 -0
- data/src/core/lib/compression/stream_compression_gzip.cc +2 -0
- data/src/core/lib/compression/stream_compression_gzip.h +2 -0
- data/src/core/lib/compression/stream_compression_identity.cc +2 -1
- data/src/core/lib/compression/stream_compression_identity.h +2 -0
- data/src/core/lib/debug/stats.cc +2 -0
- data/src/core/lib/debug/stats.h +2 -0
- data/src/core/lib/debug/stats_data.cc +3 -1
- data/src/core/lib/debug/stats_data.h +2 -0
- data/src/core/lib/debug/trace.cc +2 -0
- data/src/core/lib/debug/trace.h +2 -1
- data/src/core/lib/gpr/alloc.cc +2 -1
- data/src/core/lib/gpr/arena.cc +47 -0
- data/src/core/lib/gpr/arena.h +2 -0
- data/src/core/lib/gpr/atm.cc +2 -0
- data/src/core/lib/gpr/cpu_linux.cc +5 -1
- data/src/core/lib/gpr/cpu_posix.cc +1 -1
- data/src/core/lib/gpr/env.h +2 -0
- data/src/core/lib/gpr/fork.cc +2 -0
- data/src/core/lib/gpr/host_port.cc +2 -0
- data/src/core/lib/gpr/log.cc +2 -1
- data/src/core/lib/gpr/log_linux.cc +1 -0
- data/src/core/lib/gpr/mpscq.cc +2 -0
- data/src/core/lib/gpr/mpscq.h +2 -0
- data/src/core/lib/gpr/murmur_hash.cc +2 -0
- data/src/core/lib/gpr/spinlock.h +2 -0
- data/src/core/lib/gpr/string.cc +2 -1
- data/src/core/lib/gpr/string.h +2 -2
- data/src/core/lib/gpr/sync.cc +2 -0
- data/src/core/lib/gpr/time.cc +2 -0
- data/src/core/lib/gpr/time_posix.cc +1 -0
- data/src/core/lib/gpr/time_precise.cc +2 -0
- data/src/core/lib/gpr/time_precise.h +2 -0
- data/src/core/lib/gpr/tls_gcc.h +2 -0
- data/src/core/lib/gpr/tls_msvc.h +2 -0
- data/src/core/lib/gpr/tls_pthread.h +2 -0
- data/src/core/lib/gpr/tmpfile.h +2 -0
- data/src/core/lib/gprpp/atomic_with_atm.h +2 -0
- data/src/core/lib/gprpp/atomic_with_std.h +2 -0
- data/src/core/lib/gprpp/inlined_vector.h +2 -0
- data/src/core/lib/gprpp/manual_constructor.h +3 -1
- data/src/core/lib/gprpp/memory.h +5 -3
- data/src/core/lib/gprpp/orphanable.h +3 -0
- data/src/core/lib/gprpp/ref_counted.h +4 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +3 -0
- data/src/core/lib/gprpp/thd.h +135 -0
- data/src/core/lib/gprpp/thd_posix.cc +209 -0
- data/src/core/lib/gprpp/thd_windows.cc +162 -0
- data/src/core/lib/http/format_request.cc +2 -0
- data/src/core/lib/http/format_request.h +2 -0
- data/src/core/lib/http/httpcli.cc +2 -0
- data/src/core/lib/http/httpcli.h +2 -0
- data/src/core/lib/http/httpcli_security_connector.cc +16 -7
- data/src/core/lib/http/parser.cc +2 -0
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/call_combiner.cc +2 -0
- data/src/core/lib/iomgr/call_combiner.h +2 -1
- data/src/core/lib/iomgr/combiner.cc +2 -0
- data/src/core/lib/iomgr/combiner.h +2 -0
- data/src/core/lib/iomgr/endpoint.cc +4 -0
- data/src/core/lib/iomgr/endpoint.h +2 -0
- data/src/core/lib/iomgr/endpoint_pair.h +2 -0
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -0
- data/src/core/lib/iomgr/endpoint_pair_uv.cc +2 -0
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +7 -4
- data/src/core/lib/iomgr/error.h +2 -0
- data/src/core/lib/iomgr/error_internal.h +2 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +2 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.h +2 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +4 -18
- data/src/core/lib/iomgr/ev_epollex_linux.h +2 -0
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +2 -0
- data/src/core/lib/iomgr/ev_epollsig_linux.h +2 -0
- data/src/core/lib/iomgr/ev_poll_posix.cc +61 -31
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -0
- data/src/core/lib/iomgr/ev_posix.cc +35 -19
- data/src/core/lib/iomgr/ev_posix.h +2 -0
- data/src/core/lib/iomgr/ev_windows.cc +2 -0
- data/src/core/lib/iomgr/exec_ctx.cc +3 -1
- data/src/core/lib/iomgr/exec_ctx.h +21 -9
- data/src/core/lib/iomgr/executor.cc +13 -11
- data/src/core/lib/iomgr/executor.h +2 -0
- data/src/core/lib/iomgr/fork_posix.cc +4 -2
- data/src/core/lib/iomgr/fork_windows.cc +2 -0
- data/src/core/lib/iomgr/gethostname_fallback.cc +2 -0
- data/src/core/lib/iomgr/gethostname_host_name_max.cc +2 -0
- data/src/core/lib/iomgr/gethostname_sysconf.cc +2 -0
- data/src/core/lib/iomgr/iocp_windows.cc +3 -1
- data/src/core/lib/iomgr/iocp_windows.h +3 -0
- data/src/core/lib/iomgr/iomgr.cc +2 -1
- data/src/core/lib/iomgr/iomgr.h +2 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +63 -0
- data/src/core/lib/iomgr/iomgr_custom.h +47 -0
- data/src/core/lib/iomgr/iomgr_internal.cc +43 -0
- data/src/core/lib/iomgr/iomgr_internal.h +14 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +30 -3
- data/src/core/lib/iomgr/iomgr_posix.h +2 -0
- data/src/core/lib/iomgr/iomgr_uv.cc +17 -20
- data/src/core/lib/iomgr/iomgr_windows.cc +29 -3
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +2 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.h +2 -0
- data/src/core/lib/iomgr/load_file.cc +2 -0
- data/src/core/lib/iomgr/load_file.h +2 -0
- data/src/core/lib/iomgr/lockfree_event.cc +2 -0
- data/src/core/lib/iomgr/lockfree_event.h +14 -1
- data/src/core/lib/iomgr/nameser.h +2 -0
- data/src/core/lib/iomgr/network_status_tracker.cc +3 -1
- data/src/core/lib/iomgr/network_status_tracker.h +2 -0
- data/src/core/lib/iomgr/polling_entity.cc +2 -0
- data/src/core/lib/iomgr/polling_entity.h +2 -0
- data/src/core/lib/iomgr/pollset.cc +56 -0
- data/src/core/lib/iomgr/pollset.h +19 -0
- data/src/core/lib/iomgr/pollset_custom.cc +106 -0
- data/src/core/lib/iomgr/{timer_generic.h → pollset_custom.h} +15 -17
- data/src/core/lib/iomgr/pollset_set.cc +55 -0
- data/src/core/lib/iomgr/pollset_set.h +13 -0
- data/src/core/lib/iomgr/pollset_set_custom.cc +48 -0
- data/src/core/lib/iomgr/{pollset_uv.h → pollset_set_custom.h} +6 -7
- data/src/core/lib/iomgr/pollset_set_windows.cc +17 -10
- data/src/core/lib/iomgr/pollset_set_windows.h +2 -0
- data/src/core/lib/iomgr/pollset_uv.cc +42 -105
- data/src/core/lib/iomgr/pollset_windows.cc +20 -12
- data/src/core/lib/iomgr/pollset_windows.h +2 -0
- data/src/core/lib/iomgr/port.h +10 -19
- data/src/core/lib/iomgr/resolve_address.cc +50 -0
- data/src/core/lib/iomgr/resolve_address.h +39 -10
- data/src/core/lib/iomgr/resolve_address_custom.cc +187 -0
- data/src/core/lib/iomgr/resolve_address_custom.h +43 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -22
- data/src/core/lib/iomgr/resolve_address_windows.cc +10 -22
- data/src/core/lib/iomgr/resource_quota.cc +2 -0
- data/src/core/lib/iomgr/resource_quota.h +3 -5
- data/src/core/lib/iomgr/sockaddr.h +3 -11
- data/src/core/lib/iomgr/sockaddr_custom.h +54 -0
- data/src/core/lib/iomgr/sockaddr_posix.h +26 -0
- data/src/core/lib/iomgr/sockaddr_utils.cc +91 -71
- data/src/core/lib/iomgr/sockaddr_utils.h +4 -0
- data/src/core/lib/iomgr/sockaddr_windows.h +21 -0
- data/src/core/lib/iomgr/socket_factory_posix.cc +2 -0
- data/src/core/lib/iomgr/socket_factory_posix.h +2 -0
- data/src/core/lib/iomgr/socket_mutator.cc +2 -0
- data/src/core/lib/iomgr/socket_mutator.h +2 -0
- data/src/core/lib/iomgr/socket_utils.h +11 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +15 -6
- data/src/core/lib/iomgr/socket_utils_linux.cc +4 -4
- data/src/core/lib/iomgr/socket_utils_posix.cc +3 -2
- data/src/core/lib/iomgr/socket_utils_posix.h +2 -0
- data/src/core/lib/iomgr/socket_utils_uv.cc +13 -2
- data/src/core/lib/iomgr/socket_utils_windows.cc +10 -0
- data/src/core/lib/iomgr/socket_windows.cc +2 -0
- data/src/core/lib/iomgr/socket_windows.h +2 -1
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +2 -0
- data/src/core/lib/iomgr/tcp_client.cc +36 -0
- data/src/core/lib/iomgr/tcp_client.h +13 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +151 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +11 -24
- data/src/core/lib/iomgr/tcp_client_posix.h +2 -0
- data/src/core/lib/iomgr/tcp_client_windows.cc +10 -23
- data/src/core/lib/iomgr/tcp_custom.cc +365 -0
- data/src/core/lib/iomgr/tcp_custom.h +81 -0
- data/src/core/lib/iomgr/tcp_posix.cc +3 -1
- data/src/core/lib/iomgr/tcp_posix.h +2 -0
- data/src/core/lib/iomgr/tcp_server.cc +73 -0
- data/src/core/lib/iomgr/tcp_server.h +24 -0
- data/src/core/lib/iomgr/tcp_server_custom.cc +472 -0
- data/src/core/lib/iomgr/tcp_server_posix.cc +41 -23
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +7 -7
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -6
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +2 -0
- data/src/core/lib/iomgr/tcp_server_windows.cc +43 -21
- data/src/core/lib/iomgr/tcp_uv.cc +308 -314
- data/src/core/lib/iomgr/tcp_windows.cc +3 -1
- data/src/core/lib/iomgr/tcp_windows.h +2 -0
- data/src/core/lib/iomgr/time_averaged_stats.cc +2 -0
- data/src/core/lib/iomgr/timer.cc +45 -0
- data/src/core/lib/iomgr/timer.h +36 -15
- data/src/core/lib/iomgr/timer_custom.cc +93 -0
- data/src/core/lib/iomgr/timer_custom.h +43 -0
- data/src/core/lib/iomgr/timer_generic.cc +12 -10
- data/src/core/lib/iomgr/timer_heap.cc +2 -4
- data/src/core/lib/iomgr/timer_heap.h +2 -0
- data/src/core/lib/iomgr/timer_manager.cc +12 -20
- data/src/core/lib/iomgr/timer_manager.h +2 -0
- data/src/core/lib/iomgr/timer_uv.cc +15 -49
- data/src/core/lib/iomgr/udp_server.cc +271 -230
- data/src/core/lib/iomgr/udp_server.h +44 -20
- data/src/core/lib/iomgr/unix_sockets_posix.cc +10 -7
- data/src/core/lib/iomgr/unix_sockets_posix.h +2 -0
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +3 -1
- data/src/core/lib/iomgr/wakeup_fd_cv.h +2 -0
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +2 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.h +2 -0
- data/src/core/lib/json/json.cc +38 -0
- data/src/core/lib/json/json.h +22 -1
- data/src/core/lib/json/json_reader.cc +2 -2
- data/src/core/lib/json/json_reader.h +1 -0
- data/src/core/lib/json/json_string.cc +2 -0
- data/src/core/lib/json/json_writer.cc +2 -2
- data/src/core/lib/json/json_writer.h +2 -0
- data/src/core/lib/profiling/basic_timers.cc +11 -9
- data/src/core/lib/profiling/timers.h +6 -3
- data/src/core/lib/security/context/security_context.cc +2 -0
- data/src/core/lib/security/context/security_context.h +2 -0
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +119 -0
- data/src/core/lib/security/credentials/alts/alts_credentials.h +102 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +72 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment.h +57 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +67 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +33 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +114 -0
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +126 -0
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc +46 -0
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +112 -0
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +58 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +2 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -0
- data/src/core/lib/security/credentials/credentials.cc +2 -0
- data/src/core/lib/security/credentials/credentials.h +2 -0
- data/src/core/lib/security/credentials/credentials_metadata.cc +2 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +2 -3
- data/src/core/lib/security/credentials/fake/fake_credentials.h +5 -0
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +2 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +2 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +2 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +2 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +11 -2
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +2 -0
- data/src/core/lib/security/security_connector/alts_security_connector.cc +287 -0
- data/src/core/lib/security/security_connector/alts_security_connector.h +69 -0
- data/src/core/lib/security/security_connector/security_connector.cc +174 -74
- data/src/core/lib/security/security_connector/security_connector.h +41 -7
- data/src/core/lib/security/transport/auth_filters.h +2 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +14 -28
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -0
- data/src/core/lib/security/transport/secure_endpoint.h +2 -0
- data/src/core/lib/security/transport/security_handshaker.cc +2 -0
- data/src/core/lib/security/transport/security_handshaker.h +2 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +2 -0
- data/src/core/lib/security/transport/target_authority_table.cc +75 -0
- data/src/core/lib/security/transport/{lb_targets_info.h → target_authority_table.h} +16 -8
- data/src/core/lib/security/transport/tsi_error.cc +2 -0
- data/src/core/lib/security/transport/tsi_error.h +2 -0
- data/src/core/lib/security/util/json_util.cc +2 -0
- data/src/core/lib/security/util/json_util.h +2 -0
- data/src/core/lib/slice/b64.cc +2 -0
- data/src/core/lib/slice/b64.h +2 -0
- data/src/core/lib/slice/percent_encoding.cc +2 -0
- data/src/core/lib/slice/percent_encoding.h +2 -0
- data/src/core/lib/slice/slice.cc +2 -0
- data/src/core/lib/slice/slice_buffer.cc +3 -1
- data/src/core/lib/slice/slice_hash_table.h +178 -45
- data/src/core/lib/slice/slice_intern.cc +2 -0
- data/src/core/lib/slice/slice_internal.h +2 -2
- data/src/core/lib/slice/slice_string_helpers.cc +2 -0
- data/src/core/lib/slice/slice_string_helpers.h +2 -1
- data/src/core/lib/slice/slice_weak_hash_table.h +105 -0
- data/src/core/lib/surface/api_trace.cc +3 -1
- data/src/core/lib/surface/api_trace.h +2 -0
- data/src/core/lib/surface/byte_buffer.cc +3 -0
- data/src/core/lib/surface/byte_buffer_reader.cc +3 -0
- data/src/core/lib/surface/call.cc +46 -80
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/call_details.cc +2 -0
- data/src/core/lib/surface/call_log_batch.cc +2 -0
- data/src/core/lib/surface/call_test_only.h +2 -0
- data/src/core/lib/surface/channel.cc +72 -41
- data/src/core/lib/surface/channel.h +2 -0
- data/src/core/lib/surface/channel_init.cc +2 -0
- data/src/core/lib/surface/channel_init.h +2 -0
- data/src/core/lib/surface/channel_ping.cc +2 -0
- data/src/core/lib/surface/channel_stack_type.cc +3 -2
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.h +2 -0
- data/src/core/lib/surface/completion_queue_factory.cc +3 -1
- data/src/core/lib/surface/completion_queue_factory.h +2 -0
- data/src/core/lib/surface/event_string.cc +2 -0
- data/src/core/lib/surface/event_string.h +2 -0
- data/src/core/lib/surface/init.cc +5 -2
- data/src/core/lib/surface/init_secure.cc +5 -2
- data/src/core/lib/surface/lame_client.cc +7 -5
- data/src/core/lib/surface/lame_client.h +2 -0
- data/src/core/lib/surface/metadata_array.cc +2 -0
- data/src/core/lib/surface/server.cc +2 -0
- data/src/core/lib/surface/server.h +2 -0
- data/src/core/lib/surface/validate_metadata.cc +2 -1
- data/src/core/lib/surface/validate_metadata.h +2 -0
- data/src/core/lib/surface/version.cc +4 -2
- data/src/core/lib/transport/bdp_estimator.cc +2 -0
- data/src/core/lib/transport/byte_stream.cc +94 -116
- data/src/core/lib/transport/byte_stream.h +111 -78
- data/src/core/lib/transport/connectivity_state.cc +2 -0
- data/src/core/lib/transport/connectivity_state.h +3 -1
- data/src/core/lib/transport/error_utils.cc +2 -0
- data/src/core/lib/transport/error_utils.h +2 -0
- data/src/core/lib/transport/metadata.cc +2 -0
- data/src/core/lib/transport/metadata.h +3 -1
- data/src/core/lib/transport/metadata_batch.cc +26 -0
- data/src/core/lib/transport/metadata_batch.h +12 -1
- data/src/core/lib/transport/pid_controller.cc +2 -0
- data/src/core/lib/transport/pid_controller.h +2 -0
- data/src/core/lib/transport/service_config.cc +21 -175
- data/src/core/lib/transport/service_config.h +223 -35
- data/src/core/lib/transport/static_metadata.cc +310 -294
- data/src/core/lib/transport/static_metadata.h +96 -82
- data/src/core/lib/transport/status_conversion.cc +2 -0
- data/src/core/lib/transport/status_conversion.h +3 -0
- data/src/core/lib/transport/status_metadata.cc +54 -0
- data/src/core/lib/{iomgr/timer_uv.h → transport/status_metadata.h} +10 -12
- data/src/core/lib/transport/timeout_encoding.cc +2 -1
- data/src/core/lib/transport/timeout_encoding.h +2 -0
- data/src/core/lib/transport/transport.cc +3 -1
- data/src/core/lib/transport/transport.h +33 -7
- data/src/core/lib/transport/transport_impl.h +2 -0
- data/src/core/lib/transport/transport_op_string.cc +10 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +10 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +687 -0
- data/src/core/tsi/alts/crypt/gsec.cc +189 -0
- data/src/core/tsi/alts/crypt/gsec.h +454 -0
- data/src/core/tsi/alts/frame_protector/alts_counter.cc +118 -0
- data/src/core/tsi/alts/frame_protector/alts_counter.h +98 -0
- data/src/core/tsi/alts/frame_protector/alts_crypter.cc +66 -0
- data/src/core/tsi/alts/frame_protector/alts_crypter.h +255 -0
- data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +407 -0
- data/src/core/tsi/alts/frame_protector/alts_frame_protector.h +55 -0
- data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.cc +114 -0
- data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h +114 -0
- data/src/core/tsi/alts/frame_protector/alts_seal_privacy_integrity_crypter.cc +105 -0
- data/src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc +103 -0
- data/src/core/tsi/alts/frame_protector/frame_handler.cc +218 -0
- data/src/core/tsi/alts/frame_protector/frame_handler.h +236 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +316 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +137 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +520 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +323 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +143 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +149 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_event.cc +73 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_event.h +93 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +483 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +83 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +52 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +58 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +52 -0
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +48 -0
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +64 -0
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +123 -0
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +255 -0
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +50 -0
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +78 -0
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +196 -0
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +163 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +180 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +52 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +144 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h +49 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h +91 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +174 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +100 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +476 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h +199 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +296 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +52 -0
- data/src/core/tsi/alts_transport_security.cc +3 -1
- data/src/core/tsi/alts_transport_security.h +4 -2
- data/src/core/tsi/fake_transport_security.cc +2 -1
- data/src/core/tsi/fake_transport_security.h +2 -0
- data/src/core/tsi/ssl/session_cache/ssl_session.h +73 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +58 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +211 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +93 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +76 -0
- data/src/core/tsi/ssl_transport_security.cc +266 -62
- data/src/core/tsi/ssl_transport_security.h +128 -6
- data/src/core/tsi/ssl_types.h +2 -0
- data/src/core/tsi/transport_security.cc +2 -0
- data/src/core/tsi/transport_security.h +2 -0
- data/src/core/tsi/transport_security_adapter.cc +2 -0
- data/src/core/tsi/transport_security_adapter.h +2 -0
- data/src/core/tsi/transport_security_grpc.cc +2 -0
- data/src/core/tsi/transport_security_grpc.h +2 -0
- data/src/core/tsi/transport_security_interface.h +2 -0
- data/src/ruby/ext/grpc/extconf.rb +1 -2
- data/src/ruby/ext/grpc/rb_call.c +1 -13
- data/src/ruby/ext/grpc/rb_channel.c +6 -6
- data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
- data/src/ruby/lib/grpc/core/time_consts.rb +1 -1
- data/src/ruby/lib/grpc/generic/bidi_call.rb +19 -8
- data/src/ruby/lib/grpc/generic/client_stub.rb +6 -10
- data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +133 -0
- data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +54 -0
- data/src/ruby/spec/pb/package_with_underscore/data.proto +23 -0
- data/src/ruby/spec/pb/package_with_underscore/service.proto +23 -0
- data/third_party/address_sorting/address_sorting.c +369 -0
- data/third_party/address_sorting/address_sorting_internal.h +70 -0
- data/third_party/address_sorting/address_sorting_posix.c +97 -0
- data/third_party/address_sorting/address_sorting_windows.c +55 -0
- data/third_party/address_sorting/include/address_sorting/address_sorting.h +110 -0
- data/third_party/boringssl/crypto/asn1/a_enum.c +20 -9
- data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +3 -0
- data/third_party/boringssl/crypto/asn1/a_int.c +19 -8
- data/third_party/boringssl/crypto/asn1/a_object.c +0 -128
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +3 -0
- data/third_party/boringssl/crypto/asn1/tasn_fre.c +2 -4
- data/third_party/boringssl/crypto/asn1/tasn_new.c +3 -2
- data/third_party/boringssl/crypto/bn_extra/bn_asn1.c +0 -16
- data/third_party/boringssl/crypto/buf/buf.c +14 -0
- data/third_party/boringssl/crypto/bytestring/cbb.c +93 -0
- data/third_party/boringssl/crypto/conf/conf.c +2 -2
- data/third_party/boringssl/crypto/cpu-intel.c +17 -17
- data/third_party/boringssl/crypto/crypto.c +16 -4
- data/third_party/boringssl/crypto/curve25519/spake25519.c +11 -11
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +1 -1
- data/third_party/boringssl/crypto/dsa/dsa.c +9 -21
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +2 -2
- data/third_party/boringssl/crypto/ecdsa_extra/ecdsa_asn1.c +1 -8
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +2 -23
- data/third_party/boringssl/crypto/ex_data.c +0 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/add.c +7 -11
- data/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c +19 -16
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +15 -0
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +53 -46
- data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +242 -85
- data/third_party/boringssl/crypto/fipsmodule/bn/generic.c +42 -47
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +176 -34
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +118 -65
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +94 -61
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +79 -63
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +26 -28
- data/third_party/boringssl/crypto/fipsmodule/cipher/cipher.c +2 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +250 -149
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +0 -27
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +54 -20
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +3 -3
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +7 -41
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-64.c +6 -40
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +17 -122
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +3 -64
- data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +27 -9
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +203 -205
- data/third_party/boringssl/crypto/fipsmodule/modes/cbc.c +14 -15
- data/third_party/boringssl/crypto/fipsmodule/modes/cfb.c +12 -8
- data/third_party/boringssl/crypto/fipsmodule/modes/ctr.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/modes/gcm.c +25 -36
- data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +10 -0
- data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +0 -4
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +2 -0
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +9 -19
- data/third_party/boringssl/crypto/lhash/lhash.c +19 -0
- data/third_party/boringssl/crypto/obj/obj.c +29 -69
- data/third_party/boringssl/crypto/pem/pem_lib.c +2 -2
- data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +4 -55
- data/third_party/boringssl/crypto/rsa_extra/rsa_asn1.c +3 -22
- data/third_party/boringssl/crypto/x509/by_dir.c +1 -3
- data/third_party/boringssl/crypto/x509/by_file.c +0 -1
- data/third_party/boringssl/crypto/x509/x509_lu.c +0 -1
- data/third_party/boringssl/crypto/x509/x509_obj.c +1 -3
- data/third_party/boringssl/crypto/x509/x509_txt.c +0 -6
- data/third_party/boringssl/crypto/x509/x509_vfy.c +0 -1
- data/third_party/boringssl/crypto/x509/x509_vpm.c +0 -1
- data/third_party/boringssl/crypto/x509/x_algor.c +2 -2
- data/third_party/boringssl/crypto/x509v3/v3_alt.c +3 -4
- data/third_party/boringssl/crypto/x509v3/v3_genn.c +1 -0
- data/third_party/boringssl/crypto/x509v3/v3_info.c +1 -2
- data/third_party/boringssl/crypto/x509v3/v3_lib.c +15 -7
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +41 -2
- data/third_party/boringssl/include/openssl/asn1.h +0 -1
- data/third_party/boringssl/include/openssl/base.h +1 -1
- data/third_party/boringssl/include/openssl/bio.h +5 -2
- data/third_party/boringssl/include/openssl/bn.h +2 -17
- data/third_party/boringssl/include/openssl/buf.h +4 -0
- data/third_party/boringssl/include/openssl/bytestring.h +11 -0
- data/third_party/boringssl/include/openssl/chacha.h +5 -1
- data/third_party/boringssl/include/openssl/cipher.h +10 -0
- data/third_party/boringssl/include/openssl/conf.h +4 -8
- data/third_party/boringssl/include/openssl/dsa.h +2 -18
- data/third_party/boringssl/include/openssl/ec.h +5 -5
- data/third_party/boringssl/include/openssl/ecdsa.h +10 -28
- data/third_party/boringssl/include/openssl/evp.h +0 -4
- data/third_party/boringssl/include/openssl/lhash.h +1 -18
- data/third_party/boringssl/include/openssl/obj.h +1 -0
- data/third_party/boringssl/include/openssl/rsa.h +3 -4
- data/third_party/boringssl/include/openssl/ssl.h +35 -54
- data/third_party/boringssl/include/openssl/ssl3.h +2 -0
- data/third_party/boringssl/include/openssl/stack.h +1 -1
- data/third_party/boringssl/include/openssl/tls1.h +1 -16
- data/third_party/boringssl/include/openssl/x509.h +3 -2
- data/third_party/boringssl/include/openssl/x509_vfy.h +0 -2
- data/third_party/boringssl/include/openssl/x509v3.h +1 -0
- data/third_party/boringssl/ssl/custom_extensions.cc +1 -1
- data/third_party/boringssl/ssl/d1_both.cc +120 -129
- data/third_party/boringssl/ssl/d1_lib.cc +23 -21
- data/third_party/boringssl/ssl/d1_pkt.cc +39 -143
- data/third_party/boringssl/ssl/dtls_method.cc +16 -23
- data/third_party/boringssl/ssl/dtls_record.cc +11 -4
- data/third_party/boringssl/ssl/handshake.cc +109 -40
- data/third_party/boringssl/ssl/handshake_client.cc +104 -96
- data/third_party/boringssl/ssl/handshake_server.cc +62 -72
- data/third_party/boringssl/ssl/internal.h +397 -318
- data/third_party/boringssl/ssl/s3_both.cc +173 -191
- data/third_party/boringssl/ssl/s3_lib.cc +26 -34
- data/third_party/boringssl/ssl/s3_pkt.cc +105 -247
- data/third_party/boringssl/ssl/ssl_asn1.cc +22 -22
- data/third_party/boringssl/ssl/ssl_buffer.cc +98 -108
- data/third_party/boringssl/ssl/ssl_cert.cc +12 -1
- data/third_party/boringssl/ssl/ssl_cipher.cc +23 -28
- data/third_party/boringssl/ssl/ssl_key_share.cc +11 -6
- data/third_party/boringssl/ssl/ssl_lib.cc +190 -113
- data/third_party/boringssl/ssl/ssl_privkey.cc +76 -106
- data/third_party/boringssl/ssl/ssl_session.cc +3 -3
- data/third_party/boringssl/ssl/ssl_stat.cc +3 -3
- data/third_party/boringssl/ssl/ssl_transcript.cc +38 -22
- data/third_party/boringssl/ssl/ssl_versions.cc +64 -31
- data/third_party/boringssl/ssl/t1_enc.cc +137 -154
- data/third_party/boringssl/ssl/t1_lib.cc +463 -478
- data/third_party/boringssl/ssl/tls13_both.cc +57 -58
- data/third_party/boringssl/ssl/tls13_client.cc +256 -121
- data/third_party/boringssl/ssl/tls13_enc.cc +187 -72
- data/third_party/boringssl/ssl/tls13_server.cc +187 -86
- data/third_party/boringssl/ssl/tls_method.cc +20 -30
- data/third_party/boringssl/ssl/tls_record.cc +77 -40
- data/third_party/boringssl/third_party/fiat/curve25519.c +5062 -0
- data/third_party/boringssl/{crypto/curve25519 → third_party/fiat}/internal.h +40 -27
- data/third_party/nanopb/pb.h +1 -1
- metadata +147 -45
- data/src/core/lib/gpr/thd.cc +0 -49
- data/src/core/lib/gpr/thd.h +0 -71
- data/src/core/lib/gpr/thd_posix.cc +0 -154
- data/src/core/lib/gpr/thd_windows.cc +0 -107
- data/src/core/lib/iomgr/iomgr_uv.h +0 -37
- data/src/core/lib/iomgr/pollset_set_uv.cc +0 -43
- data/src/core/lib/iomgr/resolve_address_uv.cc +0 -284
- data/src/core/lib/iomgr/tcp_client_uv.cc +0 -175
- data/src/core/lib/iomgr/tcp_server_uv.cc +0 -471
- data/src/core/lib/iomgr/tcp_uv.h +0 -51
- data/src/core/lib/security/transport/lb_targets_info.cc +0 -59
- data/src/core/lib/slice/slice_hash_table.cc +0 -145
- data/third_party/boringssl/crypto/curve25519/curve25519.c +0 -4938
@@ -132,15 +132,15 @@
|
|
132
132
|
|
133
133
|
namespace bssl {
|
134
134
|
|
135
|
-
static
|
136
|
-
|
135
|
+
static bool add_record_to_flight(SSL *ssl, uint8_t type,
|
136
|
+
Span<const uint8_t> in) {
|
137
137
|
// We'll never add a flight while in the process of writing it out.
|
138
138
|
assert(ssl->s3->pending_flight_offset == 0);
|
139
139
|
|
140
|
-
if (ssl->s3->pending_flight ==
|
141
|
-
ssl->s3->pending_flight
|
142
|
-
if (ssl->s3->pending_flight ==
|
143
|
-
return
|
140
|
+
if (ssl->s3->pending_flight == nullptr) {
|
141
|
+
ssl->s3->pending_flight.reset(BUF_MEM_new());
|
142
|
+
if (ssl->s3->pending_flight == nullptr) {
|
143
|
+
return false;
|
144
144
|
}
|
145
145
|
}
|
146
146
|
|
@@ -148,40 +148,40 @@ static int add_record_to_flight(SSL *ssl, uint8_t type,
|
|
148
148
|
size_t new_cap = ssl->s3->pending_flight->length + max_out;
|
149
149
|
if (max_out < in.size() || new_cap < max_out) {
|
150
150
|
OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
|
151
|
-
return
|
151
|
+
return false;
|
152
152
|
}
|
153
153
|
|
154
154
|
size_t len;
|
155
|
-
if (!BUF_MEM_reserve(ssl->s3->pending_flight, new_cap) ||
|
155
|
+
if (!BUF_MEM_reserve(ssl->s3->pending_flight.get(), new_cap) ||
|
156
156
|
!tls_seal_record(ssl,
|
157
157
|
(uint8_t *)ssl->s3->pending_flight->data +
|
158
158
|
ssl->s3->pending_flight->length,
|
159
159
|
&len, max_out, type, in.data(), in.size())) {
|
160
|
-
return
|
160
|
+
return false;
|
161
161
|
}
|
162
162
|
|
163
163
|
ssl->s3->pending_flight->length += len;
|
164
|
-
return
|
164
|
+
return true;
|
165
165
|
}
|
166
166
|
|
167
|
-
|
167
|
+
bool ssl3_init_message(SSL *ssl, CBB *cbb, CBB *body, uint8_t type) {
|
168
168
|
// Pick a modest size hint to save most of the |realloc| calls.
|
169
169
|
if (!CBB_init(cbb, 64) ||
|
170
170
|
!CBB_add_u8(cbb, type) ||
|
171
171
|
!CBB_add_u24_length_prefixed(cbb, body)) {
|
172
172
|
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
173
173
|
CBB_cleanup(cbb);
|
174
|
-
return
|
174
|
+
return false;
|
175
175
|
}
|
176
176
|
|
177
|
-
return
|
177
|
+
return true;
|
178
178
|
}
|
179
179
|
|
180
|
-
|
180
|
+
bool ssl3_finish_message(SSL *ssl, CBB *cbb, Array<uint8_t> *out_msg) {
|
181
181
|
return CBBFinishArray(cbb, out_msg);
|
182
182
|
}
|
183
183
|
|
184
|
-
|
184
|
+
bool ssl3_add_message(SSL *ssl, Array<uint8_t> msg) {
|
185
185
|
// Add the message to the current flight, splitting into several records if
|
186
186
|
// needed.
|
187
187
|
Span<const uint8_t> rest = msg;
|
@@ -190,7 +190,7 @@ int ssl3_add_message(SSL *ssl, Array<uint8_t> msg) {
|
|
190
190
|
rest = rest.subspan(chunk.size());
|
191
191
|
|
192
192
|
if (!add_record_to_flight(ssl, SSL3_RT_HANDSHAKE, chunk)) {
|
193
|
-
return
|
193
|
+
return false;
|
194
194
|
}
|
195
195
|
} while (!rest.empty());
|
196
196
|
|
@@ -198,41 +198,46 @@ int ssl3_add_message(SSL *ssl, Array<uint8_t> msg) {
|
|
198
198
|
// TODO(svaldez): Move this up a layer to fix abstraction for SSLTranscript on
|
199
199
|
// hs.
|
200
200
|
if (ssl->s3->hs != NULL &&
|
201
|
-
!ssl->s3->hs->transcript.Update(msg
|
202
|
-
return
|
201
|
+
!ssl->s3->hs->transcript.Update(msg)) {
|
202
|
+
return false;
|
203
203
|
}
|
204
|
-
return
|
204
|
+
return true;
|
205
205
|
}
|
206
206
|
|
207
|
-
|
207
|
+
bool ssl3_add_change_cipher_spec(SSL *ssl) {
|
208
208
|
static const uint8_t kChangeCipherSpec[1] = {SSL3_MT_CCS};
|
209
209
|
|
210
210
|
if (!add_record_to_flight(ssl, SSL3_RT_CHANGE_CIPHER_SPEC,
|
211
211
|
kChangeCipherSpec)) {
|
212
|
-
return
|
212
|
+
return false;
|
213
213
|
}
|
214
214
|
|
215
215
|
ssl_do_msg_callback(ssl, 1 /* write */, SSL3_RT_CHANGE_CIPHER_SPEC,
|
216
216
|
kChangeCipherSpec);
|
217
|
-
return
|
217
|
+
return true;
|
218
218
|
}
|
219
219
|
|
220
|
-
|
220
|
+
bool ssl3_add_alert(SSL *ssl, uint8_t level, uint8_t desc) {
|
221
221
|
uint8_t alert[2] = {level, desc};
|
222
222
|
if (!add_record_to_flight(ssl, SSL3_RT_ALERT, alert)) {
|
223
|
-
return
|
223
|
+
return false;
|
224
224
|
}
|
225
225
|
|
226
226
|
ssl_do_msg_callback(ssl, 1 /* write */, SSL3_RT_ALERT, alert);
|
227
227
|
ssl_do_info_callback(ssl, SSL_CB_WRITE_ALERT, ((int)level << 8) | desc);
|
228
|
-
return
|
228
|
+
return true;
|
229
229
|
}
|
230
230
|
|
231
231
|
int ssl3_flush_flight(SSL *ssl) {
|
232
|
-
if (ssl->s3->pending_flight ==
|
232
|
+
if (ssl->s3->pending_flight == nullptr) {
|
233
233
|
return 1;
|
234
234
|
}
|
235
235
|
|
236
|
+
if (ssl->s3->write_shutdown != ssl_shutdown_none) {
|
237
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_PROTOCOL_IS_SHUTDOWN);
|
238
|
+
return -1;
|
239
|
+
}
|
240
|
+
|
236
241
|
if (ssl->s3->pending_flight->length > 0xffffffff ||
|
237
242
|
ssl->s3->pending_flight->length > INT_MAX) {
|
238
243
|
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
@@ -241,10 +246,10 @@ int ssl3_flush_flight(SSL *ssl) {
|
|
241
246
|
|
242
247
|
// If there is pending data in the write buffer, it must be flushed out before
|
243
248
|
// any new data in pending_flight.
|
244
|
-
if (
|
249
|
+
if (!ssl->s3->write_buffer.empty()) {
|
245
250
|
int ret = ssl_write_buffer_flush(ssl);
|
246
251
|
if (ret <= 0) {
|
247
|
-
ssl->rwstate = SSL_WRITING;
|
252
|
+
ssl->s3->rwstate = SSL_WRITING;
|
248
253
|
return ret;
|
249
254
|
}
|
250
255
|
}
|
@@ -256,7 +261,7 @@ int ssl3_flush_flight(SSL *ssl) {
|
|
256
261
|
ssl->s3->pending_flight->data + ssl->s3->pending_flight_offset,
|
257
262
|
ssl->s3->pending_flight->length - ssl->s3->pending_flight_offset);
|
258
263
|
if (ret <= 0) {
|
259
|
-
ssl->rwstate = SSL_WRITING;
|
264
|
+
ssl->s3->rwstate = SSL_WRITING;
|
260
265
|
return ret;
|
261
266
|
}
|
262
267
|
|
@@ -264,150 +269,45 @@ int ssl3_flush_flight(SSL *ssl) {
|
|
264
269
|
}
|
265
270
|
|
266
271
|
if (BIO_flush(ssl->wbio) <= 0) {
|
267
|
-
ssl->rwstate = SSL_WRITING;
|
272
|
+
ssl->s3->rwstate = SSL_WRITING;
|
268
273
|
return -1;
|
269
274
|
}
|
270
275
|
|
271
|
-
|
272
|
-
ssl->s3->pending_flight = NULL;
|
276
|
+
ssl->s3->pending_flight.reset();
|
273
277
|
ssl->s3->pending_flight_offset = 0;
|
274
278
|
return 1;
|
275
279
|
}
|
276
280
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
uint8_t finished[EVP_MAX_MD_SIZE];
|
282
|
-
size_t finished_len;
|
283
|
-
if (!hs->transcript.GetFinishedMAC(finished, &finished_len, session,
|
284
|
-
ssl->server)) {
|
285
|
-
return 0;
|
286
|
-
}
|
287
|
-
|
288
|
-
// Log the master secret, if logging is enabled.
|
289
|
-
if (!ssl_log_secret(ssl, "CLIENT_RANDOM",
|
290
|
-
session->master_key,
|
291
|
-
session->master_key_length)) {
|
292
|
-
return 0;
|
293
|
-
}
|
294
|
-
|
295
|
-
// Copy the Finished so we can use it for renegotiation checks.
|
296
|
-
if (ssl->version != SSL3_VERSION) {
|
297
|
-
if (finished_len > sizeof(ssl->s3->previous_client_finished) ||
|
298
|
-
finished_len > sizeof(ssl->s3->previous_server_finished)) {
|
299
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
300
|
-
return 0;
|
301
|
-
}
|
302
|
-
|
303
|
-
if (ssl->server) {
|
304
|
-
OPENSSL_memcpy(ssl->s3->previous_server_finished, finished, finished_len);
|
305
|
-
ssl->s3->previous_server_finished_len = finished_len;
|
306
|
-
} else {
|
307
|
-
OPENSSL_memcpy(ssl->s3->previous_client_finished, finished, finished_len);
|
308
|
-
ssl->s3->previous_client_finished_len = finished_len;
|
309
|
-
}
|
310
|
-
}
|
311
|
-
|
312
|
-
ScopedCBB cbb;
|
313
|
-
CBB body;
|
314
|
-
if (!ssl->method->init_message(ssl, cbb.get(), &body, SSL3_MT_FINISHED) ||
|
315
|
-
!CBB_add_bytes(&body, finished, finished_len) ||
|
316
|
-
!ssl_add_message_cbb(ssl, cbb.get())) {
|
317
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
318
|
-
return 0;
|
319
|
-
}
|
320
|
-
|
321
|
-
return 1;
|
322
|
-
}
|
323
|
-
|
324
|
-
int ssl3_output_cert_chain(SSL *ssl) {
|
325
|
-
ScopedCBB cbb;
|
326
|
-
CBB body;
|
327
|
-
if (!ssl->method->init_message(ssl, cbb.get(), &body, SSL3_MT_CERTIFICATE) ||
|
328
|
-
!ssl_add_cert_chain(ssl, &body) ||
|
329
|
-
!ssl_add_message_cbb(ssl, cbb.get())) {
|
330
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
331
|
-
return 0;
|
332
|
-
}
|
333
|
-
|
334
|
-
return 1;
|
335
|
-
}
|
336
|
-
|
337
|
-
static int extend_handshake_buffer(SSL *ssl, size_t length) {
|
338
|
-
if (!BUF_MEM_reserve(ssl->init_buf, length)) {
|
339
|
-
return -1;
|
340
|
-
}
|
341
|
-
while (ssl->init_buf->length < length) {
|
342
|
-
int ret = ssl3_read_handshake_bytes(
|
343
|
-
ssl, (uint8_t *)ssl->init_buf->data + ssl->init_buf->length,
|
344
|
-
length - ssl->init_buf->length);
|
345
|
-
if (ret <= 0) {
|
346
|
-
return ret;
|
347
|
-
}
|
348
|
-
ssl->init_buf->length += (size_t)ret;
|
349
|
-
}
|
350
|
-
return 1;
|
351
|
-
}
|
352
|
-
|
353
|
-
static int read_v2_client_hello(SSL *ssl) {
|
354
|
-
// Read the first 5 bytes, the size of the TLS record header. This is
|
355
|
-
// sufficient to detect a V2ClientHello and ensures that we never read beyond
|
356
|
-
// the first record.
|
357
|
-
int ret = ssl_read_buffer_extend_to(ssl, SSL3_RT_HEADER_LENGTH);
|
358
|
-
if (ret <= 0) {
|
359
|
-
return ret;
|
360
|
-
}
|
361
|
-
const uint8_t *p = ssl_read_buffer(ssl).data();
|
362
|
-
|
363
|
-
// Some dedicated error codes for protocol mixups should the application wish
|
364
|
-
// to interpret them differently. (These do not overlap with ClientHello or
|
365
|
-
// V2ClientHello.)
|
366
|
-
if (strncmp("GET ", (const char *)p, 4) == 0 ||
|
367
|
-
strncmp("POST ", (const char *)p, 5) == 0 ||
|
368
|
-
strncmp("HEAD ", (const char *)p, 5) == 0 ||
|
369
|
-
strncmp("PUT ", (const char *)p, 4) == 0) {
|
370
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_HTTP_REQUEST);
|
371
|
-
return -1;
|
372
|
-
}
|
373
|
-
if (strncmp("CONNE", (const char *)p, 5) == 0) {
|
374
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_HTTPS_PROXY_REQUEST);
|
375
|
-
return -1;
|
376
|
-
}
|
377
|
-
|
378
|
-
if ((p[0] & 0x80) == 0 || p[2] != SSL2_MT_CLIENT_HELLO ||
|
379
|
-
p[3] != SSL3_VERSION_MAJOR) {
|
380
|
-
// Not a V2ClientHello.
|
381
|
-
return 1;
|
382
|
-
}
|
383
|
-
|
281
|
+
static ssl_open_record_t read_v2_client_hello(SSL *ssl, size_t *out_consumed,
|
282
|
+
Span<const uint8_t> in) {
|
283
|
+
*out_consumed = 0;
|
284
|
+
assert(in.size() >= SSL3_RT_HEADER_LENGTH);
|
384
285
|
// Determine the length of the V2ClientHello.
|
385
|
-
size_t msg_length = ((
|
286
|
+
size_t msg_length = ((in[0] & 0x7f) << 8) | in[1];
|
386
287
|
if (msg_length > (1024 * 4)) {
|
387
288
|
OPENSSL_PUT_ERROR(SSL, SSL_R_RECORD_TOO_LARGE);
|
388
|
-
return
|
289
|
+
return ssl_open_record_error;
|
389
290
|
}
|
390
291
|
if (msg_length < SSL3_RT_HEADER_LENGTH - 2) {
|
391
292
|
// Reject lengths that are too short early. We have already read
|
392
293
|
// |SSL3_RT_HEADER_LENGTH| bytes, so we should not attempt to process an
|
393
294
|
// (invalid) V2ClientHello which would be shorter than that.
|
394
295
|
OPENSSL_PUT_ERROR(SSL, SSL_R_RECORD_LENGTH_MISMATCH);
|
395
|
-
return
|
296
|
+
return ssl_open_record_error;
|
396
297
|
}
|
397
298
|
|
398
|
-
//
|
399
|
-
|
400
|
-
|
401
|
-
return
|
299
|
+
// Ask for the remainder of the V2ClientHello.
|
300
|
+
if (in.size() < 2 + msg_length) {
|
301
|
+
*out_consumed = 2 + msg_length;
|
302
|
+
return ssl_open_record_partial;
|
402
303
|
}
|
403
304
|
|
404
|
-
CBS v2_client_hello = CBS(
|
305
|
+
CBS v2_client_hello = CBS(ssl->s3->read_buffer.span().subspan(2, msg_length));
|
405
306
|
// The V2ClientHello without the length is incorporated into the handshake
|
406
307
|
// hash. This is only ever called at the start of the handshake, so hs is
|
407
308
|
// guaranteed to be non-NULL.
|
408
|
-
if (!ssl->s3->hs->transcript.Update(
|
409
|
-
|
410
|
-
return -1;
|
309
|
+
if (!ssl->s3->hs->transcript.Update(v2_client_hello)) {
|
310
|
+
return ssl_open_record_error;
|
411
311
|
}
|
412
312
|
|
413
313
|
ssl_do_msg_callback(ssl, 0 /* read */, 0 /* V2ClientHello */,
|
@@ -426,7 +326,7 @@ static int read_v2_client_hello(SSL *ssl) {
|
|
426
326
|
!CBS_get_bytes(&v2_client_hello, &challenge, challenge_length) ||
|
427
327
|
CBS_len(&v2_client_hello) != 0) {
|
428
328
|
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
429
|
-
return
|
329
|
+
return ssl_open_record_error;
|
430
330
|
}
|
431
331
|
|
432
332
|
// msg_type has already been checked.
|
@@ -451,9 +351,9 @@ static int read_v2_client_hello(SSL *ssl) {
|
|
451
351
|
1 /* compression length */ + 1 /* compression */;
|
452
352
|
ScopedCBB client_hello;
|
453
353
|
CBB hello_body, cipher_suites;
|
454
|
-
if (!BUF_MEM_reserve(ssl->
|
455
|
-
!CBB_init_fixed(client_hello.get(), (uint8_t *)ssl->
|
456
|
-
ssl->
|
354
|
+
if (!BUF_MEM_reserve(ssl->s3->hs_buf.get(), max_v3_client_hello) ||
|
355
|
+
!CBB_init_fixed(client_hello.get(), (uint8_t *)ssl->s3->hs_buf->data,
|
356
|
+
ssl->s3->hs_buf->max) ||
|
457
357
|
!CBB_add_u8(client_hello.get(), SSL3_MT_CLIENT_HELLO) ||
|
458
358
|
!CBB_add_u24_length_prefixed(client_hello.get(), &hello_body) ||
|
459
359
|
!CBB_add_u16(&hello_body, version) ||
|
@@ -462,7 +362,7 @@ static int read_v2_client_hello(SSL *ssl) {
|
|
462
362
|
!CBB_add_u8(&hello_body, 0) ||
|
463
363
|
!CBB_add_u16_length_prefixed(&hello_body, &cipher_suites)) {
|
464
364
|
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
465
|
-
return
|
365
|
+
return ssl_open_record_error;
|
466
366
|
}
|
467
367
|
|
468
368
|
// Copy the cipher suites.
|
@@ -470,7 +370,7 @@ static int read_v2_client_hello(SSL *ssl) {
|
|
470
370
|
uint32_t cipher_spec;
|
471
371
|
if (!CBS_get_u24(&cipher_specs, &cipher_spec)) {
|
472
372
|
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
473
|
-
return
|
373
|
+
return ssl_open_record_error;
|
474
374
|
}
|
475
375
|
|
476
376
|
// Skip SSLv2 ciphers.
|
@@ -479,38 +379,34 @@ static int read_v2_client_hello(SSL *ssl) {
|
|
479
379
|
}
|
480
380
|
if (!CBB_add_u16(&cipher_suites, cipher_spec)) {
|
481
381
|
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
482
|
-
return
|
382
|
+
return ssl_open_record_error;
|
483
383
|
}
|
484
384
|
}
|
485
385
|
|
486
386
|
// Add the null compression scheme and finish.
|
487
387
|
if (!CBB_add_u8(&hello_body, 1) ||
|
488
388
|
!CBB_add_u8(&hello_body, 0) ||
|
489
|
-
!CBB_finish(client_hello.get(), NULL, &ssl->
|
389
|
+
!CBB_finish(client_hello.get(), NULL, &ssl->s3->hs_buf->length)) {
|
490
390
|
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
491
|
-
return
|
391
|
+
return ssl_open_record_error;
|
492
392
|
}
|
493
393
|
|
494
|
-
|
495
|
-
ssl_read_buffer_consume(ssl, 2 + msg_length);
|
496
|
-
ssl_read_buffer_discard(ssl);
|
497
|
-
|
394
|
+
*out_consumed = 2 + msg_length;
|
498
395
|
ssl->s3->is_v2_hello = true;
|
499
|
-
return
|
396
|
+
return ssl_open_record_success;
|
500
397
|
}
|
501
398
|
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
if (ssl->init_buf == NULL) {
|
399
|
+
static bool parse_message(const SSL *ssl, SSLMessage *out,
|
400
|
+
size_t *out_bytes_needed) {
|
401
|
+
if (!ssl->s3->hs_buf) {
|
506
402
|
*out_bytes_needed = 4;
|
507
403
|
return false;
|
508
404
|
}
|
509
405
|
|
510
406
|
CBS cbs;
|
511
407
|
uint32_t len;
|
512
|
-
CBS_init(&cbs, reinterpret_cast<const uint8_t *>(ssl->
|
513
|
-
ssl->
|
408
|
+
CBS_init(&cbs, reinterpret_cast<const uint8_t *>(ssl->s3->hs_buf->data),
|
409
|
+
ssl->s3->hs_buf->length);
|
514
410
|
if (!CBS_get_u8(&cbs, &out->type) ||
|
515
411
|
!CBS_get_u24(&cbs, &len)) {
|
516
412
|
*out_bytes_needed = 4;
|
@@ -522,7 +418,7 @@ static bool parse_message(SSL *ssl, SSLMessage *out, size_t *out_bytes_needed) {
|
|
522
418
|
return false;
|
523
419
|
}
|
524
420
|
|
525
|
-
CBS_init(&out->raw, reinterpret_cast<const uint8_t *>(ssl->
|
421
|
+
CBS_init(&out->raw, reinterpret_cast<const uint8_t *>(ssl->s3->hs_buf->data),
|
526
422
|
4 + len);
|
527
423
|
out->is_v2_hello = ssl->s3->is_v2_hello;
|
528
424
|
return true;
|
@@ -542,61 +438,147 @@ bool ssl3_get_message(SSL *ssl, SSLMessage *out) {
|
|
542
438
|
return true;
|
543
439
|
}
|
544
440
|
|
545
|
-
|
441
|
+
bool tls_can_accept_handshake_data(const SSL *ssl, uint8_t *out_alert) {
|
442
|
+
// If there is a complete message, the caller must have consumed it first.
|
546
443
|
SSLMessage msg;
|
547
444
|
size_t bytes_needed;
|
548
445
|
if (parse_message(ssl, &msg, &bytes_needed)) {
|
549
446
|
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
550
|
-
|
447
|
+
*out_alert = SSL_AD_INTERNAL_ERROR;
|
448
|
+
return false;
|
551
449
|
}
|
552
450
|
|
553
451
|
// Enforce the limit so the peer cannot force us to buffer 16MB.
|
554
452
|
if (bytes_needed > 4 + ssl_max_handshake_message_len(ssl)) {
|
555
|
-
ssl3_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER);
|
556
453
|
OPENSSL_PUT_ERROR(SSL, SSL_R_EXCESSIVE_MESSAGE_SIZE);
|
557
|
-
|
454
|
+
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
455
|
+
return false;
|
456
|
+
}
|
457
|
+
|
458
|
+
return true;
|
459
|
+
}
|
460
|
+
|
461
|
+
bool tls_has_unprocessed_handshake_data(const SSL *ssl) {
|
462
|
+
size_t msg_len = 0;
|
463
|
+
if (ssl->s3->has_message) {
|
464
|
+
SSLMessage msg;
|
465
|
+
size_t unused;
|
466
|
+
if (parse_message(ssl, &msg, &unused)) {
|
467
|
+
msg_len = CBS_len(&msg.raw);
|
468
|
+
}
|
558
469
|
}
|
559
470
|
|
471
|
+
return ssl->s3->hs_buf && ssl->s3->hs_buf->length > msg_len;
|
472
|
+
}
|
473
|
+
|
474
|
+
ssl_open_record_t ssl3_open_handshake(SSL *ssl, size_t *out_consumed,
|
475
|
+
uint8_t *out_alert, Span<uint8_t> in) {
|
476
|
+
*out_consumed = 0;
|
560
477
|
// Re-create the handshake buffer if needed.
|
561
|
-
if (ssl->
|
562
|
-
ssl->
|
563
|
-
if (ssl->
|
564
|
-
|
478
|
+
if (!ssl->s3->hs_buf) {
|
479
|
+
ssl->s3->hs_buf.reset(BUF_MEM_new());
|
480
|
+
if (!ssl->s3->hs_buf) {
|
481
|
+
*out_alert = SSL_AD_INTERNAL_ERROR;
|
482
|
+
return ssl_open_record_error;
|
565
483
|
}
|
566
484
|
}
|
567
485
|
|
568
486
|
// Bypass the record layer for the first message to handle V2ClientHello.
|
569
487
|
if (ssl->server && !ssl->s3->v2_hello_done) {
|
570
|
-
|
571
|
-
|
572
|
-
|
488
|
+
// Ask for the first 5 bytes, the size of the TLS record header. This is
|
489
|
+
// sufficient to detect a V2ClientHello and ensures that we never read
|
490
|
+
// beyond the first record.
|
491
|
+
if (in.size() < SSL3_RT_HEADER_LENGTH) {
|
492
|
+
*out_consumed = SSL3_RT_HEADER_LENGTH;
|
493
|
+
return ssl_open_record_partial;
|
494
|
+
}
|
495
|
+
|
496
|
+
// Some dedicated error codes for protocol mixups should the application
|
497
|
+
// wish to interpret them differently. (These do not overlap with
|
498
|
+
// ClientHello or V2ClientHello.)
|
499
|
+
const char *str = reinterpret_cast<const char*>(in.data());
|
500
|
+
if (strncmp("GET ", str, 4) == 0 ||
|
501
|
+
strncmp("POST ", str, 5) == 0 ||
|
502
|
+
strncmp("HEAD ", str, 5) == 0 ||
|
503
|
+
strncmp("PUT ", str, 4) == 0) {
|
504
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_HTTP_REQUEST);
|
505
|
+
*out_alert = 0;
|
506
|
+
return ssl_open_record_error;
|
507
|
+
}
|
508
|
+
if (strncmp("CONNE", str, 5) == 0) {
|
509
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_HTTPS_PROXY_REQUEST);
|
510
|
+
*out_alert = 0;
|
511
|
+
return ssl_open_record_error;
|
573
512
|
}
|
513
|
+
|
514
|
+
// Check for a V2ClientHello.
|
515
|
+
if ((in[0] & 0x80) != 0 && in[2] == SSL2_MT_CLIENT_HELLO &&
|
516
|
+
in[3] == SSL3_VERSION_MAJOR) {
|
517
|
+
auto ret = read_v2_client_hello(ssl, out_consumed, in);
|
518
|
+
if (ret == ssl_open_record_error) {
|
519
|
+
*out_alert = 0;
|
520
|
+
} else if (ret == ssl_open_record_success) {
|
521
|
+
ssl->s3->v2_hello_done = true;
|
522
|
+
}
|
523
|
+
return ret;
|
524
|
+
}
|
525
|
+
|
526
|
+
ssl->s3->v2_hello_done = true;
|
527
|
+
}
|
528
|
+
|
529
|
+
uint8_t type;
|
530
|
+
Span<uint8_t> body;
|
531
|
+
auto ret = tls_open_record(ssl, &type, &body, out_consumed, out_alert, in);
|
532
|
+
if (ret != ssl_open_record_success) {
|
574
533
|
return ret;
|
575
534
|
}
|
576
535
|
|
577
|
-
|
536
|
+
// WatchGuard's TLS 1.3 interference bug is very distinctive: they drop the
|
537
|
+
// ServerHello and send the remaining encrypted application data records
|
538
|
+
// as-is. This manifests as an application data record when we expect
|
539
|
+
// handshake. Report a dedicated error code for this case.
|
540
|
+
if (!ssl->server && type == SSL3_RT_APPLICATION_DATA &&
|
541
|
+
ssl->s3->aead_read_ctx->is_null_cipher()) {
|
542
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_APPLICATION_DATA_INSTEAD_OF_HANDSHAKE);
|
543
|
+
*out_alert = SSL_AD_UNEXPECTED_MESSAGE;
|
544
|
+
return ssl_open_record_error;
|
545
|
+
}
|
546
|
+
|
547
|
+
if (type != SSL3_RT_HANDSHAKE) {
|
548
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_RECORD);
|
549
|
+
*out_alert = SSL_AD_UNEXPECTED_MESSAGE;
|
550
|
+
return ssl_open_record_error;
|
551
|
+
}
|
552
|
+
|
553
|
+
// Append the entire handshake record to the buffer.
|
554
|
+
if (!BUF_MEM_append(ssl->s3->hs_buf.get(), body.data(), body.size())) {
|
555
|
+
*out_alert = SSL_AD_INTERNAL_ERROR;
|
556
|
+
return ssl_open_record_error;
|
557
|
+
}
|
558
|
+
|
559
|
+
return ssl_open_record_success;
|
578
560
|
}
|
579
561
|
|
580
562
|
void ssl3_next_message(SSL *ssl) {
|
581
563
|
SSLMessage msg;
|
582
564
|
if (!ssl3_get_message(ssl, &msg) ||
|
583
|
-
ssl->
|
584
|
-
ssl->
|
565
|
+
!ssl->s3->hs_buf ||
|
566
|
+
ssl->s3->hs_buf->length < CBS_len(&msg.raw)) {
|
585
567
|
assert(0);
|
586
568
|
return;
|
587
569
|
}
|
588
570
|
|
589
|
-
OPENSSL_memmove(ssl->
|
590
|
-
ssl->
|
591
|
-
|
571
|
+
OPENSSL_memmove(ssl->s3->hs_buf->data,
|
572
|
+
ssl->s3->hs_buf->data + CBS_len(&msg.raw),
|
573
|
+
ssl->s3->hs_buf->length - CBS_len(&msg.raw));
|
574
|
+
ssl->s3->hs_buf->length -= CBS_len(&msg.raw);
|
592
575
|
ssl->s3->is_v2_hello = false;
|
593
576
|
ssl->s3->has_message = false;
|
594
577
|
|
595
578
|
// Post-handshake messages are rare, so release the buffer after every
|
596
579
|
// message. During the handshake, |on_handshake_complete| will release it.
|
597
|
-
if (!SSL_in_init(ssl) && ssl->
|
598
|
-
|
599
|
-
ssl->init_buf = NULL;
|
580
|
+
if (!SSL_in_init(ssl) && ssl->s3->hs_buf->length == 0) {
|
581
|
+
ssl->s3->hs_buf.reset();
|
600
582
|
}
|
601
583
|
}
|
602
584
|
|