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
@@ -90,32 +90,6 @@ void ec_GFp_mont_group_finish(EC_GROUP *group) {
|
|
90
90
|
ec_GFp_simple_group_finish(group);
|
91
91
|
}
|
92
92
|
|
93
|
-
int ec_GFp_mont_group_copy(EC_GROUP *dest, const EC_GROUP *src) {
|
94
|
-
BN_MONT_CTX_free(dest->mont);
|
95
|
-
dest->mont = NULL;
|
96
|
-
|
97
|
-
if (!ec_GFp_simple_group_copy(dest, src)) {
|
98
|
-
return 0;
|
99
|
-
}
|
100
|
-
|
101
|
-
if (src->mont != NULL) {
|
102
|
-
dest->mont = BN_MONT_CTX_new();
|
103
|
-
if (dest->mont == NULL) {
|
104
|
-
return 0;
|
105
|
-
}
|
106
|
-
if (!BN_MONT_CTX_copy(dest->mont, src->mont)) {
|
107
|
-
goto err;
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
return 1;
|
112
|
-
|
113
|
-
err:
|
114
|
-
BN_MONT_CTX_free(dest->mont);
|
115
|
-
dest->mont = NULL;
|
116
|
-
return 0;
|
117
|
-
}
|
118
|
-
|
119
93
|
int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p,
|
120
94
|
const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) {
|
121
95
|
BN_CTX *new_ctx = NULL;
|
@@ -293,7 +267,6 @@ err:
|
|
293
267
|
DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_mont_method) {
|
294
268
|
out->group_init = ec_GFp_mont_group_init;
|
295
269
|
out->group_finish = ec_GFp_mont_group_finish;
|
296
|
-
out->group_copy = ec_GFp_mont_group_copy;
|
297
270
|
out->group_set_curve = ec_GFp_mont_group_set_curve;
|
298
271
|
out->point_get_affine_coordinates = ec_GFp_mont_point_get_affine_coordinates;
|
299
272
|
out->mul = ec_wNAF_mul /* XXX: Not constant time. */;
|
@@ -73,16 +73,37 @@
|
|
73
73
|
#include <openssl/bn.h>
|
74
74
|
#include <openssl/ex_data.h>
|
75
75
|
#include <openssl/thread.h>
|
76
|
+
#include <openssl/type_check.h>
|
77
|
+
|
78
|
+
#include "../bn/internal.h"
|
76
79
|
|
77
80
|
#if defined(__cplusplus)
|
78
81
|
extern "C" {
|
79
82
|
#endif
|
80
83
|
|
81
84
|
|
85
|
+
// Cap the size of all field elements and scalars, including custom curves, to
|
86
|
+
// 66 bytes, large enough to fit secp521r1 and brainpoolP512r1, which appear to
|
87
|
+
// be the largest fields anyone plausibly uses.
|
88
|
+
#define EC_MAX_SCALAR_BYTES 66
|
89
|
+
#define EC_MAX_SCALAR_WORDS ((66 + BN_BYTES - 1) / BN_BYTES)
|
90
|
+
|
91
|
+
OPENSSL_COMPILE_ASSERT(EC_MAX_SCALAR_WORDS <= BN_SMALL_MAX_WORDS,
|
92
|
+
bn_small_functions_applicable);
|
93
|
+
|
94
|
+
// An EC_SCALAR is a |BN_num_bits(order)|-bit integer. Only the first
|
95
|
+
// |order->top| words are used. An |EC_SCALAR| is specific to an |EC_GROUP| and
|
96
|
+
// must not be mixed between groups. Unless otherwise specified, it is fully
|
97
|
+
// reduced modulo the |order|.
|
98
|
+
typedef union {
|
99
|
+
// bytes is the representation of the scalar in little-endian order.
|
100
|
+
uint8_t bytes[EC_MAX_SCALAR_BYTES];
|
101
|
+
BN_ULONG words[EC_MAX_SCALAR_WORDS];
|
102
|
+
} EC_SCALAR;
|
103
|
+
|
82
104
|
struct ec_method_st {
|
83
105
|
int (*group_init)(EC_GROUP *);
|
84
106
|
void (*group_finish)(EC_GROUP *);
|
85
|
-
int (*group_copy)(EC_GROUP *, const EC_GROUP *);
|
86
107
|
int (*group_set_curve)(EC_GROUP *, const BIGNUM *p, const BIGNUM *a,
|
87
108
|
const BIGNUM *b, BN_CTX *);
|
88
109
|
int (*point_get_affine_coordinates)(const EC_GROUP *, const EC_POINT *,
|
@@ -93,8 +114,8 @@ struct ec_method_st {
|
|
93
114
|
// Computes |r = p_scalar*p| if g_scalar is null. At least one of |g_scalar|
|
94
115
|
// and |p_scalar| must be non-null, and |p| must be non-null if |p_scalar| is
|
95
116
|
// non-null.
|
96
|
-
int (*mul)(const EC_GROUP *group, EC_POINT *r, const
|
97
|
-
const EC_POINT *p, const
|
117
|
+
int (*mul)(const EC_GROUP *group, EC_POINT *r, const EC_SCALAR *g_scalar,
|
118
|
+
const EC_POINT *p, const EC_SCALAR *p_scalar, BN_CTX *ctx);
|
98
119
|
|
99
120
|
// 'field_mul' and 'field_sqr' can be used by 'add' and 'dbl' so that the
|
100
121
|
// same implementations of point operations can be used with different
|
@@ -114,12 +135,14 @@ const EC_METHOD *EC_GFp_mont_method(void);
|
|
114
135
|
struct ec_group_st {
|
115
136
|
const EC_METHOD *meth;
|
116
137
|
|
138
|
+
// Unlike all other |EC_POINT|s, |generator| does not own |generator->group|
|
139
|
+
// to avoid a reference cycle.
|
117
140
|
EC_POINT *generator;
|
118
141
|
BIGNUM order;
|
119
142
|
|
120
143
|
int curve_name; // optional NID for named curve
|
121
144
|
|
122
|
-
|
145
|
+
BN_MONT_CTX *order_mont; // data for ECDSA inverse
|
123
146
|
|
124
147
|
// The following members are handled by the method functions,
|
125
148
|
// even if they appear generic
|
@@ -130,13 +153,17 @@ struct ec_group_st {
|
|
130
153
|
|
131
154
|
int a_is_minus3; // enable optimized point arithmetics for special case
|
132
155
|
|
156
|
+
CRYPTO_refcount_t references;
|
157
|
+
|
133
158
|
BN_MONT_CTX *mont; // Montgomery structure.
|
134
159
|
|
135
160
|
BIGNUM one; // The value one.
|
136
161
|
} /* EC_GROUP */;
|
137
162
|
|
138
163
|
struct ec_point_st {
|
139
|
-
|
164
|
+
// group is an owning reference to |group|, unless this is
|
165
|
+
// |group->generator|.
|
166
|
+
EC_GROUP *group;
|
140
167
|
|
141
168
|
BIGNUM X;
|
142
169
|
BIGNUM Y;
|
@@ -145,20 +172,33 @@ struct ec_point_st {
|
|
145
172
|
} /* EC_POINT */;
|
146
173
|
|
147
174
|
EC_GROUP *ec_group_new(const EC_METHOD *meth);
|
148
|
-
int ec_group_copy(EC_GROUP *dest, const EC_GROUP *src);
|
149
|
-
|
150
|
-
// ec_group_get_order_mont returns a Montgomery context for operations modulo
|
151
|
-
// |group|'s order. It may return NULL in the case that |group| is not a
|
152
|
-
// built-in group.
|
153
|
-
const BN_MONT_CTX *ec_group_get_order_mont(const EC_GROUP *group);
|
154
175
|
|
155
|
-
|
156
|
-
|
176
|
+
// ec_bignum_to_scalar converts |in| to an |EC_SCALAR| and writes it to |*out|.
|
177
|
+
// |in| must be non-negative and have at most |BN_num_bits(&group->order)| bits.
|
178
|
+
// It returns one on success and zero on error. It does not ensure |in| is fully
|
179
|
+
// reduced.
|
180
|
+
int ec_bignum_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
181
|
+
const BIGNUM *in);
|
182
|
+
|
183
|
+
// ec_random_nonzero_scalar sets |out| to a uniformly selected random value from
|
184
|
+
// 1 to |group->order| - 1. It returns one on success and zero on error.
|
185
|
+
int ec_random_nonzero_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
186
|
+
const uint8_t additional_data[32]);
|
187
|
+
|
188
|
+
// ec_point_mul_scalar sets |r| to generator * |g_scalar| + |p| *
|
189
|
+
// |p_scalar|. Unlike other functions which take |EC_SCALAR|, |g_scalar| and
|
190
|
+
// |p_scalar| need not be fully reduced. They need only contain as many bits as
|
191
|
+
// the order.
|
192
|
+
int ec_point_mul_scalar(const EC_GROUP *group, EC_POINT *r,
|
193
|
+
const EC_SCALAR *g_scalar, const EC_POINT *p,
|
194
|
+
const EC_SCALAR *p_scalar, BN_CTX *ctx);
|
195
|
+
|
196
|
+
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const EC_SCALAR *g_scalar,
|
197
|
+
const EC_POINT *p, const EC_SCALAR *p_scalar, BN_CTX *ctx);
|
157
198
|
|
158
199
|
// method functions in simple.c
|
159
200
|
int ec_GFp_simple_group_init(EC_GROUP *);
|
160
201
|
void ec_GFp_simple_group_finish(EC_GROUP *);
|
161
|
-
int ec_GFp_simple_group_copy(EC_GROUP *, const EC_GROUP *);
|
162
202
|
int ec_GFp_simple_group_set_curve(EC_GROUP *, const BIGNUM *p, const BIGNUM *a,
|
163
203
|
const BIGNUM *b, BN_CTX *);
|
164
204
|
int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a,
|
@@ -166,17 +206,12 @@ int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a,
|
|
166
206
|
unsigned ec_GFp_simple_group_get_degree(const EC_GROUP *);
|
167
207
|
int ec_GFp_simple_point_init(EC_POINT *);
|
168
208
|
void ec_GFp_simple_point_finish(EC_POINT *);
|
169
|
-
void ec_GFp_simple_point_clear_finish(EC_POINT *);
|
170
209
|
int ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *);
|
171
210
|
int ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *);
|
172
211
|
int ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *,
|
173
212
|
const BIGNUM *x,
|
174
213
|
const BIGNUM *y,
|
175
214
|
const BIGNUM *z, BN_CTX *);
|
176
|
-
int ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP *,
|
177
|
-
const EC_POINT *, BIGNUM *x,
|
178
|
-
BIGNUM *y, BIGNUM *z,
|
179
|
-
BN_CTX *);
|
180
215
|
int ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *, EC_POINT *,
|
181
216
|
const BIGNUM *x, const BIGNUM *y,
|
182
217
|
BN_CTX *);
|
@@ -205,7 +240,6 @@ int ec_GFp_mont_group_init(EC_GROUP *);
|
|
205
240
|
int ec_GFp_mont_group_set_curve(EC_GROUP *, const BIGNUM *p, const BIGNUM *a,
|
206
241
|
const BIGNUM *b, BN_CTX *);
|
207
242
|
void ec_GFp_mont_group_finish(EC_GROUP *);
|
208
|
-
int ec_GFp_mont_group_copy(EC_GROUP *, const EC_GROUP *);
|
209
243
|
int ec_GFp_mont_field_mul(const EC_GROUP *, BIGNUM *r, const BIGNUM *a,
|
210
244
|
const BIGNUM *b, BN_CTX *);
|
211
245
|
int ec_GFp_mont_field_sqr(const EC_GROUP *, BIGNUM *r, const BIGNUM *a,
|
@@ -251,7 +251,7 @@ err:
|
|
251
251
|
|
252
252
|
int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
|
253
253
|
const uint8_t *buf, size_t len, BN_CTX *ctx) {
|
254
|
-
if (group->
|
254
|
+
if (EC_GROUP_cmp(group, point->group, NULL) != 0) {
|
255
255
|
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
|
256
256
|
return 0;
|
257
257
|
}
|
@@ -261,7 +261,7 @@ int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
|
|
261
261
|
size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
|
262
262
|
point_conversion_form_t form, uint8_t *buf,
|
263
263
|
size_t len, BN_CTX *ctx) {
|
264
|
-
if (group->
|
264
|
+
if (EC_GROUP_cmp(group, point->group, NULL) != 0) {
|
265
265
|
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
|
266
266
|
return 0;
|
267
267
|
}
|
@@ -396,7 +396,7 @@ err:
|
|
396
396
|
int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
|
397
397
|
EC_POINT *point, const BIGNUM *x,
|
398
398
|
int y_bit, BN_CTX *ctx) {
|
399
|
-
if (group->
|
399
|
+
if (EC_GROUP_cmp(group, point->group, NULL) != 0) {
|
400
400
|
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
|
401
401
|
return 0;
|
402
402
|
}
|
@@ -1038,14 +1038,13 @@ static int ec_GFp_nistp224_point_get_affine_coordinates(const EC_GROUP *group,
|
|
1038
1038
|
}
|
1039
1039
|
|
1040
1040
|
static int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
1041
|
-
const
|
1042
|
-
const
|
1041
|
+
const EC_SCALAR *g_scalar,
|
1042
|
+
const EC_POINT *p,
|
1043
|
+
const EC_SCALAR *p_scalar, BN_CTX *ctx) {
|
1043
1044
|
int ret = 0;
|
1044
1045
|
BN_CTX *new_ctx = NULL;
|
1045
1046
|
BIGNUM *x, *y, *z, *tmp_scalar;
|
1046
|
-
p224_felem_bytearray g_secret, p_secret;
|
1047
1047
|
p224_felem p_pre_comp[17][3];
|
1048
|
-
p224_felem_bytearray tmp;
|
1049
1048
|
p224_felem x_in, y_in, z_in, x_out, y_out, z_out;
|
1050
1049
|
|
1051
1050
|
if (ctx == NULL) {
|
@@ -1067,23 +1066,7 @@ static int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
|
1067
1066
|
if (p != NULL && p_scalar != NULL) {
|
1068
1067
|
// We treat NULL scalars as 0, and NULL points as points at infinity, i.e.,
|
1069
1068
|
// they contribute nothing to the linear combination.
|
1070
|
-
OPENSSL_memset(&p_secret, 0, sizeof(p_secret));
|
1071
1069
|
OPENSSL_memset(&p_pre_comp, 0, sizeof(p_pre_comp));
|
1072
|
-
size_t num_bytes;
|
1073
|
-
// reduce g_scalar to 0 <= g_scalar < 2^224
|
1074
|
-
if (BN_num_bits(p_scalar) > 224 || BN_is_negative(p_scalar)) {
|
1075
|
-
// this is an unusual input, and we don't guarantee
|
1076
|
-
// constant-timeness
|
1077
|
-
if (!BN_nnmod(tmp_scalar, p_scalar, &group->order, ctx)) {
|
1078
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
1079
|
-
goto err;
|
1080
|
-
}
|
1081
|
-
num_bytes = BN_bn2bin(tmp_scalar, tmp);
|
1082
|
-
} else {
|
1083
|
-
num_bytes = BN_bn2bin(p_scalar, tmp);
|
1084
|
-
}
|
1085
|
-
|
1086
|
-
p224_flip_endian(p_secret, tmp, num_bytes);
|
1087
1070
|
// precompute multiples
|
1088
1071
|
if (!p224_BN_to_felem(x_out, &p->X) ||
|
1089
1072
|
!p224_BN_to_felem(y_out, &p->Y) ||
|
@@ -1109,26 +1092,10 @@ static int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
|
1109
1092
|
}
|
1110
1093
|
}
|
1111
1094
|
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
if (BN_num_bits(g_scalar) > 224 || BN_is_negative(g_scalar)) {
|
1117
|
-
// this is an unusual input, and we don't guarantee constant-timeness
|
1118
|
-
if (!BN_nnmod(tmp_scalar, g_scalar, &group->order, ctx)) {
|
1119
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
1120
|
-
goto err;
|
1121
|
-
}
|
1122
|
-
num_bytes = BN_bn2bin(tmp_scalar, tmp);
|
1123
|
-
} else {
|
1124
|
-
num_bytes = BN_bn2bin(g_scalar, tmp);
|
1125
|
-
}
|
1126
|
-
|
1127
|
-
p224_flip_endian(g_secret, tmp, num_bytes);
|
1128
|
-
}
|
1129
|
-
p224_batch_mul(
|
1130
|
-
x_out, y_out, z_out, (p != NULL && p_scalar != NULL) ? p_secret : NULL,
|
1131
|
-
g_scalar != NULL ? g_secret : NULL, (const p224_felem(*)[3])p_pre_comp);
|
1095
|
+
p224_batch_mul(x_out, y_out, z_out,
|
1096
|
+
(p != NULL && p_scalar != NULL) ? p_scalar->bytes : NULL,
|
1097
|
+
g_scalar != NULL ? g_scalar->bytes : NULL,
|
1098
|
+
(const p224_felem(*)[3])p_pre_comp);
|
1132
1099
|
|
1133
1100
|
// reduce the output to its unique minimal representation
|
1134
1101
|
p224_felem_contract(x_in, x_out);
|
@@ -1151,7 +1118,6 @@ err:
|
|
1151
1118
|
DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_nistp224_method) {
|
1152
1119
|
out->group_init = ec_GFp_simple_group_init;
|
1153
1120
|
out->group_finish = ec_GFp_simple_group_finish;
|
1154
|
-
out->group_copy = ec_GFp_simple_group_copy;
|
1155
1121
|
out->group_set_curve = ec_GFp_simple_group_set_curve;
|
1156
1122
|
out->point_get_affine_coordinates =
|
1157
1123
|
ec_GFp_nistp224_point_get_affine_coordinates;
|
@@ -1582,14 +1582,13 @@ static int ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP *group,
|
|
1582
1582
|
}
|
1583
1583
|
|
1584
1584
|
static int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
|
1585
|
-
const
|
1586
|
-
const
|
1585
|
+
const EC_SCALAR *g_scalar,
|
1586
|
+
const EC_POINT *p,
|
1587
|
+
const EC_SCALAR *p_scalar, BN_CTX *ctx) {
|
1587
1588
|
int ret = 0;
|
1588
1589
|
BN_CTX *new_ctx = NULL;
|
1589
1590
|
BIGNUM *x, *y, *z, *tmp_scalar;
|
1590
|
-
felem_bytearray g_secret, p_secret;
|
1591
1591
|
smallfelem p_pre_comp[17][3];
|
1592
|
-
felem_bytearray tmp;
|
1593
1592
|
smallfelem x_in, y_in, z_in;
|
1594
1593
|
felem x_out, y_out, z_out;
|
1595
1594
|
|
@@ -1611,21 +1610,7 @@ static int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
|
|
1611
1610
|
if (p != NULL && p_scalar != NULL) {
|
1612
1611
|
// We treat NULL scalars as 0, and NULL points as points at infinity, i.e.,
|
1613
1612
|
// they contribute nothing to the linear combination.
|
1614
|
-
OPENSSL_memset(&p_secret, 0, sizeof(p_secret));
|
1615
1613
|
OPENSSL_memset(&p_pre_comp, 0, sizeof(p_pre_comp));
|
1616
|
-
size_t num_bytes;
|
1617
|
-
// Reduce g_scalar to 0 <= g_scalar < 2^256.
|
1618
|
-
if (BN_num_bits(p_scalar) > 256 || BN_is_negative(p_scalar)) {
|
1619
|
-
// This is an unusual input, and we don't guarantee constant-timeness.
|
1620
|
-
if (!BN_nnmod(tmp_scalar, p_scalar, &group->order, ctx)) {
|
1621
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
1622
|
-
goto err;
|
1623
|
-
}
|
1624
|
-
num_bytes = BN_bn2bin(tmp_scalar, tmp);
|
1625
|
-
} else {
|
1626
|
-
num_bytes = BN_bn2bin(p_scalar, tmp);
|
1627
|
-
}
|
1628
|
-
flip_endian(p_secret, tmp, num_bytes);
|
1629
1614
|
// Precompute multiples.
|
1630
1615
|
if (!BN_to_felem(x_out, &p->X) ||
|
1631
1616
|
!BN_to_felem(y_out, &p->Y) ||
|
@@ -1650,28 +1635,10 @@ static int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
|
|
1650
1635
|
}
|
1651
1636
|
}
|
1652
1637
|
|
1653
|
-
if (g_scalar != NULL) {
|
1654
|
-
size_t num_bytes;
|
1655
|
-
|
1656
|
-
OPENSSL_memset(g_secret, 0, sizeof(g_secret));
|
1657
|
-
// reduce g_scalar to 0 <= g_scalar < 2^256
|
1658
|
-
if (BN_num_bits(g_scalar) > 256 || BN_is_negative(g_scalar)) {
|
1659
|
-
// this is an unusual input, and we don't guarantee
|
1660
|
-
// constant-timeness.
|
1661
|
-
if (!BN_nnmod(tmp_scalar, g_scalar, &group->order, ctx)) {
|
1662
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
1663
|
-
goto err;
|
1664
|
-
}
|
1665
|
-
num_bytes = BN_bn2bin(tmp_scalar, tmp);
|
1666
|
-
} else {
|
1667
|
-
num_bytes = BN_bn2bin(g_scalar, tmp);
|
1668
|
-
}
|
1669
|
-
flip_endian(g_secret, tmp, num_bytes);
|
1670
|
-
}
|
1671
1638
|
batch_mul(x_out, y_out, z_out,
|
1672
|
-
(p != NULL && p_scalar != NULL) ?
|
1673
|
-
g_scalar != NULL ?
|
1674
|
-
(const smallfelem(*)[3]) &p_pre_comp);
|
1639
|
+
(p != NULL && p_scalar != NULL) ? p_scalar->bytes : NULL,
|
1640
|
+
g_scalar != NULL ? g_scalar->bytes : NULL,
|
1641
|
+
(const smallfelem(*)[3]) & p_pre_comp);
|
1675
1642
|
|
1676
1643
|
// reduce the output to its unique minimal representation
|
1677
1644
|
felem_contract(x_in, x_out);
|
@@ -1694,7 +1661,6 @@ err:
|
|
1694
1661
|
DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_nistp256_method) {
|
1695
1662
|
out->group_init = ec_GFp_simple_group_init;
|
1696
1663
|
out->group_finish = ec_GFp_simple_group_finish;
|
1697
|
-
out->group_copy = ec_GFp_simple_group_copy;
|
1698
1664
|
out->group_set_curve = ec_GFp_simple_group_set_curve;
|
1699
1665
|
out->point_get_affine_coordinates =
|
1700
1666
|
ec_GFp_nistp256_point_get_affine_coordinates;
|
@@ -216,8 +216,8 @@ static int ecp_nistz256_bignum_to_field_elem(BN_ULONG out[P256_LIMBS],
|
|
216
216
|
|
217
217
|
// r = p * p_scalar
|
218
218
|
static int ecp_nistz256_windowed_mul(const EC_GROUP *group, P256_POINT *r,
|
219
|
-
const EC_POINT *p,
|
220
|
-
|
219
|
+
const EC_POINT *p,
|
220
|
+
const EC_SCALAR *p_scalar) {
|
221
221
|
assert(p != NULL);
|
222
222
|
assert(p_scalar != NULL);
|
223
223
|
|
@@ -229,55 +229,8 @@ static int ecp_nistz256_windowed_mul(const EC_GROUP *group, P256_POINT *r,
|
|
229
229
|
// ~1599 ((96 * 16) + 63) bytes of stack space.
|
230
230
|
alignas(64) P256_POINT table[16];
|
231
231
|
uint8_t p_str[33];
|
232
|
-
|
233
|
-
|
234
|
-
int ret = 0;
|
235
|
-
BN_CTX *new_ctx = NULL;
|
236
|
-
int ctx_started = 0;
|
237
|
-
|
238
|
-
if (BN_num_bits(p_scalar) > 256 || BN_is_negative(p_scalar)) {
|
239
|
-
if (ctx == NULL) {
|
240
|
-
new_ctx = BN_CTX_new();
|
241
|
-
if (new_ctx == NULL) {
|
242
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE);
|
243
|
-
goto err;
|
244
|
-
}
|
245
|
-
ctx = new_ctx;
|
246
|
-
}
|
247
|
-
BN_CTX_start(ctx);
|
248
|
-
ctx_started = 1;
|
249
|
-
BIGNUM *mod = BN_CTX_get(ctx);
|
250
|
-
if (mod == NULL) {
|
251
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE);
|
252
|
-
goto err;
|
253
|
-
}
|
254
|
-
if (!BN_nnmod(mod, p_scalar, &group->order, ctx)) {
|
255
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
256
|
-
goto err;
|
257
|
-
}
|
258
|
-
p_scalar = mod;
|
259
|
-
}
|
260
|
-
|
261
|
-
int j;
|
262
|
-
for (j = 0; j < p_scalar->top * BN_BYTES; j += BN_BYTES) {
|
263
|
-
BN_ULONG d = p_scalar->d[j / BN_BYTES];
|
264
|
-
|
265
|
-
p_str[j + 0] = d & 0xff;
|
266
|
-
p_str[j + 1] = (d >> 8) & 0xff;
|
267
|
-
p_str[j + 2] = (d >> 16) & 0xff;
|
268
|
-
p_str[j + 3] = (d >>= 24) & 0xff;
|
269
|
-
if (BN_BYTES == 8) {
|
270
|
-
d >>= 8;
|
271
|
-
p_str[j + 4] = d & 0xff;
|
272
|
-
p_str[j + 5] = (d >> 8) & 0xff;
|
273
|
-
p_str[j + 6] = (d >> 16) & 0xff;
|
274
|
-
p_str[j + 7] = (d >> 24) & 0xff;
|
275
|
-
}
|
276
|
-
}
|
277
|
-
|
278
|
-
for (; j < 33; j++) {
|
279
|
-
p_str[j] = 0;
|
280
|
-
}
|
232
|
+
OPENSSL_memcpy(p_str, p_scalar->bytes, 32);
|
233
|
+
p_str[32] = 0;
|
281
234
|
|
282
235
|
// table[0] is implicitly (0,0,0) (the point at infinity), therefore it is
|
283
236
|
// not stored. All other values are actually stored with an offset of -1 in
|
@@ -288,7 +241,7 @@ static int ecp_nistz256_windowed_mul(const EC_GROUP *group, P256_POINT *r,
|
|
288
241
|
!ecp_nistz256_bignum_to_field_elem(row[1 - 1].Y, &p->Y) ||
|
289
242
|
!ecp_nistz256_bignum_to_field_elem(row[1 - 1].Z, &p->Z)) {
|
290
243
|
OPENSSL_PUT_ERROR(EC, EC_R_COORDINATES_OUT_OF_RANGE);
|
291
|
-
|
244
|
+
return 0;
|
292
245
|
}
|
293
246
|
|
294
247
|
ecp_nistz256_point_double(&row[2 - 1], &row[1 - 1]);
|
@@ -354,19 +307,13 @@ static int ecp_nistz256_windowed_mul(const EC_GROUP *group, P256_POINT *r,
|
|
354
307
|
|
355
308
|
ecp_nistz256_point_add(r, r, &h);
|
356
309
|
|
357
|
-
|
358
|
-
|
359
|
-
err:
|
360
|
-
if (ctx_started) {
|
361
|
-
BN_CTX_end(ctx);
|
362
|
-
}
|
363
|
-
BN_CTX_free(new_ctx);
|
364
|
-
return ret;
|
310
|
+
return 1;
|
365
311
|
}
|
366
312
|
|
367
|
-
static int ecp_nistz256_points_mul(
|
368
|
-
|
369
|
-
|
313
|
+
static int ecp_nistz256_points_mul(const EC_GROUP *group, EC_POINT *r,
|
314
|
+
const EC_SCALAR *g_scalar,
|
315
|
+
const EC_POINT *p_,
|
316
|
+
const EC_SCALAR *p_scalar, BN_CTX *ctx) {
|
370
317
|
assert((p_ != NULL) == (p_scalar != NULL));
|
371
318
|
|
372
319
|
static const unsigned kWindowSize = 7;
|
@@ -377,54 +324,10 @@ static int ecp_nistz256_points_mul(
|
|
377
324
|
P256_POINT_AFFINE a;
|
378
325
|
} t, p;
|
379
326
|
|
380
|
-
int ret = 0;
|
381
|
-
BN_CTX *new_ctx = NULL;
|
382
|
-
int ctx_started = 0;
|
383
|
-
|
384
327
|
if (g_scalar != NULL) {
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
if (new_ctx == NULL) {
|
389
|
-
goto err;
|
390
|
-
}
|
391
|
-
ctx = new_ctx;
|
392
|
-
}
|
393
|
-
BN_CTX_start(ctx);
|
394
|
-
ctx_started = 1;
|
395
|
-
BIGNUM *tmp_scalar = BN_CTX_get(ctx);
|
396
|
-
if (tmp_scalar == NULL) {
|
397
|
-
goto err;
|
398
|
-
}
|
399
|
-
|
400
|
-
if (!BN_nnmod(tmp_scalar, g_scalar, &group->order, ctx)) {
|
401
|
-
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
402
|
-
goto err;
|
403
|
-
}
|
404
|
-
g_scalar = tmp_scalar;
|
405
|
-
}
|
406
|
-
|
407
|
-
uint8_t p_str[33] = {0};
|
408
|
-
int i;
|
409
|
-
for (i = 0; i < g_scalar->top * BN_BYTES; i += BN_BYTES) {
|
410
|
-
BN_ULONG d = g_scalar->d[i / BN_BYTES];
|
411
|
-
|
412
|
-
p_str[i + 0] = d & 0xff;
|
413
|
-
p_str[i + 1] = (d >> 8) & 0xff;
|
414
|
-
p_str[i + 2] = (d >> 16) & 0xff;
|
415
|
-
p_str[i + 3] = (d >>= 24) & 0xff;
|
416
|
-
if (BN_BYTES == 8) {
|
417
|
-
d >>= 8;
|
418
|
-
p_str[i + 4] = d & 0xff;
|
419
|
-
p_str[i + 5] = (d >> 8) & 0xff;
|
420
|
-
p_str[i + 6] = (d >> 16) & 0xff;
|
421
|
-
p_str[i + 7] = (d >> 24) & 0xff;
|
422
|
-
}
|
423
|
-
}
|
424
|
-
|
425
|
-
for (; i < (int) sizeof(p_str); i++) {
|
426
|
-
p_str[i] = 0;
|
427
|
-
}
|
328
|
+
uint8_t p_str[33];
|
329
|
+
OPENSSL_memcpy(p_str, g_scalar->bytes, 32);
|
330
|
+
p_str[32] = 0;
|
428
331
|
|
429
332
|
// First window
|
430
333
|
unsigned wvalue = (p_str[0] << 1) & kMask;
|
@@ -445,7 +348,7 @@ static int ecp_nistz256_points_mul(
|
|
445
348
|
OPENSSL_memset(p.p.Z, 0, sizeof(p.p.Z));
|
446
349
|
copy_conditional(p.p.Z, ONE, is_not_zero(wvalue >> 1));
|
447
350
|
|
448
|
-
for (i = 1; i < 37; i++) {
|
351
|
+
for (int i = 1; i < 37; i++) {
|
449
352
|
unsigned off = (index - 1) / 8;
|
450
353
|
wvalue = p_str[off] | p_str[off + 1] << 8;
|
451
354
|
wvalue = (wvalue >> ((index - 1) % 8)) & kMask;
|
@@ -469,8 +372,8 @@ static int ecp_nistz256_points_mul(
|
|
469
372
|
out = &p.p;
|
470
373
|
}
|
471
374
|
|
472
|
-
if (!ecp_nistz256_windowed_mul(group, out, p_, p_scalar
|
473
|
-
|
375
|
+
if (!ecp_nistz256_windowed_mul(group, out, p_, p_scalar)) {
|
376
|
+
return 0;
|
474
377
|
}
|
475
378
|
|
476
379
|
if (!p_is_infinity) {
|
@@ -485,14 +388,7 @@ static int ecp_nistz256_points_mul(
|
|
485
388
|
return 0;
|
486
389
|
}
|
487
390
|
|
488
|
-
|
489
|
-
|
490
|
-
err:
|
491
|
-
if (ctx_started) {
|
492
|
-
BN_CTX_end(ctx);
|
493
|
-
}
|
494
|
-
BN_CTX_free(new_ctx);
|
495
|
-
return ret;
|
391
|
+
return 1;
|
496
392
|
}
|
497
393
|
|
498
394
|
static int ecp_nistz256_get_affine(const EC_GROUP *group, const EC_POINT *point,
|
@@ -547,7 +443,6 @@ static int ecp_nistz256_get_affine(const EC_GROUP *group, const EC_POINT *point,
|
|
547
443
|
DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_nistz256_method) {
|
548
444
|
out->group_init = ec_GFp_mont_group_init;
|
549
445
|
out->group_finish = ec_GFp_mont_group_finish;
|
550
|
-
out->group_copy = ec_GFp_mont_group_copy;
|
551
446
|
out->group_set_curve = ec_GFp_mont_group_set_curve;
|
552
447
|
out->point_get_affine_coordinates = ecp_nistz256_get_affine;
|
553
448
|
out->mul = ecp_nistz256_points_mul;
|