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
@@ -56,6 +56,7 @@
|
|
56
56
|
|
57
57
|
#include <openssl/x509.h>
|
58
58
|
|
59
|
+
#include <inttypes.h>
|
59
60
|
#include <string.h>
|
60
61
|
|
61
62
|
#include <openssl/asn1.h>
|
@@ -63,6 +64,7 @@
|
|
63
64
|
#include <openssl/obj.h>
|
64
65
|
|
65
66
|
#include "charmap.h"
|
67
|
+
#include "../asn1/asn1_locl.h"
|
66
68
|
|
67
69
|
/*
|
68
70
|
* ASN1_STRING_print_ex() and X509_NAME_print_ex(). Enhanced string and name
|
@@ -105,22 +107,20 @@ typedef int char_io (void *arg, const void *buf, int len);
|
|
105
107
|
|
106
108
|
#define HEX_SIZE(type) (sizeof(type)*2)
|
107
109
|
|
108
|
-
static int do_esc_char(
|
110
|
+
static int do_esc_char(uint32_t c, unsigned char flags, char *do_quotes,
|
109
111
|
char_io *io_ch, void *arg)
|
110
112
|
{
|
111
113
|
unsigned char chflgs, chtmp;
|
112
|
-
char tmphex[HEX_SIZE(
|
114
|
+
char tmphex[HEX_SIZE(uint32_t) + 3];
|
113
115
|
|
114
|
-
if (c > 0xffffffffL)
|
115
|
-
return -1;
|
116
116
|
if (c > 0xffff) {
|
117
|
-
BIO_snprintf(tmphex, sizeof tmphex, "\\W%
|
117
|
+
BIO_snprintf(tmphex, sizeof tmphex, "\\W%08" PRIX32, c);
|
118
118
|
if (!io_ch(arg, tmphex, 10))
|
119
119
|
return -1;
|
120
120
|
return 10;
|
121
121
|
}
|
122
122
|
if (c > 0xff) {
|
123
|
-
BIO_snprintf(tmphex, sizeof tmphex, "\\U%
|
123
|
+
BIO_snprintf(tmphex, sizeof tmphex, "\\U%04" PRIX32, c);
|
124
124
|
if (!io_ch(arg, tmphex, 6))
|
125
125
|
return -1;
|
126
126
|
return 6;
|
@@ -180,7 +180,7 @@ static int do_buf(unsigned char *buf, int buflen,
|
|
180
180
|
{
|
181
181
|
int i, outlen, len;
|
182
182
|
unsigned char orflags, *p, *q;
|
183
|
-
|
183
|
+
uint32_t c;
|
184
184
|
p = buf;
|
185
185
|
q = buf + buflen;
|
186
186
|
outlen = 0;
|
@@ -191,14 +191,14 @@ static int do_buf(unsigned char *buf, int buflen,
|
|
191
191
|
orflags = 0;
|
192
192
|
switch (type & BUF_TYPE_WIDTH_MASK) {
|
193
193
|
case 4:
|
194
|
-
c = ((
|
195
|
-
c |= ((
|
196
|
-
c |= ((
|
194
|
+
c = ((uint32_t)*p++) << 24;
|
195
|
+
c |= ((uint32_t)*p++) << 16;
|
196
|
+
c |= ((uint32_t)*p++) << 8;
|
197
197
|
c |= *p++;
|
198
198
|
break;
|
199
199
|
|
200
200
|
case 2:
|
201
|
-
c = ((
|
201
|
+
c = ((uint32_t)*p++) << 8;
|
202
202
|
c |= *p++;
|
203
203
|
break;
|
204
204
|
|
@@ -784,6 +784,10 @@ static int check_id(X509_STORE_CTX *ctx)
|
|
784
784
|
X509_VERIFY_PARAM *vpm = ctx->param;
|
785
785
|
X509_VERIFY_PARAM_ID *id = vpm->id;
|
786
786
|
X509 *x = ctx->cert;
|
787
|
+
if (id->poison) {
|
788
|
+
if (!check_id_error(ctx, X509_V_ERR_INVALID_CALL))
|
789
|
+
return 0;
|
790
|
+
}
|
787
791
|
if (id->hosts && check_hosts(x, id) <= 0) {
|
788
792
|
if (!check_id_error(ctx, X509_V_ERR_HOSTNAME_MISMATCH))
|
789
793
|
return 0;
|
@@ -89,6 +89,11 @@ static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode,
|
|
89
89
|
{
|
90
90
|
char *copy;
|
91
91
|
|
92
|
+
if (name == NULL || namelen == 0) {
|
93
|
+
// Unlike OpenSSL, we reject trying to set or add an empty name.
|
94
|
+
return 0;
|
95
|
+
}
|
96
|
+
|
92
97
|
/*
|
93
98
|
* Refuse names with embedded NUL bytes.
|
94
99
|
* XXX: Do we need to push an error onto the error stack?
|
@@ -100,8 +105,6 @@ static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode,
|
|
100
105
|
string_stack_free(id->hosts);
|
101
106
|
id->hosts = NULL;
|
102
107
|
}
|
103
|
-
if (name == NULL || namelen == 0)
|
104
|
-
return 1;
|
105
108
|
|
106
109
|
copy = BUF_strndup(name, namelen);
|
107
110
|
if (copy == NULL)
|
@@ -162,7 +165,7 @@ static void x509_verify_param_zero(X509_VERIFY_PARAM *param)
|
|
162
165
|
paramid->ip = NULL;
|
163
166
|
paramid->iplen = 0;
|
164
167
|
}
|
165
|
-
|
168
|
+
paramid->poison = 0;
|
166
169
|
}
|
167
170
|
|
168
171
|
X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void)
|
@@ -316,6 +319,8 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
|
|
316
319
|
return 0;
|
317
320
|
}
|
318
321
|
|
322
|
+
dest->id->poison = src->id->poison;
|
323
|
+
|
319
324
|
return 1;
|
320
325
|
}
|
321
326
|
|
@@ -334,18 +339,17 @@ static int int_x509_param_set1(char **pdest, size_t *pdestlen,
|
|
334
339
|
const char *src, size_t srclen)
|
335
340
|
{
|
336
341
|
void *tmp;
|
337
|
-
if (src) {
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
tmp = NULL;
|
347
|
-
srclen = 0;
|
342
|
+
if (src == NULL || srclen == 0) {
|
343
|
+
// Unlike OpenSSL, we do not allow an empty string to disable previously
|
344
|
+
// configured checks.
|
345
|
+
return 0;
|
346
|
+
}
|
347
|
+
|
348
|
+
tmp = BUF_memdup(src, srclen);
|
349
|
+
if (!tmp) {
|
350
|
+
return 0;
|
348
351
|
}
|
352
|
+
|
349
353
|
if (*pdest)
|
350
354
|
OPENSSL_free(*pdest);
|
351
355
|
*pdest = tmp;
|
@@ -454,13 +458,21 @@ int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
|
|
454
458
|
int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
|
455
459
|
const char *name, size_t namelen)
|
456
460
|
{
|
457
|
-
|
461
|
+
if (!int_x509_param_set_hosts(param->id, SET_HOST, name, namelen)) {
|
462
|
+
param->id->poison = 1;
|
463
|
+
return 0;
|
464
|
+
}
|
465
|
+
return 1;
|
458
466
|
}
|
459
467
|
|
460
468
|
int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,
|
461
469
|
const char *name, size_t namelen)
|
462
470
|
{
|
463
|
-
|
471
|
+
if (!int_x509_param_set_hosts(param->id, ADD_HOST, name, namelen)) {
|
472
|
+
param->id->poison = 1;
|
473
|
+
return 0;
|
474
|
+
}
|
475
|
+
return 1;
|
464
476
|
}
|
465
477
|
|
466
478
|
void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,
|
@@ -477,17 +489,27 @@ char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param)
|
|
477
489
|
int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
|
478
490
|
const char *email, size_t emaillen)
|
479
491
|
{
|
480
|
-
|
481
|
-
|
492
|
+
if (OPENSSL_memchr(email, '\0', emaillen) != NULL ||
|
493
|
+
!int_x509_param_set1(¶m->id->email, ¶m->id->emaillen,
|
494
|
+
email, emaillen)) {
|
495
|
+
param->id->poison = 1;
|
496
|
+
return 0;
|
497
|
+
}
|
498
|
+
|
499
|
+
return 1;
|
482
500
|
}
|
483
501
|
|
484
502
|
int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,
|
485
503
|
const unsigned char *ip, size_t iplen)
|
486
504
|
{
|
487
|
-
if (iplen !=
|
505
|
+
if ((iplen != 4 && iplen != 16) ||
|
506
|
+
!int_x509_param_set1((char **)¶m->id->ip, ¶m->id->iplen,
|
507
|
+
(char *)ip, iplen)) {
|
508
|
+
param->id->poison = 1;
|
488
509
|
return 0;
|
489
|
-
|
490
|
-
|
510
|
+
}
|
511
|
+
|
512
|
+
return 1;
|
491
513
|
}
|
492
514
|
|
493
515
|
int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc)
|
@@ -512,7 +534,7 @@ const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param)
|
|
512
534
|
}
|
513
535
|
|
514
536
|
static const X509_VERIFY_PARAM_ID _empty_id =
|
515
|
-
{ NULL, 0U, NULL, NULL, 0, NULL, 0 };
|
537
|
+
{ NULL, 0U, NULL, NULL, 0, NULL, 0, 0 };
|
516
538
|
|
517
539
|
#define vpm_empty_id ((X509_VERIFY_PARAM_ID *)&_empty_id)
|
518
540
|
|
@@ -539,3 +539,16 @@ int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
|
|
539
539
|
{
|
540
540
|
return ne->set;
|
541
541
|
}
|
542
|
+
|
543
|
+
int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder,
|
544
|
+
size_t *pderlen)
|
545
|
+
{
|
546
|
+
/* Make sure encoding is valid */
|
547
|
+
if (i2d_X509_NAME(nm, NULL) <= 0)
|
548
|
+
return 0;
|
549
|
+
if (pder != NULL)
|
550
|
+
*pder = (unsigned char *)nm->bytes->data;
|
551
|
+
if (pderlen != NULL)
|
552
|
+
*pderlen = nm->bytes->length;
|
553
|
+
return 1;
|
554
|
+
}
|
@@ -117,6 +117,16 @@ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_siv(void);
|
|
117
117
|
// https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02
|
118
118
|
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_siv(void);
|
119
119
|
|
120
|
+
// EVP_aead_aes_128_ccm_bluetooth is AES-128-CCM with M=4 and L=2 (4-byte tags
|
121
|
+
// and 13-byte nonces), as decribed in the Bluetooth Core Specification v5.0,
|
122
|
+
// Volume 6, Part E, Section 1.
|
123
|
+
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ccm_bluetooth(void);
|
124
|
+
|
125
|
+
// EVP_aead_aes_128_ccm_bluetooth_8 is AES-128-CCM with M=8 and L=2 (8-byte tags
|
126
|
+
// and 13-byte nonces), as used in the Bluetooth Mesh Networking Specification
|
127
|
+
// v1.0.
|
128
|
+
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ccm_bluetooth_8(void);
|
129
|
+
|
120
130
|
// EVP_has_aes_hardware returns one if we enable hardware support for fast and
|
121
131
|
// constant-time AES-GCM.
|
122
132
|
OPENSSL_EXPORT int EVP_has_aes_hardware(void);
|
@@ -708,9 +708,6 @@ DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
|
|
708
708
|
DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
|
709
709
|
DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
|
710
710
|
|
711
|
-
OPENSSL_EXPORT int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
|
712
|
-
OPENSSL_EXPORT int UTF8_putc(unsigned char *str, int len, unsigned long value);
|
713
|
-
|
714
711
|
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
|
715
712
|
|
716
713
|
DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
|
@@ -740,6 +737,7 @@ OPENSSL_EXPORT int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
|
|
740
737
|
OPENSSL_EXPORT ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, const char *sn, const char *ln);
|
741
738
|
|
742
739
|
OPENSSL_EXPORT int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
|
740
|
+
OPENSSL_EXPORT int ASN1_INTEGER_set_uint64(ASN1_INTEGER *out, uint64_t v);
|
743
741
|
OPENSSL_EXPORT long ASN1_INTEGER_get(const ASN1_INTEGER *a);
|
744
742
|
OPENSSL_EXPORT ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
|
745
743
|
OPENSSL_EXPORT BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn);
|
@@ -978,5 +976,6 @@ BORINGSSL_MAKE_DELETER(ASN1_TYPE, ASN1_TYPE_free)
|
|
978
976
|
#define ASN1_R_WRONG_PUBLIC_KEY_TYPE 189
|
979
977
|
#define ASN1_R_WRONG_TAG 190
|
980
978
|
#define ASN1_R_WRONG_TYPE 191
|
979
|
+
#define ASN1_R_NESTED_TOO_DEEP 192
|
981
980
|
|
982
981
|
#endif
|
@@ -104,6 +104,10 @@ extern "C" {
|
|
104
104
|
#elif defined(__pnacl__)
|
105
105
|
#define OPENSSL_32_BIT
|
106
106
|
#define OPENSSL_PNACL
|
107
|
+
#elif defined(__wasm__)
|
108
|
+
#define OPENSSL_32_BIT
|
109
|
+
#elif defined(__asmjs__)
|
110
|
+
#define OPENSSL_32_BIT
|
107
111
|
#elif defined(__myriad2__)
|
108
112
|
#define OPENSSL_32_BIT
|
109
113
|
#elif defined(__s390x__)
|
@@ -153,7 +157,7 @@ extern "C" {
|
|
153
157
|
// A consumer may use this symbol in the preprocessor to temporarily build
|
154
158
|
// against multiple revisions of BoringSSL at the same time. It is not
|
155
159
|
// recommended to do so for longer than is necessary.
|
156
|
-
#define BORINGSSL_API_VERSION
|
160
|
+
#define BORINGSSL_API_VERSION 7
|
157
161
|
|
158
162
|
#if defined(BORINGSSL_SHARED_LIBRARY)
|
159
163
|
|
@@ -225,19 +229,6 @@ extern "C" {
|
|
225
229
|
#endif
|
226
230
|
#endif
|
227
231
|
|
228
|
-
// Have a generic fall-through for different versions of C/C++.
|
229
|
-
#if defined(__cplusplus) && __cplusplus >= 201703L
|
230
|
-
#define OPENSSL_FALLTHROUGH [[fallthrough]]
|
231
|
-
#elif defined(__cplusplus) && __cplusplus >= 201103L && defined(__clang__)
|
232
|
-
#define OPENSSL_FALLTHROUGH [[clang::fallthrough]]
|
233
|
-
#elif defined(__cplusplus) && __cplusplus >= 201103L && __GNUC__ >= 7
|
234
|
-
#define OPENSSL_FALLTHROUGH [[gnu::fallthrough]]
|
235
|
-
#elif __GNUC__ >= 7 // gcc 7
|
236
|
-
#define OPENSSL_FALLTHROUGH __attribute__ ((fallthrough))
|
237
|
-
#else // C++11 on gcc 6, and all other cases
|
238
|
-
#define OPENSSL_FALLTHROUGH
|
239
|
-
#endif
|
240
|
-
|
241
232
|
// CRYPTO_THREADID is a dummy value.
|
242
233
|
typedef int CRYPTO_THREADID;
|
243
234
|
|
@@ -347,7 +347,7 @@ OPENSSL_EXPORT int BIO_read_asn1(BIO *bio, uint8_t **out, size_t *out_len,
|
|
347
347
|
// Memory BIOs.
|
348
348
|
//
|
349
349
|
// Memory BIOs can be used as a read-only source (with |BIO_new_mem_buf|) or a
|
350
|
-
// writable sink (with |BIO_new|, |BIO_s_mem| and |
|
350
|
+
// writable sink (with |BIO_new|, |BIO_s_mem| and |BIO_mem_contents|). Data
|
351
351
|
// written to a writable, memory BIO can be recalled by reading from it.
|
352
352
|
//
|
353
353
|
// Calling |BIO_reset| on a read-only BIO resets it to the original contents.
|
@@ -237,7 +237,8 @@ OPENSSL_EXPORT BIGNUM *BN_bin2bn(const uint8_t *in, size_t len, BIGNUM *ret);
|
|
237
237
|
|
238
238
|
// BN_bn2bin serialises the absolute value of |in| to |out| as a big-endian
|
239
239
|
// integer, which must have |BN_num_bytes| of space available. It returns the
|
240
|
-
// number of bytes written.
|
240
|
+
// number of bytes written. Note this function leaks the magnitude of |in|. If
|
241
|
+
// |in| is secret, use |BN_bn2bin_padded| instead.
|
241
242
|
OPENSSL_EXPORT size_t BN_bn2bin(const BIGNUM *in, uint8_t *out);
|
242
243
|
|
243
244
|
// BN_le2bn sets |*ret| to the value of |len| bytes from |in|, interpreted as
|
@@ -459,6 +460,7 @@ OPENSSL_EXPORT int BN_is_odd(const BIGNUM *bn);
|
|
459
460
|
// BN_is_pow2 returns 1 if |a| is a power of two, and 0 otherwise.
|
460
461
|
OPENSSL_EXPORT int BN_is_pow2(const BIGNUM *a);
|
461
462
|
|
463
|
+
|
462
464
|
// Bitwise operations.
|
463
465
|
|
464
466
|
// BN_lshift sets |r| equal to |a| << n. The |a| and |r| arguments may be the
|
@@ -492,9 +494,19 @@ OPENSSL_EXPORT int BN_clear_bit(BIGNUM *a, int n);
|
|
492
494
|
OPENSSL_EXPORT int BN_is_bit_set(const BIGNUM *a, int n);
|
493
495
|
|
494
496
|
// BN_mask_bits truncates |a| so that it is only |n| bits long. It returns one
|
495
|
-
// on success or zero if |n| is
|
497
|
+
// on success or zero if |n| is negative.
|
498
|
+
//
|
499
|
+
// This differs from OpenSSL which additionally returns zero if |a|'s word
|
500
|
+
// length is less than or equal to |n|, rounded down to a number of words. Note
|
501
|
+
// word size is platform-dependent, so this behavior is also difficult to rely
|
502
|
+
// on in OpenSSL and not very useful.
|
496
503
|
OPENSSL_EXPORT int BN_mask_bits(BIGNUM *a, int n);
|
497
504
|
|
505
|
+
// BN_count_low_zero_bits returns the number of low-order zero bits in |bn|, or
|
506
|
+
// the number of factors of two which divide it. It returns zero if |bn| is
|
507
|
+
// zero.
|
508
|
+
OPENSSL_EXPORT int BN_count_low_zero_bits(const BIGNUM *bn);
|
509
|
+
|
498
510
|
|
499
511
|
// Modulo arithmetic.
|
500
512
|
|
@@ -694,7 +706,7 @@ enum bn_primality_result_t {
|
|
694
706
|
// than the number-field sieve security level of |w| is used. It returns one on
|
695
707
|
// success and zero on failure. If |cb| is not NULL, then it is called during
|
696
708
|
// each iteration of the primality test.
|
697
|
-
int BN_enhanced_miller_rabin_primality_test(
|
709
|
+
OPENSSL_EXPORT int BN_enhanced_miller_rabin_primality_test(
|
698
710
|
enum bn_primality_result_t *out_result, const BIGNUM *w, int iterations,
|
699
711
|
BN_CTX *ctx, BN_GENCB *cb);
|
700
712
|
|
@@ -767,6 +779,10 @@ OPENSSL_EXPORT BIGNUM *BN_mod_inverse(BIGNUM *out, const BIGNUM *a,
|
|
767
779
|
// value) to protect it against side-channel attacks. On failure, if the failure
|
768
780
|
// was caused by |a| having no inverse mod |n| then |*out_no_inverse| will be
|
769
781
|
// set to one; otherwise it will be set to zero.
|
782
|
+
//
|
783
|
+
// Note this function may incorrectly report |a| has no inverse if the random
|
784
|
+
// blinding value has no inverse. It should only be used when |n| has few
|
785
|
+
// non-invertible elements, such as an RSA modulus.
|
770
786
|
int BN_mod_inverse_blinded(BIGNUM *out, int *out_no_inverse, const BIGNUM *a,
|
771
787
|
const BN_MONT_CTX *mont, BN_CTX *ctx);
|
772
788
|
|
@@ -788,8 +804,10 @@ int BN_mod_inverse_odd(BIGNUM *out, int *out_no_inverse, const BIGNUM *a,
|
|
788
804
|
// BN_MONT_CTX contains the precomputed values needed to work in a specific
|
789
805
|
// Montgomery domain.
|
790
806
|
|
791
|
-
//
|
792
|
-
|
807
|
+
// BN_MONT_CTX_new_for_modulus returns a fresh |BN_MONT_CTX| given the modulus,
|
808
|
+
// |mod| or NULL on error.
|
809
|
+
OPENSSL_EXPORT BN_MONT_CTX *BN_MONT_CTX_new_for_modulus(const BIGNUM *mod,
|
810
|
+
BN_CTX *ctx);
|
793
811
|
|
794
812
|
// BN_MONT_CTX_free frees memory associated with |mont|.
|
795
813
|
OPENSSL_EXPORT void BN_MONT_CTX_free(BN_MONT_CTX *mont);
|
@@ -799,11 +817,6 @@ OPENSSL_EXPORT void BN_MONT_CTX_free(BN_MONT_CTX *mont);
|
|
799
817
|
OPENSSL_EXPORT BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,
|
800
818
|
const BN_MONT_CTX *from);
|
801
819
|
|
802
|
-
// BN_MONT_CTX_set sets up a Montgomery context given the modulus, |mod|. It
|
803
|
-
// returns one on success and zero on error.
|
804
|
-
OPENSSL_EXPORT int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod,
|
805
|
-
BN_CTX *ctx);
|
806
|
-
|
807
820
|
// BN_MONT_CTX_set_locked takes |lock| and checks whether |*pmont| is NULL. If
|
808
821
|
// so, it creates a new |BN_MONT_CTX| and sets the modulus for it to |mod|. It
|
809
822
|
// then stores it as |*pmont|. It returns one on success and zero on error.
|
@@ -891,21 +904,52 @@ OPENSSL_EXPORT int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1,
|
|
891
904
|
const BIGNUM *p2, const BIGNUM *m,
|
892
905
|
BN_CTX *ctx, const BN_MONT_CTX *mont);
|
893
906
|
|
907
|
+
// BN_MONT_CTX_new returns a fresh |BN_MONT_CTX| or NULL on allocation failure.
|
908
|
+
// Use |BN_MONT_CTX_new_for_modulus| instead.
|
909
|
+
OPENSSL_EXPORT BN_MONT_CTX *BN_MONT_CTX_new(void);
|
910
|
+
|
911
|
+
// BN_MONT_CTX_set sets up a Montgomery context given the modulus, |mod|. It
|
912
|
+
// returns one on success and zero on error. Use |BN_MONT_CTX_new_for_modulus|
|
913
|
+
// instead.
|
914
|
+
OPENSSL_EXPORT int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod,
|
915
|
+
BN_CTX *ctx);
|
916
|
+
|
894
917
|
|
895
918
|
// Private functions
|
896
919
|
|
897
920
|
struct bignum_st {
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
921
|
+
// d is a pointer to an array of |width| |BN_BITS2|-bit chunks in
|
922
|
+
// little-endian order. This stores the absolute value of the number.
|
923
|
+
BN_ULONG *d;
|
924
|
+
// width is the number of elements of |d| which are valid. This value is not
|
925
|
+
// necessarily minimal; the most-significant words of |d| may be zero.
|
926
|
+
// |width| determines a potentially loose upper-bound on the absolute value
|
927
|
+
// of the |BIGNUM|.
|
928
|
+
//
|
929
|
+
// Functions taking |BIGNUM| inputs must compute the same answer for all
|
930
|
+
// possible widths. |bn_minimal_width|, |bn_set_minimal_width|, and other
|
931
|
+
// helpers may be used to recover the minimal width, provided it is not
|
932
|
+
// secret. If it is secret, use a different algorithm. Functions may output
|
933
|
+
// minimal or non-minimal |BIGNUM|s depending on secrecy requirements, but
|
934
|
+
// those which cause widths to unboundedly grow beyond the minimal value
|
935
|
+
// should be documented such.
|
936
|
+
//
|
937
|
+
// Note this is different from historical |BIGNUM| semantics.
|
938
|
+
int width;
|
939
|
+
// dmax is number of elements of |d| which are allocated.
|
940
|
+
int dmax;
|
941
|
+
// neg is one if the number if negative and zero otherwise.
|
942
|
+
int neg;
|
943
|
+
// flags is a bitmask of |BN_FLG_*| values
|
944
|
+
int flags;
|
904
945
|
};
|
905
946
|
|
906
947
|
struct bn_mont_ctx_st {
|
907
|
-
|
908
|
-
BIGNUM
|
948
|
+
// RR is R^2, reduced modulo |N|. It is used to convert to Montgomery form.
|
949
|
+
BIGNUM RR;
|
950
|
+
// N is the modulus. It is always stored in minimal form, so |N.top|
|
951
|
+
// determines R.
|
952
|
+
BIGNUM N;
|
909
953
|
BN_ULONG n0[2]; // least significant words of (R*Ri-1)/N
|
910
954
|
};
|
911
955
|
|