grpc 1.66.0 → 1.67.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +19 -10
- data/include/grpc/credentials.h +1 -1
- data/include/grpc/event_engine/README.md +1 -1
- data/include/grpc/event_engine/internal/slice_cast.h +1 -1
- data/include/grpc/event_engine/slice.h +0 -1
- data/include/grpc/event_engine/slice_buffer.h +0 -1
- data/include/grpc/grpc_crl_provider.h +1 -1
- data/include/grpc/impl/channel_arg_names.h +1 -1
- data/include/grpc/support/log.h +34 -32
- data/include/grpc/support/sync_generic.h +2 -4
- data/src/core/channelz/channelz.cc +0 -1
- data/src/core/channelz/channelz_registry.cc +0 -1
- data/src/core/client_channel/client_channel.cc +10 -7
- data/src/core/client_channel/client_channel.h +1 -1
- data/src/core/client_channel/client_channel_filter.cc +21 -18
- data/src/core/client_channel/client_channel_filter.h +1 -1
- data/src/core/client_channel/client_channel_internal.h +0 -2
- data/src/core/client_channel/config_selector.h +0 -1
- data/src/core/client_channel/dynamic_filters.cc +0 -2
- data/src/core/client_channel/local_subchannel_pool.cc +0 -2
- data/src/core/client_channel/retry_filter.h +0 -1
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +175 -257
- data/src/core/client_channel/subchannel.cc +21 -27
- data/src/core/client_channel/subchannel_stream_client.cc +1 -1
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +8 -9
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +0 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +3 -4
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +167 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +82 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.cc +81 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.h +87 -0
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +7 -9
- data/src/core/ext/filters/http/server/http_server_filter.cc +2 -4
- data/src/core/ext/filters/message_size/message_size_filter.cc +6 -7
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +0 -2
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +0 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -8
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +288 -265
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/flow_control.h +0 -1
- data/src/core/ext/transport/chttp2/transport/frame.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +37 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +27 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +21 -32
- data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +6 -8
- data/src/core/ext/transport/chttp2/transport/varint.h +0 -1
- data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/writing.cc +22 -22
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +431 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +129 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h +33 -0
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb.h +16 -0
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb_minitable.c +13 -2
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb.h +397 -22
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb_minitable.c +94 -20
- data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb_minitable.h +2 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.c +86 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/checked.upbdefs.c +108 -107
- data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/syntax.upbdefs.c +101 -78
- data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/syntax.upbdefs.h +10 -0
- data/src/core/handshaker/handshaker.cc +21 -29
- data/src/core/handshaker/security/secure_endpoint.cc +3 -3
- data/src/core/handshaker/security/security_handshaker.cc +60 -72
- data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +0 -1
- data/src/core/lib/backoff/backoff.cc +7 -10
- data/src/core/lib/backoff/backoff.h +4 -6
- data/src/core/lib/channel/channel_stack.cc +0 -1
- data/src/core/lib/channel/channel_stack.h +0 -1
- data/src/core/lib/channel/channel_stack_builder_impl.cc +0 -1
- data/src/core/lib/channel/connected_channel.cc +0 -1
- data/src/core/lib/channel/promise_based_filter.cc +146 -194
- data/src/core/lib/channel/promise_based_filter.h +1 -1
- data/src/core/lib/compression/compression_internal.cc +0 -1
- data/src/core/lib/config/config_vars.cc +11 -1
- data/src/core/lib/config/config_vars.h +8 -0
- data/src/core/lib/config/core_configuration.cc +0 -1
- data/src/core/lib/config/core_configuration.h +0 -1
- data/src/core/lib/debug/event_log.cc +0 -1
- data/src/core/lib/debug/trace_flags.cc +4 -18
- data/src/core/lib/debug/trace_flags.h +2 -5
- data/src/core/lib/debug/trace_impl.h +6 -0
- data/src/core/lib/event_engine/ares_resolver.cc +89 -56
- data/src/core/lib/event_engine/ares_resolver.h +0 -9
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +14 -1
- data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +1 -1
- data/src/core/lib/event_engine/forkable.cc +0 -1
- data/src/core/lib/event_engine/forkable.h +0 -1
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +4 -4
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +0 -1
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +0 -1
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +9 -1
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +0 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +1 -2
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +4 -9
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +0 -1
- data/src/core/lib/event_engine/resolved_address.cc +0 -1
- data/src/core/lib/event_engine/slice.cc +0 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.cc +0 -1
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +3 -5
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +121 -93
- data/src/core/lib/experiments/config.cc +12 -10
- data/src/core/lib/experiments/experiments.cc +45 -66
- data/src/core/lib/experiments/experiments.h +22 -27
- data/src/core/lib/gprpp/chunked_vector.h +0 -1
- data/src/core/lib/gprpp/down_cast.h +0 -1
- data/src/core/lib/gprpp/host_port.cc +0 -1
- data/src/core/lib/gprpp/load_file.cc +0 -1
- data/src/core/lib/gprpp/mpscq.h +0 -1
- data/src/core/lib/gprpp/single_set_ptr.h +0 -1
- data/src/core/lib/gprpp/status_helper.cc +0 -1
- data/src/core/lib/gprpp/sync.h +0 -1
- data/src/core/lib/gprpp/table.h +28 -0
- data/src/core/lib/gprpp/thd.h +0 -1
- data/src/core/lib/gprpp/time.h +0 -1
- data/src/core/lib/gprpp/time_util.cc +0 -1
- data/src/core/lib/gprpp/windows/directory_reader.cc +0 -2
- data/src/core/lib/gprpp/windows/thd.cc +0 -1
- data/src/core/lib/gprpp/work_serializer.cc +23 -34
- data/src/core/lib/iomgr/buffer_list.cc +0 -1
- data/src/core/lib/iomgr/call_combiner.h +6 -8
- data/src/core/lib/iomgr/cfstream_handle.cc +6 -8
- data/src/core/lib/iomgr/closure.h +5 -8
- data/src/core/lib/iomgr/combiner.cc +6 -8
- data/src/core/lib/iomgr/endpoint_cfstream.cc +17 -22
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +0 -1
- data/src/core/lib/iomgr/error.h +0 -1
- data/src/core/lib/iomgr/ev_apple.cc +13 -18
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +47 -85
- data/src/core/lib/iomgr/ev_poll_posix.cc +17 -24
- data/src/core/lib/iomgr/ev_posix.cc +55 -44
- data/src/core/lib/iomgr/ev_posix.h +0 -5
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +7 -9
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +3 -4
- data/src/core/lib/iomgr/exec_ctx.cc +6 -9
- data/src/core/lib/iomgr/exec_ctx.h +26 -16
- data/src/core/lib/iomgr/executor.cc +43 -33
- data/src/core/lib/iomgr/fork_windows.cc +0 -1
- data/src/core/lib/iomgr/internal_errqueue.cc +0 -1
- data/src/core/lib/iomgr/iocp_windows.cc +0 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +0 -2
- data/src/core/lib/iomgr/lockfree_event.cc +7 -11
- data/src/core/lib/iomgr/polling_entity.cc +10 -3
- data/src/core/lib/iomgr/pollset_windows.cc +0 -2
- data/src/core/lib/iomgr/resolve_address.cc +0 -1
- data/src/core/lib/iomgr/resolve_address_posix.cc +0 -1
- data/src/core/lib/iomgr/resolve_address_windows.cc +0 -1
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +0 -1
- data/src/core/lib/iomgr/socket_mutator.cc +0 -1
- data/src/core/lib/iomgr/socket_utils_linux.cc +0 -2
- data/src/core/lib/iomgr/socket_utils_posix.cc +0 -1
- data/src/core/lib/iomgr/socket_utils_windows.cc +0 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +7 -12
- data/src/core/lib/iomgr/tcp_client_posix.cc +8 -12
- data/src/core/lib/iomgr/tcp_client_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_posix.cc +32 -68
- data/src/core/lib/iomgr/tcp_server_posix.cc +7 -11
- data/src/core/lib/iomgr/tcp_windows.cc +4 -12
- data/src/core/lib/iomgr/timer_generic.cc +46 -65
- data/src/core/lib/iomgr/timer_manager.cc +4 -5
- data/src/core/lib/iomgr/unix_sockets_posix.cc +0 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +0 -2
- data/src/core/lib/iomgr/vsock.cc +0 -1
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/promise/activity.h +0 -1
- data/src/core/lib/promise/context.h +0 -1
- data/src/core/lib/promise/detail/join_state.h +44 -44
- data/src/core/lib/promise/detail/seq_state.h +1101 -1356
- data/src/core/lib/promise/for_each.h +8 -15
- data/src/core/lib/promise/interceptor_list.h +17 -27
- data/src/core/lib/promise/latch.h +16 -24
- data/src/core/lib/promise/map.h +1 -1
- data/src/core/lib/promise/party.cc +238 -114
- data/src/core/lib/promise/party.h +105 -308
- data/src/core/lib/promise/pipe.h +3 -4
- data/src/core/lib/promise/poll.h +0 -1
- data/src/core/lib/promise/status_flag.h +0 -1
- data/src/core/lib/resource_quota/connection_quota.cc +0 -1
- data/src/core/lib/resource_quota/memory_quota.cc +11 -19
- data/src/core/lib/resource_quota/memory_quota.h +2 -4
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/lib/resource_quota/thread_quota.cc +0 -1
- data/src/core/lib/security/authorization/audit_logging.cc +0 -1
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +0 -1
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +14 -19
- data/src/core/lib/security/authorization/stdout_logger.cc +0 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +0 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +0 -1
- data/src/core/lib/security/credentials/call_creds_util.cc +0 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +0 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -0
- data/src/core/lib/security/credentials/credentials.h +1 -2
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +322 -324
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +53 -42
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +391 -353
- data/src/core/lib/security/credentials/external/external_account_credentials.h +121 -51
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +83 -44
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +27 -7
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +91 -116
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +14 -17
- data/src/core/lib/security/credentials/fake/fake_credentials.h +2 -0
- data/src/core/lib/security/credentials/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +196 -0
- data/src/core/lib/security/credentials/gcp_service_account_identity/gcp_service_account_identity_credentials.h +90 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +27 -41
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +0 -1
- data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +163 -259
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +34 -56
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +12 -16
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +0 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +0 -1
- data/src/core/lib/security/credentials/token_fetcher/token_fetcher_credentials.cc +298 -0
- data/src/core/lib/security/credentials/token_fetcher/token_fetcher_credentials.h +176 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +0 -1
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +0 -1
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +0 -1
- data/src/core/lib/security/security_connector/load_system_roots_windows.cc +0 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +4 -6
- data/src/core/lib/slice/percent_encoding.cc +0 -1
- data/src/core/lib/slice/slice.cc +0 -1
- data/src/core/lib/slice/slice.h +0 -1
- data/src/core/lib/slice/slice_buffer.cc +0 -1
- data/src/core/lib/slice/slice_internal.h +0 -1
- data/src/core/lib/slice/slice_refcount.h +6 -8
- data/src/core/lib/surface/byte_buffer_reader.cc +0 -1
- data/src/core/lib/surface/call.cc +3 -5
- data/src/core/lib/surface/call_utils.h +0 -1
- data/src/core/lib/surface/channel.cc +0 -1
- data/src/core/lib/surface/channel_create.cc +0 -1
- data/src/core/lib/surface/channel_init.h +0 -1
- data/src/core/lib/surface/client_call.cc +0 -1
- data/src/core/lib/surface/client_call.h +0 -1
- data/src/core/lib/surface/completion_queue.cc +28 -4
- data/src/core/lib/surface/completion_queue_factory.cc +0 -1
- data/src/core/lib/surface/filter_stack_call.cc +9 -9
- data/src/core/lib/surface/filter_stack_call.h +0 -1
- data/src/core/lib/surface/lame_client.cc +0 -1
- data/src/core/lib/surface/server_call.cc +0 -1
- data/src/core/lib/surface/server_call.h +0 -1
- data/src/core/lib/surface/validate_metadata.h +0 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +9 -12
- data/src/core/lib/transport/bdp_estimator.h +6 -8
- data/src/core/lib/transport/call_arena_allocator.cc +2 -16
- data/src/core/lib/transport/call_arena_allocator.h +20 -5
- data/src/core/lib/transport/call_filters.cc +6 -9
- data/src/core/lib/transport/call_spine.h +24 -13
- data/src/core/lib/transport/connectivity_state.cc +34 -42
- data/src/core/lib/transport/metadata_batch.h +41 -1
- data/src/core/lib/transport/timeout_encoding.cc +0 -1
- data/src/core/lib/transport/transport.h +6 -8
- data/src/core/lib/transport/transport_op_string.cc +0 -1
- data/src/core/lib/uri/uri_parser.cc +0 -1
- data/src/core/load_balancing/grpclb/grpclb.cc +55 -71
- data/src/core/load_balancing/health_check_client.cc +31 -42
- data/src/core/load_balancing/oob_backend_metric.cc +2 -4
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +99 -129
- data/src/core/load_balancing/pick_first/pick_first.cc +168 -228
- data/src/core/load_balancing/priority/priority.cc +77 -106
- data/src/core/load_balancing/ring_hash/ring_hash.cc +32 -46
- data/src/core/load_balancing/rls/rls.cc +142 -187
- data/src/core/load_balancing/round_robin/round_robin.cc +36 -55
- data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +0 -1
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +85 -110
- data/src/core/load_balancing/weighted_target/weighted_target.cc +52 -75
- data/src/core/load_balancing/xds/cds.cc +26 -43
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +57 -54
- data/src/core/load_balancing/xds/xds_cluster_manager.cc +36 -50
- data/src/core/load_balancing/xds/xds_override_host.cc +95 -131
- data/src/core/load_balancing/xds/xds_wrr_locality.cc +15 -23
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +3 -0
- data/src/core/resolver/binder/binder_resolver.cc +0 -2
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +62 -44
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -2
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +110 -89
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +132 -96
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -7
- data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -1
- data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +40 -39
- data/src/core/resolver/dns/native/dns_resolver.cc +8 -14
- data/src/core/resolver/endpoint_addresses.cc +0 -1
- data/src/core/resolver/fake/fake_resolver.cc +0 -1
- data/src/core/resolver/polling_resolver.cc +6 -15
- data/src/core/resolver/polling_resolver.h +1 -1
- data/src/core/resolver/xds/xds_config.cc +96 -0
- data/src/core/resolver/xds/xds_config.h +109 -0
- data/src/core/resolver/xds/xds_dependency_manager.cc +59 -154
- data/src/core/resolver/xds/xds_dependency_manager.h +1 -69
- data/src/core/resolver/xds/xds_resolver.cc +51 -55
- data/src/core/server/server.cc +2 -2
- data/src/core/server/server_config_selector_filter.cc +0 -1
- data/src/core/server/xds_server_config_fetcher.cc +4 -6
- data/src/core/service_config/service_config_call_data.h +2 -3
- data/src/core/service_config/service_config_channel_arg_filter.cc +0 -1
- data/src/core/service_config/service_config_impl.h +0 -1
- data/src/core/telemetry/call_tracer.cc +0 -1
- data/src/core/telemetry/metrics.h +0 -1
- data/src/core/telemetry/stats_data.cc +67 -0
- data/src/core/telemetry/stats_data.h +48 -0
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +0 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +0 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +0 -1
- data/src/core/tsi/fake_transport_security.cc +6 -5
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +0 -1
- data/src/core/util/alloc.cc +0 -1
- data/src/core/util/gcp_metadata_query.cc +0 -1
- data/src/core/util/http_client/httpcli.cc +12 -15
- data/src/core/util/http_client/httpcli.h +16 -11
- data/src/core/util/http_client/parser.cc +3 -4
- data/src/core/util/json/json_reader.cc +0 -1
- data/src/core/util/latent_see.cc +29 -9
- data/src/core/util/latent_see.h +122 -27
- data/src/core/util/log.cc +36 -55
- data/src/core/util/lru_cache.h +104 -0
- data/src/core/util/msys/tmpfile.cc +0 -1
- data/src/core/util/posix/sync.cc +0 -1
- data/src/core/util/posix/time.cc +0 -1
- data/src/core/util/ring_buffer.h +123 -0
- data/src/core/util/spinlock.h +1 -2
- data/src/core/util/string.cc +7 -7
- data/src/core/util/sync.cc +0 -1
- data/src/core/util/sync_abseil.cc +0 -1
- data/src/core/util/time.cc +0 -1
- data/src/core/util/unique_ptr_with_bitset.h +86 -0
- data/src/core/util/useful.h +0 -24
- data/src/core/util/windows/cpu.cc +0 -1
- data/src/core/util/windows/sync.cc +0 -1
- data/src/core/util/windows/time.cc +0 -1
- data/src/core/util/windows/tmpfile.cc +0 -1
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +0 -32
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +0 -5
- data/src/core/xds/grpc/xds_certificate_provider.cc +0 -1
- data/src/core/xds/grpc/xds_client_grpc.cc +11 -16
- data/src/core/xds/grpc/xds_cluster.cc +2 -8
- data/src/core/xds/grpc/xds_cluster.h +4 -4
- data/src/core/xds/grpc/xds_cluster_parser.cc +58 -96
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -1
- data/src/core/xds/grpc/xds_common_types_parser.cc +4 -4
- data/src/core/xds/grpc/xds_common_types_parser.h +17 -0
- data/src/core/xds/grpc/xds_endpoint_parser.cc +14 -14
- data/src/core/xds/grpc/xds_http_fault_filter.cc +15 -6
- data/src/core/xds/grpc/xds_http_fault_filter.h +5 -1
- data/src/core/xds/grpc/xds_http_filter.h +11 -1
- data/src/core/xds/grpc/xds_http_filter_registry.cc +7 -1
- data/src/core/xds/grpc/xds_http_filter_registry.h +8 -1
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +142 -0
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +61 -0
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +14 -6
- data/src/core/xds/grpc/xds_http_rbac_filter.h +5 -1
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +9 -1
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +5 -1
- data/src/core/xds/grpc/xds_lb_policy_registry.cc +14 -16
- data/src/core/xds/grpc/xds_listener_parser.cc +10 -11
- data/src/core/xds/grpc/xds_metadata.cc +62 -0
- data/src/core/xds/grpc/xds_metadata.h +127 -0
- data/src/core/xds/grpc/xds_metadata_parser.cc +143 -0
- data/src/core/xds/grpc/xds_metadata_parser.h +36 -0
- data/src/core/xds/grpc/xds_route_config_parser.cc +12 -17
- data/src/core/xds/grpc/xds_routing.cc +57 -22
- data/src/core/xds/grpc/xds_routing.h +10 -2
- data/src/core/xds/grpc/xds_transport_grpc.cc +0 -1
- data/src/core/xds/xds_client/xds_client.cc +124 -165
- data/src/core/xds/xds_client/xds_client_stats.cc +20 -27
- data/src/ruby/ext/grpc/rb_call.c +1 -1
- data/src/ruby/ext/grpc/rb_call_credentials.c +34 -27
- data/src/ruby/ext/grpc/rb_channel.c +22 -16
- data/src/ruby/ext/grpc/rb_event_thread.c +3 -2
- data/src/ruby/ext/grpc/rb_grpc.c +9 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +6 -10
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +9 -15
- data/src/ruby/ext/grpc/rb_server.c +10 -8
- data/src/ruby/lib/grpc/generic/active_call.rb +8 -5
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/call_spec.rb +53 -40
- data/src/ruby/spec/channel_spec.rb +4 -2
- data/src/ruby/spec/client_server_spec.rb +148 -507
- data/src/ruby/spec/generic/active_call_spec.rb +64 -86
- data/src/ruby/spec/support/services.rb +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/rand/fork_detect.h → bcm_support.h} +51 -6
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +43 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu_intel.c +72 -23
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/ecdsa_extra/ecdsa_asn1.c +160 -14
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +79 -78
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm_interface.h +89 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div.c → div.c.inc} +146 -179
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{random.c → random.c.inc} +6 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{sqrt.c → sqrt.c.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aes.c → e_aes.c.inc} +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_key.c → ec_key.c.inc} +11 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256-nistz.c → p256-nistz.c.inc} +104 -12
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.h +65 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/{ecdsa.c → ecdsa.c.inc} +52 -107
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +28 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -80
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{rand.c → rand.c.inc} +26 -40
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{padding.c → padding.c.inc} +2 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa_impl.c → rsa_impl.c.inc} +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{self_check.c → self_check.c.inc} +9 -35
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/internal.h +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/{service_indicator.c → service_indicator.c.inc} +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +293 -2
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +69 -14
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/mldsa/internal.h +73 -0
- data/third_party/boringssl-with-bazel/src/crypto/mldsa/mldsa.c +1687 -0
- data/third_party/boringssl-with-bazel/src/crypto/mlkem/internal.h +90 -0
- data/third_party/boringssl-with-bazel/src/crypto/mlkem/mlkem.cc +1097 -0
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +4 -5
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/rand → rand_extra}/fork_detect.c +26 -28
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/ios.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +19 -3
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +26 -23
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/sysrand_internal.h +37 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/trusty.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/rand → rand_extra}/urandom.c +19 -19
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +8 -1
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +2 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +14 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +14 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/experimental/dilithium.h +13 -15
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +8 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/mldsa.h +136 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/mlkem.h +246 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +3 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +3 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/service_indicator.h +2 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +22 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +35 -5
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +5 -6
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +6 -1
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -1
- data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +289 -55
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +2 -0
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +69 -38
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +14 -3
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +107 -14
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +44 -16
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +86 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_buffer.cc +7 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +97 -3
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +31 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +18 -4
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +96 -34
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +15 -5
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +3 -23
- metadata +113 -87
- data/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc +0 -45
- data/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h +0 -67
- data/src/core/util/android/log.cc +0 -48
- data/src/core/util/linux/log.cc +0 -69
- data/src/core/util/posix/log.cc +0 -69
- data/src/core/util/windows/log.cc +0 -73
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes.c → aes.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes_nohw.c → aes_nohw.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{key_wrap.c → key_wrap.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{mode_wrappers.c → mode_wrappers.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{add.c → add.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/asm/{x86_64-gcc.c → x86_64-gcc.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bn.c → bn.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bytes.c → bytes.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{cmp.c → cmp.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{ctx.c → ctx.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div_extra.c → div_extra.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{exponentiation.c → exponentiation.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd.c → gcd.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd_extra.c → gcd_extra.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{generic.c → generic.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{jacobi.c → jacobi.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery.c → montgomery.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery_inv.c → montgomery_inv.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{mul.c → mul.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{prime.c → prime.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{rsaz_exp.c → rsaz_exp.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{shift.c → shift.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{aead.c → aead.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{cipher.c → cipher.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aesccm.c → e_aesccm.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cmac/{cmac.c → cmac.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{check.c → check.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{dh.c → dh.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digest.c → digest.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digests.c → digests.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digestsign/{digestsign.c → digestsign.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec.c → ec.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_montgomery.c → ec_montgomery.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{felem.c → felem.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{oct.c → oct.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p224-64.c → p224-64.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256.c → p256.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{scalar.c → scalar.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple.c → simple.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple_mul.c → simple_mul.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{util.c → util.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{wnaf.c → wnaf.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/{ecdh.c → ecdh.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/{hkdf.c → hkdf.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hmac/{hmac.c → hmac.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/{md4.c → md4.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/{md5.c → md5.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cbc.c → cbc.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cfb.c → cfb.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ctr.c → ctr.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm.c → gcm.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm_nohw.c → gcm_nohw.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ofb.c → ofb.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{polyval.c → polyval.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{ctrdrbg.c → ctrdrbg.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{blinding.c → blinding.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa.c → rsa.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{fips.c → fips.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha1.c → sha1.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha256.c → sha256.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha512.c → sha512.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/{kdf.c → kdf.c.inc} +0 -0
- /data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/rand → rand_extra}/getrandom_fillin.h +0 -0
@@ -207,6 +207,7 @@ static bool tls1_check_duplicate_extensions(const CBS *cbs) {
|
|
207
207
|
static bool is_post_quantum_group(uint16_t id) {
|
208
208
|
switch (id) {
|
209
209
|
case SSL_GROUP_X25519_KYBER768_DRAFT00:
|
210
|
+
case SSL_GROUP_X25519_MLKEM768:
|
210
211
|
return true;
|
211
212
|
default:
|
212
213
|
return false;
|
@@ -3794,6 +3795,7 @@ static bool ssl_check_clienthello_tlsext(SSL_HANDSHAKE *hs) {
|
|
3794
3795
|
return true;
|
3795
3796
|
|
3796
3797
|
default:
|
3798
|
+
hs->should_ack_sni = ssl->s3->hostname != nullptr;
|
3797
3799
|
return true;
|
3798
3800
|
}
|
3799
3801
|
}
|
@@ -244,23 +244,36 @@ static bool ssl_write_client_cipher_list(const SSL_HANDSHAKE *hs, CBB *out,
|
|
244
244
|
// Add TLS 1.3 ciphers. Order ChaCha20-Poly1305 relative to AES-GCM based on
|
245
245
|
// hardware support.
|
246
246
|
if (hs->max_version >= TLS1_3_VERSION) {
|
247
|
+
static const uint16_t kCiphersNoAESHardware[] = {
|
248
|
+
TLS1_3_CK_CHACHA20_POLY1305_SHA256 & 0xffff,
|
249
|
+
TLS1_3_CK_AES_128_GCM_SHA256 & 0xffff,
|
250
|
+
TLS1_3_CK_AES_256_GCM_SHA384 & 0xffff,
|
251
|
+
};
|
252
|
+
static const uint16_t kCiphersAESHardware[] = {
|
253
|
+
TLS1_3_CK_AES_128_GCM_SHA256 & 0xffff,
|
254
|
+
TLS1_3_CK_AES_256_GCM_SHA384 & 0xffff,
|
255
|
+
TLS1_3_CK_CHACHA20_POLY1305_SHA256 & 0xffff,
|
256
|
+
};
|
257
|
+
static const uint16_t kCiphersCNSA[] = {
|
258
|
+
TLS1_3_CK_AES_256_GCM_SHA384 & 0xffff,
|
259
|
+
TLS1_3_CK_AES_128_GCM_SHA256 & 0xffff,
|
260
|
+
TLS1_3_CK_CHACHA20_POLY1305_SHA256 & 0xffff,
|
261
|
+
};
|
262
|
+
|
247
263
|
const bool has_aes_hw = ssl->config->aes_hw_override
|
248
264
|
? ssl->config->aes_hw_override_value
|
249
265
|
: EVP_has_aes_hardware();
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
TLS1_3_CK_CHACHA20_POLY1305_SHA256 & 0xffff,
|
262
|
-
ssl->config->tls13_cipher_policy))) {
|
263
|
-
return false;
|
266
|
+
const bssl::Span<const uint16_t> ciphers =
|
267
|
+
ssl->config->tls13_cipher_policy == ssl_compliance_policy_cnsa_202407
|
268
|
+
? bssl::Span<const uint16_t>(kCiphersCNSA)
|
269
|
+
: (has_aes_hw ? bssl::Span<const uint16_t>(kCiphersAESHardware)
|
270
|
+
: bssl::Span<const uint16_t>(kCiphersNoAESHardware));
|
271
|
+
|
272
|
+
for (auto cipher : ciphers) {
|
273
|
+
if (!ssl_add_tls13_cipher(&child, cipher,
|
274
|
+
ssl->config->tls13_cipher_policy)) {
|
275
|
+
return false;
|
276
|
+
}
|
264
277
|
}
|
265
278
|
}
|
266
279
|
|
@@ -372,9 +385,13 @@ bool ssl_add_client_hello(SSL_HANDSHAKE *hs) {
|
|
372
385
|
static bool parse_server_version(const SSL_HANDSHAKE *hs, uint16_t *out_version,
|
373
386
|
uint8_t *out_alert,
|
374
387
|
const ParsedServerHello &server_hello) {
|
388
|
+
uint16_t legacy_version = TLS1_2_VERSION;
|
389
|
+
if (SSL_is_dtls(hs->ssl)) {
|
390
|
+
legacy_version = DTLS1_2_VERSION;
|
391
|
+
}
|
375
392
|
// If the outer version is not TLS 1.2, use it.
|
376
393
|
// TODO(davidben): This function doesn't quite match the RFC8446 formulation.
|
377
|
-
if (server_hello.legacy_version !=
|
394
|
+
if (server_hello.legacy_version != legacy_version) {
|
378
395
|
*out_version = server_hello.legacy_version;
|
379
396
|
return true;
|
380
397
|
}
|
@@ -509,25 +526,28 @@ static enum ssl_hs_wait_t do_start_connect(SSL_HANDSHAKE *hs) {
|
|
509
526
|
return ssl_hs_error;
|
510
527
|
}
|
511
528
|
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
529
|
+
const bool has_id_session = ssl->session != nullptr &&
|
530
|
+
ssl->session->session_id_length > 0 &&
|
531
|
+
ssl->session->ticket.empty();
|
532
|
+
const bool has_ticket_session =
|
533
|
+
ssl->session != nullptr && !ssl->session->ticket.empty();
|
534
|
+
// TLS 1.2 session tickets require a placeholder value to signal resumption.
|
535
|
+
const bool ticket_session_requires_random_id =
|
536
|
+
has_ticket_session &&
|
537
|
+
ssl_session_protocol_version(ssl->session.get()) < TLS1_3_VERSION;
|
538
|
+
// Compatibility mode sends a random session ID. Compatibility mode is
|
539
|
+
// enabled for TLS 1.3, but not when it's run over QUIC or DTLS.
|
540
|
+
const bool enable_compatibility_mode = hs->max_version >= TLS1_3_VERSION &&
|
541
|
+
ssl->quic_method == nullptr &&
|
542
|
+
!SSL_is_dtls(hs->ssl);
|
543
|
+
if (has_id_session) {
|
544
|
+
hs->session_id_len = ssl->session->session_id_length;
|
545
|
+
OPENSSL_memcpy(hs->session_id, ssl->session->session_id,
|
546
|
+
hs->session_id_len);
|
547
|
+
} else if (ticket_session_requires_random_id || enable_compatibility_mode) {
|
548
|
+
hs->session_id_len = sizeof(hs->session_id);
|
549
|
+
if (!RAND_bytes(hs->session_id, hs->session_id_len)) {
|
550
|
+
return ssl_hs_error;
|
531
551
|
}
|
532
552
|
}
|
533
553
|
|
@@ -618,10 +638,6 @@ static enum ssl_hs_wait_t do_read_hello_verify_request(SSL_HANDSHAKE *hs) {
|
|
618
638
|
|
619
639
|
assert(SSL_is_dtls(ssl));
|
620
640
|
|
621
|
-
// When implementing DTLS 1.3, we need to handle the interactions between
|
622
|
-
// HelloVerifyRequest, DTLS 1.3's HelloVerifyRequest removal, and ECH.
|
623
|
-
assert(hs->max_version < TLS1_3_VERSION);
|
624
|
-
|
625
641
|
SSLMessage msg;
|
626
642
|
if (!ssl->method->get_message(ssl, &msg)) {
|
627
643
|
return ssl_hs_read_message;
|
@@ -632,6 +648,12 @@ static enum ssl_hs_wait_t do_read_hello_verify_request(SSL_HANDSHAKE *hs) {
|
|
632
648
|
return ssl_hs_ok;
|
633
649
|
}
|
634
650
|
|
651
|
+
// TODO(crbug.com/boringssl/715): At the point when we read an HVR, we don't
|
652
|
+
// know whether the connection is DTLS 1.2 (or earlier) or DTLS 1.3 - that's
|
653
|
+
// determined when we read the supported_versions in the ServerHello. If we
|
654
|
+
// receive HVR and then the ServerHello selects DTLS 1.3, that is an error and
|
655
|
+
// we should close the connection.
|
656
|
+
|
635
657
|
CBS hello_verify_request = msg.body, cookie;
|
636
658
|
uint16_t server_version;
|
637
659
|
if (!CBS_get_u16(&hello_verify_request, &server_version) ||
|
@@ -716,6 +738,15 @@ static enum ssl_hs_wait_t do_read_server_hello(SSL_HANDSHAKE *hs) {
|
|
716
738
|
return ssl_hs_error;
|
717
739
|
}
|
718
740
|
|
741
|
+
// TODO(crbug.com/boringssl/715): Check that if the server picked DTLS 1.3,
|
742
|
+
// that it didn't also previously send an HVR, as that is not allowed by RFC
|
743
|
+
// 9147. (DTLS 1.25 still uses HVR instead of HRR.) Also add a runner test to
|
744
|
+
// test that we handle that case properly.
|
745
|
+
//
|
746
|
+
// See
|
747
|
+
// https://boringssl-review.googlesource.com/c/boringssl/+/68027/3/ssl/handshake_client.cc
|
748
|
+
// for an example of what this check might look like.
|
749
|
+
|
719
750
|
assert(ssl->s3->have_version == ssl->s3->initial_handshake_complete);
|
720
751
|
if (!ssl->s3->have_version) {
|
721
752
|
ssl->version = server_version;
|
@@ -613,6 +613,9 @@ static bool extract_sni(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
|
613
613
|
if (!ssl_client_hello_get_extension(client_hello, &sni,
|
614
614
|
TLSEXT_TYPE_server_name)) {
|
615
615
|
// No SNI extension to parse.
|
616
|
+
//
|
617
|
+
// Clear state in case we previously extracted SNI from ClientHelloOuter.
|
618
|
+
ssl->s3->hostname.reset();
|
616
619
|
return true;
|
617
620
|
}
|
618
621
|
|
@@ -649,8 +652,6 @@ static bool extract_sni(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
|
649
652
|
return false;
|
650
653
|
}
|
651
654
|
ssl->s3->hostname.reset(raw);
|
652
|
-
|
653
|
-
hs->should_ack_sni = true;
|
654
655
|
return true;
|
655
656
|
}
|
656
657
|
|
@@ -686,7 +687,10 @@ static enum ssl_hs_wait_t do_read_client_hello(SSL_HANDSHAKE *hs) {
|
|
686
687
|
}
|
687
688
|
|
688
689
|
uint8_t alert = SSL_AD_DECODE_ERROR;
|
689
|
-
|
690
|
+
// We check for rejection status in case we've rewound the state machine after
|
691
|
+
// determining `ClientHelloInner` is invalid.
|
692
|
+
if (ssl->s3->ech_status != ssl_ech_rejected &&
|
693
|
+
!decrypt_ech(hs, &alert, &client_hello)) {
|
690
694
|
ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
|
691
695
|
return ssl_hs_error;
|
692
696
|
}
|
@@ -722,6 +726,13 @@ static enum ssl_hs_wait_t do_read_client_hello_after_ech(SSL_HANDSHAKE *hs) {
|
|
722
726
|
case ssl_select_cert_retry:
|
723
727
|
return ssl_hs_certificate_selection_pending;
|
724
728
|
|
729
|
+
case ssl_select_cert_disable_ech:
|
730
|
+
hs->ech_client_hello_buf.Reset();
|
731
|
+
hs->ech_keys = nullptr;
|
732
|
+
hs->state = state12_read_client_hello;
|
733
|
+
ssl->s3->ech_status = ssl_ech_rejected;
|
734
|
+
return ssl_hs_ok;
|
735
|
+
|
725
736
|
case ssl_select_cert_error:
|
726
737
|
// Connection rejected.
|
727
738
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CONNECTION_REJECTED);
|
@@ -155,6 +155,7 @@
|
|
155
155
|
#include <utility>
|
156
156
|
|
157
157
|
#include <openssl/aead.h>
|
158
|
+
#include <openssl/aes.h>
|
158
159
|
#include <openssl/curve25519.h>
|
159
160
|
#include <openssl/err.h>
|
160
161
|
#include <openssl/hpke.h>
|
@@ -811,6 +812,16 @@ bool tls1_prf(const EVP_MD *digest, Span<uint8_t> out,
|
|
811
812
|
|
812
813
|
// Encryption layer.
|
813
814
|
|
815
|
+
class RecordNumberEncrypter {
|
816
|
+
public:
|
817
|
+
virtual ~RecordNumberEncrypter() = default;
|
818
|
+
static constexpr bool kAllowUniquePtr = true;
|
819
|
+
|
820
|
+
virtual size_t KeySize() = 0;
|
821
|
+
virtual bool SetKey(Span<const uint8_t> key) = 0;
|
822
|
+
virtual bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) = 0;
|
823
|
+
};
|
824
|
+
|
814
825
|
// SSLAEADContext contains information about an AEAD that is being used to
|
815
826
|
// encrypt an SSL connection.
|
816
827
|
class SSLAEADContext {
|
@@ -916,6 +927,17 @@ class SSLAEADContext {
|
|
916
927
|
|
917
928
|
bool GetIV(const uint8_t **out_iv, size_t *out_iv_len) const;
|
918
929
|
|
930
|
+
RecordNumberEncrypter *GetRecordNumberEncrypter() {
|
931
|
+
return rn_encrypter_.get();
|
932
|
+
}
|
933
|
+
|
934
|
+
// GenerateRecordNumberMask computes the mask used for DTLS 1.3 record number
|
935
|
+
// encryption (RFC 9147 section 4.2.3), writing it to |out|. The |out| buffer
|
936
|
+
// must be sized to AES_BLOCK_SIZE. The |sample| buffer must be at least 16
|
937
|
+
// bytes, as required by the AES and ChaCha20 cipher suites in RFC 9147. Extra
|
938
|
+
// bytes in |sample| will be ignored.
|
939
|
+
bool GenerateRecordNumberMask(Span<uint8_t> out, Span<const uint8_t> sample);
|
940
|
+
|
919
941
|
private:
|
920
942
|
// GetAdditionalData returns the additional data, writing into |storage| if
|
921
943
|
// necessary.
|
@@ -924,6 +946,8 @@ class SSLAEADContext {
|
|
924
946
|
uint64_t seqnum, size_t plaintext_len,
|
925
947
|
Span<const uint8_t> header);
|
926
948
|
|
949
|
+
void CreateRecordNumberEncrypter();
|
950
|
+
|
927
951
|
const SSL_CIPHER *cipher_;
|
928
952
|
ScopedEVP_AEAD_CTX ctx_;
|
929
953
|
// fixed_nonce_ contains any bytes of the nonce that are fixed for all
|
@@ -932,6 +956,7 @@ class SSLAEADContext {
|
|
932
956
|
uint8_t fixed_nonce_len_ = 0, variable_nonce_len_ = 0;
|
933
957
|
// version_ is the wire version that should be used with this AEAD.
|
934
958
|
uint16_t version_;
|
959
|
+
UniquePtr<RecordNumberEncrypter> rn_encrypter_;
|
935
960
|
// is_dtls_ is whether DTLS is being used with this AEAD.
|
936
961
|
bool is_dtls_;
|
937
962
|
// variable_nonce_included_in_record_ is true if the variable nonce
|
@@ -951,6 +976,45 @@ class SSLAEADContext {
|
|
951
976
|
bool ad_is_header_ : 1;
|
952
977
|
};
|
953
978
|
|
979
|
+
class AESRecordNumberEncrypter : public RecordNumberEncrypter {
|
980
|
+
public:
|
981
|
+
bool SetKey(Span<const uint8_t> key) override;
|
982
|
+
bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
|
983
|
+
|
984
|
+
private:
|
985
|
+
AES_KEY key_;
|
986
|
+
};
|
987
|
+
|
988
|
+
class AES128RecordNumberEncrypter : public AESRecordNumberEncrypter {
|
989
|
+
public:
|
990
|
+
size_t KeySize() override;
|
991
|
+
};
|
992
|
+
|
993
|
+
class AES256RecordNumberEncrypter : public AESRecordNumberEncrypter {
|
994
|
+
public:
|
995
|
+
size_t KeySize() override;
|
996
|
+
};
|
997
|
+
|
998
|
+
class ChaChaRecordNumberEncrypter : public RecordNumberEncrypter {
|
999
|
+
public:
|
1000
|
+
size_t KeySize() override;
|
1001
|
+
bool SetKey(Span<const uint8_t> key) override;
|
1002
|
+
bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
|
1003
|
+
|
1004
|
+
private:
|
1005
|
+
static const size_t kKeySize = 32;
|
1006
|
+
uint8_t key_[kKeySize];
|
1007
|
+
};
|
1008
|
+
|
1009
|
+
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
1010
|
+
class NullRecordNumberEncrypter : public RecordNumberEncrypter {
|
1011
|
+
public:
|
1012
|
+
size_t KeySize() override;
|
1013
|
+
bool SetKey(Span<const uint8_t> key) override;
|
1014
|
+
bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
|
1015
|
+
};
|
1016
|
+
#endif // BORINGSSL_UNSAFE_FUZZER_MODE
|
1017
|
+
|
954
1018
|
|
955
1019
|
// DTLS replay bitmap.
|
956
1020
|
|
@@ -965,6 +1029,17 @@ struct DTLS1_BITMAP {
|
|
965
1029
|
uint64_t max_seq_num = 0;
|
966
1030
|
};
|
967
1031
|
|
1032
|
+
// reconstruct_seqnum takes the low order bits of a record sequence number from
|
1033
|
+
// the wire and reconstructs the full sequence number. It does so using the
|
1034
|
+
// algorithm described in section 4.2.2 of RFC 9147, where |wire_seq| is the
|
1035
|
+
// low bits of the sequence number as seen on the wire, |seq_mask| is a bitmask
|
1036
|
+
// of 8 or 16 1 bits corresponding to the length of the sequence number on the
|
1037
|
+
// wire, and |max_valid_seqnum| is the largest sequence number of a record
|
1038
|
+
// successfully deprotected in this epoch. This function returns the sequence
|
1039
|
+
// number that is numerically closest to one plus |max_valid_seqnum| that when
|
1040
|
+
// bitwise and-ed with |seq_mask| equals |wire_seq|.
|
1041
|
+
OPENSSL_EXPORT uint64_t reconstruct_seqnum(uint16_t wire_seq, uint64_t seq_mask,
|
1042
|
+
uint64_t max_valid_seqnum);
|
968
1043
|
|
969
1044
|
// Record layer.
|
970
1045
|
|
@@ -1018,17 +1093,9 @@ enum ssl_open_record_t dtls_open_record(SSL *ssl, uint8_t *out_type,
|
|
1018
1093
|
size_t *out_consumed,
|
1019
1094
|
uint8_t *out_alert, Span<uint8_t> in);
|
1020
1095
|
|
1021
|
-
//
|
1022
|
-
//
|
1023
|
-
|
1024
|
-
//
|
1025
|
-
// Note when TLS 1.0 CBC record-splitting is enabled, this includes the one byte
|
1026
|
-
// record and is the offset into second record's ciphertext. Thus sealing a
|
1027
|
-
// small record may result in a smaller output than this value.
|
1028
|
-
//
|
1029
|
-
// TODO(davidben): Is this alignment valuable? Record-splitting makes this a
|
1030
|
-
// mess.
|
1031
|
-
size_t ssl_seal_align_prefix_len(const SSL *ssl);
|
1096
|
+
// ssl_needs_record_splitting returns one if |ssl|'s current outgoing cipher
|
1097
|
+
// state needs record-splitting and zero otherwise.
|
1098
|
+
bool ssl_needs_record_splitting(const SSL *ssl);
|
1032
1099
|
|
1033
1100
|
// tls_seal_record seals a new record of type |type| and body |in| and writes it
|
1034
1101
|
// to |out|. At most |max_out| bytes will be written. It returns true on success
|
@@ -1036,7 +1103,7 @@ size_t ssl_seal_align_prefix_len(const SSL *ssl);
|
|
1036
1103
|
// 1/n-1 record splitting and may write two records concatenated.
|
1037
1104
|
//
|
1038
1105
|
// For a large record, the bulk of the ciphertext will begin
|
1039
|
-
// |
|
1106
|
+
// |tls_seal_align_prefix_len| bytes into out. Aligning |out| appropriately may
|
1040
1107
|
// improve performance. It writes at most |in_len| + |SSL_max_seal_overhead|
|
1041
1108
|
// bytes to |out|.
|
1042
1109
|
//
|
@@ -1044,6 +1111,10 @@ size_t ssl_seal_align_prefix_len(const SSL *ssl);
|
|
1044
1111
|
bool tls_seal_record(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out,
|
1045
1112
|
uint8_t type, const uint8_t *in, size_t in_len);
|
1046
1113
|
|
1114
|
+
// dtls_record_header_write_len returns the length of the record header that
|
1115
|
+
// will be written at |epoch|.
|
1116
|
+
size_t dtls_record_header_write_len(const SSL *ssl, uint16_t epoch);
|
1117
|
+
|
1047
1118
|
// dtls_max_seal_overhead returns the maximum overhead, in bytes, of sealing a
|
1048
1119
|
// record.
|
1049
1120
|
size_t dtls_max_seal_overhead(const SSL *ssl, uint16_t epoch);
|
@@ -1444,7 +1515,8 @@ bool tls13_finished_mac(SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len,
|
|
1444
1515
|
// tls13_derive_session_psk calculates the PSK for this session based on the
|
1445
1516
|
// resumption master secret and |nonce|. It returns true on success, and false
|
1446
1517
|
// on failure.
|
1447
|
-
bool tls13_derive_session_psk(SSL_SESSION *session, Span<const uint8_t> nonce
|
1518
|
+
bool tls13_derive_session_psk(SSL_SESSION *session, Span<const uint8_t> nonce,
|
1519
|
+
bool is_dtls);
|
1448
1520
|
|
1449
1521
|
// tls13_write_psk_binder calculates the PSK binder value over |transcript| and
|
1450
1522
|
// |msg|, and replaces the last bytes of |msg| with the resulting value. It
|
@@ -2939,7 +3011,23 @@ struct SSL3_STATE {
|
|
2939
3011
|
};
|
2940
3012
|
|
2941
3013
|
// lengths of messages
|
2942
|
-
#define
|
3014
|
+
#define DTLS1_RT_MAX_HEADER_LENGTH 13
|
3015
|
+
|
3016
|
+
// DTLS_PLAINTEXT_RECORD_HEADER_LENGTH is the length of the DTLS record header
|
3017
|
+
// for plaintext records (in DTLS 1.3) or DTLS versions <= 1.2.
|
3018
|
+
#define DTLS_PLAINTEXT_RECORD_HEADER_LENGTH 13
|
3019
|
+
|
3020
|
+
// DTLS1_3_RECORD_HEADER_LENGTH is the length of the DTLS 1.3 record header
|
3021
|
+
// sent by BoringSSL for encrypted records. Note that received encrypted DTLS
|
3022
|
+
// 1.3 records might have a different length header.
|
3023
|
+
#define DTLS1_3_RECORD_HEADER_WRITE_LENGTH 5
|
3024
|
+
|
3025
|
+
static_assert(DTLS1_RT_MAX_HEADER_LENGTH >= DTLS_PLAINTEXT_RECORD_HEADER_LENGTH,
|
3026
|
+
"DTLS1_RT_MAX_HEADER_LENGTH must not be smaller than defined "
|
3027
|
+
"record header lengths");
|
3028
|
+
static_assert(DTLS1_RT_MAX_HEADER_LENGTH >= DTLS1_3_RECORD_HEADER_WRITE_LENGTH,
|
3029
|
+
"DTLS1_RT_MAX_HEADER_LENGTH must not be smaller than defined "
|
3030
|
+
"record header lengths");
|
2943
3031
|
|
2944
3032
|
#define DTLS1_HM_HEADER_LENGTH 12
|
2945
3033
|
|
@@ -3019,6 +3107,11 @@ struct DTLS1_STATE {
|
|
3019
3107
|
uint64_t last_write_sequence = 0;
|
3020
3108
|
UniquePtr<SSLAEADContext> last_aead_write_ctx;
|
3021
3109
|
|
3110
|
+
|
3111
|
+
// In DTLS 1.3, this contains the write AEAD for the initial encryption level.
|
3112
|
+
// TODO(crbug.com/boringssl/715): Drop this when it is no longer needed.
|
3113
|
+
UniquePtr<SSLAEADContext> initial_aead_write_ctx;
|
3114
|
+
|
3022
3115
|
// incoming_messages is a ring buffer of incoming handshake messages that have
|
3023
3116
|
// yet to be processed. The front of the ring buffer is message number
|
3024
3117
|
// |handshake_read_seq|, at position |handshake_read_seq| %
|
@@ -659,36 +659,60 @@ void tls_next_message(SSL *ssl) {
|
|
659
659
|
}
|
660
660
|
}
|
661
661
|
|
662
|
-
|
663
|
-
|
662
|
+
namespace {
|
663
|
+
|
664
664
|
class CipherScorer {
|
665
665
|
public:
|
666
|
-
|
666
|
+
using Score = int;
|
667
|
+
static constexpr Score kMinScore = 0;
|
667
668
|
|
668
|
-
|
669
|
+
virtual ~CipherScorer() = default;
|
669
670
|
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
671
|
+
virtual Score Evaluate(const SSL_CIPHER *cipher) const = 0;
|
672
|
+
};
|
673
|
+
|
674
|
+
// AesHwCipherScorer scores cipher suites based on whether AES is supported in
|
675
|
+
// hardware.
|
676
|
+
class AesHwCipherScorer : public CipherScorer {
|
677
|
+
public:
|
678
|
+
explicit AesHwCipherScorer(bool has_aes_hw) : aes_is_fine_(has_aes_hw) {}
|
679
|
+
|
680
|
+
virtual ~AesHwCipherScorer() override = default;
|
675
681
|
|
676
|
-
Score Evaluate(const SSL_CIPHER *a) const {
|
677
|
-
return
|
682
|
+
Score Evaluate(const SSL_CIPHER *a) const override {
|
683
|
+
return
|
678
684
|
// Something is always preferable to nothing.
|
679
|
-
|
685
|
+
1 +
|
680
686
|
// Either AES is fine, or else ChaCha20 is preferred.
|
681
|
-
aes_is_fine_ || a->algorithm_enc == SSL_CHACHA20POLY1305);
|
687
|
+
((aes_is_fine_ || a->algorithm_enc == SSL_CHACHA20POLY1305) ? 1 : 0);
|
682
688
|
}
|
683
689
|
|
684
690
|
private:
|
685
691
|
const bool aes_is_fine_;
|
686
692
|
};
|
687
693
|
|
694
|
+
// CNsaCipherScorer prefers AES-256-GCM over AES-128-GCM over anything else.
|
695
|
+
class CNsaCipherScorer : public CipherScorer {
|
696
|
+
public:
|
697
|
+
virtual ~CNsaCipherScorer() override = default;
|
698
|
+
|
699
|
+
Score Evaluate(const SSL_CIPHER *a) const override {
|
700
|
+
if (a->id == TLS1_3_CK_AES_256_GCM_SHA384) {
|
701
|
+
return 3;
|
702
|
+
} else if (a->id == TLS1_3_CK_AES_128_GCM_SHA256) {
|
703
|
+
return 2;
|
704
|
+
}
|
705
|
+
return 1;
|
706
|
+
}
|
707
|
+
};
|
708
|
+
|
709
|
+
}
|
710
|
+
|
688
711
|
bool ssl_tls13_cipher_meets_policy(uint16_t cipher_id,
|
689
712
|
enum ssl_compliance_policy_t policy) {
|
690
713
|
switch (policy) {
|
691
714
|
case ssl_compliance_policy_none:
|
715
|
+
case ssl_compliance_policy_cnsa_202407:
|
692
716
|
return true;
|
693
717
|
|
694
718
|
case ssl_compliance_policy_fips_202205:
|
@@ -728,8 +752,12 @@ const SSL_CIPHER *ssl_choose_tls13_cipher(CBS cipher_suites, bool has_aes_hw,
|
|
728
752
|
}
|
729
753
|
|
730
754
|
const SSL_CIPHER *best = nullptr;
|
731
|
-
|
732
|
-
|
755
|
+
AesHwCipherScorer aes_hw_scorer(has_aes_hw);
|
756
|
+
CNsaCipherScorer cnsa_scorer;
|
757
|
+
CipherScorer *const scorer = (policy == ssl_compliance_policy_cnsa_202407)
|
758
|
+
? static_cast<CipherScorer*>(&cnsa_scorer)
|
759
|
+
: static_cast<CipherScorer*>(&aes_hw_scorer);
|
760
|
+
CipherScorer::Score best_score = CipherScorer::kMinScore;
|
733
761
|
|
734
762
|
while (CBS_len(&cipher_suites) > 0) {
|
735
763
|
uint16_t cipher_suite;
|
@@ -750,7 +778,7 @@ const SSL_CIPHER *ssl_choose_tls13_cipher(CBS cipher_suites, bool has_aes_hw,
|
|
750
778
|
continue;
|
751
779
|
}
|
752
780
|
|
753
|
-
const CipherScorer::Score candidate_score = scorer
|
781
|
+
const CipherScorer::Score candidate_score = scorer->Evaluate(candidate);
|
754
782
|
// |candidate_score| must be larger to displace the current choice. That way
|
755
783
|
// the client's order controls between ciphers with an equal score.
|
756
784
|
if (candidate_score > best_score) {
|
@@ -198,6 +198,26 @@ int tls_write_app_data(SSL *ssl, bool *out_needs_handshake,
|
|
198
198
|
}
|
199
199
|
}
|
200
200
|
|
201
|
+
// tls_seal_align_prefix_len returns the length of the prefix before the start
|
202
|
+
// of the bulk of the ciphertext when sealing a record with |ssl|. Callers may
|
203
|
+
// use this to align buffers.
|
204
|
+
//
|
205
|
+
// Note when TLS 1.0 CBC record-splitting is enabled, this includes the one byte
|
206
|
+
// record and is the offset into second record's ciphertext. Thus sealing a
|
207
|
+
// small record may result in a smaller output than this value.
|
208
|
+
//
|
209
|
+
// TODO(davidben): Is this alignment valuable? Record-splitting makes this a
|
210
|
+
// mess.
|
211
|
+
static size_t tls_seal_align_prefix_len(const SSL *ssl) {
|
212
|
+
size_t ret =
|
213
|
+
SSL3_RT_HEADER_LENGTH + ssl->s3->aead_write_ctx->ExplicitNonceLen();
|
214
|
+
if (ssl_needs_record_splitting(ssl)) {
|
215
|
+
ret += SSL3_RT_HEADER_LENGTH;
|
216
|
+
ret += ssl_cipher_get_record_split_len(ssl->s3->aead_write_ctx->cipher());
|
217
|
+
}
|
218
|
+
return ret;
|
219
|
+
}
|
220
|
+
|
201
221
|
// do_tls_write writes an SSL record of the given type. On success, it sets
|
202
222
|
// |*out_bytes_written| to number of bytes successfully written and returns one.
|
203
223
|
// On error, it returns a value <= 0 from the underlying |BIO|.
|
@@ -265,7 +285,7 @@ static int do_tls_write(SSL *ssl, size_t *out_bytes_written, uint8_t type,
|
|
265
285
|
return 1;
|
266
286
|
}
|
267
287
|
|
268
|
-
if (!buf->EnsureCap(pending_flight.size() +
|
288
|
+
if (!buf->EnsureCap(pending_flight.size() + tls_seal_align_prefix_len(ssl),
|
269
289
|
max_out)) {
|
270
290
|
return -1;
|
271
291
|
}
|
@@ -18,6 +18,7 @@
|
|
18
18
|
#include <string.h>
|
19
19
|
|
20
20
|
#include <openssl/aead.h>
|
21
|
+
#include <openssl/chacha.h>
|
21
22
|
#include <openssl/err.h>
|
22
23
|
#include <openssl/rand.h>
|
23
24
|
|
@@ -44,6 +45,7 @@ SSLAEADContext::SSLAEADContext(uint16_t version_arg, bool is_dtls_arg,
|
|
44
45
|
omit_length_in_ad_(false),
|
45
46
|
ad_is_header_(false) {
|
46
47
|
OPENSSL_memset(fixed_nonce_, 0, sizeof(fixed_nonce_));
|
48
|
+
CreateRecordNumberEncrypter();
|
47
49
|
}
|
48
50
|
|
49
51
|
SSLAEADContext::~SSLAEADContext() {}
|
@@ -145,6 +147,23 @@ UniquePtr<SSLAEADContext> SSLAEADContext::Create(
|
|
145
147
|
return aead_ctx;
|
146
148
|
}
|
147
149
|
|
150
|
+
void SSLAEADContext::CreateRecordNumberEncrypter() {
|
151
|
+
if (!cipher_) {
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
155
|
+
rn_encrypter_ = MakeUnique<NullRecordNumberEncrypter>();
|
156
|
+
#else
|
157
|
+
if (cipher_->algorithm_enc == SSL_AES128GCM) {
|
158
|
+
rn_encrypter_ = MakeUnique<AES128RecordNumberEncrypter>();
|
159
|
+
} else if (cipher_->algorithm_enc == SSL_AES256GCM) {
|
160
|
+
rn_encrypter_ = MakeUnique<AES256RecordNumberEncrypter>();
|
161
|
+
} else if (cipher_->algorithm_enc == SSL_CHACHA20POLY1305) {
|
162
|
+
rn_encrypter_ = MakeUnique<ChaChaRecordNumberEncrypter>();
|
163
|
+
}
|
164
|
+
#endif // BORINGSSL_UNSAFE_FUZZER_MODE
|
165
|
+
}
|
166
|
+
|
148
167
|
UniquePtr<SSLAEADContext> SSLAEADContext::CreatePlaceholderForQUIC(
|
149
168
|
uint16_t version, const SSL_CIPHER *cipher) {
|
150
169
|
return MakeUnique<SSLAEADContext>(version, false, cipher);
|
@@ -175,7 +194,7 @@ uint16_t SSLAEADContext::RecordVersion() const {
|
|
175
194
|
return version_;
|
176
195
|
}
|
177
196
|
|
178
|
-
return TLS1_2_VERSION;
|
197
|
+
return is_dtls_ ? DTLS1_2_VERSION : TLS1_2_VERSION;
|
179
198
|
}
|
180
199
|
|
181
200
|
size_t SSLAEADContext::ExplicitNonceLen() const {
|
@@ -427,4 +446,70 @@ bool SSLAEADContext::GetIV(const uint8_t **out_iv, size_t *out_iv_len) const {
|
|
427
446
|
EVP_AEAD_CTX_get_iv(ctx_.get(), out_iv, out_iv_len);
|
428
447
|
}
|
429
448
|
|
449
|
+
bool SSLAEADContext::GenerateRecordNumberMask(Span<uint8_t> out,
|
450
|
+
Span<const uint8_t> sample) {
|
451
|
+
if (!rn_encrypter_) {
|
452
|
+
return false;
|
453
|
+
}
|
454
|
+
return rn_encrypter_->GenerateMask(out, sample);
|
455
|
+
}
|
456
|
+
|
457
|
+
size_t AES128RecordNumberEncrypter::KeySize() { return 16; }
|
458
|
+
|
459
|
+
size_t AES256RecordNumberEncrypter::KeySize() { return 32; }
|
460
|
+
|
461
|
+
bool AESRecordNumberEncrypter::SetKey(Span<const uint8_t> key) {
|
462
|
+
return AES_set_encrypt_key(key.data(), key.size() * 8, &key_) == 0;
|
463
|
+
}
|
464
|
+
|
465
|
+
bool AESRecordNumberEncrypter::GenerateMask(Span<uint8_t> out,
|
466
|
+
Span<const uint8_t> sample) {
|
467
|
+
if (sample.size() < AES_BLOCK_SIZE || out.size() != AES_BLOCK_SIZE) {
|
468
|
+
return false;
|
469
|
+
}
|
470
|
+
AES_encrypt(sample.data(), out.data(), &key_);
|
471
|
+
return true;
|
472
|
+
}
|
473
|
+
|
474
|
+
size_t ChaChaRecordNumberEncrypter::KeySize() { return kKeySize; }
|
475
|
+
|
476
|
+
bool ChaChaRecordNumberEncrypter::SetKey(Span<const uint8_t> key) {
|
477
|
+
if (key.size() != kKeySize) {
|
478
|
+
return false;
|
479
|
+
}
|
480
|
+
OPENSSL_memcpy(key_, key.data(), key.size());
|
481
|
+
return true;
|
482
|
+
}
|
483
|
+
|
484
|
+
bool ChaChaRecordNumberEncrypter::GenerateMask(Span<uint8_t> out,
|
485
|
+
Span<const uint8_t> sample) {
|
486
|
+
Array<uint8_t> zeroes;
|
487
|
+
if (!zeroes.Init(out.size())) {
|
488
|
+
return false;
|
489
|
+
}
|
490
|
+
OPENSSL_memset(zeroes.data(), 0, zeroes.size());
|
491
|
+
// RFC 9147 section 4.2.3 uses the first 4 bytes of the sample as the counter
|
492
|
+
// and the next 12 bytes as the nonce. If we have less than 4+12=16 bytes in
|
493
|
+
// the sample, then we'll read past the end of the |sample| buffer.
|
494
|
+
if (sample.size() < 16) {
|
495
|
+
return false;
|
496
|
+
}
|
497
|
+
uint32_t counter = CRYPTO_load_u32_be(sample.data());
|
498
|
+
Span<const uint8_t> nonce = sample.subspan(4);
|
499
|
+
CRYPTO_chacha_20(out.data(), zeroes.data(), zeroes.size(), key_, nonce.data(),
|
500
|
+
counter);
|
501
|
+
return true;
|
502
|
+
}
|
503
|
+
|
504
|
+
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
505
|
+
size_t NullRecordNumberEncrypter::KeySize() { return 0; }
|
506
|
+
bool NullRecordNumberEncrypter::SetKey(Span<const uint8_t> key) { return true; }
|
507
|
+
|
508
|
+
bool NullRecordNumberEncrypter::GenerateMask(Span<uint8_t> out,
|
509
|
+
Span<const uint8_t> sample) {
|
510
|
+
OPENSSL_memset(out.data(), 0, out.size());
|
511
|
+
return true;
|
512
|
+
}
|
513
|
+
#endif // BORINGSSL_UNSAFE_FUZZER_MODE
|
514
|
+
|
430
515
|
BSSL_NAMESPACE_END
|