grpc-flamingo 1.11.0 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +1150 -176
- data/etc/roots.pem +40 -196
- data/include/grpc/grpc.h +49 -8
- data/include/grpc/grpc_security.h +123 -2
- data/include/grpc/grpc_security_constants.h +6 -0
- data/include/grpc/impl/codegen/fork.h +4 -4
- data/include/grpc/impl/codegen/grpc_types.h +26 -5
- data/include/grpc/impl/codegen/log.h +112 -0
- data/include/grpc/impl/codegen/port_platform.h +55 -4
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/support/log.h +2 -80
- data/include/grpc/support/string_util.h +2 -0
- data/include/grpc/support/sync.h +0 -16
- data/src/boringssl/err_data.c +602 -588
- data/src/core/ext/{census → filters/census}/grpc_context.cc +0 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +1234 -1070
- data/src/core/ext/filters/client_channel/client_channel.h +5 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +113 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +71 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +9 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/http_proxy.cc +22 -5
- data/src/core/ext/filters/client_channel/lb_policy.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy.h +30 -10
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +11 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +120 -127
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +36 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +36 -102
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +37 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +25 -22
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +4 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +19 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +19 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +4 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +37 -63
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +306 -239
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +444 -392
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +538 -98
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +8 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -0
- data/src/core/ext/filters/client_channel/method_params.h +4 -0
- data/src/core/ext/filters/client_channel/resolver.h +10 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +36 -19
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +320 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +62 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +49 -294
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +537 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +112 -87
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +17 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +6 -5
- data/src/core/ext/filters/{load_reporting/server_load_reporting_filter.h → client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc} +7 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +29 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +32 -15
- data/src/core/ext/filters/client_channel/retry_throttle.h +4 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +58 -15
- data/src/core/ext/filters/client_channel/subchannel.h +11 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +18 -15
- data/src/core/ext/filters/deadline/deadline_filter.h +5 -5
- data/src/core/ext/filters/http/client/http_client_filter.cc +10 -9
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -5
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +6 -6
- data/src/core/ext/filters/http/server/http_server_filter.cc +123 -131
- data/src/core/ext/filters/http/server/http_server_filter.h +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +9 -8
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +97 -48
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +12 -8
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +14 -12
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +32 -27
- data/src/core/ext/transport/inproc/inproc_transport.cc +87 -49
- data/src/core/lib/channel/channel_args.cc +28 -0
- data/src/core/lib/channel/channel_args.h +4 -0
- data/src/core/lib/channel/channel_stack.cc +22 -29
- data/src/core/lib/channel/channel_stack.h +2 -2
- data/src/core/lib/channel/channel_stack_builder.cc +0 -3
- data/src/core/lib/channel/channel_stack_builder.h +0 -2
- data/src/core/lib/channel/channel_trace.cc +28 -63
- data/src/core/lib/channel/channel_trace.h +13 -17
- data/src/core/lib/channel/channelz.cc +153 -0
- data/src/core/lib/channel/channelz.h +133 -0
- data/src/core/lib/channel/channelz_registry.cc +145 -0
- data/src/core/lib/channel/channelz_registry.h +120 -0
- data/src/core/lib/channel/connected_channel.cc +8 -1
- data/src/core/lib/channel/handshaker.cc +71 -0
- data/src/core/lib/channel/handshaker.h +4 -0
- data/src/core/lib/debug/stats.h +7 -0
- data/src/core/lib/debug/stats_data.cc +5 -0
- data/src/core/lib/debug/stats_data.h +120 -0
- data/src/core/lib/debug/trace.cc +2 -1
- data/src/core/lib/debug/trace.h +12 -1
- data/src/core/lib/gpr/alloc.h +28 -0
- data/src/core/lib/gpr/arena.cc +38 -45
- data/src/core/lib/gpr/log.cc +8 -2
- data/src/core/lib/gpr/log_android.cc +4 -0
- data/src/core/lib/gpr/log_linux.cc +4 -0
- data/src/core/lib/gpr/log_posix.cc +4 -0
- data/src/core/lib/gpr/log_windows.cc +5 -0
- data/src/core/lib/gpr/string.cc +28 -0
- data/src/core/lib/gpr/string.h +10 -0
- data/src/core/lib/gprpp/abstract.h +5 -2
- data/src/core/lib/gprpp/fork.cc +268 -0
- data/src/core/lib/gprpp/fork.h +88 -0
- data/src/core/lib/gprpp/inlined_vector.h +87 -37
- data/src/core/lib/gprpp/memory.h +12 -0
- data/src/core/lib/gprpp/mutex_lock.h +42 -0
- data/src/core/lib/gprpp/orphanable.h +10 -12
- data/src/core/lib/gprpp/ref_counted.h +10 -12
- data/src/core/lib/gprpp/ref_counted_ptr.h +65 -8
- data/src/core/lib/gprpp/thd.h +0 -3
- data/src/core/lib/gprpp/thd_posix.cc +5 -54
- data/src/core/lib/gprpp/thd_windows.cc +0 -7
- data/src/core/lib/http/httpcli_security_connector.cc +1 -3
- data/src/core/lib/iomgr/call_combiner.cc +13 -13
- data/src/core/lib/iomgr/call_combiner.h +84 -1
- data/src/core/lib/iomgr/closure.h +6 -5
- data/src/core/lib/iomgr/combiner.cc +30 -13
- data/src/core/lib/iomgr/combiner.h +1 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/error.cc +12 -0
- data/src/core/lib/iomgr/error.h +5 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +138 -51
- data/src/core/lib/iomgr/ev_epollex_linux.cc +276 -93
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +58 -50
- data/src/core/lib/iomgr/ev_poll_posix.cc +163 -42
- data/src/core/lib/iomgr/ev_posix.cc +88 -24
- data/src/core/lib/iomgr/ev_posix.h +48 -12
- data/src/core/lib/iomgr/exec_ctx.cc +15 -9
- data/src/core/lib/iomgr/exec_ctx.h +48 -20
- data/src/core/lib/iomgr/executor.cc +274 -142
- data/src/core/lib/iomgr/executor.h +82 -16
- data/src/core/lib/iomgr/fork_posix.cc +42 -19
- data/src/core/lib/iomgr/iocp_windows.cc +9 -4
- data/src/core/lib/iomgr/iomgr.cc +2 -0
- data/src/core/lib/iomgr/iomgr.h +5 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +1 -0
- data/src/core/lib/iomgr/lockfree_event.cc +5 -1
- data/src/core/lib/iomgr/polling_entity.cc +11 -2
- data/src/core/lib/iomgr/pollset_custom.cc +2 -2
- data/src/core/lib/iomgr/port.h +51 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +4 -3
- data/src/core/lib/iomgr/resolve_address_windows.cc +3 -2
- data/src/core/lib/iomgr/resource_quota.cc +89 -12
- data/src/core/lib/iomgr/resource_quota.h +16 -0
- data/src/core/lib/iomgr/sockaddr_posix.h +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_mutator.cc +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +1 -1
- data/src/core/lib/iomgr/socket_utils.h +9 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -1
- data/src/core/lib/iomgr/socket_utils_linux.cc +0 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +2 -3
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/socket_utils_uv.cc +4 -0
- data/src/core/lib/iomgr/socket_utils_windows.cc +4 -0
- data/src/core/lib/iomgr/socket_windows.cc +33 -0
- data/src/core/lib/iomgr/socket_windows.h +6 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +5 -5
- data/src/core/lib/iomgr/tcp_client_posix.cc +10 -11
- data/src/core/lib/iomgr/tcp_custom.cc +11 -11
- data/src/core/lib/iomgr/tcp_posix.cc +49 -36
- data/src/core/lib/iomgr/tcp_server_custom.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_posix.cc +16 -36
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +17 -5
- data/src/core/lib/iomgr/tcp_server_windows.cc +1 -0
- data/src/core/lib/iomgr/tcp_uv.cc +3 -0
- data/src/core/lib/iomgr/tcp_windows.cc +18 -2
- data/src/core/lib/iomgr/tcp_windows.h +2 -0
- data/src/core/lib/iomgr/timer.h +4 -3
- data/src/core/lib/iomgr/timer_generic.cc +133 -51
- data/src/core/lib/iomgr/timer_manager.cc +12 -14
- data/src/core/lib/iomgr/timer_uv.cc +3 -0
- data/src/core/lib/iomgr/udp_server.cc +106 -52
- data/src/core/lib/iomgr/udp_server.h +8 -4
- data/src/core/lib/json/json.cc +12 -1
- data/src/core/lib/json/json.h +5 -0
- data/src/core/lib/profiling/basic_timers.cc +1 -0
- data/src/core/lib/security/context/security_context.cc +8 -8
- data/src/core/lib/security/context/security_context.h +6 -2
- data/src/core/lib/security/credentials/alts/alts_credentials.h +0 -20
- data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +3 -2
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +7 -7
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +1 -38
- data/src/core/lib/security/credentials/credentials.h +1 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +89 -115
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +16 -0
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -0
- data/src/core/lib/security/credentials/local/local_credentials.cc +77 -0
- data/src/core/lib/security/credentials/local/local_credentials.h +40 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +11 -7
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +17 -3
- data/src/core/lib/security/security_connector/alts_security_connector.cc +2 -1
- data/src/core/lib/security/security_connector/load_system_roots.h +29 -0
- data/src/core/lib/{gpr/fork.h → security/security_connector/load_system_roots_fallback.cc} +10 -13
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +165 -0
- data/src/core/lib/security/security_connector/load_system_roots_linux.h +44 -0
- data/src/core/lib/security/security_connector/local_security_connector.cc +245 -0
- data/src/core/lib/security/security_connector/local_security_connector.h +58 -0
- data/src/core/lib/security/security_connector/security_connector.cc +79 -32
- data/src/core/lib/security/security_connector/security_connector.h +5 -3
- data/src/core/lib/security/transport/client_auth_filter.cc +5 -5
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
- data/src/core/lib/security/transport/security_handshaker.cc +7 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +4 -7
- data/src/core/lib/security/util/json_util.cc +4 -0
- data/src/core/lib/slice/slice.cc +6 -2
- data/src/core/lib/slice/slice_buffer.cc +27 -7
- data/src/core/lib/slice/slice_hash_table.h +4 -0
- data/src/core/lib/slice/slice_weak_hash_table.h +4 -0
- data/src/core/lib/surface/call.cc +119 -58
- data/src/core/lib/surface/call.h +7 -0
- data/src/core/lib/surface/channel.cc +50 -18
- data/src/core/lib/surface/channel.h +4 -0
- data/src/core/lib/surface/completion_queue.cc +153 -18
- data/src/core/lib/surface/completion_queue.h +20 -2
- data/src/core/lib/surface/completion_queue_factory.cc +13 -4
- data/src/core/lib/surface/init.cc +7 -8
- data/src/core/lib/surface/init.h +0 -1
- data/src/core/lib/surface/server.cc +16 -0
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.cc +3 -3
- data/src/core/lib/transport/bdp_estimator.h +2 -2
- data/src/core/lib/transport/byte_stream.cc +1 -1
- data/src/core/lib/transport/connectivity_state.cc +6 -7
- data/src/core/lib/transport/service_config.cc +2 -2
- data/src/core/lib/transport/service_config.h +3 -3
- data/src/core/lib/transport/transport.cc +22 -10
- data/src/core/lib/transport/transport.h +18 -18
- data/src/core/lib/transport/transport_op_string.cc +1 -8
- data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +2 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +19 -7
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +10 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +38 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +3 -0
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +1 -2
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +1 -2
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +2 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +47 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +12 -11
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +7 -2
- data/src/core/tsi/fake_transport_security.cc +1 -0
- data/src/core/tsi/grpc_shadow_boringssl.h +3006 -0
- data/src/core/tsi/local_transport_security.cc +209 -0
- data/src/core/tsi/local_transport_security.h +51 -0
- data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +5 -5
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +6 -0
- data/src/core/tsi/ssl_transport_security.cc +245 -116
- data/src/core/tsi/ssl_types.h +2 -0
- data/src/core/tsi/transport_security.cc +14 -0
- data/src/core/tsi/transport_security.h +2 -0
- data/src/core/tsi/transport_security_interface.h +11 -1
- data/src/ruby/bin/math_client.rb +17 -9
- data/src/ruby/ext/grpc/extconf.rb +1 -26
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +42 -16
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +65 -26
- data/src/ruby/lib/grpc/generic/active_call.rb +19 -23
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +7 -1
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +4 -1
- data/src/ruby/spec/call_credentials_spec.rb +1 -1
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +1 -1
- data/src/ruby/spec/client_auth_spec.rb +1 -12
- data/src/ruby/spec/client_server_spec.rb +1 -1
- data/src/ruby/spec/compression_options_spec.rb +1 -1
- data/src/ruby/spec/error_sanity_spec.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +16 -4
- data/src/ruby/spec/generic/rpc_desc_spec.rb +1 -1
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +1 -1
- data/src/ruby/spec/generic/service_spec.rb +1 -1
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +1 -12
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +1 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
- data/src/ruby/spec/server_credentials_spec.rb +1 -1
- data/src/ruby/spec/server_spec.rb +1 -1
- data/src/ruby/spec/spec_helper.rb +1 -0
- data/src/ruby/spec/support/services.rb +1 -1
- data/src/ruby/spec/time_consts_spec.rb +1 -1
- data/third_party/address_sorting/address_sorting.c +17 -11
- data/third_party/address_sorting/address_sorting_windows.c +43 -3
- data/third_party/address_sorting/include/address_sorting/address_sorting.h +3 -0
- data/third_party/boringssl/crypto/asn1/a_int.c +33 -28
- data/third_party/boringssl/crypto/asn1/a_mbstr.c +24 -22
- data/third_party/boringssl/crypto/asn1/a_utf8.c +13 -11
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +3 -0
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +40 -19
- data/third_party/boringssl/crypto/bio/fd.c +1 -0
- data/third_party/boringssl/crypto/bio/file.c +2 -0
- data/third_party/boringssl/crypto/bn_extra/convert.c +6 -5
- data/third_party/boringssl/crypto/bytestring/ber.c +1 -4
- data/third_party/boringssl/crypto/bytestring/cbb.c +116 -16
- data/third_party/boringssl/crypto/bytestring/cbs.c +151 -20
- data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +203 -0
- data/third_party/boringssl/crypto/cipher_extra/e_rc2.c +2 -0
- data/third_party/boringssl/crypto/cipher_extra/e_tls.c +1 -2
- data/third_party/boringssl/crypto/cpu-aarch64-fuchsia.c +55 -0
- data/third_party/boringssl/crypto/cpu-aarch64-linux.c +2 -1
- data/third_party/boringssl/crypto/dsa/dsa.c +16 -54
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +9 -10
- data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/bcm.c +11 -542
- data/third_party/boringssl/crypto/fipsmodule/bn/add.c +57 -112
- data/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +128 -70
- data/third_party/boringssl/crypto/fipsmodule/bn/bytes.c +32 -71
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +64 -118
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +284 -122
- data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +31 -65
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +274 -218
- data/third_party/boringssl/crypto/fipsmodule/bn/generic.c +2 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +187 -27
- data/third_party/boringssl/crypto/fipsmodule/bn/jacobi.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +124 -81
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +8 -30
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +321 -347
- data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +326 -66
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +77 -25
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +199 -222
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +27 -47
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +155 -96
- data/third_party/boringssl/crypto/fipsmodule/bn/sqrt.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +10 -10
- data/third_party/boringssl/crypto/fipsmodule/des/internal.h +2 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +78 -47
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +99 -163
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +3 -10
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +44 -23
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +59 -90
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +38 -65
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +5378 -5418
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +17 -26
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +15 -11
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +45 -51
- data/third_party/boringssl/crypto/fipsmodule/ec/{util-64.c → util.c} +0 -5
- data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +144 -264
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +78 -62
- data/third_party/boringssl/crypto/fipsmodule/modes/ccm.c +256 -0
- data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +36 -32
- data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +9 -7
- data/third_party/boringssl/crypto/fipsmodule/rsa/blinding.c +16 -40
- data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +1 -6
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +57 -39
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +309 -142
- data/third_party/boringssl/crypto/fipsmodule/self_check/self_check.c +581 -0
- data/third_party/boringssl/crypto/fipsmodule/tls/internal.h +39 -0
- data/third_party/boringssl/crypto/fipsmodule/tls/kdf.c +165 -0
- data/third_party/boringssl/crypto/internal.h +65 -2
- data/third_party/boringssl/crypto/mem.c +0 -2
- data/third_party/boringssl/crypto/obj/obj.c +6 -73
- data/third_party/boringssl/crypto/thread_pthread.c +35 -5
- data/third_party/boringssl/crypto/x509/a_strex.c +11 -11
- data/third_party/boringssl/crypto/x509/vpm_int.h +1 -0
- data/third_party/boringssl/crypto/x509/x509_vfy.c +4 -0
- data/third_party/boringssl/crypto/x509/x509_vpm.c +44 -22
- data/third_party/boringssl/crypto/x509/x_name.c +13 -0
- data/third_party/boringssl/include/openssl/aead.h +10 -0
- data/third_party/boringssl/include/openssl/asn1.h +2 -3
- data/third_party/boringssl/include/openssl/base.h +5 -14
- data/third_party/boringssl/include/openssl/bio.h +1 -1
- data/third_party/boringssl/include/openssl/bn.h +62 -18
- data/third_party/boringssl/include/openssl/bytestring.h +53 -28
- data/third_party/boringssl/include/openssl/crypto.h +4 -0
- data/third_party/boringssl/include/openssl/ec.h +10 -4
- data/third_party/boringssl/include/openssl/ec_key.h +7 -6
- data/third_party/boringssl/include/openssl/err.h +9 -9
- data/third_party/boringssl/include/openssl/evp.h +1 -1
- data/third_party/boringssl/include/openssl/rsa.h +35 -10
- data/third_party/boringssl/include/openssl/ssl.h +167 -19
- data/third_party/boringssl/include/openssl/ssl3.h +0 -1
- data/third_party/boringssl/include/openssl/stack.h +1 -1
- data/third_party/boringssl/include/openssl/tls1.h +10 -2
- data/third_party/boringssl/include/openssl/x509.h +4 -0
- data/third_party/boringssl/include/openssl/x509v3.h +1 -0
- data/third_party/boringssl/ssl/d1_both.cc +16 -2
- data/third_party/boringssl/ssl/dtls_method.cc +1 -1
- data/third_party/boringssl/ssl/handoff.cc +285 -0
- data/third_party/boringssl/ssl/handshake.cc +26 -12
- data/third_party/boringssl/ssl/handshake_client.cc +101 -95
- data/third_party/boringssl/ssl/handshake_server.cc +14 -2
- data/third_party/boringssl/ssl/internal.h +132 -79
- data/third_party/boringssl/ssl/s3_both.cc +2 -2
- data/third_party/boringssl/ssl/s3_lib.cc +3 -1
- data/third_party/boringssl/ssl/s3_pkt.cc +0 -18
- data/third_party/boringssl/ssl/ssl_aead_ctx.cc +1 -4
- data/third_party/boringssl/ssl/ssl_asn1.cc +47 -43
- data/third_party/boringssl/ssl/ssl_cipher.cc +12 -8
- data/third_party/boringssl/ssl/ssl_key_share.cc +3 -1
- data/third_party/boringssl/ssl/ssl_lib.cc +83 -14
- data/third_party/boringssl/ssl/ssl_privkey.cc +6 -0
- data/third_party/boringssl/ssl/ssl_stat.cc +6 -6
- data/third_party/boringssl/ssl/ssl_versions.cc +12 -85
- data/third_party/boringssl/ssl/ssl_x509.cc +59 -61
- data/third_party/boringssl/ssl/t1_enc.cc +73 -124
- data/third_party/boringssl/ssl/t1_lib.cc +367 -41
- data/third_party/boringssl/ssl/tls13_both.cc +8 -0
- data/third_party/boringssl/ssl/tls13_client.cc +98 -184
- data/third_party/boringssl/ssl/tls13_enc.cc +88 -158
- data/third_party/boringssl/ssl/tls13_server.cc +91 -137
- data/third_party/boringssl/ssl/tls_method.cc +0 -17
- data/third_party/boringssl/ssl/tls_record.cc +1 -10
- data/third_party/boringssl/third_party/fiat/curve25519.c +921 -2753
- data/third_party/boringssl/third_party/fiat/curve25519_tables.h +7880 -0
- data/third_party/boringssl/third_party/fiat/internal.h +32 -20
- data/third_party/boringssl/third_party/fiat/p256.c +1824 -0
- metadata +86 -71
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +0 -253
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +0 -222
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +0 -71
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +0 -61
- data/src/core/lib/channel/channel_trace_registry.cc +0 -80
- data/src/core/lib/channel/channel_trace_registry.h +0 -43
- data/src/core/lib/gpr/fork.cc +0 -78
- data/src/core/tsi/transport_security_adapter.cc +0 -235
- data/src/core/tsi/transport_security_adapter.h +0 -41
- data/src/ruby/bin/apis/google/protobuf/empty.rb +0 -29
- data/src/ruby/bin/apis/pubsub_demo.rb +0 -241
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +0 -159
- data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +0 -88
- data/src/ruby/pb/test/client.rb +0 -764
- data/src/ruby/pb/test/server.rb +0 -252
- data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +0 -54
- data/src/ruby/spec/pb/package_with_underscore/data.proto +0 -23
- data/src/ruby/spec/pb/package_with_underscore/service.proto +0 -23
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +0 -247
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-64.c +0 -1674
@@ -93,7 +93,6 @@ void ec_GFp_mont_group_finish(EC_GROUP *group) {
|
|
93
93
|
int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p,
|
94
94
|
const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) {
|
95
95
|
BN_CTX *new_ctx = NULL;
|
96
|
-
BN_MONT_CTX *mont = NULL;
|
97
96
|
int ret = 0;
|
98
97
|
|
99
98
|
BN_MONT_CTX_free(group->mont);
|
@@ -106,18 +105,12 @@ int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p,
|
|
106
105
|
}
|
107
106
|
}
|
108
107
|
|
109
|
-
mont =
|
110
|
-
if (mont == NULL) {
|
111
|
-
goto err;
|
112
|
-
}
|
113
|
-
if (!BN_MONT_CTX_set(mont, p, ctx)) {
|
108
|
+
group->mont = BN_MONT_CTX_new_for_modulus(p, ctx);
|
109
|
+
if (group->mont == NULL) {
|
114
110
|
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
115
111
|
goto err;
|
116
112
|
}
|
117
113
|
|
118
|
-
group->mont = mont;
|
119
|
-
mont = NULL;
|
120
|
-
|
121
114
|
ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
|
122
115
|
|
123
116
|
if (!ret) {
|
@@ -127,7 +120,6 @@ int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p,
|
|
127
120
|
|
128
121
|
err:
|
129
122
|
BN_CTX_free(new_ctx);
|
130
|
-
BN_MONT_CTX_free(mont);
|
131
123
|
return ret;
|
132
124
|
}
|
133
125
|
|
@@ -270,6 +262,7 @@ DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_mont_method) {
|
|
270
262
|
out->group_set_curve = ec_GFp_mont_group_set_curve;
|
271
263
|
out->point_get_affine_coordinates = ec_GFp_mont_point_get_affine_coordinates;
|
272
264
|
out->mul = ec_wNAF_mul /* XXX: Not constant time. */;
|
265
|
+
out->mul_public = ec_wNAF_mul;
|
273
266
|
out->field_mul = ec_GFp_mont_field_mul;
|
274
267
|
out->field_sqr = ec_GFp_mont_field_sqr;
|
275
268
|
out->field_encode = ec_GFp_mont_field_encode;
|
@@ -91,10 +91,9 @@ extern "C" {
|
|
91
91
|
OPENSSL_COMPILE_ASSERT(EC_MAX_SCALAR_WORDS <= BN_SMALL_MAX_WORDS,
|
92
92
|
bn_small_functions_applicable);
|
93
93
|
|
94
|
-
// An EC_SCALAR is
|
95
|
-
// |order->
|
96
|
-
// must not be mixed between groups.
|
97
|
-
// reduced modulo the |order|.
|
94
|
+
// An EC_SCALAR is an integer fully reduced modulo the order. Only the first
|
95
|
+
// |order->width| words are used. An |EC_SCALAR| is specific to an |EC_GROUP|
|
96
|
+
// and must not be mixed between groups.
|
98
97
|
typedef union {
|
99
98
|
// bytes is the representation of the scalar in little-endian order.
|
100
99
|
uint8_t bytes[EC_MAX_SCALAR_BYTES];
|
@@ -116,6 +115,12 @@ struct ec_method_st {
|
|
116
115
|
// non-null.
|
117
116
|
int (*mul)(const EC_GROUP *group, EC_POINT *r, const EC_SCALAR *g_scalar,
|
118
117
|
const EC_POINT *p, const EC_SCALAR *p_scalar, BN_CTX *ctx);
|
118
|
+
// mul_public performs the same computation as mul. It further assumes that
|
119
|
+
// the inputs are public so there is no concern about leaking their values
|
120
|
+
// through timing.
|
121
|
+
int (*mul_public)(const EC_GROUP *group, EC_POINT *r,
|
122
|
+
const EC_SCALAR *g_scalar, const EC_POINT *p,
|
123
|
+
const EC_SCALAR *p_scalar, BN_CTX *ctx);
|
119
124
|
|
120
125
|
// 'field_mul' and 'field_sqr' can be used by 'add' and 'dbl' so that the
|
121
126
|
// same implementations of point operations can be used with different
|
@@ -173,12 +178,15 @@ struct ec_point_st {
|
|
173
178
|
|
174
179
|
EC_GROUP *ec_group_new(const EC_METHOD *meth);
|
175
180
|
|
176
|
-
// ec_bignum_to_scalar converts |in| to an |EC_SCALAR| and writes it to
|
177
|
-
//
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
181
|
+
// ec_bignum_to_scalar converts |in| to an |EC_SCALAR| and writes it to
|
182
|
+
// |*out|. It returns one on success and zero if |in| is out of range.
|
183
|
+
OPENSSL_EXPORT int ec_bignum_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
|
184
|
+
const BIGNUM *in);
|
185
|
+
|
186
|
+
// ec_bignum_to_scalar_unchecked behaves like |ec_bignum_to_scalar| but does not
|
187
|
+
// check |in| is fully reduced.
|
188
|
+
int ec_bignum_to_scalar_unchecked(const EC_GROUP *group, EC_SCALAR *out,
|
189
|
+
const BIGNUM *in);
|
182
190
|
|
183
191
|
// ec_random_nonzero_scalar sets |out| to a uniformly selected random value from
|
184
192
|
// 1 to |group->order| - 1. It returns one on success and zero on error.
|
@@ -193,6 +201,24 @@ int ec_point_mul_scalar(const EC_GROUP *group, EC_POINT *r,
|
|
193
201
|
const EC_SCALAR *g_scalar, const EC_POINT *p,
|
194
202
|
const EC_SCALAR *p_scalar, BN_CTX *ctx);
|
195
203
|
|
204
|
+
// ec_point_mul_scalar_public performs the same computation as
|
205
|
+
// ec_point_mul_scalar. It further assumes that the inputs are public so
|
206
|
+
// there is no concern about leaking their values through timing.
|
207
|
+
OPENSSL_EXPORT int ec_point_mul_scalar_public(
|
208
|
+
const EC_GROUP *group, EC_POINT *r, const EC_SCALAR *g_scalar,
|
209
|
+
const EC_POINT *p, const EC_SCALAR *p_scalar, BN_CTX *ctx);
|
210
|
+
|
211
|
+
// ec_compute_wNAF writes the modified width-(w+1) Non-Adjacent Form (wNAF) of
|
212
|
+
// |scalar| to |out| and returns one on success or zero on internal error. |out|
|
213
|
+
// must have room for |bits| + 1 elements, each of which will be either zero or
|
214
|
+
// odd with an absolute value less than 2^w satisfying
|
215
|
+
// scalar = \sum_j out[j]*2^j
|
216
|
+
// where at most one of any w+1 consecutive digits is non-zero
|
217
|
+
// with the exception that the most significant digit may be only
|
218
|
+
// w-1 zeros away from that next non-zero digit.
|
219
|
+
int ec_compute_wNAF(const EC_GROUP *group, int8_t *out, const EC_SCALAR *scalar,
|
220
|
+
size_t bits, int w);
|
221
|
+
|
196
222
|
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const EC_SCALAR *g_scalar,
|
197
223
|
const EC_POINT *p, const EC_SCALAR *p_scalar, BN_CTX *ctx);
|
198
224
|
|
@@ -208,16 +234,9 @@ int ec_GFp_simple_point_init(EC_POINT *);
|
|
208
234
|
void ec_GFp_simple_point_finish(EC_POINT *);
|
209
235
|
int ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *);
|
210
236
|
int ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *);
|
211
|
-
int ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *,
|
212
|
-
const BIGNUM *x,
|
213
|
-
const BIGNUM *y,
|
214
|
-
const BIGNUM *z, BN_CTX *);
|
215
237
|
int ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *, EC_POINT *,
|
216
238
|
const BIGNUM *x, const BIGNUM *y,
|
217
239
|
BN_CTX *);
|
218
|
-
int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *, EC_POINT *,
|
219
|
-
const BIGNUM *x, int y_bit,
|
220
|
-
BN_CTX *);
|
221
240
|
int ec_GFp_simple_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a,
|
222
241
|
const EC_POINT *b, BN_CTX *);
|
223
242
|
int ec_GFp_simple_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a,
|
@@ -249,11 +268,6 @@ int ec_GFp_mont_field_encode(const EC_GROUP *, BIGNUM *r, const BIGNUM *a,
|
|
249
268
|
int ec_GFp_mont_field_decode(const EC_GROUP *, BIGNUM *r, const BIGNUM *a,
|
250
269
|
BN_CTX *);
|
251
270
|
|
252
|
-
int ec_point_set_Jprojective_coordinates_GFp(const EC_GROUP *group,
|
253
|
-
EC_POINT *point, const BIGNUM *x,
|
254
|
-
const BIGNUM *y, const BIGNUM *z,
|
255
|
-
BN_CTX *ctx);
|
256
|
-
|
257
271
|
void ec_GFp_nistp_recode_scalar_bits(uint8_t *sign, uint8_t *digit, uint8_t in);
|
258
272
|
|
259
273
|
const EC_METHOD *EC_GFp_nistp224_method(void);
|
@@ -263,11 +277,18 @@ const EC_METHOD *EC_GFp_nistp256_method(void);
|
|
263
277
|
// x86-64 optimized P256. See http://eprint.iacr.org/2013/816.
|
264
278
|
const EC_METHOD *EC_GFp_nistz256_method(void);
|
265
279
|
|
280
|
+
// An EC_WRAPPED_SCALAR is an |EC_SCALAR| with a parallel |BIGNUM|
|
281
|
+
// representation. It exists to support the |EC_KEY_get0_private_key| API.
|
282
|
+
typedef struct {
|
283
|
+
BIGNUM bignum;
|
284
|
+
EC_SCALAR scalar;
|
285
|
+
} EC_WRAPPED_SCALAR;
|
286
|
+
|
266
287
|
struct ec_key_st {
|
267
288
|
EC_GROUP *group;
|
268
289
|
|
269
290
|
EC_POINT *pub_key;
|
270
|
-
|
291
|
+
EC_WRAPPED_SCALAR *priv_key;
|
271
292
|
|
272
293
|
// fixed_k may contain a specific value of 'k', to be used in ECDSA signing.
|
273
294
|
// This is only for the FIPS power-on tests.
|
@@ -77,11 +77,9 @@ static size_t ec_GFp_simple_point2oct(const EC_GROUP *group,
|
|
77
77
|
const EC_POINT *point,
|
78
78
|
point_conversion_form_t form,
|
79
79
|
uint8_t *buf, size_t len, BN_CTX *ctx) {
|
80
|
-
size_t ret;
|
80
|
+
size_t ret = 0;
|
81
81
|
BN_CTX *new_ctx = NULL;
|
82
82
|
int used_ctx = 0;
|
83
|
-
BIGNUM *x, *y;
|
84
|
-
size_t field_len, i;
|
85
83
|
|
86
84
|
if ((form != POINT_CONVERSION_COMPRESSED) &&
|
87
85
|
(form != POINT_CONVERSION_UNCOMPRESSED)) {
|
@@ -94,14 +92,16 @@ static size_t ec_GFp_simple_point2oct(const EC_GROUP *group,
|
|
94
92
|
goto err;
|
95
93
|
}
|
96
94
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
95
|
+
const size_t field_len = BN_num_bytes(&group->field);
|
96
|
+
size_t output_len = 1 /* type byte */ + field_len;
|
97
|
+
if (form == POINT_CONVERSION_UNCOMPRESSED) {
|
98
|
+
// Uncompressed points have a second coordinate.
|
99
|
+
output_len += field_len;
|
100
|
+
}
|
101
101
|
|
102
102
|
// if 'buf' is NULL, just return required length
|
103
103
|
if (buf != NULL) {
|
104
|
-
if (len <
|
104
|
+
if (len < output_len) {
|
105
105
|
OPENSSL_PUT_ERROR(EC, EC_R_BUFFER_TOO_SMALL);
|
106
106
|
goto err;
|
107
107
|
}
|
@@ -115,8 +115,8 @@ static size_t ec_GFp_simple_point2oct(const EC_GROUP *group,
|
|
115
115
|
|
116
116
|
BN_CTX_start(ctx);
|
117
117
|
used_ctx = 1;
|
118
|
-
x = BN_CTX_get(ctx);
|
119
|
-
y = BN_CTX_get(ctx);
|
118
|
+
BIGNUM *x = BN_CTX_get(ctx);
|
119
|
+
BIGNUM *y = BN_CTX_get(ctx);
|
120
120
|
if (y == NULL) {
|
121
121
|
goto err;
|
122
122
|
}
|
@@ -131,7 +131,7 @@ static size_t ec_GFp_simple_point2oct(const EC_GROUP *group,
|
|
131
131
|
} else {
|
132
132
|
buf[0] = form;
|
133
133
|
}
|
134
|
-
i = 1;
|
134
|
+
size_t i = 1;
|
135
135
|
|
136
136
|
if (!BN_bn2bin_padded(buf + i, field_len, x)) {
|
137
137
|
OPENSSL_PUT_ERROR(EC, ERR_R_INTERNAL_ERROR);
|
@@ -147,70 +147,66 @@ static size_t ec_GFp_simple_point2oct(const EC_GROUP *group,
|
|
147
147
|
i += field_len;
|
148
148
|
}
|
149
149
|
|
150
|
-
if (i !=
|
150
|
+
if (i != output_len) {
|
151
151
|
OPENSSL_PUT_ERROR(EC, ERR_R_INTERNAL_ERROR);
|
152
152
|
goto err;
|
153
153
|
}
|
154
154
|
}
|
155
155
|
|
156
|
-
|
157
|
-
BN_CTX_end(ctx);
|
158
|
-
}
|
159
|
-
BN_CTX_free(new_ctx);
|
160
|
-
return ret;
|
156
|
+
ret = output_len;
|
161
157
|
|
162
158
|
err:
|
163
159
|
if (used_ctx) {
|
164
160
|
BN_CTX_end(ctx);
|
165
161
|
}
|
166
162
|
BN_CTX_free(new_ctx);
|
167
|
-
return
|
163
|
+
return ret;
|
168
164
|
}
|
169
165
|
|
170
|
-
|
171
166
|
static int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
|
172
167
|
const uint8_t *buf, size_t len,
|
173
168
|
BN_CTX *ctx) {
|
174
|
-
point_conversion_form_t form;
|
175
|
-
int y_bit;
|
176
169
|
BN_CTX *new_ctx = NULL;
|
177
|
-
|
178
|
-
size_t field_len, enc_len;
|
179
|
-
int ret = 0;
|
170
|
+
int ret = 0, used_ctx = 0;
|
180
171
|
|
181
172
|
if (len == 0) {
|
182
173
|
OPENSSL_PUT_ERROR(EC, EC_R_BUFFER_TOO_SMALL);
|
183
|
-
|
174
|
+
goto err;
|
184
175
|
}
|
185
|
-
|
186
|
-
|
176
|
+
|
177
|
+
point_conversion_form_t form = buf[0];
|
178
|
+
const int y_bit = form & 1;
|
187
179
|
form = form & ~1U;
|
188
180
|
if ((form != POINT_CONVERSION_COMPRESSED &&
|
189
181
|
form != POINT_CONVERSION_UNCOMPRESSED) ||
|
190
182
|
(form == POINT_CONVERSION_UNCOMPRESSED && y_bit)) {
|
191
183
|
OPENSSL_PUT_ERROR(EC, EC_R_INVALID_ENCODING);
|
192
|
-
|
184
|
+
goto err;
|
193
185
|
}
|
194
186
|
|
195
|
-
field_len = BN_num_bytes(&group->field);
|
196
|
-
enc_len =
|
197
|
-
|
187
|
+
const size_t field_len = BN_num_bytes(&group->field);
|
188
|
+
size_t enc_len = 1 /* type byte */ + field_len;
|
189
|
+
if (form == POINT_CONVERSION_UNCOMPRESSED) {
|
190
|
+
// Uncompressed points have a second coordinate.
|
191
|
+
enc_len += field_len;
|
192
|
+
}
|
198
193
|
|
199
194
|
if (len != enc_len) {
|
200
195
|
OPENSSL_PUT_ERROR(EC, EC_R_INVALID_ENCODING);
|
201
|
-
|
196
|
+
goto err;
|
202
197
|
}
|
203
198
|
|
204
199
|
if (ctx == NULL) {
|
205
200
|
ctx = new_ctx = BN_CTX_new();
|
206
201
|
if (ctx == NULL) {
|
207
|
-
|
202
|
+
goto err;
|
208
203
|
}
|
209
204
|
}
|
210
205
|
|
211
206
|
BN_CTX_start(ctx);
|
212
|
-
|
213
|
-
|
207
|
+
used_ctx = 1;
|
208
|
+
BIGNUM *x = BN_CTX_get(ctx);
|
209
|
+
BIGNUM *y = BN_CTX_get(ctx);
|
214
210
|
if (x == NULL || y == NULL) {
|
215
211
|
goto err;
|
216
212
|
}
|
@@ -244,7 +240,9 @@ static int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
|
|
244
240
|
ret = 1;
|
245
241
|
|
246
242
|
err:
|
247
|
-
|
243
|
+
if (used_ctx) {
|
244
|
+
BN_CTX_end(ctx);
|
245
|
+
}
|
248
246
|
BN_CTX_free(new_ctx);
|
249
247
|
return ret;
|
250
248
|
}
|
@@ -268,16 +266,20 @@ size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
|
|
268
266
|
return ec_GFp_simple_point2oct(group, point, form, buf, len, ctx);
|
269
267
|
}
|
270
268
|
|
271
|
-
int
|
272
|
-
|
273
|
-
|
269
|
+
int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
|
270
|
+
EC_POINT *point, const BIGNUM *x,
|
271
|
+
int y_bit, BN_CTX *ctx) {
|
272
|
+
if (EC_GROUP_cmp(group, point->group, NULL) != 0) {
|
273
|
+
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
|
274
|
+
return 0;
|
275
|
+
}
|
276
|
+
|
274
277
|
if (BN_is_negative(x) || BN_cmp(x, &group->field) >= 0) {
|
275
278
|
OPENSSL_PUT_ERROR(EC, EC_R_INVALID_COMPRESSED_POINT);
|
276
279
|
return 0;
|
277
280
|
}
|
278
281
|
|
279
282
|
BN_CTX *new_ctx = NULL;
|
280
|
-
BIGNUM *tmp1, *tmp2, *y;
|
281
283
|
int ret = 0;
|
282
284
|
|
283
285
|
ERR_clear_error();
|
@@ -292,10 +294,13 @@ int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
|
|
292
294
|
y_bit = (y_bit != 0);
|
293
295
|
|
294
296
|
BN_CTX_start(ctx);
|
295
|
-
tmp1 = BN_CTX_get(ctx);
|
296
|
-
tmp2 = BN_CTX_get(ctx);
|
297
|
-
|
298
|
-
|
297
|
+
BIGNUM *tmp1 = BN_CTX_get(ctx);
|
298
|
+
BIGNUM *tmp2 = BN_CTX_get(ctx);
|
299
|
+
BIGNUM *a = BN_CTX_get(ctx);
|
300
|
+
BIGNUM *b = BN_CTX_get(ctx);
|
301
|
+
BIGNUM *y = BN_CTX_get(ctx);
|
302
|
+
if (y == NULL ||
|
303
|
+
!EC_GROUP_get_curve_GFp(group, NULL, a, b, ctx)) {
|
299
304
|
goto err;
|
300
305
|
}
|
301
306
|
|
@@ -304,54 +309,28 @@ int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
|
|
304
309
|
// so y is one of the square roots of x^3 + a*x + b.
|
305
310
|
|
306
311
|
// tmp1 := x^3
|
307
|
-
if (group->
|
308
|
-
|
309
|
-
|
310
|
-
!group->meth->field_mul(group, tmp1, tmp2, x, ctx)) {
|
311
|
-
goto err;
|
312
|
-
}
|
313
|
-
} else {
|
314
|
-
if (!BN_mod_sqr(tmp2, x, &group->field, ctx) ||
|
315
|
-
!BN_mod_mul(tmp1, tmp2, x, &group->field, ctx)) {
|
316
|
-
goto err;
|
317
|
-
}
|
312
|
+
if (!BN_mod_sqr(tmp2, x, &group->field, ctx) ||
|
313
|
+
!BN_mod_mul(tmp1, tmp2, x, &group->field, ctx)) {
|
314
|
+
goto err;
|
318
315
|
}
|
319
316
|
|
320
317
|
// tmp1 := tmp1 + a*x
|
321
318
|
if (group->a_is_minus3) {
|
322
|
-
if (!
|
323
|
-
!
|
324
|
-
!
|
319
|
+
if (!bn_mod_lshift1_consttime(tmp2, x, &group->field, ctx) ||
|
320
|
+
!bn_mod_add_consttime(tmp2, tmp2, x, &group->field, ctx) ||
|
321
|
+
!bn_mod_sub_consttime(tmp1, tmp1, tmp2, &group->field, ctx)) {
|
325
322
|
goto err;
|
326
323
|
}
|
327
324
|
} else {
|
328
|
-
if (group->
|
329
|
-
|
330
|
-
!BN_mod_mul(tmp2, tmp2, x, &group->field, ctx)) {
|
331
|
-
goto err;
|
332
|
-
}
|
333
|
-
} else {
|
334
|
-
// field_mul works on standard representation
|
335
|
-
if (!group->meth->field_mul(group, tmp2, &group->a, x, ctx)) {
|
336
|
-
goto err;
|
337
|
-
}
|
338
|
-
}
|
339
|
-
|
340
|
-
if (!BN_mod_add_quick(tmp1, tmp1, tmp2, &group->field)) {
|
325
|
+
if (!BN_mod_mul(tmp2, a, x, &group->field, ctx) ||
|
326
|
+
!bn_mod_add_consttime(tmp1, tmp1, tmp2, &group->field, ctx)) {
|
341
327
|
goto err;
|
342
328
|
}
|
343
329
|
}
|
344
330
|
|
345
331
|
// tmp1 := tmp1 + b
|
346
|
-
if (group->
|
347
|
-
|
348
|
-
!BN_mod_add_quick(tmp1, tmp1, tmp2, &group->field)) {
|
349
|
-
goto err;
|
350
|
-
}
|
351
|
-
} else {
|
352
|
-
if (!BN_mod_add_quick(tmp1, tmp1, &group->b, &group->field)) {
|
353
|
-
goto err;
|
354
|
-
}
|
332
|
+
if (!bn_mod_add_consttime(tmp1, tmp1, b, &group->field, ctx)) {
|
333
|
+
goto err;
|
355
334
|
}
|
356
335
|
|
357
336
|
if (!BN_mod_sqrt(y, tmp1, &group->field, ctx)) {
|
@@ -392,13 +371,3 @@ err:
|
|
392
371
|
BN_CTX_free(new_ctx);
|
393
372
|
return ret;
|
394
373
|
}
|
395
|
-
|
396
|
-
int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
|
397
|
-
EC_POINT *point, const BIGNUM *x,
|
398
|
-
int y_bit, BN_CTX *ctx) {
|
399
|
-
if (EC_GROUP_cmp(group, point->group, NULL) != 0) {
|
400
|
-
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
|
401
|
-
return 0;
|
402
|
-
}
|
403
|
-
return ec_GFp_simple_set_compressed_coordinates(group, point, x, y_bit, ctx);
|
404
|
-
}
|
@@ -19,9 +19,6 @@
|
|
19
19
|
|
20
20
|
#include <openssl/base.h>
|
21
21
|
|
22
|
-
#if defined(OPENSSL_64_BIT) && !defined(OPENSSL_WINDOWS) && \
|
23
|
-
!defined(OPENSSL_SMALL)
|
24
|
-
|
25
22
|
#include <openssl/bn.h>
|
26
23
|
#include <openssl/ec.h>
|
27
24
|
#include <openssl/err.h>
|
@@ -34,6 +31,8 @@
|
|
34
31
|
#include "../../internal.h"
|
35
32
|
|
36
33
|
|
34
|
+
#if defined(BORINGSSL_HAS_UINT128) && !defined(OPENSSL_SMALL)
|
35
|
+
|
37
36
|
// Field elements are represented as a_0 + 2^56*a_1 + 2^112*a_2 + 2^168*a_3
|
38
37
|
// using 64-bit coefficients called 'limbs', and sometimes (for multiplication
|
39
38
|
// results) as b_0 + 2^56*b_1 + 2^112*b_2 + 2^168*b_3 + 2^224*b_4 + 2^280*b_5 +
|
@@ -258,23 +257,6 @@ static void p224_felem_sum(p224_felem out, const p224_felem in) {
|
|
258
257
|
out[3] += in[3];
|
259
258
|
}
|
260
259
|
|
261
|
-
// Get negative value: out = -in
|
262
|
-
// Assumes in[i] < 2^57
|
263
|
-
static void p224_felem_neg(p224_felem out, const p224_felem in) {
|
264
|
-
static const p224_limb two58p2 =
|
265
|
-
(((p224_limb)1) << 58) + (((p224_limb)1) << 2);
|
266
|
-
static const p224_limb two58m2 =
|
267
|
-
(((p224_limb)1) << 58) - (((p224_limb)1) << 2);
|
268
|
-
static const p224_limb two58m42m2 =
|
269
|
-
(((p224_limb)1) << 58) - (((p224_limb)1) << 42) - (((p224_limb)1) << 2);
|
270
|
-
|
271
|
-
// Set to 0 mod 2^224-2^96+1 to ensure out > in
|
272
|
-
out[0] = two58p2 - in[0];
|
273
|
-
out[1] = two58m42m2 - in[1];
|
274
|
-
out[2] = two58m2 - in[2];
|
275
|
-
out[3] = two58m2 - in[3];
|
276
|
-
}
|
277
|
-
|
278
260
|
// Subtract field elements: out -= in
|
279
261
|
// Assumes in[i] < 2^57
|
280
262
|
static void p224_felem_diff(p224_felem out, const p224_felem in) {
|
@@ -514,6 +496,15 @@ static void p224_felem_contract(p224_felem out, const p224_felem in) {
|
|
514
496
|
out[3] = tmp[3];
|
515
497
|
}
|
516
498
|
|
499
|
+
// Get negative value: out = -in
|
500
|
+
// Requires in[i] < 2^63,
|
501
|
+
// ensures out[0] < 2^56, out[1] < 2^56, out[2] < 2^56, out[3] <= 2^56 + 2^16
|
502
|
+
static void p224_felem_neg(p224_felem out, const p224_felem in) {
|
503
|
+
p224_widefelem tmp = {0};
|
504
|
+
p224_felem_diff_128_64(tmp, in);
|
505
|
+
p224_felem_reduce(out, tmp);
|
506
|
+
}
|
507
|
+
|
517
508
|
// Zero-check: returns 1 if input is 0, and 0 otherwise. We know that field
|
518
509
|
// elements are reduced to in < 2^225, so we only need to check three cases: 0,
|
519
510
|
// 2^224 - 2^96 + 1, and 2^225 - 2^97 + 2
|
@@ -1016,22 +1007,27 @@ static int ec_GFp_nistp224_point_get_affine_coordinates(const EC_GROUP *group,
|
|
1016
1007
|
p224_felem_inv(z2, z1);
|
1017
1008
|
p224_felem_square(tmp, z2);
|
1018
1009
|
p224_felem_reduce(z1, tmp);
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1010
|
+
|
1011
|
+
if (x != NULL) {
|
1012
|
+
p224_felem_mul(tmp, x_in, z1);
|
1013
|
+
p224_felem_reduce(x_in, tmp);
|
1014
|
+
p224_felem_contract(x_out, x_in);
|
1015
|
+
if (!p224_felem_to_BN(x, x_out)) {
|
1016
|
+
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
1017
|
+
return 0;
|
1018
|
+
}
|
1025
1019
|
}
|
1026
1020
|
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1021
|
+
if (y != NULL) {
|
1022
|
+
p224_felem_mul(tmp, z1, z2);
|
1023
|
+
p224_felem_reduce(z1, tmp);
|
1024
|
+
p224_felem_mul(tmp, y_in, z1);
|
1025
|
+
p224_felem_reduce(y_in, tmp);
|
1026
|
+
p224_felem_contract(y_out, y_in);
|
1027
|
+
if (!p224_felem_to_BN(y, y_out)) {
|
1028
|
+
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
1029
|
+
return 0;
|
1030
|
+
}
|
1035
1031
|
}
|
1036
1032
|
|
1037
1033
|
return 1;
|
@@ -1041,28 +1037,9 @@ static int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
|
1041
1037
|
const EC_SCALAR *g_scalar,
|
1042
1038
|
const EC_POINT *p,
|
1043
1039
|
const EC_SCALAR *p_scalar, BN_CTX *ctx) {
|
1044
|
-
int ret = 0;
|
1045
|
-
BN_CTX *new_ctx = NULL;
|
1046
|
-
BIGNUM *x, *y, *z, *tmp_scalar;
|
1047
1040
|
p224_felem p_pre_comp[17][3];
|
1048
1041
|
p224_felem x_in, y_in, z_in, x_out, y_out, z_out;
|
1049
1042
|
|
1050
|
-
if (ctx == NULL) {
|
1051
|
-
ctx = BN_CTX_new();
|
1052
|
-
new_ctx = ctx;
|
1053
|
-
if (ctx == NULL) {
|
1054
|
-
return 0;
|
1055
|
-
}
|
1056
|
-
}
|
1057
|
-
|
1058
|
-
BN_CTX_start(ctx);
|
1059
|
-
if ((x = BN_CTX_get(ctx)) == NULL ||
|
1060
|
-
(y = BN_CTX_get(ctx)) == NULL ||
|
1061
|
-
(z = BN_CTX_get(ctx)) == NULL ||
|
1062
|
-
(tmp_scalar = BN_CTX_get(ctx)) == NULL) {
|
1063
|
-
goto err;
|
1064
|
-
}
|
1065
|
-
|
1066
1043
|
if (p != NULL && p_scalar != NULL) {
|
1067
1044
|
// We treat NULL scalars as 0, and NULL points as points at infinity, i.e.,
|
1068
1045
|
// they contribute nothing to the linear combination.
|
@@ -1071,7 +1048,7 @@ static int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
|
1071
1048
|
if (!p224_BN_to_felem(x_out, &p->X) ||
|
1072
1049
|
!p224_BN_to_felem(y_out, &p->Y) ||
|
1073
1050
|
!p224_BN_to_felem(z_out, &p->Z)) {
|
1074
|
-
|
1051
|
+
return 0;
|
1075
1052
|
}
|
1076
1053
|
|
1077
1054
|
p224_felem_assign(p_pre_comp[1][0], x_out);
|
@@ -1101,18 +1078,13 @@ static int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
|
|
1101
1078
|
p224_felem_contract(x_in, x_out);
|
1102
1079
|
p224_felem_contract(y_in, y_out);
|
1103
1080
|
p224_felem_contract(z_in, z_out);
|
1104
|
-
if (!p224_felem_to_BN(
|
1105
|
-
!p224_felem_to_BN(
|
1106
|
-
!p224_felem_to_BN(
|
1081
|
+
if (!p224_felem_to_BN(&r->X, x_in) ||
|
1082
|
+
!p224_felem_to_BN(&r->Y, y_in) ||
|
1083
|
+
!p224_felem_to_BN(&r->Z, z_in)) {
|
1107
1084
|
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
|
1108
|
-
|
1085
|
+
return 0;
|
1109
1086
|
}
|
1110
|
-
|
1111
|
-
|
1112
|
-
err:
|
1113
|
-
BN_CTX_end(ctx);
|
1114
|
-
BN_CTX_free(new_ctx);
|
1115
|
-
return ret;
|
1087
|
+
return 1;
|
1116
1088
|
}
|
1117
1089
|
|
1118
1090
|
DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_nistp224_method) {
|
@@ -1122,10 +1094,11 @@ DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_nistp224_method) {
|
|
1122
1094
|
out->point_get_affine_coordinates =
|
1123
1095
|
ec_GFp_nistp224_point_get_affine_coordinates;
|
1124
1096
|
out->mul = ec_GFp_nistp224_points_mul;
|
1097
|
+
out->mul_public = ec_GFp_nistp224_points_mul;
|
1125
1098
|
out->field_mul = ec_GFp_simple_field_mul;
|
1126
1099
|
out->field_sqr = ec_GFp_simple_field_sqr;
|
1127
1100
|
out->field_encode = NULL;
|
1128
1101
|
out->field_decode = NULL;
|
1129
1102
|
};
|
1130
1103
|
|
1131
|
-
#endif //
|
1104
|
+
#endif // BORINGSSL_HAS_UINT128 && !SMALL
|