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
@@ -104,18 +104,6 @@ void ec_GFp_simple_group_finish(EC_GROUP *group) {
|
|
104
104
|
BN_free(&group->one);
|
105
105
|
}
|
106
106
|
|
107
|
-
int ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) {
|
108
|
-
if (!BN_copy(&dest->field, &src->field) ||
|
109
|
-
!BN_copy(&dest->a, &src->a) ||
|
110
|
-
!BN_copy(&dest->b, &src->b) ||
|
111
|
-
!BN_copy(&dest->one, &src->one)) {
|
112
|
-
return 0;
|
113
|
-
}
|
114
|
-
|
115
|
-
dest->a_is_minus3 = src->a_is_minus3;
|
116
|
-
return 1;
|
117
|
-
}
|
118
|
-
|
119
107
|
int ec_GFp_simple_group_set_curve(EC_GROUP *group, const BIGNUM *p,
|
120
108
|
const BIGNUM *a, const BIGNUM *b,
|
121
109
|
BN_CTX *ctx) {
|
@@ -249,12 +237,6 @@ void ec_GFp_simple_point_finish(EC_POINT *point) {
|
|
249
237
|
BN_free(&point->Z);
|
250
238
|
}
|
251
239
|
|
252
|
-
void ec_GFp_simple_point_clear_finish(EC_POINT *point) {
|
253
|
-
BN_clear_free(&point->X);
|
254
|
-
BN_clear_free(&point->Y);
|
255
|
-
BN_clear_free(&point->Z);
|
256
|
-
}
|
257
|
-
|
258
240
|
int ec_GFp_simple_point_copy(EC_POINT *dest, const EC_POINT *src) {
|
259
241
|
if (!BN_copy(&dest->X, &src->X) ||
|
260
242
|
!BN_copy(&dest->Y, &src->Y) ||
|
@@ -313,49 +295,6 @@ err:
|
|
313
295
|
return ret;
|
314
296
|
}
|
315
297
|
|
316
|
-
int ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
|
317
|
-
const EC_POINT *point,
|
318
|
-
BIGNUM *x, BIGNUM *y,
|
319
|
-
BIGNUM *z, BN_CTX *ctx) {
|
320
|
-
BN_CTX *new_ctx = NULL;
|
321
|
-
int ret = 0;
|
322
|
-
|
323
|
-
if (group->meth->field_decode != 0) {
|
324
|
-
if (ctx == NULL) {
|
325
|
-
ctx = new_ctx = BN_CTX_new();
|
326
|
-
if (ctx == NULL) {
|
327
|
-
return 0;
|
328
|
-
}
|
329
|
-
}
|
330
|
-
|
331
|
-
if (x != NULL && !group->meth->field_decode(group, x, &point->X, ctx)) {
|
332
|
-
goto err;
|
333
|
-
}
|
334
|
-
if (y != NULL && !group->meth->field_decode(group, y, &point->Y, ctx)) {
|
335
|
-
goto err;
|
336
|
-
}
|
337
|
-
if (z != NULL && !group->meth->field_decode(group, z, &point->Z, ctx)) {
|
338
|
-
goto err;
|
339
|
-
}
|
340
|
-
} else {
|
341
|
-
if (x != NULL && !BN_copy(x, &point->X)) {
|
342
|
-
goto err;
|
343
|
-
}
|
344
|
-
if (y != NULL && !BN_copy(y, &point->Y)) {
|
345
|
-
goto err;
|
346
|
-
}
|
347
|
-
if (z != NULL && !BN_copy(z, &point->Z)) {
|
348
|
-
goto err;
|
349
|
-
}
|
350
|
-
}
|
351
|
-
|
352
|
-
ret = 1;
|
353
|
-
|
354
|
-
err:
|
355
|
-
BN_CTX_free(new_ctx);
|
356
|
-
return ret;
|
357
|
-
}
|
358
|
-
|
359
298
|
int ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *group,
|
360
299
|
EC_POINT *point, const BIGNUM *x,
|
361
300
|
const BIGNUM *y, BN_CTX *ctx) {
|
@@ -814,11 +753,11 @@ int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
|
|
814
753
|
const BIGNUM *tmp1_, *tmp2_;
|
815
754
|
int ret = -1;
|
816
755
|
|
817
|
-
if (
|
818
|
-
return
|
756
|
+
if (ec_GFp_simple_is_at_infinity(group, a)) {
|
757
|
+
return ec_GFp_simple_is_at_infinity(group, b) ? 0 : 1;
|
819
758
|
}
|
820
759
|
|
821
|
-
if (
|
760
|
+
if (ec_GFp_simple_is_at_infinity(group, b)) {
|
822
761
|
return 1;
|
823
762
|
}
|
824
763
|
|
@@ -122,11 +122,6 @@ static int8_t *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) {
|
|
122
122
|
sign = -1;
|
123
123
|
}
|
124
124
|
|
125
|
-
if (scalar->d == NULL || scalar->top == 0) {
|
126
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_INTERNAL_ERROR);
|
127
|
-
goto err;
|
128
|
-
}
|
129
|
-
|
130
125
|
len = BN_num_bits(scalar);
|
131
126
|
// The modified wNAF may be one digit longer than binary representation
|
132
127
|
// (*ret_len will be set to the actual length, i.e. at most
|
@@ -236,8 +231,9 @@ static size_t window_bits_for_scalar_size(size_t b) {
|
|
236
231
|
return 1;
|
237
232
|
}
|
238
233
|
|
239
|
-
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r,
|
240
|
-
const
|
234
|
+
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r,
|
235
|
+
const EC_SCALAR *g_scalar_raw, const EC_POINT *p,
|
236
|
+
const EC_SCALAR *p_scalar_raw, BN_CTX *ctx) {
|
241
237
|
BN_CTX *new_ctx = NULL;
|
242
238
|
const EC_POINT *generator = NULL;
|
243
239
|
EC_POINT *tmp = NULL;
|
@@ -262,13 +258,32 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
|
|
262
258
|
goto err;
|
263
259
|
}
|
264
260
|
}
|
261
|
+
BN_CTX_start(ctx);
|
262
|
+
|
263
|
+
// Convert from |EC_SCALAR| to |BIGNUM|. |BIGNUM| is not constant-time, but
|
264
|
+
// neither is the rest of this function.
|
265
|
+
BIGNUM *g_scalar = NULL, *p_scalar = NULL;
|
266
|
+
if (g_scalar_raw != NULL) {
|
267
|
+
g_scalar = BN_CTX_get(ctx);
|
268
|
+
if (g_scalar == NULL ||
|
269
|
+
!bn_set_words(g_scalar, g_scalar_raw->words, group->order.top)) {
|
270
|
+
goto err;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
if (p_scalar_raw != NULL) {
|
274
|
+
p_scalar = BN_CTX_get(ctx);
|
275
|
+
if (p_scalar == NULL ||
|
276
|
+
!bn_set_words(p_scalar, p_scalar_raw->words, group->order.top)) {
|
277
|
+
goto err;
|
278
|
+
}
|
279
|
+
}
|
265
280
|
|
266
281
|
// TODO: This function used to take |points| and |scalars| as arrays of
|
267
282
|
// |num| elements. The code below should be simplified to work in terms of |p|
|
268
283
|
// and |p_scalar|.
|
269
284
|
size_t num = p != NULL ? 1 : 0;
|
270
285
|
const EC_POINT **points = p != NULL ? &p : NULL;
|
271
|
-
|
286
|
+
BIGNUM **scalars = p != NULL ? &p_scalar : NULL;
|
272
287
|
|
273
288
|
total_num = num;
|
274
289
|
|
@@ -433,6 +448,9 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
|
|
433
448
|
ret = 1;
|
434
449
|
|
435
450
|
err:
|
451
|
+
if (ctx != NULL) {
|
452
|
+
BN_CTX_end(ctx);
|
453
|
+
}
|
436
454
|
BN_CTX_free(new_ctx);
|
437
455
|
EC_POINT_free(tmp);
|
438
456
|
OPENSSL_free(wsize);
|
@@ -446,7 +464,7 @@ err:
|
|
446
464
|
}
|
447
465
|
if (val != NULL) {
|
448
466
|
for (i = 0; i < num_val; i++) {
|
449
|
-
|
467
|
+
EC_POINT_free(val[i]);
|
450
468
|
}
|
451
469
|
|
452
470
|
OPENSSL_free(val);
|
@@ -58,37 +58,72 @@
|
|
58
58
|
#include <openssl/bn.h>
|
59
59
|
#include <openssl/err.h>
|
60
60
|
#include <openssl/mem.h>
|
61
|
+
#include <openssl/sha.h>
|
62
|
+
#include <openssl/type_check.h>
|
61
63
|
|
62
64
|
#include "../bn/internal.h"
|
63
65
|
#include "../ec/internal.h"
|
64
66
|
#include "../../internal.h"
|
65
67
|
|
66
68
|
|
67
|
-
//
|
68
|
-
//
|
69
|
-
//
|
70
|
-
static
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
// Need to truncate digest if it is too long: first truncate whole
|
76
|
-
// bytes.
|
69
|
+
// digest_to_scalar interprets |digest_len| bytes from |digest| as a scalar for
|
70
|
+
// ECDSA. Note this value is not fully reduced modulo the order, only the
|
71
|
+
// correct number of bits.
|
72
|
+
static void digest_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
73
|
+
const uint8_t *digest, size_t digest_len) {
|
74
|
+
const BIGNUM *order = &group->order;
|
75
|
+
size_t num_bits = BN_num_bits(order);
|
76
|
+
// Need to truncate digest if it is too long: first truncate whole bytes.
|
77
77
|
if (8 * digest_len > num_bits) {
|
78
78
|
digest_len = (num_bits + 7) / 8;
|
79
79
|
}
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
OPENSSL_memset(out, 0, sizeof(EC_SCALAR));
|
81
|
+
for (size_t i = 0; i < digest_len; i++) {
|
82
|
+
out->bytes[i] = digest[digest_len - 1 - i];
|
83
83
|
}
|
84
84
|
|
85
85
|
// If still too long truncate remaining bits with a shift
|
86
|
-
if (
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
if (8 * digest_len > num_bits) {
|
87
|
+
size_t shift = 8 - (num_bits & 0x7);
|
88
|
+
for (int i = 0; i < order->top - 1; i++) {
|
89
|
+
out->words[i] =
|
90
|
+
(out->words[i] >> shift) | (out->words[i + 1] << (BN_BITS2 - shift));
|
91
|
+
}
|
92
|
+
out->words[order->top - 1] >>= shift;
|
90
93
|
}
|
94
|
+
}
|
91
95
|
|
96
|
+
// field_element_to_scalar reduces |r| modulo |group->order|. |r| must
|
97
|
+
// previously have been reduced modulo |group->field|.
|
98
|
+
static int field_element_to_scalar(const EC_GROUP *group, BIGNUM *r) {
|
99
|
+
// We must have p < 2×order, assuming p is not tiny (p >= 17). Thus rather we
|
100
|
+
// can reduce by performing at most one subtraction.
|
101
|
+
//
|
102
|
+
// Proof: We only work with prime order curves, so the number of points on
|
103
|
+
// the curve is the order. Thus Hasse's theorem gives:
|
104
|
+
//
|
105
|
+
// |order - (p + 1)| <= 2×sqrt(p)
|
106
|
+
// p + 1 - order <= 2×sqrt(p)
|
107
|
+
// p + 1 - 2×sqrt(p) <= order
|
108
|
+
// p + 1 - 2×(p/4) < order (p/4 > sqrt(p) for p >= 17)
|
109
|
+
// p/2 < p/2 + 1 < order
|
110
|
+
// p < 2×order
|
111
|
+
//
|
112
|
+
// Additionally, one can manually check this property for built-in curves. It
|
113
|
+
// is enforced for legacy custom curves in |EC_GROUP_set_generator|.
|
114
|
+
//
|
115
|
+
// TODO(davidben): Introduce |EC_FIELD_ELEMENT|, make this a function from
|
116
|
+
// |EC_FIELD_ELEMENT| to |EC_SCALAR|, and cut out the |BIGNUM|. Does this need
|
117
|
+
// to be constant-time for signing? |r| is the x-coordinate for kG, which is
|
118
|
+
// public unless k was rerolled because |s| was zero.
|
119
|
+
assert(!BN_is_negative(r));
|
120
|
+
assert(BN_cmp(r, &group->field) < 0);
|
121
|
+
if (BN_cmp(r, &group->order) >= 0 &&
|
122
|
+
!BN_sub(r, r, &group->order)) {
|
123
|
+
return 0;
|
124
|
+
}
|
125
|
+
assert(!BN_is_negative(r));
|
126
|
+
assert(BN_cmp(r, &group->order) < 0);
|
92
127
|
return 1;
|
93
128
|
}
|
94
129
|
|
@@ -116,67 +151,87 @@ void ECDSA_SIG_free(ECDSA_SIG *sig) {
|
|
116
151
|
OPENSSL_free(sig);
|
117
152
|
}
|
118
153
|
|
119
|
-
|
120
|
-
|
121
|
-
|
154
|
+
void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **out_r,
|
155
|
+
const BIGNUM **out_s) {
|
156
|
+
if (out_r != NULL) {
|
157
|
+
*out_r = sig->r;
|
158
|
+
}
|
159
|
+
if (out_s != NULL) {
|
160
|
+
*out_s = sig->s;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s) {
|
165
|
+
if (r == NULL || s == NULL) {
|
166
|
+
return 0;
|
167
|
+
}
|
168
|
+
BN_free(sig->r);
|
169
|
+
BN_free(sig->s);
|
170
|
+
sig->r = r;
|
171
|
+
sig->s = s;
|
172
|
+
return 1;
|
122
173
|
}
|
123
174
|
|
124
175
|
int ECDSA_do_verify(const uint8_t *digest, size_t digest_len,
|
125
176
|
const ECDSA_SIG *sig, const EC_KEY *eckey) {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
EC_POINT *point = NULL;
|
130
|
-
const EC_GROUP *group;
|
131
|
-
const EC_POINT *pub_key;
|
132
|
-
|
133
|
-
// check input values
|
134
|
-
if ((group = EC_KEY_get0_group(eckey)) == NULL ||
|
135
|
-
(pub_key = EC_KEY_get0_public_key(eckey)) == NULL ||
|
136
|
-
sig == NULL) {
|
177
|
+
const EC_GROUP *group = EC_KEY_get0_group(eckey);
|
178
|
+
const EC_POINT *pub_key = EC_KEY_get0_public_key(eckey);
|
179
|
+
if (group == NULL || pub_key == NULL || sig == NULL) {
|
137
180
|
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_MISSING_PARAMETERS);
|
138
181
|
return 0;
|
139
182
|
}
|
140
183
|
|
141
|
-
ctx = BN_CTX_new();
|
184
|
+
BN_CTX *ctx = BN_CTX_new();
|
142
185
|
if (!ctx) {
|
143
186
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_MALLOC_FAILURE);
|
144
187
|
return 0;
|
145
188
|
}
|
189
|
+
int ret = 0;
|
190
|
+
EC_POINT *point = NULL;
|
146
191
|
BN_CTX_start(ctx);
|
147
|
-
|
148
|
-
|
149
|
-
m = BN_CTX_get(ctx);
|
150
|
-
X = BN_CTX_get(ctx);
|
151
|
-
if (u1 == NULL || u2 == NULL || m == NULL || X == NULL) {
|
192
|
+
BIGNUM *X = BN_CTX_get(ctx);
|
193
|
+
if (X == NULL) {
|
152
194
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_BN_LIB);
|
153
195
|
goto err;
|
154
196
|
}
|
155
197
|
|
198
|
+
EC_SCALAR r, s, m, u1, u2, s_inv_mont;
|
156
199
|
const BIGNUM *order = EC_GROUP_get0_order(group);
|
157
|
-
if (BN_is_zero(sig->r) ||
|
158
|
-
|
159
|
-
|
200
|
+
if (BN_is_zero(sig->r) ||
|
201
|
+
BN_is_negative(sig->r) ||
|
202
|
+
BN_ucmp(sig->r, order) >= 0 ||
|
203
|
+
!ec_bignum_to_scalar(group, &r, sig->r) ||
|
204
|
+
BN_is_zero(sig->s) ||
|
205
|
+
BN_is_negative(sig->s) ||
|
206
|
+
BN_ucmp(sig->s, order) >= 0 ||
|
207
|
+
!ec_bignum_to_scalar(group, &s, sig->s)) {
|
160
208
|
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_BAD_SIGNATURE);
|
161
209
|
goto err;
|
162
210
|
}
|
163
|
-
//
|
211
|
+
// s_inv_mont = s^-1 mod order. We convert the result to Montgomery form for
|
212
|
+
// the products below.
|
164
213
|
int no_inverse;
|
165
|
-
if (!BN_mod_inverse_odd(
|
166
|
-
|
214
|
+
if (!BN_mod_inverse_odd(X, &no_inverse, sig->s, order, ctx) ||
|
215
|
+
!ec_bignum_to_scalar(group, &s_inv_mont, X) ||
|
216
|
+
!bn_to_montgomery_small(s_inv_mont.words, order->top, s_inv_mont.words,
|
217
|
+
order->top, group->order_mont)) {
|
167
218
|
goto err;
|
168
219
|
}
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
//
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
if (!
|
179
|
-
|
220
|
+
// u1 = m * s_inv_mont mod order
|
221
|
+
// u2 = r * s_inv_mont mod order
|
222
|
+
//
|
223
|
+
// |s_inv_mont| is in Montgomery form while |m| and |r| are not, so |u1| and
|
224
|
+
// |u2| will be taken out of Montgomery form, as desired. Note that, although
|
225
|
+
// |m| is not fully reduced, |bn_mod_mul_montgomery_small| only requires the
|
226
|
+
// product not exceed R * |order|. |s_inv_mont| is fully reduced and |m| <
|
227
|
+
// 2^BN_num_bits(order) <= R, so this holds.
|
228
|
+
digest_to_scalar(group, &m, digest, digest_len);
|
229
|
+
if (!bn_mod_mul_montgomery_small(u1.words, order->top, m.words, order->top,
|
230
|
+
s_inv_mont.words, order->top,
|
231
|
+
group->order_mont) ||
|
232
|
+
!bn_mod_mul_montgomery_small(u2.words, order->top, r.words, order->top,
|
233
|
+
s_inv_mont.words, order->top,
|
234
|
+
group->order_mont)) {
|
180
235
|
goto err;
|
181
236
|
}
|
182
237
|
|
@@ -185,7 +240,7 @@ int ECDSA_do_verify(const uint8_t *digest, size_t digest_len,
|
|
185
240
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_MALLOC_FAILURE);
|
186
241
|
goto err;
|
187
242
|
}
|
188
|
-
if (!
|
243
|
+
if (!ec_point_mul_scalar(group, point, &u1, pub_key, &u2, ctx)) {
|
189
244
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_EC_LIB);
|
190
245
|
goto err;
|
191
246
|
}
|
@@ -193,12 +248,12 @@ int ECDSA_do_verify(const uint8_t *digest, size_t digest_len,
|
|
193
248
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_EC_LIB);
|
194
249
|
goto err;
|
195
250
|
}
|
196
|
-
if (!
|
251
|
+
if (!field_element_to_scalar(group, X)) {
|
197
252
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_BN_LIB);
|
198
253
|
goto err;
|
199
254
|
}
|
200
|
-
//
|
201
|
-
if (BN_ucmp(
|
255
|
+
// The signature is correct iff |X| is equal to |sig->r|.
|
256
|
+
if (BN_ucmp(X, sig->r) != 0) {
|
202
257
|
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_BAD_SIGNATURE);
|
203
258
|
goto err;
|
204
259
|
}
|
@@ -212,45 +267,26 @@ err:
|
|
212
267
|
return ret;
|
213
268
|
}
|
214
269
|
|
215
|
-
static int ecdsa_sign_setup(const EC_KEY *eckey, BN_CTX *
|
216
|
-
BIGNUM **rp,
|
217
|
-
size_t digest_len
|
218
|
-
|
219
|
-
BIGNUM *k = NULL, *kinv = NULL, *r = NULL, *tmp = NULL;
|
270
|
+
static int ecdsa_sign_setup(const EC_KEY *eckey, BN_CTX *ctx,
|
271
|
+
EC_SCALAR *out_kinv_mont, BIGNUM **rp,
|
272
|
+
const uint8_t *digest, size_t digest_len,
|
273
|
+
const EC_SCALAR *priv_key) {
|
220
274
|
EC_POINT *tmp_point = NULL;
|
221
|
-
const EC_GROUP *group;
|
222
275
|
int ret = 0;
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
return 0;
|
227
|
-
}
|
228
|
-
|
229
|
-
if (ctx_in == NULL) {
|
230
|
-
if ((ctx = BN_CTX_new()) == NULL) {
|
231
|
-
OPENSSL_PUT_ERROR(ECDSA, ERR_R_MALLOC_FAILURE);
|
232
|
-
return 0;
|
233
|
-
}
|
234
|
-
} else {
|
235
|
-
ctx = ctx_in;
|
236
|
-
}
|
237
|
-
|
238
|
-
k = BN_new();
|
239
|
-
kinv = BN_new(); // this value is later returned in *kinvp
|
240
|
-
r = BN_new(); // this value is later returned in *rp
|
241
|
-
tmp = BN_new();
|
242
|
-
if (k == NULL || kinv == NULL || r == NULL || tmp == NULL) {
|
276
|
+
EC_SCALAR k;
|
277
|
+
BIGNUM *r = BN_new(); // this value is later returned in *rp
|
278
|
+
if (r == NULL) {
|
243
279
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_MALLOC_FAILURE);
|
244
280
|
goto err;
|
245
281
|
}
|
282
|
+
const EC_GROUP *group = EC_KEY_get0_group(eckey);
|
283
|
+
const BIGNUM *order = EC_GROUP_get0_order(group);
|
246
284
|
tmp_point = EC_POINT_new(group);
|
247
285
|
if (tmp_point == NULL) {
|
248
286
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_EC_LIB);
|
249
287
|
goto err;
|
250
288
|
}
|
251
289
|
|
252
|
-
const BIGNUM *order = EC_GROUP_get0_order(group);
|
253
|
-
|
254
290
|
// Check that the size of the group order is FIPS compliant (FIPS 186-4
|
255
291
|
// B.5.2).
|
256
292
|
if (BN_num_bits(order) < 160) {
|
@@ -259,171 +295,130 @@ static int ecdsa_sign_setup(const EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp,
|
|
259
295
|
}
|
260
296
|
|
261
297
|
do {
|
262
|
-
//
|
263
|
-
// generation. The |digest| argument is only empty if |ECDSA_sign_setup| is
|
264
|
-
// being used.
|
298
|
+
// Include the private key and message digest in the k generation.
|
265
299
|
if (eckey->fixed_k != NULL) {
|
266
|
-
if (!
|
300
|
+
if (!ec_bignum_to_scalar(group, &k, eckey->fixed_k)) {
|
267
301
|
goto err;
|
268
302
|
}
|
269
|
-
} else
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
// Compute the inverse of k. The order is a prime, so use Fermat's Little
|
283
|
-
// Theorem. Note |ec_group_get_order_mont| may return NULL but
|
284
|
-
// |bn_mod_inverse_prime| allows this.
|
285
|
-
if (!bn_mod_inverse_prime(kinv, k, order, ctx,
|
286
|
-
ec_group_get_order_mont(group))) {
|
287
|
-
OPENSSL_PUT_ERROR(ECDSA, ERR_R_BN_LIB);
|
288
|
-
goto err;
|
289
|
-
}
|
290
|
-
|
291
|
-
// We do not want timing information to leak the length of k,
|
292
|
-
// so we compute G*k using an equivalent scalar of fixed
|
293
|
-
// bit-length.
|
294
|
-
|
295
|
-
if (!BN_add(k, k, order)) {
|
296
|
-
goto err;
|
297
|
-
}
|
298
|
-
if (BN_num_bits(k) <= BN_num_bits(order)) {
|
299
|
-
if (!BN_add(k, k, order)) {
|
303
|
+
} else {
|
304
|
+
// Pass a SHA512 hash of the private key and digest as additional data
|
305
|
+
// into the RBG. This is a hardening measure against entropy failure.
|
306
|
+
OPENSSL_COMPILE_ASSERT(SHA512_DIGEST_LENGTH >= 32,
|
307
|
+
additional_data_is_too_large_for_sha512);
|
308
|
+
SHA512_CTX sha;
|
309
|
+
uint8_t additional_data[SHA512_DIGEST_LENGTH];
|
310
|
+
SHA512_Init(&sha);
|
311
|
+
SHA512_Update(&sha, priv_key->words, order->top * sizeof(BN_ULONG));
|
312
|
+
SHA512_Update(&sha, digest, digest_len);
|
313
|
+
SHA512_Final(additional_data, &sha);
|
314
|
+
if (!ec_random_nonzero_scalar(group, &k, additional_data)) {
|
300
315
|
goto err;
|
301
316
|
}
|
302
317
|
}
|
303
318
|
|
304
|
-
//
|
305
|
-
|
306
|
-
|
319
|
+
// Compute k^-1. We leave it in the Montgomery domain as an optimization for
|
320
|
+
// later operations.
|
321
|
+
if (!bn_to_montgomery_small(out_kinv_mont->words, order->top, k.words,
|
322
|
+
order->top, group->order_mont) ||
|
323
|
+
!bn_mod_inverse_prime_mont_small(out_kinv_mont->words, order->top,
|
324
|
+
out_kinv_mont->words, order->top,
|
325
|
+
group->order_mont)) {
|
307
326
|
goto err;
|
308
327
|
}
|
309
|
-
|
328
|
+
|
329
|
+
// Compute r, the x-coordinate of generator * k.
|
330
|
+
if (!ec_point_mul_scalar(group, tmp_point, &k, NULL, NULL, ctx) ||
|
331
|
+
!EC_POINT_get_affine_coordinates_GFp(group, tmp_point, r, NULL,
|
310
332
|
ctx)) {
|
311
|
-
OPENSSL_PUT_ERROR(ECDSA, ERR_R_EC_LIB);
|
312
333
|
goto err;
|
313
334
|
}
|
314
335
|
|
315
|
-
if (!
|
316
|
-
OPENSSL_PUT_ERROR(ECDSA, ERR_R_BN_LIB);
|
336
|
+
if (!field_element_to_scalar(group, r)) {
|
317
337
|
goto err;
|
318
338
|
}
|
319
339
|
} while (BN_is_zero(r));
|
320
340
|
|
321
|
-
// clear old values if necessary
|
322
341
|
BN_clear_free(*rp);
|
323
|
-
BN_clear_free(*kinvp);
|
324
|
-
|
325
|
-
// save the pre-computed values
|
326
342
|
*rp = r;
|
327
|
-
|
343
|
+
r = NULL;
|
328
344
|
ret = 1;
|
329
345
|
|
330
346
|
err:
|
331
|
-
|
332
|
-
|
333
|
-
BN_clear_free(kinv);
|
334
|
-
BN_clear_free(r);
|
335
|
-
}
|
336
|
-
if (ctx_in == NULL) {
|
337
|
-
BN_CTX_free(ctx);
|
338
|
-
}
|
347
|
+
OPENSSL_cleanse(&k, sizeof(k));
|
348
|
+
BN_clear_free(r);
|
339
349
|
EC_POINT_free(tmp_point);
|
340
|
-
BN_clear_free(tmp);
|
341
350
|
return ret;
|
342
351
|
}
|
343
352
|
|
344
|
-
|
345
|
-
|
346
|
-
return ecdsa_sign_setup(eckey, ctx, kinv, rp, NULL, 0);
|
347
|
-
}
|
348
|
-
|
349
|
-
ECDSA_SIG *ECDSA_do_sign_ex(const uint8_t *digest, size_t digest_len,
|
350
|
-
const BIGNUM *in_kinv, const BIGNUM *in_r,
|
351
|
-
const EC_KEY *eckey) {
|
352
|
-
int ok = 0;
|
353
|
-
BIGNUM *kinv = NULL, *s, *m = NULL, *tmp = NULL;
|
354
|
-
const BIGNUM *ckinv;
|
355
|
-
BN_CTX *ctx = NULL;
|
356
|
-
const EC_GROUP *group;
|
357
|
-
ECDSA_SIG *ret;
|
358
|
-
const BIGNUM *priv_key;
|
359
|
-
|
353
|
+
ECDSA_SIG *ECDSA_do_sign(const uint8_t *digest, size_t digest_len,
|
354
|
+
const EC_KEY *eckey) {
|
360
355
|
if (eckey->ecdsa_meth && eckey->ecdsa_meth->sign) {
|
361
356
|
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_NOT_IMPLEMENTED);
|
362
357
|
return NULL;
|
363
358
|
}
|
364
359
|
|
365
|
-
group = EC_KEY_get0_group(eckey);
|
366
|
-
|
367
|
-
|
368
|
-
if (group == NULL || priv_key == NULL) {
|
360
|
+
const EC_GROUP *group = EC_KEY_get0_group(eckey);
|
361
|
+
const BIGNUM *priv_key_bn = EC_KEY_get0_private_key(eckey);
|
362
|
+
if (group == NULL || priv_key_bn == NULL) {
|
369
363
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_PASSED_NULL_PARAMETER);
|
370
364
|
return NULL;
|
371
365
|
}
|
366
|
+
const BIGNUM *order = EC_GROUP_get0_order(group);
|
372
367
|
|
373
|
-
|
374
|
-
|
368
|
+
int ok = 0;
|
369
|
+
ECDSA_SIG *ret = ECDSA_SIG_new();
|
370
|
+
BN_CTX *ctx = BN_CTX_new();
|
371
|
+
EC_SCALAR kinv_mont, priv_key, r_mont, s, tmp, m;
|
372
|
+
if (ret == NULL || ctx == NULL) {
|
375
373
|
OPENSSL_PUT_ERROR(ECDSA, ERR_R_MALLOC_FAILURE);
|
376
374
|
return NULL;
|
377
375
|
}
|
378
|
-
s = ret->s;
|
379
|
-
|
380
|
-
if ((ctx = BN_CTX_new()) == NULL ||
|
381
|
-
(tmp = BN_new()) == NULL ||
|
382
|
-
(m = BN_new()) == NULL) {
|
383
|
-
OPENSSL_PUT_ERROR(ECDSA, ERR_R_MALLOC_FAILURE);
|
384
|
-
goto err;
|
385
|
-
}
|
386
|
-
|
387
|
-
const BIGNUM *order = EC_GROUP_get0_order(group);
|
388
376
|
|
389
|
-
|
377
|
+
digest_to_scalar(group, &m, digest, digest_len);
|
378
|
+
if (!ec_bignum_to_scalar(group, &priv_key, priv_key_bn)) {
|
390
379
|
goto err;
|
391
380
|
}
|
392
381
|
for (;;) {
|
393
|
-
if (
|
394
|
-
|
395
|
-
|
396
|
-
goto err;
|
397
|
-
}
|
398
|
-
ckinv = kinv;
|
399
|
-
} else {
|
400
|
-
ckinv = in_kinv;
|
401
|
-
if (BN_copy(ret->r, in_r) == NULL) {
|
402
|
-
OPENSSL_PUT_ERROR(ECDSA, ERR_R_MALLOC_FAILURE);
|
403
|
-
goto err;
|
404
|
-
}
|
382
|
+
if (!ecdsa_sign_setup(eckey, ctx, &kinv_mont, &ret->r, digest, digest_len,
|
383
|
+
&priv_key)) {
|
384
|
+
goto err;
|
405
385
|
}
|
406
386
|
|
407
|
-
|
408
|
-
|
387
|
+
// Compute priv_key * r (mod order). Note if only one parameter is in the
|
388
|
+
// Montgomery domain, |bn_mod_mul_montgomery_small| will compute the answer
|
389
|
+
// in the normal domain.
|
390
|
+
if (!ec_bignum_to_scalar(group, &r_mont, ret->r) ||
|
391
|
+
!bn_to_montgomery_small(r_mont.words, order->top, r_mont.words,
|
392
|
+
order->top, group->order_mont) ||
|
393
|
+
!bn_mod_mul_montgomery_small(s.words, order->top, priv_key.words,
|
394
|
+
order->top, r_mont.words, order->top,
|
395
|
+
group->order_mont)) {
|
409
396
|
goto err;
|
410
397
|
}
|
411
|
-
|
412
|
-
|
413
|
-
|
398
|
+
|
399
|
+
// Compute s += m in constant time. Reduce one copy of |order| if necessary.
|
400
|
+
// Note this does not leave |s| fully reduced. We have
|
401
|
+
// |m| < 2^BN_num_bits(order), so subtracting |order| leaves
|
402
|
+
// 0 <= |s| < 2^BN_num_bits(order).
|
403
|
+
BN_ULONG carry = bn_add_words(s.words, s.words, m.words, order->top);
|
404
|
+
BN_ULONG v = bn_sub_words(tmp.words, s.words, order->d, order->top) - carry;
|
405
|
+
v = 0u - v;
|
406
|
+
for (int i = 0; i < order->top; i++) {
|
407
|
+
s.words[i] = constant_time_select_w(v, s.words[i], tmp.words[i]);
|
414
408
|
}
|
415
|
-
|
416
|
-
|
409
|
+
|
410
|
+
// Finally, multiply s by k^-1. That was retained in Montgomery form, so the
|
411
|
+
// same technique as the previous multiplication works. Although the
|
412
|
+
// previous step did not fully reduce |s|, |bn_mod_mul_montgomery_small|
|
413
|
+
// only requires the product not exceed R * |order|. |kinv_mont| is fully
|
414
|
+
// reduced and |s| < 2^BN_num_bits(order) <= R, so this holds.
|
415
|
+
if (!bn_mod_mul_montgomery_small(s.words, order->top, s.words, order->top,
|
416
|
+
kinv_mont.words, order->top,
|
417
|
+
group->order_mont) ||
|
418
|
+
!bn_set_words(ret->s, s.words, order->top)) {
|
417
419
|
goto err;
|
418
420
|
}
|
419
|
-
if (BN_is_zero(s)) {
|
420
|
-
// if kinv and r have been supplied by the caller
|
421
|
-
// don't to generate new kinv and r values
|
422
|
-
if (in_kinv != NULL && in_r != NULL) {
|
423
|
-
OPENSSL_PUT_ERROR(ECDSA, ECDSA_R_NEED_NEW_SETUP_VALUES);
|
424
|
-
goto err;
|
425
|
-
}
|
426
|
-
} else {
|
421
|
+
if (!BN_is_zero(ret->s)) {
|
427
422
|
// s != 0 => we have a valid signature
|
428
423
|
break;
|
429
424
|
}
|
@@ -437,8 +432,11 @@ err:
|
|
437
432
|
ret = NULL;
|
438
433
|
}
|
439
434
|
BN_CTX_free(ctx);
|
440
|
-
|
441
|
-
|
442
|
-
|
435
|
+
OPENSSL_cleanse(&kinv_mont, sizeof(kinv_mont));
|
436
|
+
OPENSSL_cleanse(&priv_key, sizeof(priv_key));
|
437
|
+
OPENSSL_cleanse(&r_mont, sizeof(r_mont));
|
438
|
+
OPENSSL_cleanse(&s, sizeof(s));
|
439
|
+
OPENSSL_cleanse(&tmp, sizeof(tmp));
|
440
|
+
OPENSSL_cleanse(&m, sizeof(m));
|
443
441
|
return ret;
|
444
442
|
}
|