grpc 1.84.0 → 1.85.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +40 -27
- data/include/grpc/event_engine/memory_allocator.h +1 -0
- data/include/grpc/grpc.h +3 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +4 -0
- data/src/core/call/call_filters.h +10 -10
- data/src/core/{lib/security/authorization → call}/evaluate_args.cc +22 -1
- data/src/core/{lib/security/authorization → call}/evaluate_args.h +19 -5
- data/src/core/call/filter_fusion.h +15 -15
- data/src/core/call/interception_chain.h +3 -3
- data/src/core/call/metadata_batch.cc +1 -0
- data/src/core/call/metadata_batch.h +45 -33
- data/src/core/call/parsed_metadata.h +3 -3
- data/src/core/call/request_buffer.cc +6 -6
- data/src/core/call/request_buffer.h +1 -1
- data/src/core/channelz/channel_trace.cc +5 -5
- data/src/core/channelz/channel_trace.h +1 -1
- data/src/core/channelz/channelz.cc +9 -9
- data/src/core/channelz/channelz.h +12 -12
- data/src/core/channelz/channelz_registry.cc +10 -10
- data/src/core/channelz/ztrace_collector.h +5 -5
- data/src/core/client_channel/client_channel.cc +4 -4
- data/src/core/client_channel/client_channel_filter.cc +14 -14
- data/src/core/client_channel/global_subchannel_pool.cc +4 -4
- data/src/core/client_channel/subchannel.cc +24 -23
- data/src/core/client_channel/subchannel_stream_client.cc +5 -5
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +7 -7
- data/src/core/credentials/call/external/aws_request_signer.cc +16 -0
- data/src/core/credentials/call/external/external_account_credentials.cc +4 -4
- data/src/core/credentials/call/regional_access_boundary_fetcher.cc +9 -9
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +4 -4
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -3
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +1 -1
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +9 -9
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +1 -1
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +6 -6
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.cc +3 -3
- data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +4 -4
- data/src/core/credentials/transport/tls/ssl_utils.cc +10 -0
- data/src/core/credentials/transport/tls/tls_security_connector.cc +10 -10
- data/src/core/credentials/transport/tls/tls_security_connector.h +6 -6
- data/src/core/credentials/transport/tls/tls_utils.h +9 -0
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +1 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +1 -1
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +2 -2
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +1 -1
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +15 -0
- data/src/core/ext/filters/rbac/rbac_filter.h +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +5 -5
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +30 -21
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +5 -11
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +14 -11
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +0 -4
- data/src/core/ext/transport/chttp2/transport/frame.h +9 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +12 -9
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +4 -2
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +16 -18
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +2 -1
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +277 -189
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +40 -17
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +12 -24
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +3 -29
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/read_context.h +96 -3
- data/src/core/ext/transport/chttp2/transport/reclaimer.cc +32 -0
- data/src/core/ext/transport/chttp2/transport/reclaimer.h +64 -0
- data/src/core/ext/transport/chttp2/transport/security_frame.h +8 -8
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +17 -9
- data/src/core/ext/transport/chttp2/transport/write_cycle.h +23 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +5 -5
- data/src/core/ext/upb-gen/grpc/channelz/v1/channelz.upb.h +137 -73
- data/src/core/ext/upb-gen/grpc/channelz/v1/channelz.upb_minitable.c +45 -25
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/altscontext.upb.h +6 -6
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/altscontext.upb_minitable.c +4 -4
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/altscontext.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/handshaker.upb.h +46 -26
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/handshaker.upb_minitable.c +17 -14
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/handshaker.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/transport_security_common.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/transport_security_common.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/gcp/transport_security_common.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/grpc/health/v1/health.upb.h +329 -0
- data/src/core/ext/upb-gen/grpc/health/v1/health.upb_minitable.c +128 -0
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/health/v1/health.upb_minitable.h +8 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lb/v1/load_balancer.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lb/v1/load_balancer.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lb/v1/load_balancer.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls.upb.h +185 -23
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls.upb_minitable.c +20 -12
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls.upb_minitable.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls_config.upb.h +58 -42
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls_config.upb_minitable.c +17 -12
- data/src/core/ext/upb-gen/{src/proto/grpc → grpc}/lookup/v1/rls_config.upb_minitable.h +5 -5
- data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +567 -549
- data/src/core/ext/upbdefs-gen/grpc/lookup/v1/rls_config.upbdefs.c +182 -0
- data/src/core/ext/upbdefs-gen/{src/proto/grpc → grpc}/lookup/v1/rls_config.upbdefs.h +14 -14
- data/src/core/filter/ext_proc/ext_proc_filter.cc +1603 -46
- data/src/core/filter/ext_proc/ext_proc_filter.h +55 -22
- data/src/core/filter/ext_proc/ext_proc_messages.cc +106 -51
- data/src/core/filter/ext_proc/ext_proc_messages.h +36 -9
- data/src/core/handshaker/handshaker.cc +4 -4
- data/src/core/handshaker/http_connect/http_connect_client_handshaker.cc +3 -3
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +10 -10
- data/src/core/handshaker/security/secure_endpoint.cc +13 -13
- data/src/core/handshaker/security/security_handshaker.cc +6 -6
- data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +4 -4
- data/src/core/lib/channel/channel_args.cc +20 -0
- data/src/core/lib/channel/channel_args.h +17 -17
- data/src/core/lib/channel/promise_based_filter.cc +2 -2
- data/src/core/lib/channel/promise_based_filter.h +66 -27
- data/src/core/lib/debug/trace_flags.cc +2 -0
- data/src/core/lib/debug/trace_flags.h +1 -0
- data/src/core/lib/event_engine/ares_resolver.cc +14 -14
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +7 -7
- data/src/core/lib/event_engine/cf_engine/cfsocket_listener.cc +4 -4
- data/src/core/lib/event_engine/default_event_engine.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +9 -9
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +16 -14
- data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +6 -6
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +7 -7
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +17 -17
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/timer.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +1 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.cc +1 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.h +3 -3
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +50 -21
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +3 -3
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +3 -3
- data/src/core/lib/event_engine/windows/windows_engine.cc +15 -15
- data/src/core/lib/event_engine/windows/windows_listener.cc +6 -6
- data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +6 -6
- data/src/core/lib/experiments/experiments.cc +48 -0
- data/src/core/lib/experiments/experiments.h +24 -0
- data/src/core/lib/iomgr/buffer_list.cc +3 -3
- data/src/core/lib/iomgr/buffer_list.h +1 -1
- data/src/core/lib/iomgr/combiner.cc +0 -1
- data/src/core/lib/iomgr/ev_apple.cc +4 -4
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_posix.cc +7 -7
- data/src/core/lib/promise/activity.cc +1 -1
- data/src/core/lib/promise/activity.h +1 -1
- data/src/core/lib/promise/arena_promise.h +7 -7
- data/src/core/lib/promise/detail/promise_factory.h +8 -8
- data/src/core/lib/promise/detail/promise_like.h +4 -4
- data/src/core/lib/promise/inter_activity_latch.h +6 -6
- data/src/core/lib/promise/inter_activity_pipe.h +1 -1
- data/src/core/lib/promise/observable.h +3 -3
- data/src/core/lib/promise/party.cc +1 -1
- data/src/core/lib/promise/try_seq.h +2 -2
- data/src/core/lib/resource_quota/arena.h +3 -3
- data/src/core/lib/resource_quota/memory_quota.cc +16 -16
- data/src/core/lib/resource_quota/memory_quota.h +1 -1
- data/src/core/lib/resource_quota/thread_quota.cc +3 -3
- data/src/core/lib/security/authorization/audit_logging.cc +5 -5
- data/src/core/lib/security/authorization/authorization_engine.h +1 -1
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +1 -1
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +1 -1
- data/src/core/lib/security/authorization/grpc_server_authz_filter.h +1 -1
- data/src/core/lib/security/authorization/matchers.h +1 -1
- data/src/core/lib/surface/call.cc +8 -7
- data/src/core/lib/surface/call.h +3 -3
- data/src/core/lib/surface/call_utils.h +4 -0
- data/src/core/lib/surface/channel.cc +1 -1
- data/src/core/lib/surface/channel.h +1 -1
- data/src/core/lib/surface/channel_init.cc +1 -1
- data/src/core/lib/surface/init.cc +7 -7
- data/src/core/lib/surface/lame_client.cc +1 -1
- data/src/core/lib/surface/legacy_channel.cc +2 -2
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/transport_framing_endpoint_extension.h +3 -3
- data/src/core/load_balancing/autosharding/autosharding.cc +931 -0
- data/src/core/load_balancing/autosharding/autosharding.h +78 -0
- data/src/core/load_balancing/grpclb/grpclb_client_stats.cc +2 -2
- data/src/core/load_balancing/grpclb/load_balancer_api.cc +1 -1
- data/src/core/load_balancing/grpclb/load_balancer_api.h +3 -1
- data/src/core/load_balancing/health_check_client.cc +7 -7
- data/src/core/load_balancing/lb_policy.cc +1 -1
- data/src/core/load_balancing/oob_backend_metric.cc +5 -5
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +2 -2
- data/src/core/load_balancing/ring_hash/ring_hash.cc +109 -37
- data/src/core/load_balancing/rls/rls.cc +23 -17
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +10 -10
- data/src/core/load_balancing/xds/cds.cc +6 -5
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +2 -2
- data/src/core/load_balancing/xds/xds_override_host.cc +10 -10
- data/src/core/mitigation_engine/mitigation_engine.h +28 -4
- data/src/core/plugin_registry/grpc_plugin_registry.cc +2 -0
- data/src/core/resolver/dns/dns_resolver.cc +7 -7
- data/src/core/resolver/fake/fake_resolver.cc +5 -5
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +38 -30
- data/src/core/server/server.cc +30 -30
- data/src/core/server/server.h +4 -3
- data/src/core/server/server_config_selector_filter.cc +3 -3
- data/src/core/server/xds_server_config_fetcher_legacy.cc +15 -15
- data/src/core/telemetry/default_tcp_tracer.cc +1 -1
- data/src/core/telemetry/instrument.cc +30 -16
- data/src/core/telemetry/instrument.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +4 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +1 -1
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +5 -5
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +3 -3
- data/src/core/tsi/ssl_transport_security.cc +46 -13
- data/src/core/tsi/ssl_transport_security.h +7 -0
- data/src/core/tsi/ssl_transport_security_utils.cc +16 -6
- data/src/core/util/event_log.cc +3 -3
- data/src/core/util/http_client/httpcli.cc +5 -5
- data/src/core/util/http_client/httpcli.h +1 -1
- data/src/core/util/json/json_object_loader.cc +7 -0
- data/src/core/util/json/json_object_loader.h +17 -2
- data/src/core/util/latent_see.cc +123 -36
- data/src/core/util/latent_see.h +14 -1
- data/src/core/util/mpscq.cc +1 -1
- data/src/core/util/notification.h +4 -4
- data/src/core/util/sync.h +20 -6
- data/src/core/util/table.h +20 -22
- data/src/core/util/work_serializer.cc +2 -2
- data/src/core/xds/grpc/blackboard.cc +4 -3
- data/src/core/xds/grpc/certificate_provider_store.cc +2 -2
- data/src/core/xds/grpc/streaming_call_promise_wrapper.cc +181 -0
- data/src/core/xds/grpc/streaming_call_promise_wrapper.h +213 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +2 -2
- data/src/core/xds/grpc/xds_client_grpc.cc +8 -8
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
- data/src/core/xds/grpc/xds_endpoint.cc +1 -1
- data/src/core/xds/grpc/xds_endpoint_parser.cc +11 -0
- data/src/core/xds/grpc/xds_grpc_service_parser.cc +12 -10
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +17 -14
- data/src/core/xds/grpc/xds_matcher.h +2 -2
- data/src/core/xds/grpc/xds_transport_grpc.cc +125 -85
- data/src/core/xds/grpc/xds_transport_grpc.h +19 -4
- data/src/core/xds/xds_client/lrs_client.cc +22 -19
- data/src/core/xds/xds_client/xds_client.cc +19 -16
- data/src/core/xds/xds_client/xds_transport.h +49 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/README.md +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +1 -1
- data/third_party/abseil-cpp/absl/algorithm/algorithm.h +34 -2
- data/third_party/abseil-cpp/absl/algorithm/container.h +345 -147
- data/third_party/abseil-cpp/absl/base/attributes.h +67 -44
- data/third_party/abseil-cpp/absl/base/call_once.h +1 -0
- data/third_party/abseil-cpp/absl/base/casts.cc +61 -0
- data/third_party/abseil-cpp/absl/base/casts.h +135 -2
- data/third_party/abseil-cpp/absl/base/config.h +63 -41
- data/third_party/abseil-cpp/absl/base/fast_type_id.h +30 -2
- data/third_party/abseil-cpp/absl/base/internal/dynamic_annotations.h +1 -1
- data/third_party/abseil-cpp/absl/base/internal/hardening.h +136 -0
- data/third_party/abseil-cpp/absl/base/internal/iterator_traits.h +6 -2
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +39 -4
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +6 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +77 -15
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +3 -4
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +26 -24
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +74 -29
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +1 -11
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +52 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +5 -1
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +5 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +1 -1
- data/third_party/abseil-cpp/absl/base/macros.h +76 -37
- data/third_party/abseil-cpp/absl/base/nullability.h +5 -5
- data/third_party/abseil-cpp/absl/base/optimization.h +4 -5
- data/third_party/abseil-cpp/absl/base/options.h +46 -18
- data/third_party/abseil-cpp/absl/base/policy_checks.h +5 -5
- data/third_party/abseil-cpp/absl/base/{internal/throw_delegate.cc → throw_delegate.cc} +9 -7
- data/third_party/abseil-cpp/absl/base/{internal/throw_delegate.h → throw_delegate.h} +4 -14
- data/third_party/abseil-cpp/absl/cleanup/cleanup.h +7 -2
- data/third_party/abseil-cpp/absl/cleanup/internal/cleanup.h +3 -2
- data/third_party/abseil-cpp/absl/container/btree_map.h +60 -10
- data/third_party/abseil-cpp/absl/container/btree_set.h +61 -15
- data/third_party/abseil-cpp/absl/container/fixed_array.h +19 -21
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +49 -27
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +50 -26
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +42 -36
- data/third_party/abseil-cpp/absl/container/internal/btree.h +32 -24
- data/third_party/abseil-cpp/absl/container/internal/btree_container.h +30 -22
- data/third_party/abseil-cpp/absl/container/internal/common.h +57 -5
- data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +1 -1
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +40 -36
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +119 -39
- data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +14 -2
- data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +14 -22
- data/third_party/abseil-cpp/absl/container/internal/hashtable_control_bytes.h +52 -52
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +7 -7
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +7 -7
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +32 -40
- data/third_party/abseil-cpp/absl/container/internal/layout.h +13 -13
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +95 -72
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +633 -365
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1016 -749
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set_resize_impl.h +0 -1
- data/third_party/abseil-cpp/absl/container/node_hash_map.h +58 -35
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +23 -6
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.h +7 -1
- data/third_party/abseil-cpp/absl/crc/internal/crc.cc +4 -6
- data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +41 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +0 -16
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_arm_combined.cc +5 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +304 -188
- data/third_party/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +4 -2
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +2 -2
- data/third_party/abseil-cpp/absl/debugging/internal/demangle_rust.h +8 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +4 -4
- data/third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc +15 -1
- data/third_party/abseil-cpp/absl/debugging/internal/examine_stack.h +7 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +12 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +6 -5
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +13 -11
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +14 -7
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +3 -2
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +6 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +14 -8
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +48 -38
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +4 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +63 -118
- data/third_party/abseil-cpp/absl/debugging/stacktrace.h +7 -47
- data/third_party/abseil-cpp/absl/debugging/symbolize.cc +20 -2
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +83 -149
- data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +4 -17
- data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +4 -4
- data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +2 -4
- data/third_party/abseil-cpp/absl/flags/commandlineflag.h +8 -6
- data/third_party/abseil-cpp/absl/flags/declare.h +9 -0
- data/third_party/abseil-cpp/absl/flags/flag.h +2 -1
- data/third_party/abseil-cpp/absl/flags/internal/commandlineflag.h +1 -1
- data/third_party/abseil-cpp/absl/flags/internal/flag.cc +19 -18
- data/third_party/abseil-cpp/absl/flags/internal/flag.h +33 -34
- data/third_party/abseil-cpp/absl/flags/internal/program_name.cc +2 -2
- data/third_party/abseil-cpp/absl/flags/marshalling.cc +1 -16
- data/third_party/abseil-cpp/absl/flags/marshalling.h +2 -28
- data/third_party/abseil-cpp/absl/flags/reflection.cc +11 -7
- data/third_party/abseil-cpp/absl/flags/usage_config.cc +2 -2
- data/third_party/abseil-cpp/absl/functional/any_invocable.h +22 -19
- data/third_party/abseil-cpp/absl/functional/bind_front.h +7 -1
- data/third_party/abseil-cpp/absl/functional/function_ref.h +125 -20
- data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +43 -31
- data/third_party/abseil-cpp/absl/functional/internal/front_binder.h +4 -4
- data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +44 -6
- data/third_party/abseil-cpp/absl/hash/hash.h +1 -1
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +39 -51
- data/third_party/abseil-cpp/absl/hash/internal/hash.cc +379 -14
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +457 -353
- data/third_party/abseil-cpp/absl/log/absl_vlog_is_on.h +0 -2
- data/third_party/abseil-cpp/absl/log/internal/check_impl.h +2 -1
- data/third_party/abseil-cpp/absl/log/internal/check_op.cc +4 -0
- data/third_party/abseil-cpp/absl/log/internal/check_op.h +128 -50
- data/third_party/abseil-cpp/absl/log/internal/conditions.h +38 -35
- data/third_party/abseil-cpp/absl/log/internal/log_impl.h +108 -110
- data/third_party/abseil-cpp/absl/log/internal/log_message.cc +10 -6
- data/third_party/abseil-cpp/absl/log/internal/log_message.h +19 -1
- data/third_party/abseil-cpp/absl/log/internal/log_sink_set.cc +4 -4
- data/third_party/abseil-cpp/absl/log/internal/nullstream.h +1 -1
- data/third_party/abseil-cpp/absl/log/internal/proto.cc +13 -0
- data/third_party/abseil-cpp/absl/log/internal/strip.h +30 -31
- data/third_party/abseil-cpp/absl/log/internal/structured_proto.cc +5 -5
- data/third_party/abseil-cpp/absl/log/internal/structured_proto.h +6 -5
- data/third_party/abseil-cpp/absl/log/internal/vlog_config.cc +30 -30
- data/third_party/abseil-cpp/absl/log/internal/vlog_config.h +0 -1
- data/third_party/abseil-cpp/absl/log/log.h +2 -2
- data/third_party/abseil-cpp/absl/log/log_entry.cc +263 -0
- data/third_party/abseil-cpp/absl/log/log_entry.h +2 -0
- data/third_party/abseil-cpp/absl/log/vlog_is_on.h +0 -2
- data/third_party/abseil-cpp/absl/memory/memory.h +55 -5
- data/third_party/abseil-cpp/absl/meta/type_traits.h +161 -56
- data/third_party/abseil-cpp/absl/numeric/int128.h +41 -21
- data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +16 -22
- data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +5 -7
- data/third_party/abseil-cpp/absl/numeric/internal/bits.h +32 -4
- data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +9 -9
- data/third_party/abseil-cpp/absl/random/beta_distribution.h +2 -2
- data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +26 -53
- data/third_party/abseil-cpp/absl/random/discrete_distribution.h +1 -1
- data/third_party/abseil-cpp/absl/random/distributions.h +17 -17
- data/third_party/abseil-cpp/absl/random/exponential_distribution.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +8 -21
- data/third_party/abseil-cpp/absl/random/internal/entropy_pool.cc +2 -2
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/generate_real.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +2 -2
- data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +2 -2
- data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +6 -6
- data/third_party/abseil-cpp/absl/random/internal/platform.h +0 -13
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +6 -6
- data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +2 -2
- data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +6 -5
- data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +5 -31
- data/third_party/abseil-cpp/absl/random/internal/seed_material.h +2 -1
- data/third_party/abseil-cpp/absl/random/internal/traits.h +21 -0
- data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +23 -23
- data/third_party/abseil-cpp/absl/random/mocking_access.h +74 -0
- data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +1 -1
- data/third_party/abseil-cpp/absl/status/internal/status_internal.cc +63 -18
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +30 -4
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +225 -63
- data/third_party/abseil-cpp/absl/status/status.cc +66 -70
- data/third_party/abseil-cpp/absl/status/status.h +254 -23
- data/third_party/abseil-cpp/absl/status/status_payload_printer.h +3 -2
- data/third_party/abseil-cpp/absl/status/statusor.h +117 -137
- data/third_party/abseil-cpp/absl/strings/ascii.h +10 -6
- data/third_party/abseil-cpp/absl/strings/cord.cc +41 -17
- data/third_party/abseil-cpp/absl/strings/cord.h +26 -17
- data/third_party/abseil-cpp/absl/strings/cord_buffer.h +4 -2
- data/third_party/abseil-cpp/absl/strings/escaping.cc +305 -125
- data/third_party/abseil-cpp/absl/strings/escaping.h +12 -2
- data/third_party/abseil-cpp/absl/strings/internal/append_and_overwrite.h +93 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc +6 -6
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +27 -21
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +11 -19
- data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc +6 -0
- data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.h +1 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +0 -141
- data/third_party/abseil-cpp/absl/strings/internal/escaping.h +2 -24
- data/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h +31 -36
- data/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h +39 -39
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +14 -22
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +2 -4
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +921 -231
- data/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h +18 -16
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +16 -12
- data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.h +12 -0
- data/third_party/abseil-cpp/absl/strings/numbers.cc +477 -8
- data/third_party/abseil-cpp/absl/strings/numbers.h +29 -12
- data/third_party/abseil-cpp/absl/strings/resize_and_overwrite.h +198 -0
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +96 -91
- data/third_party/abseil-cpp/absl/strings/str_cat.h +53 -13
- data/third_party/abseil-cpp/absl/strings/str_split.h +14 -9
- data/third_party/abseil-cpp/absl/strings/string_view.h +10 -716
- data/third_party/abseil-cpp/absl/strings/substitute.cc +24 -24
- data/third_party/abseil-cpp/absl/strings/substitute.h +2 -2
- data/third_party/abseil-cpp/absl/synchronization/barrier.cc +1 -1
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +2 -2
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +24 -3
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +30 -33
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +2 -2
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +5 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +41 -29
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +199 -94
- data/third_party/abseil-cpp/absl/synchronization/notification.cc +5 -5
- data/third_party/abseil-cpp/absl/synchronization/notification.h +1 -1
- data/third_party/abseil-cpp/absl/time/clock.cc +29 -30
- data/third_party/abseil-cpp/absl/time/clock.h +3 -0
- data/third_party/abseil-cpp/absl/time/duration.cc +2 -2
- data/third_party/abseil-cpp/absl/time/format.cc +3 -10
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +12 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +131 -91
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +6 -103
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.cc +185 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.h +37 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +10 -15
- data/third_party/abseil-cpp/absl/time/time.cc +4 -4
- data/third_party/abseil-cpp/absl/time/time.h +14 -13
- data/third_party/abseil-cpp/absl/types/compare.h +64 -63
- data/third_party/abseil-cpp/absl/types/internal/span.h +6 -6
- data/third_party/abseil-cpp/absl/types/optional.h +31 -4
- data/third_party/abseil-cpp/absl/types/optional_ref.h +295 -0
- data/third_party/{boringssl-with-bazel/crypto/x509/x_val.cc → abseil-cpp/absl/types/source_location.cc} +4 -14
- data/third_party/abseil-cpp/absl/types/source_location.h +172 -0
- data/third_party/abseil-cpp/absl/types/span.h +67 -38
- data/third_party/abseil-cpp/absl/types/variant.h +75 -18
- data/third_party/abseil-cpp/absl/utility/utility.h +112 -16
- data/third_party/boringssl-with-bazel/crypto/aes/aes.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/armv8_feature_parsing.h +67 -0
- data/third_party/boringssl-with-bazel/crypto/asn1/a_bitstr.cc +143 -105
- data/third_party/boringssl-with-bazel/crypto/asn1/a_bool.cc +5 -8
- data/third_party/boringssl-with-bazel/crypto/asn1/a_d2i_fp.cc +3 -3
- data/third_party/boringssl-with-bazel/crypto/asn1/a_dup.cc +6 -6
- data/third_party/boringssl-with-bazel/crypto/asn1/a_gentm.cc +33 -12
- data/third_party/boringssl-with-bazel/crypto/asn1/a_i2d_fp.cc +7 -6
- data/third_party/boringssl-with-bazel/crypto/asn1/a_int.cc +80 -52
- data/third_party/boringssl-with-bazel/crypto/asn1/a_mbstr.cc +7 -4
- data/third_party/boringssl-with-bazel/crypto/asn1/a_object.cc +70 -72
- data/third_party/boringssl-with-bazel/crypto/asn1/a_strex.cc +38 -42
- data/third_party/boringssl-with-bazel/crypto/asn1/a_strnid.cc +41 -39
- data/third_party/boringssl-with-bazel/crypto/asn1/a_time.cc +59 -35
- data/third_party/boringssl-with-bazel/crypto/asn1/a_type.cc +275 -15
- data/third_party/boringssl-with-bazel/crypto/asn1/a_utctm.cc +32 -13
- data/third_party/boringssl-with-bazel/crypto/asn1/asn1_lib.cc +128 -30
- data/third_party/boringssl-with-bazel/crypto/asn1/asn_pack.cc +10 -10
- data/third_party/boringssl-with-bazel/crypto/asn1/f_int.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/asn1/f_string.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/asn1/internal.h +261 -115
- data/third_party/boringssl-with-bazel/crypto/asn1/posix_time.cc +8 -5
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_dec.cc +373 -725
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_enc.cc +211 -526
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_fre.cc +22 -19
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_new.cc +26 -24
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_typ.cc +19 -5
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_utl.cc +47 -51
- data/third_party/boringssl-with-bazel/crypto/base64/base64.cc +14 -15
- data/third_party/boringssl-with-bazel/crypto/bcm_support.h +7 -29
- data/third_party/boringssl-with-bazel/crypto/bio/bio.cc +234 -176
- data/third_party/boringssl-with-bazel/crypto/bio/bio_mem.cc +72 -86
- data/third_party/boringssl-with-bazel/crypto/bio/connect.cc +153 -199
- data/third_party/boringssl-with-bazel/crypto/bio/errno.cc +3 -1
- data/third_party/boringssl-with-bazel/crypto/bio/fd.cc +56 -55
- data/third_party/boringssl-with-bazel/crypto/bio/file.cc +70 -78
- data/third_party/boringssl-with-bazel/crypto/bio/hexdump.cc +6 -4
- data/third_party/boringssl-with-bazel/crypto/bio/internal.h +69 -17
- data/third_party/boringssl-with-bazel/crypto/bio/pair.cc +117 -136
- data/third_party/boringssl-with-bazel/crypto/bio/printf.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/bio/socket.cc +116 -50
- data/third_party/boringssl-with-bazel/crypto/bio/socket_helper.cc +53 -5
- data/third_party/boringssl-with-bazel/crypto/blake2/blake2.cc +9 -5
- data/third_party/boringssl-with-bazel/crypto/bn/bn_asn1.cc +2 -2
- data/third_party/boringssl-with-bazel/crypto/bn/convert.cc +56 -70
- data/third_party/boringssl-with-bazel/crypto/bn/div.cc +102 -0
- data/third_party/boringssl-with-bazel/crypto/bn/exponentiation.cc +26 -42
- data/third_party/boringssl-with-bazel/crypto/bn/sqrt.cc +93 -0
- data/third_party/boringssl-with-bazel/crypto/buf/buf.cc +6 -5
- data/third_party/boringssl-with-bazel/crypto/bytestring/asn1_compat.cc +6 -5
- data/third_party/boringssl-with-bazel/crypto/bytestring/ber.cc +22 -20
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbb.cc +119 -59
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbs.cc +115 -31
- data/third_party/boringssl-with-bazel/crypto/bytestring/internal.h +79 -24
- data/third_party/boringssl-with-bazel/crypto/bytestring/unicode.cc +2 -2
- data/third_party/boringssl-with-bazel/crypto/chacha/chacha.cc +5 -3
- data/third_party/boringssl-with-bazel/crypto/chacha/internal.h +23 -22
- data/third_party/boringssl-with-bazel/crypto/cipher/derive_key.cc +14 -18
- data/third_party/boringssl-with-bazel/crypto/cipher/e_aesctrhmac.cc +73 -58
- data/third_party/boringssl-with-bazel/crypto/cipher/e_aeseax.cc +132 -70
- data/third_party/boringssl-with-bazel/crypto/cipher/e_aesgcmsiv.cc +390 -249
- data/third_party/boringssl-with-bazel/crypto/cipher/e_chacha20poly1305.cc +200 -137
- data/third_party/boringssl-with-bazel/crypto/cipher/e_des.cc +45 -29
- data/third_party/boringssl-with-bazel/crypto/cipher/e_null.cc +9 -5
- data/third_party/boringssl-with-bazel/crypto/cipher/e_rc2.cc +43 -28
- data/third_party/boringssl-with-bazel/crypto/cipher/e_rc4.cc +7 -5
- data/third_party/boringssl-with-bazel/crypto/cipher/e_tls.cc +250 -237
- data/third_party/boringssl-with-bazel/crypto/cipher/get_cipher.cc +12 -12
- data/third_party/boringssl-with-bazel/crypto/cipher/internal.h +59 -59
- data/third_party/boringssl-with-bazel/crypto/cipher/tls_cbc.cc +111 -111
- data/third_party/boringssl-with-bazel/crypto/cms/cms.cc +48 -42
- data/third_party/boringssl-with-bazel/crypto/conf/conf.cc +69 -63
- data/third_party/boringssl-with-bazel/crypto/conf/internal.h +11 -12
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_apple.cc +8 -5
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_fuchsia.cc +6 -1
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_linux.cc +7 -1
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_openbsd.cc +7 -21
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_sysreg.cc +15 -41
- data/third_party/boringssl-with-bazel/crypto/cpu_aarch64_win.cc +16 -3
- data/third_party/boringssl-with-bazel/crypto/cpu_arm_freebsd.cc +4 -2
- data/third_party/boringssl-with-bazel/crypto/cpu_arm_linux.cc +54 -31
- data/third_party/boringssl-with-bazel/crypto/cpu_arm_linux.h +79 -101
- data/third_party/boringssl-with-bazel/crypto/cpu_intel.cc +51 -45
- data/third_party/boringssl-with-bazel/crypto/crypto.cc +26 -55
- data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519.cc +28 -25
- data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519_tables.h +6 -6
- data/third_party/boringssl-with-bazel/crypto/curve25519/internal.h +14 -15
- data/third_party/boringssl-with-bazel/crypto/curve25519/spake25519.cc +23 -20
- data/third_party/boringssl-with-bazel/crypto/des/des.cc +27 -19
- data/third_party/boringssl-with-bazel/crypto/des/internal.h +4 -9
- data/third_party/boringssl-with-bazel/crypto/dh/dh_asn1.cc +34 -49
- data/third_party/boringssl-with-bazel/crypto/dh/params.cc +44 -41
- data/third_party/boringssl-with-bazel/crypto/digest/digest_extra.cc +87 -40
- data/third_party/boringssl-with-bazel/crypto/dsa/dsa.cc +237 -260
- data/third_party/boringssl-with-bazel/crypto/dsa/dsa_asn1.cc +100 -173
- data/third_party/boringssl-with-bazel/crypto/dsa/internal.h +23 -21
- data/third_party/boringssl-with-bazel/crypto/ec/ec_asn1.cc +181 -209
- data/third_party/boringssl-with-bazel/crypto/ec/ec_derive.cc +26 -28
- data/third_party/boringssl-with-bazel/crypto/ec/hash_to_curve.cc +265 -174
- data/third_party/boringssl-with-bazel/crypto/ec/internal.h +54 -18
- data/third_party/boringssl-with-bazel/crypto/ecdh/ecdh.cc +7 -5
- data/third_party/boringssl-with-bazel/crypto/ecdsa/ecdsa_asn1.cc +50 -70
- data/third_party/boringssl-with-bazel/crypto/ecdsa/ecdsa_p1363.cc +54 -0
- data/third_party/boringssl-with-bazel/crypto/engine/engine.cc +7 -7
- data/third_party/boringssl-with-bazel/crypto/err/err.cc +116 -105
- data/third_party/boringssl-with-bazel/crypto/err/internal.h +8 -21
- data/third_party/boringssl-with-bazel/crypto/evp/evp.cc +238 -166
- data/third_party/boringssl-with-bazel/crypto/evp/evp_asn1.cc +202 -234
- data/third_party/boringssl-with-bazel/crypto/evp/evp_ctx.cc +260 -159
- data/third_party/boringssl-with-bazel/crypto/evp/evp_kem.cc +82 -0
- data/third_party/boringssl-with-bazel/crypto/evp/internal.h +292 -137
- data/third_party/boringssl-with-bazel/crypto/evp/p_dh.cc +198 -25
- data/third_party/boringssl-with-bazel/crypto/evp/p_dsa.cc +333 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_ec.cc +427 -42
- data/third_party/boringssl-with-bazel/crypto/evp/p_ed25519.cc +270 -14
- data/third_party/boringssl-with-bazel/crypto/evp/p_hkdf.cc +70 -102
- data/third_party/boringssl-with-bazel/crypto/evp/p_mldsa.cc +549 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_mlkem.cc +485 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_rsa.cc +666 -158
- data/third_party/boringssl-with-bazel/crypto/evp/p_x25519.cc +290 -28
- data/third_party/boringssl-with-bazel/crypto/evp/p_xwing.cc +273 -0
- data/third_party/boringssl-with-bazel/crypto/evp/pbkdf.cc +14 -7
- data/third_party/boringssl-with-bazel/crypto/evp/print.cc +34 -89
- data/third_party/boringssl-with-bazel/crypto/evp/scrypt.cc +23 -21
- data/third_party/boringssl-with-bazel/crypto/evp/sign.cc +23 -42
- data/third_party/boringssl-with-bazel/crypto/ex_data.cc +40 -41
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/aes.cc.inc +34 -28
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/aes_nohw.cc.inc +119 -121
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/cbc.cc.inc +16 -14
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/cfb.cc.inc +12 -10
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/ctr.cc.inc +7 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/gcm.cc.inc +39 -29
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/gcm_nohw.cc.inc +15 -13
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/internal.h +193 -177
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/key_wrap.cc.inc +5 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/mode_wrappers.cc.inc +7 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/ofb.cc.inc +7 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bcm.cc +24 -19
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bcm_interface.h +512 -384
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/add.cc.inc +7 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +63 -44
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/bn.cc.inc +40 -37
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/bytes.cc.inc +27 -22
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/cmp.cc.inc +9 -7
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/ctx.cc.inc +62 -126
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/div.cc.inc +92 -167
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/div_extra.cc.inc +15 -12
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/exponentiation.cc.inc +96 -93
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/gcd.cc.inc +73 -92
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/gcd_extra.cc.inc +59 -71
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/generic.cc.inc +54 -57
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/internal.h +333 -255
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/jacobi.cc.inc +12 -19
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/montgomery.cc.inc +80 -95
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/montgomery_inv.cc.inc +53 -96
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/mul.cc.inc +58 -419
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/prime.cc.inc +164 -213
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/random.cc.inc +27 -26
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/rsaz_exp.cc.inc +12 -10
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/rsaz_exp.h +47 -49
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/shift.cc.inc +14 -17
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/sqrt.cc.inc +19 -108
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/aead.cc.inc +427 -105
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/cipher.cc.inc +412 -212
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/e_aes.cc.inc +230 -225
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/e_aesccm.cc.inc +115 -84
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/internal.h +374 -27
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cmac/cmac.cc.inc +28 -23
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/delocate.h +36 -40
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/check.cc.inc +68 -78
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/dh.cc.inc +154 -196
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/internal.h +24 -24
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digest/digest.cc.inc +40 -69
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digest/digests.cc.inc +13 -7
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digest/internal.h +13 -11
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digest/md32_common.h +86 -81
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/digestsign/digestsign.cc.inc +38 -34
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec.cc.inc +187 -196
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec_key.cc.inc +196 -154
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec_montgomery.cc.inc +65 -125
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/felem.cc.inc +85 -22
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/internal.h +281 -287
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/oct.cc.inc +23 -22
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256.cc.inc +514 -573
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256_internal.h +193 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/scalar.cc.inc +44 -39
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/simple.cc.inc +58 -90
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/simple_mul.cc.inc +39 -34
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/util.cc.inc +6 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/wnaf.cc.inc +23 -20
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdh/ecdh.cc.inc +6 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +47 -37
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdsa/internal.h +5 -10
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/internal.h +38 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/jitter.cc.inc +463 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/sha512.cc.inc +329 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/hkdf/hkdf.cc.inc +8 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/hmac/hmac.cc.inc +19 -16
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/internal.h +41 -15
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/keccak.cc.inc +172 -44
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mldsa/fips_known_values.inc +5 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mldsa/mldsa.cc.inc +1632 -766
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mlkem/fips_known_values.inc +5 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mlkem/mlkem.cc.inc +740 -436
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rand/android_entropy_client.cc.inc +82 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rand/ctrdrbg.cc.inc +240 -53
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rand/internal.h +41 -26
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rand/rand.cc.inc +221 -218
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/internal.h +64 -67
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/padding.cc.inc +49 -57
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/rsa.cc.inc +247 -234
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/rsa_impl.cc.inc +392 -692
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/self_check/fips.cc.inc +10 -10
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/self_check/self_check.cc.inc +479 -449
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/service_indicator/internal.h +34 -11
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/service_indicator/service_indicator.cc.inc +46 -43
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/internal.h +61 -70
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha1.cc.inc +27 -13
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha256.cc.inc +46 -30
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha512.cc.inc +47 -47
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/address.h +98 -73
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/fors.cc.inc +108 -98
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/fors.h +14 -24
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/merkle.cc.inc +94 -91
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/merkle.h +19 -31
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/params.h +156 -56
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/slhdsa.cc.inc +318 -132
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/thash.cc.inc +234 -81
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/thash.h +20 -34
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/wots.cc.inc +97 -96
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/wots.h +10 -20
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/tls/internal.h +2 -16
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/tls/kdf.cc.inc +26 -26
- data/third_party/boringssl-with-bazel/crypto/fuzzer_mode.cc +5 -5
- data/third_party/boringssl-with-bazel/crypto/hpke/hpke.cc +461 -97
- data/third_party/boringssl-with-bazel/crypto/hrss/hrss.cc +153 -149
- data/third_party/boringssl-with-bazel/crypto/hrss/internal.h +9 -13
- data/third_party/boringssl-with-bazel/crypto/internal.h +531 -394
- data/third_party/boringssl-with-bazel/crypto/kyber/internal.h +117 -12
- data/third_party/boringssl-with-bazel/crypto/kyber/kyber.cc +59 -58
- data/third_party/boringssl-with-bazel/crypto/lhash/internal.h +38 -37
- data/third_party/boringssl-with-bazel/crypto/lhash/lhash.cc +68 -65
- data/third_party/boringssl-with-bazel/crypto/md4/md4.cc +19 -6
- data/third_party/boringssl-with-bazel/crypto/md5/internal.h +6 -9
- data/third_party/boringssl-with-bazel/crypto/md5/md5.cc +18 -6
- data/third_party/boringssl-with-bazel/crypto/mem.cc +61 -65
- data/third_party/boringssl-with-bazel/crypto/mem_internal.h +671 -0
- data/third_party/boringssl-with-bazel/crypto/mldsa/mldsa.cc +238 -32
- data/third_party/boringssl-with-bazel/crypto/mlkem/mlkem.cc +21 -65
- data/third_party/boringssl-with-bazel/crypto/obj/obj.cc +132 -157
- data/third_party/boringssl-with-bazel/crypto/obj/obj_dat.h +79 -1
- data/third_party/boringssl-with-bazel/crypto/obj/obj_xref.cc +14 -11
- data/third_party/boringssl-with-bazel/crypto/params_internal.h +30 -0
- data/third_party/boringssl-with-bazel/crypto/pem/internal.h +20 -15
- data/third_party/boringssl-with-bazel/crypto/pem/pem_all.cc +20 -19
- data/third_party/boringssl-with-bazel/crypto/pem/pem_info.cc +72 -76
- data/third_party/boringssl-with-bazel/crypto/pem/pem_lib.cc +215 -217
- data/third_party/boringssl-with-bazel/crypto/pem/pem_oth.cc +6 -6
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pk8.cc +13 -13
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pkey.cc +11 -11
- data/third_party/boringssl-with-bazel/crypto/pkcs7/internal.h +12 -17
- data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7.cc +29 -27
- data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7_x509.cc +55 -49
- data/third_party/boringssl-with-bazel/crypto/pkcs8/internal.h +21 -26
- data/third_party/boringssl-with-bazel/crypto/pkcs8/p5_pbev2.cc +33 -31
- data/third_party/boringssl-with-bazel/crypto/pkcs8/pkcs8.cc +73 -81
- data/third_party/boringssl-with-bazel/crypto/pkcs8/pkcs8_x509.cc +139 -138
- data/third_party/boringssl-with-bazel/crypto/poly1305/internal.h +3 -7
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305.cc +5 -4
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_arm.cc +43 -47
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_vec.cc +29 -26
- data/third_party/boringssl-with-bazel/crypto/pool/internal.h +64 -20
- data/third_party/boringssl-with-bazel/crypto/pool/pool.cc +177 -157
- data/third_party/boringssl-with-bazel/crypto/rand/deterministic.cc +9 -16
- data/third_party/boringssl-with-bazel/crypto/rand/fork_detect.cc +70 -42
- data/third_party/boringssl-with-bazel/crypto/rand/forkunsafe.cc +7 -7
- data/third_party/boringssl-with-bazel/crypto/rand/getentropy.cc +6 -13
- data/third_party/boringssl-with-bazel/crypto/rand/internal.h +16 -4
- data/third_party/boringssl-with-bazel/crypto/rand/ios.cc +4 -11
- data/third_party/boringssl-with-bazel/crypto/rand/rand.cc +11 -9
- data/third_party/boringssl-with-bazel/crypto/rand/trusty.cc +4 -11
- data/third_party/boringssl-with-bazel/crypto/rand/urandom.cc +16 -195
- data/third_party/boringssl-with-bazel/crypto/rand/windows.cc +12 -19
- data/third_party/boringssl-with-bazel/crypto/refcount.cc +7 -17
- data/third_party/boringssl-with-bazel/crypto/rsa/internal.h +22 -7
- data/third_party/boringssl-with-bazel/crypto/rsa/rsa_asn1.cc +199 -78
- data/third_party/boringssl-with-bazel/crypto/rsa/rsa_crypt.cc +49 -50
- data/third_party/boringssl-with-bazel/crypto/rsa/rsa_extra.cc +11 -0
- data/third_party/boringssl-with-bazel/crypto/rsa/rsa_print.cc +4 -6
- data/third_party/boringssl-with-bazel/crypto/sha/sha1.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/sha/sha256.cc +3 -1
- data/third_party/boringssl-with-bazel/crypto/sha/sha512.cc +6 -4
- data/third_party/boringssl-with-bazel/crypto/siphash/siphash.cc +2 -0
- data/third_party/boringssl-with-bazel/crypto/slhdsa/slhdsa.cc +43 -6
- data/third_party/boringssl-with-bazel/crypto/spake2plus/internal.h +31 -31
- data/third_party/boringssl-with-bazel/crypto/spake2plus/spake2plus.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/stack/stack.cc +89 -130
- data/third_party/boringssl-with-bazel/crypto/thread.cc +14 -14
- data/third_party/boringssl-with-bazel/crypto/thread_none.cc +10 -13
- data/third_party/boringssl-with-bazel/crypto/thread_pthread.cc +22 -35
- data/third_party/boringssl-with-bazel/crypto/thread_win.cc +29 -40
- data/third_party/boringssl-with-bazel/crypto/trust_token/internal.h +81 -88
- data/third_party/boringssl-with-bazel/crypto/trust_token/pmbtoken.cc +160 -144
- data/third_party/boringssl-with-bazel/crypto/trust_token/trust_token.cc +96 -80
- data/third_party/boringssl-with-bazel/crypto/trust_token/voprf.cc +90 -87
- data/third_party/boringssl-with-bazel/crypto/x509/a_digest.cc +5 -5
- data/third_party/boringssl-with-bazel/crypto/x509/a_sign.cc +51 -48
- data/third_party/boringssl-with-bazel/crypto/x509/a_verify.cc +30 -34
- data/third_party/boringssl-with-bazel/crypto/x509/algorithm.cc +47 -16
- data/third_party/boringssl-with-bazel/crypto/x509/asn1_gen.cc +41 -43
- data/third_party/boringssl-with-bazel/crypto/x509/by_dir.cc +183 -237
- data/third_party/boringssl-with-bazel/crypto/x509/by_file.cc +29 -30
- data/third_party/boringssl-with-bazel/crypto/x509/internal.h +276 -180
- data/third_party/boringssl-with-bazel/crypto/x509/name_print.cc +15 -13
- data/third_party/boringssl-with-bazel/crypto/x509/policy.cc +415 -525
- data/third_party/boringssl-with-bazel/crypto/x509/rsa_pss.cc +94 -271
- data/third_party/boringssl-with-bazel/crypto/x509/t_crl.cc +11 -8
- data/third_party/boringssl-with-bazel/crypto/x509/t_req.cc +26 -23
- data/third_party/boringssl-with-bazel/crypto/x509/t_x509.cc +26 -22
- data/third_party/boringssl-with-bazel/crypto/x509/t_x509a.cc +3 -1
- data/third_party/boringssl-with-bazel/crypto/x509/v3_akey.cc +69 -76
- data/third_party/boringssl-with-bazel/crypto/x509/v3_akeya.cc +2 -2
- data/third_party/boringssl-with-bazel/crypto/x509/v3_alt.cc +112 -69
- data/third_party/boringssl-with-bazel/crypto/x509/v3_bcons.cc +15 -14
- data/third_party/boringssl-with-bazel/crypto/x509/v3_bitst.cc +16 -18
- data/third_party/boringssl-with-bazel/crypto/x509/v3_conf.cc +62 -67
- data/third_party/boringssl-with-bazel/crypto/x509/v3_cpols.cc +143 -170
- data/third_party/boringssl-with-bazel/crypto/x509/v3_crld.cc +121 -165
- data/third_party/boringssl-with-bazel/crypto/x509/v3_enum.cc +13 -12
- data/third_party/boringssl-with-bazel/crypto/x509/v3_extku.cc +17 -34
- data/third_party/boringssl-with-bazel/crypto/x509/v3_genn.cc +20 -10
- data/third_party/boringssl-with-bazel/crypto/x509/v3_ia5.cc +22 -18
- data/third_party/boringssl-with-bazel/crypto/x509/v3_info.cc +45 -47
- data/third_party/boringssl-with-bazel/crypto/x509/v3_int.cc +35 -33
- data/third_party/boringssl-with-bazel/crypto/x509/v3_lib.cc +106 -61
- data/third_party/boringssl-with-bazel/crypto/x509/v3_ncons.cc +642 -358
- data/third_party/boringssl-with-bazel/crypto/x509/v3_ocsp.cc +25 -22
- data/third_party/boringssl-with-bazel/crypto/x509/v3_pcons.cc +15 -14
- data/third_party/boringssl-with-bazel/crypto/x509/v3_pmaps.cc +16 -15
- data/third_party/boringssl-with-bazel/crypto/x509/v3_prn.cc +6 -6
- data/third_party/boringssl-with-bazel/crypto/x509/v3_purp.cc +150 -137
- data/third_party/boringssl-with-bazel/crypto/x509/v3_skey.cc +23 -26
- data/third_party/boringssl-with-bazel/crypto/x509/v3_utl.cc +151 -178
- data/third_party/boringssl-with-bazel/crypto/x509/x509.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/x509_att.cc +32 -30
- data/third_party/boringssl-with-bazel/crypto/x509/x509_cmp.cc +95 -88
- data/third_party/boringssl-with-bazel/crypto/x509/x509_d2.cc +9 -9
- data/third_party/boringssl-with-bazel/crypto/x509/x509_def.cc +6 -8
- data/third_party/boringssl-with-bazel/crypto/x509/x509_ext.cc +46 -24
- data/third_party/boringssl-with-bazel/crypto/x509/x509_lu.cc +211 -195
- data/third_party/boringssl-with-bazel/crypto/x509/x509_obj.cc +20 -16
- data/third_party/boringssl-with-bazel/crypto/x509/x509_req.cc +37 -46
- data/third_party/boringssl-with-bazel/crypto/x509/x509_set.cc +62 -90
- data/third_party/boringssl-with-bazel/crypto/x509/x509_trs.cc +18 -13
- data/third_party/boringssl-with-bazel/crypto/x509/x509_v3.cc +33 -33
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vfy.cc +109 -110
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vpm.cc +56 -47
- data/third_party/boringssl-with-bazel/crypto/x509/x509cset.cc +27 -40
- data/third_party/boringssl-with-bazel/crypto/x509/x509name.cc +77 -67
- data/third_party/boringssl-with-bazel/crypto/x509/x509rset.cc +5 -17
- data/third_party/boringssl-with-bazel/crypto/x509/x509spki.cc +13 -13
- data/third_party/boringssl-with-bazel/crypto/x509/x_algor.cc +131 -24
- data/third_party/boringssl-with-bazel/crypto/x509/x_all.cc +72 -39
- data/third_party/boringssl-with-bazel/crypto/x509/x_attrib.cc +10 -4
- data/third_party/boringssl-with-bazel/crypto/x509/x_crl.cc +77 -44
- data/third_party/boringssl-with-bazel/crypto/x509/x_exten.cc +6 -0
- data/third_party/boringssl-with-bazel/crypto/x509/x_name.cc +311 -383
- data/third_party/boringssl-with-bazel/crypto/x509/x_pubkey.cc +129 -82
- data/third_party/boringssl-with-bazel/crypto/x509/x_req.cc +11 -6
- data/third_party/boringssl-with-bazel/crypto/x509/x_sig.cc +4 -4
- data/third_party/boringssl-with-bazel/crypto/x509/x_spki.cc +11 -1
- data/third_party/boringssl-with-bazel/crypto/x509/x_x509.cc +285 -280
- data/third_party/boringssl-with-bazel/crypto/x509/x_x509a.cc +60 -60
- data/third_party/boringssl-with-bazel/crypto/xwing/xwing.cc +257 -0
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +301 -0
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +301 -0
- data/third_party/boringssl-with-bazel/gen/crypto/err_data.cc +526 -500
- data/third_party/boringssl-with-bazel/include/openssl/aead.h +286 -114
- data/third_party/boringssl-with-bazel/include/openssl/aes.h +43 -43
- data/third_party/boringssl-with-bazel/include/openssl/asm_base.h +29 -16
- data/third_party/boringssl-with-bazel/include/openssl/asn1.h +641 -631
- data/third_party/boringssl-with-bazel/include/openssl/asn1t.h +7 -9
- data/third_party/boringssl-with-bazel/include/openssl/base.h +34 -54
- data/third_party/boringssl-with-bazel/include/openssl/base64.h +30 -30
- data/third_party/boringssl-with-bazel/include/openssl/bio.h +373 -316
- data/third_party/boringssl-with-bazel/include/openssl/blake2.h +15 -11
- data/third_party/boringssl-with-bazel/include/openssl/blowfish.h +10 -3
- data/third_party/boringssl-with-bazel/include/openssl/bn.h +298 -306
- data/third_party/boringssl-with-bazel/include/openssl/buf.h +14 -14
- data/third_party/boringssl-with-bazel/include/openssl/bytestring.h +272 -207
- data/third_party/boringssl-with-bazel/include/openssl/cast.h +45 -8
- data/third_party/boringssl-with-bazel/include/openssl/chacha.h +3 -3
- data/third_party/boringssl-with-bazel/include/openssl/cipher.h +334 -152
- data/third_party/boringssl-with-bazel/include/openssl/cmac.h +13 -13
- data/third_party/boringssl-with-bazel/include/openssl/cms.h +35 -34
- data/third_party/boringssl-with-bazel/include/openssl/conf.h +15 -14
- data/third_party/boringssl-with-bazel/include/openssl/crypto.h +15 -13
- data/third_party/boringssl-with-bazel/include/openssl/ctrdrbg.h +49 -15
- data/third_party/boringssl-with-bazel/include/openssl/curve25519.h +24 -24
- data/third_party/boringssl-with-bazel/include/openssl/des.h +22 -16
- data/third_party/boringssl-with-bazel/include/openssl/dh.h +95 -95
- data/third_party/boringssl-with-bazel/include/openssl/digest.h +140 -71
- data/third_party/boringssl-with-bazel/include/openssl/dsa.h +101 -101
- data/third_party/boringssl-with-bazel/include/openssl/ec.h +143 -119
- data/third_party/boringssl-with-bazel/include/openssl/ec_key.h +97 -97
- data/third_party/boringssl-with-bazel/include/openssl/ecdh.h +9 -9
- data/third_party/boringssl-with-bazel/include/openssl/ecdsa.h +89 -46
- data/third_party/boringssl-with-bazel/include/openssl/engine.h +5 -5
- data/third_party/boringssl-with-bazel/include/openssl/err.h +73 -71
- data/third_party/boringssl-with-bazel/include/openssl/evp.h +824 -344
- data/third_party/boringssl-with-bazel/include/openssl/evp_errors.h +9 -2
- data/third_party/boringssl-with-bazel/include/openssl/ex_data.h +27 -32
- data/third_party/boringssl-with-bazel/include/openssl/hkdf.h +6 -6
- data/third_party/boringssl-with-bazel/include/openssl/hmac.h +31 -31
- data/third_party/boringssl-with-bazel/include/openssl/hpke.h +133 -117
- data/third_party/boringssl-with-bazel/include/openssl/hrss.h +14 -8
- data/third_party/boringssl-with-bazel/include/openssl/kdf.h +20 -19
- data/third_party/boringssl-with-bazel/include/openssl/lhash.h +4 -25
- data/third_party/boringssl-with-bazel/include/openssl/md4.h +14 -7
- data/third_party/boringssl-with-bazel/include/openssl/md5.h +7 -7
- data/third_party/boringssl-with-bazel/include/openssl/mem.h +38 -38
- data/third_party/boringssl-with-bazel/include/openssl/mldsa.h +380 -24
- data/third_party/boringssl-with-bazel/include/openssl/mlkem.h +43 -43
- data/third_party/boringssl-with-bazel/include/openssl/nid.h +1297 -2
- data/third_party/boringssl-with-bazel/include/openssl/obj.h +49 -49
- data/third_party/boringssl-with-bazel/include/openssl/opensslconf.h +30 -0
- data/third_party/boringssl-with-bazel/include/openssl/params.h +42 -0
- data/third_party/boringssl-with-bazel/include/openssl/pem.h +39 -30
- data/third_party/boringssl-with-bazel/include/openssl/pkcs7.h +40 -40
- data/third_party/boringssl-with-bazel/include/openssl/pkcs8.h +69 -63
- data/third_party/boringssl-with-bazel/include/openssl/poly1305.h +8 -5
- data/third_party/boringssl-with-bazel/include/openssl/pool.h +54 -25
- data/third_party/boringssl-with-bazel/include/openssl/posix_time.h +6 -6
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols.h +7866 -0
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_S.h +585 -0
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_c.h +305 -0
- data/third_party/boringssl-with-bazel/include/openssl/rand.h +18 -18
- data/third_party/boringssl-with-bazel/include/openssl/rc4.h +4 -4
- data/third_party/boringssl-with-bazel/include/openssl/ripemd.h +15 -10
- data/third_party/boringssl-with-bazel/include/openssl/rsa.h +272 -235
- data/third_party/boringssl-with-bazel/include/openssl/service_indicator.h +4 -81
- data/third_party/boringssl-with-bazel/include/openssl/sha.h +43 -166
- data/third_party/boringssl-with-bazel/include/openssl/sha2.h +201 -0
- data/third_party/boringssl-with-bazel/include/openssl/slhdsa.h +100 -48
- data/third_party/boringssl-with-bazel/include/openssl/span.h +190 -75
- data/third_party/boringssl-with-bazel/include/openssl/ssl.h +2168 -1567
- data/third_party/boringssl-with-bazel/include/openssl/ssl3.h +11 -69
- data/third_party/boringssl-with-bazel/include/openssl/stack.h +135 -80
- data/third_party/boringssl-with-bazel/include/openssl/target.h +13 -1
- data/third_party/boringssl-with-bazel/include/openssl/thread.h +0 -10
- data/third_party/boringssl-with-bazel/include/openssl/tls1.h +31 -310
- data/third_party/boringssl-with-bazel/include/openssl/tls_prf.h +47 -0
- data/third_party/boringssl-with-bazel/include/openssl/trust_token.h +97 -92
- data/third_party/boringssl-with-bazel/include/openssl/type_check.h +1 -1
- data/third_party/boringssl-with-bazel/include/openssl/x509.h +1805 -1857
- data/third_party/boringssl-with-bazel/include/openssl/x509v3.h +1 -1
- data/third_party/boringssl-with-bazel/include/openssl/xwing.h +115 -0
- data/third_party/boringssl-with-bazel/ssl/bio_ssl.cc +24 -19
- data/third_party/boringssl-with-bazel/ssl/d1_both.cc +59 -57
- data/third_party/boringssl-with-bazel/ssl/d1_lib.cc +53 -42
- data/third_party/boringssl-with-bazel/ssl/d1_pkt.cc +4 -4
- data/third_party/boringssl-with-bazel/ssl/d1_srtp.cc +2 -2
- data/third_party/boringssl-with-bazel/ssl/dtls_method.cc +10 -10
- data/third_party/boringssl-with-bazel/ssl/dtls_record.cc +6 -6
- data/third_party/boringssl-with-bazel/ssl/encrypted_client_hello.cc +61 -71
- data/third_party/boringssl-with-bazel/ssl/extensions.cc +967 -366
- data/third_party/boringssl-with-bazel/ssl/handoff.cc +77 -38
- data/third_party/boringssl-with-bazel/ssl/handshake.cc +63 -30
- data/third_party/boringssl-with-bazel/ssl/handshake_client.cc +129 -85
- data/third_party/boringssl-with-bazel/ssl/handshake_server.cc +116 -68
- data/third_party/boringssl-with-bazel/ssl/internal.h +983 -1207
- data/third_party/boringssl-with-bazel/ssl/s3_both.cc +34 -29
- data/third_party/boringssl-with-bazel/ssl/s3_lib.cc +4 -3
- data/third_party/boringssl-with-bazel/ssl/s3_pkt.cc +12 -12
- data/third_party/boringssl-with-bazel/ssl/ssl_aead_ctx.cc +5 -5
- data/third_party/boringssl-with-bazel/ssl/ssl_asn1.cc +114 -59
- data/third_party/boringssl-with-bazel/ssl/ssl_buffer.cc +17 -18
- data/third_party/boringssl-with-bazel/ssl/ssl_cert.cc +99 -61
- data/third_party/boringssl-with-bazel/ssl/ssl_cipher.cc +143 -134
- data/third_party/boringssl-with-bazel/ssl/ssl_credential.cc +188 -90
- data/third_party/boringssl-with-bazel/ssl/ssl_file.cc +132 -225
- data/third_party/boringssl-with-bazel/ssl/ssl_key_share.cc +79 -7
- data/third_party/boringssl-with-bazel/ssl/ssl_lib.cc +698 -302
- data/third_party/boringssl-with-bazel/ssl/ssl_privkey.cc +102 -45
- data/third_party/boringssl-with-bazel/ssl/ssl_session.cc +117 -102
- data/third_party/boringssl-with-bazel/ssl/ssl_transcript.cc +3 -3
- data/third_party/boringssl-with-bazel/ssl/ssl_versions.cc +24 -24
- data/third_party/boringssl-with-bazel/ssl/ssl_x509.cc +184 -170
- data/third_party/boringssl-with-bazel/ssl/t1_enc.cc +12 -10
- data/third_party/boringssl-with-bazel/ssl/tls13_both.cc +86 -54
- data/third_party/boringssl-with-bazel/ssl/tls13_client.cc +176 -90
- data/third_party/boringssl-with-bazel/ssl/tls13_enc.cc +166 -112
- data/third_party/boringssl-with-bazel/ssl/tls13_server.cc +188 -97
- data/third_party/boringssl-with-bazel/ssl/tls_method.cc +23 -23
- data/third_party/boringssl-with-bazel/ssl/tls_record.cc +17 -14
- data/third_party/boringssl-with-bazel/third_party/fiat/bedrock_unverified_bareminimum.c.inc +47 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/bedrock_unverified_platform.c.inc +137 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/curve25519_64_adx.h +37 -33
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64.h +4 -93
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64_msvc.h +4 -69
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_field_32.br.c.inc +71 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_field_64.br.c.inc +84 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_point.br.c.inc +166 -0
- metadata +77 -52
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +0 -240
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +0 -56
- data/src/core/ext/upb-gen/src/proto/grpc/health/v1/health.upb.h +0 -157
- data/src/core/ext/upb-gen/src/proto/grpc/health/v1/health.upb_minitable.c +0 -72
- data/src/core/ext/upbdefs-gen/src/proto/grpc/lookup/v1/rls_config.upbdefs.c +0 -181
- data/third_party/abseil-cpp/absl/base/internal/identity.h +0 -39
- data/third_party/abseil-cpp/absl/base/internal/nullability_deprecated.h +0 -106
- data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +0 -105
- data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.h +0 -50
- data/third_party/abseil-cpp/absl/strings/string_view.cc +0 -257
- data/third_party/boringssl-with-bazel/crypto/evp/p_dh_asn1.cc +0 -142
- data/third_party/boringssl-with-bazel/crypto/evp/p_dsa_asn1.cc +0 -279
- data/third_party/boringssl-with-bazel/crypto/evp/p_ec_asn1.cc +0 -286
- data/third_party/boringssl-with-bazel/crypto/evp/p_ed25519_asn1.cc +0 -225
- data/third_party/boringssl-with-bazel/crypto/evp/p_rsa_asn1.cc +0 -198
- data/third_party/boringssl-with-bazel/crypto/evp/p_x25519_asn1.cc +0 -237
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p224-64.cc.inc +0 -1163
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.cc.inc +0 -741
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.h +0 -207
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/blinding.cc.inc +0 -147
- data/third_party/boringssl-with-bazel/crypto/rand/getrandom_fillin.h +0 -64
- data/third_party/boringssl-with-bazel/crypto/rand/passive.cc +0 -178
- data/third_party/boringssl-with-bazel/crypto/x509/ext_dat.h +0 -92
- data/third_party/boringssl-with-bazel/include/openssl/bcm_public.h +0 -82
- data/third_party/boringssl-with-bazel/include/openssl/experimental/kyber.h +0 -146
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
#include <openssl/ssl.h>
|
|
18
18
|
|
|
19
19
|
#include <algorithm>
|
|
20
|
+
#include <iterator>
|
|
21
|
+
#include <utility>
|
|
20
22
|
|
|
21
23
|
#include <assert.h>
|
|
22
24
|
#include <limits.h>
|
|
@@ -26,10 +28,12 @@
|
|
|
26
28
|
#include <openssl/bytestring.h>
|
|
27
29
|
#include <openssl/crypto.h>
|
|
28
30
|
#include <openssl/err.h>
|
|
29
|
-
#include <openssl/
|
|
31
|
+
#include <openssl/evp.h>
|
|
30
32
|
#include <openssl/mem.h>
|
|
33
|
+
#include <openssl/nid.h>
|
|
31
34
|
#include <openssl/rand.h>
|
|
32
35
|
|
|
36
|
+
#include "../crypto/bytestring/internal.h"
|
|
33
37
|
#include "../crypto/internal.h"
|
|
34
38
|
#include "internal.h"
|
|
35
39
|
|
|
@@ -47,7 +51,7 @@ static_assert(SSL3_RT_MAX_ENCRYPTED_OVERHEAD >=
|
|
|
47
51
|
SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD,
|
|
48
52
|
"max overheads are inconsistent");
|
|
49
53
|
|
|
50
|
-
//
|
|
54
|
+
// `SSL_R_UNKNOWN_PROTOCOL` is no longer emitted, but continue to define it
|
|
51
55
|
// to avoid downstream churn.
|
|
52
56
|
OPENSSL_DECLARE_ERROR_REASON(SSL, UNKNOWN_PROTOCOL)
|
|
53
57
|
|
|
@@ -65,24 +69,11 @@ static_assert(SSL_R_TLSV1_ALERT_NO_RENEGOTIATION ==
|
|
|
65
69
|
// kMaxHandshakeSize is the maximum size, in bytes, of a handshake message.
|
|
66
70
|
static const size_t kMaxHandshakeSize = (1u << 24) - 1;
|
|
67
71
|
|
|
68
|
-
static
|
|
69
|
-
|
|
70
|
-
static CRYPTO_EX_DATA_CLASS g_ex_data_class_ssl_ctx =
|
|
71
|
-
CRYPTO_EX_DATA_CLASS_INIT_WITH_APP_DATA;
|
|
72
|
-
|
|
73
|
-
bool CBBFinishArray(CBB *cbb, Array<uint8_t> *out) {
|
|
74
|
-
uint8_t *ptr;
|
|
75
|
-
size_t len;
|
|
76
|
-
if (!CBB_finish(cbb, &ptr, &len)) {
|
|
77
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
out->Reset(ptr, len);
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
72
|
+
static ExDataClass g_ex_data_class_ssl(/*with_app_data=*/true);
|
|
73
|
+
static ExDataClass g_ex_data_class_ssl_ctx(/*with_app_data=*/true);
|
|
83
74
|
|
|
84
75
|
void ssl_reset_error_state(SSL *ssl) {
|
|
85
|
-
// Functions which use
|
|
76
|
+
// Functions which use `SSL_get_error` must reset I/O and error state on
|
|
86
77
|
// entry.
|
|
87
78
|
ssl->s3->rwstate = SSL_ERROR_NONE;
|
|
88
79
|
ERR_clear_error();
|
|
@@ -177,7 +168,7 @@ static bool cbb_add_hex_consttime(CBB *cbb, Span<const uint8_t> in) {
|
|
|
177
168
|
|
|
178
169
|
bool ssl_log_secret(const SSL *ssl, const char *label,
|
|
179
170
|
Span<const uint8_t> secret) {
|
|
180
|
-
if (ssl->ctx->keylog_callback ==
|
|
171
|
+
if (ssl->ctx->keylog_callback == nullptr) {
|
|
181
172
|
return true;
|
|
182
173
|
}
|
|
183
174
|
|
|
@@ -190,7 +181,7 @@ bool ssl_log_secret(const SSL *ssl, const char *label,
|
|
|
190
181
|
!CBB_add_u8(cbb.get(), ' ') ||
|
|
191
182
|
!cbb_add_hex_consttime(cbb.get(), ssl->s3->client_random) ||
|
|
192
183
|
!CBB_add_u8(cbb.get(), ' ') ||
|
|
193
|
-
// Convert to hex in constant time to avoid leaking
|
|
184
|
+
// Convert to hex in constant time to avoid leaking `secret`. If the
|
|
194
185
|
// callback discards the data, we should not introduce side channels.
|
|
195
186
|
!cbb_add_hex_consttime(cbb.get(), secret) ||
|
|
196
187
|
!CBB_add_u8(cbb.get(), 0 /* NUL */) ||
|
|
@@ -203,25 +194,25 @@ bool ssl_log_secret(const SSL *ssl, const char *label,
|
|
|
203
194
|
}
|
|
204
195
|
|
|
205
196
|
void ssl_do_info_callback(const SSL *ssl, int type, int value) {
|
|
206
|
-
void (*cb)(const SSL *ssl, int type, int value) =
|
|
207
|
-
if (ssl->info_callback !=
|
|
197
|
+
void (*cb)(const SSL *ssl, int type, int value) = nullptr;
|
|
198
|
+
if (ssl->info_callback != nullptr) {
|
|
208
199
|
cb = ssl->info_callback;
|
|
209
|
-
} else if (ssl->ctx->info_callback !=
|
|
200
|
+
} else if (ssl->ctx->info_callback != nullptr) {
|
|
210
201
|
cb = ssl->ctx->info_callback;
|
|
211
202
|
}
|
|
212
203
|
|
|
213
|
-
if (cb !=
|
|
204
|
+
if (cb != nullptr) {
|
|
214
205
|
cb(ssl, type, value);
|
|
215
206
|
}
|
|
216
207
|
}
|
|
217
208
|
|
|
218
209
|
void ssl_do_msg_callback(const SSL *ssl, int is_write, int content_type,
|
|
219
210
|
Span<const uint8_t> in) {
|
|
220
|
-
if (ssl->msg_callback ==
|
|
211
|
+
if (ssl->msg_callback == nullptr) {
|
|
221
212
|
return;
|
|
222
213
|
}
|
|
223
214
|
|
|
224
|
-
//
|
|
215
|
+
// `version` is zero when calling for `SSL3_RT_HEADER` and `SSL2_VERSION` for
|
|
225
216
|
// a V2ClientHello.
|
|
226
217
|
int version;
|
|
227
218
|
switch (content_type) {
|
|
@@ -240,8 +231,8 @@ void ssl_do_msg_callback(const SSL *ssl, int is_write, int content_type,
|
|
|
240
231
|
const_cast<SSL *>(ssl), ssl->msg_callback_arg);
|
|
241
232
|
}
|
|
242
233
|
|
|
243
|
-
OPENSSL_timeval ssl_ctx_get_current_time(const
|
|
244
|
-
if (ctx->current_time_cb !=
|
|
234
|
+
OPENSSL_timeval ssl_ctx_get_current_time(const SSLContext *ctx) {
|
|
235
|
+
if (ctx->current_time_cb != nullptr) {
|
|
245
236
|
// TODO(davidben): Update current_time_cb to use OPENSSL_timeval. See
|
|
246
237
|
// https://crbug.com/boringssl/155.
|
|
247
238
|
struct timeval clock;
|
|
@@ -267,7 +258,7 @@ OPENSSL_timeval ssl_ctx_get_current_time(const SSL_CTX *ctx) {
|
|
|
267
258
|
}
|
|
268
259
|
#else
|
|
269
260
|
struct timeval clock;
|
|
270
|
-
gettimeofday(&clock,
|
|
261
|
+
gettimeofday(&clock, nullptr);
|
|
271
262
|
if (clock.tv_sec < 0) {
|
|
272
263
|
assert(0);
|
|
273
264
|
return {0, 0};
|
|
@@ -278,7 +269,9 @@ OPENSSL_timeval ssl_ctx_get_current_time(const SSL_CTX *ctx) {
|
|
|
278
269
|
#endif
|
|
279
270
|
}
|
|
280
271
|
|
|
281
|
-
void SSL_CTX_set_handoff_mode(SSL_CTX *ctx, bool on) {
|
|
272
|
+
void SSL_CTX_set_handoff_mode(SSL_CTX *ctx, bool on) {
|
|
273
|
+
FromOpaque(ctx)->handoff = on;
|
|
274
|
+
}
|
|
282
275
|
|
|
283
276
|
static bool ssl_can_renegotiate(const SSL *ssl) {
|
|
284
277
|
if (ssl->server || SSL_is_dtls(ssl)) {
|
|
@@ -333,7 +326,7 @@ bool SSL_get_traffic_secrets(const SSL *ssl,
|
|
|
333
326
|
Span<const uint8_t> *out_read_traffic_secret,
|
|
334
327
|
Span<const uint8_t> *out_write_traffic_secret) {
|
|
335
328
|
// This API is not well-defined for DTLS, where multiple epochs may be alive
|
|
336
|
-
// at once. Callers should use
|
|
329
|
+
// at once. Callers should use `SSL_get_dtls_*_traffic_secret` instead. In
|
|
337
330
|
// QUIC, the application is already handed the traffic secret.
|
|
338
331
|
if (SSL_is_dtls(ssl) || SSL_is_quic(ssl)) {
|
|
339
332
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
@@ -357,8 +350,9 @@ bool SSL_get_traffic_secrets(const SSL *ssl,
|
|
|
357
350
|
|
|
358
351
|
void SSL_CTX_set_aes_hw_override_for_testing(SSL_CTX *ctx,
|
|
359
352
|
bool override_value) {
|
|
360
|
-
|
|
361
|
-
|
|
353
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
354
|
+
ctx_impl->aes_hw_override = true;
|
|
355
|
+
ctx_impl->aes_hw_override_value = override_value;
|
|
362
356
|
}
|
|
363
357
|
|
|
364
358
|
void SSL_set_aes_hw_override_for_testing(SSL *ssl, bool override_value) {
|
|
@@ -370,7 +364,7 @@ BSSL_NAMESPACE_END
|
|
|
370
364
|
|
|
371
365
|
using namespace bssl;
|
|
372
366
|
|
|
373
|
-
int SSL_library_init(
|
|
367
|
+
int SSL_library_init() { return 1; }
|
|
374
368
|
|
|
375
369
|
int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) {
|
|
376
370
|
return 1;
|
|
@@ -384,7 +378,7 @@ static int ssl_session_cmp(const SSL_SESSION *a, const SSL_SESSION *b) {
|
|
|
384
378
|
return Span(a->session_id) == b->session_id ? 0 : 1;
|
|
385
379
|
}
|
|
386
380
|
|
|
387
|
-
|
|
381
|
+
bssl::SSLContext::SSLContext(const SSL_METHOD *ssl_method)
|
|
388
382
|
: RefCounted(CheckSubClass()),
|
|
389
383
|
method(ssl_method->method),
|
|
390
384
|
x509_method(ssl_method->x509_method),
|
|
@@ -402,30 +396,28 @@ ssl_ctx_st::ssl_ctx_st(const SSL_METHOD *ssl_method)
|
|
|
402
396
|
aes_hw_override(false),
|
|
403
397
|
aes_hw_override_value(false),
|
|
404
398
|
resumption_across_names_enabled(false) {
|
|
405
|
-
CRYPTO_MUTEX_init(&lock);
|
|
406
399
|
CRYPTO_new_ex_data(&ex_data);
|
|
407
400
|
}
|
|
408
401
|
|
|
409
|
-
|
|
402
|
+
bssl::SSLContext::~SSLContext() {
|
|
410
403
|
// Free the internal session cache. Note that this calls the caller-supplied
|
|
411
404
|
// remove callback, so we must do it before clearing ex_data. (See ticket
|
|
412
405
|
// [openssl.org #212].)
|
|
413
406
|
SSL_CTX_flush_sessions(this, 0);
|
|
414
407
|
|
|
415
|
-
CRYPTO_free_ex_data(&g_ex_data_class_ssl_ctx,
|
|
408
|
+
CRYPTO_free_ex_data(&g_ex_data_class_ssl_ctx, &ex_data);
|
|
416
409
|
|
|
417
|
-
CRYPTO_MUTEX_cleanup(&lock);
|
|
418
410
|
lh_SSL_SESSION_free(sessions);
|
|
419
411
|
x509_method->ssl_ctx_free(this);
|
|
420
412
|
}
|
|
421
413
|
|
|
422
414
|
SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
423
|
-
if (method ==
|
|
415
|
+
if (method == nullptr) {
|
|
424
416
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NULL_SSL_METHOD_PASSED);
|
|
425
417
|
return nullptr;
|
|
426
418
|
}
|
|
427
419
|
|
|
428
|
-
UniquePtr<
|
|
420
|
+
UniquePtr<SSLContext> ret = MakeUnique<SSLContext>(method);
|
|
429
421
|
if (!ret) {
|
|
430
422
|
return nullptr;
|
|
431
423
|
}
|
|
@@ -452,21 +444,29 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
|
452
444
|
return nullptr;
|
|
453
445
|
}
|
|
454
446
|
|
|
447
|
+
if (!ret->supported_group_list.CopyFrom(DefaultSupportedGroupIds())) {
|
|
448
|
+
return nullptr;
|
|
449
|
+
}
|
|
450
|
+
if (!ret->supported_group_list_flags.Init(ret->supported_group_list.size())) {
|
|
451
|
+
return nullptr;
|
|
452
|
+
}
|
|
453
|
+
ret->accepted_peer_cert_types.PushBack(kDefaultCertType);
|
|
454
|
+
|
|
455
455
|
return ret.release();
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
int SSL_CTX_up_ref(SSL_CTX *ctx) {
|
|
459
|
-
ctx->UpRefInternal();
|
|
459
|
+
FromOpaque(ctx)->UpRefInternal();
|
|
460
460
|
return 1;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
void SSL_CTX_free(SSL_CTX *ctx) {
|
|
464
464
|
if (ctx != nullptr) {
|
|
465
|
-
ctx->DecRefInternal();
|
|
465
|
+
FromOpaque(ctx)->DecRefInternal();
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
-
ssl_st::ssl_st(
|
|
469
|
+
ssl_st::ssl_st(SSLContext *ctx_arg)
|
|
470
470
|
: method(ctx_arg->method),
|
|
471
471
|
max_send_fragment(ctx_arg->max_send_fragment),
|
|
472
472
|
msg_callback(ctx_arg->msg_callback),
|
|
@@ -484,21 +484,22 @@ ssl_st::ssl_st(SSL_CTX *ctx_arg)
|
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
ssl_st::~ssl_st() {
|
|
487
|
-
CRYPTO_free_ex_data(&g_ex_data_class_ssl,
|
|
488
|
-
//
|
|
487
|
+
CRYPTO_free_ex_data(&g_ex_data_class_ssl, &ex_data);
|
|
488
|
+
// `config` refers to `this`, so we must release it earlier.
|
|
489
489
|
config.reset();
|
|
490
|
-
if (method !=
|
|
490
|
+
if (method != nullptr) {
|
|
491
491
|
method->ssl_free(this);
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
SSL *SSL_new(SSL_CTX *ctx) {
|
|
496
|
-
|
|
496
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
497
|
+
if (ctx_impl == nullptr) {
|
|
497
498
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NULL_SSL_CTX);
|
|
498
499
|
return nullptr;
|
|
499
500
|
}
|
|
500
501
|
|
|
501
|
-
UniquePtr<SSL> ssl = MakeUnique<SSL>(
|
|
502
|
+
UniquePtr<SSL> ssl = MakeUnique<SSL>(ctx_impl);
|
|
502
503
|
if (ssl == nullptr) {
|
|
503
504
|
return nullptr;
|
|
504
505
|
}
|
|
@@ -507,57 +508,64 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
|
507
508
|
if (ssl->config == nullptr) {
|
|
508
509
|
return nullptr;
|
|
509
510
|
}
|
|
510
|
-
ssl->config->conf_min_version =
|
|
511
|
-
ssl->config->conf_max_version =
|
|
511
|
+
ssl->config->conf_min_version = ctx_impl->conf_min_version;
|
|
512
|
+
ssl->config->conf_max_version = ctx_impl->conf_max_version;
|
|
512
513
|
|
|
513
|
-
ssl->config->cert = ssl_cert_dup(
|
|
514
|
+
ssl->config->cert = ssl_cert_dup(ctx_impl->cert.get());
|
|
514
515
|
if (ssl->config->cert == nullptr) {
|
|
515
516
|
return nullptr;
|
|
516
517
|
}
|
|
517
518
|
|
|
518
|
-
ssl->config->verify_mode =
|
|
519
|
-
ssl->config->verify_callback =
|
|
520
|
-
ssl->config->custom_verify_callback =
|
|
519
|
+
ssl->config->verify_mode = ctx_impl->verify_mode;
|
|
520
|
+
ssl->config->verify_callback = ctx_impl->default_verify_callback;
|
|
521
|
+
ssl->config->custom_verify_callback = ctx_impl->custom_verify_callback;
|
|
521
522
|
ssl->config->retain_only_sha256_of_client_certs =
|
|
522
|
-
|
|
523
|
-
ssl->config->permute_extensions =
|
|
524
|
-
ssl->config->aes_hw_override =
|
|
525
|
-
ssl->config->aes_hw_override_value =
|
|
526
|
-
ssl->config->compliance_policy =
|
|
527
|
-
|
|
528
|
-
if (!ssl->config->supported_group_list.CopyFrom(
|
|
523
|
+
ctx_impl->retain_only_sha256_of_client_certs;
|
|
524
|
+
ssl->config->permute_extensions = ctx_impl->permute_extensions;
|
|
525
|
+
ssl->config->aes_hw_override = ctx_impl->aes_hw_override;
|
|
526
|
+
ssl->config->aes_hw_override_value = ctx_impl->aes_hw_override_value;
|
|
527
|
+
ssl->config->compliance_policy = ctx_impl->compliance_policy;
|
|
528
|
+
|
|
529
|
+
if (!ssl->config->supported_group_list.CopyFrom(
|
|
530
|
+
ctx_impl->supported_group_list) ||
|
|
531
|
+
!ssl->config->supported_group_list_flags.CopyFrom(
|
|
532
|
+
ctx_impl->supported_group_list_flags) ||
|
|
529
533
|
!ssl->config->alpn_client_proto_list.CopyFrom(
|
|
530
|
-
|
|
531
|
-
!ssl->config->verify_sigalgs.CopyFrom(
|
|
534
|
+
ctx_impl->alpn_client_proto_list) ||
|
|
535
|
+
!ssl->config->verify_sigalgs.CopyFrom(ctx_impl->verify_sigalgs) ||
|
|
536
|
+
!ssl->config->accepted_peer_cert_types.TryCopyFrom(
|
|
537
|
+
ctx_impl->accepted_peer_cert_types) ||
|
|
538
|
+
!ssl->config->available_client_cert_types.TryCopyFrom(
|
|
539
|
+
ctx_impl->available_client_cert_types)) {
|
|
532
540
|
return nullptr;
|
|
533
541
|
}
|
|
534
542
|
|
|
535
|
-
if (
|
|
543
|
+
if (ctx_impl->requested_trust_anchors) {
|
|
536
544
|
ssl->config->requested_trust_anchors.emplace();
|
|
537
545
|
if (!ssl->config->requested_trust_anchors->CopyFrom(
|
|
538
|
-
*
|
|
546
|
+
*ctx_impl->requested_trust_anchors)) {
|
|
539
547
|
return nullptr;
|
|
540
548
|
}
|
|
541
549
|
}
|
|
542
550
|
|
|
543
|
-
if (
|
|
551
|
+
if (ctx_impl->psk_identity_hint) {
|
|
544
552
|
ssl->config->psk_identity_hint.reset(
|
|
545
|
-
OPENSSL_strdup(
|
|
553
|
+
OPENSSL_strdup(ctx_impl->psk_identity_hint.get()));
|
|
546
554
|
if (ssl->config->psk_identity_hint == nullptr) {
|
|
547
555
|
return nullptr;
|
|
548
556
|
}
|
|
549
557
|
}
|
|
550
|
-
ssl->config->psk_client_callback =
|
|
551
|
-
ssl->config->psk_server_callback =
|
|
558
|
+
ssl->config->psk_client_callback = ctx_impl->psk_client_callback;
|
|
559
|
+
ssl->config->psk_server_callback = ctx_impl->psk_server_callback;
|
|
552
560
|
|
|
553
|
-
ssl->config->channel_id_enabled =
|
|
554
|
-
ssl->config->channel_id_private = UpRef(
|
|
561
|
+
ssl->config->channel_id_enabled = ctx_impl->channel_id_enabled;
|
|
562
|
+
ssl->config->channel_id_private = UpRef(ctx_impl->channel_id_private);
|
|
555
563
|
|
|
556
564
|
ssl->config->signed_cert_timestamps_enabled =
|
|
557
|
-
|
|
558
|
-
ssl->config->ocsp_stapling_enabled =
|
|
559
|
-
ssl->config->handoff =
|
|
560
|
-
ssl->quic_method =
|
|
565
|
+
ctx_impl->signed_cert_timestamps_enabled;
|
|
566
|
+
ssl->config->ocsp_stapling_enabled = ctx_impl->ocsp_stapling_enabled;
|
|
567
|
+
ssl->config->handoff = ctx_impl->handoff;
|
|
568
|
+
ssl->quic_method = ctx_impl->quic_method;
|
|
561
569
|
|
|
562
570
|
if (!ssl->method->ssl_new(ssl.get()) ||
|
|
563
571
|
!ssl->ctx->x509_method->ssl_new(ssl->s3->hs.get())) {
|
|
@@ -580,7 +588,8 @@ SSL_CONFIG::SSL_CONFIG(SSL *ssl_arg)
|
|
|
580
588
|
jdk11_workaround(false),
|
|
581
589
|
quic_use_legacy_codepoint(false),
|
|
582
590
|
permute_extensions(false),
|
|
583
|
-
alps_use_new_codepoint(true)
|
|
591
|
+
alps_use_new_codepoint(true),
|
|
592
|
+
server_padding_enabled(false) {
|
|
584
593
|
assert(ssl);
|
|
585
594
|
}
|
|
586
595
|
|
|
@@ -617,7 +626,7 @@ void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
|
|
|
617
626
|
|
|
618
627
|
// If the two arguments are equal, one fewer reference is granted than
|
|
619
628
|
// taken.
|
|
620
|
-
if (rbio !=
|
|
629
|
+
if (rbio != nullptr && rbio == wbio) {
|
|
621
630
|
BIO_up_ref(rbio);
|
|
622
631
|
}
|
|
623
632
|
|
|
@@ -717,7 +726,7 @@ int SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level,
|
|
|
717
726
|
int SSL_do_handshake(SSL *ssl) {
|
|
718
727
|
ssl_reset_error_state(ssl);
|
|
719
728
|
|
|
720
|
-
if (ssl->do_handshake ==
|
|
729
|
+
if (ssl->do_handshake == nullptr) {
|
|
721
730
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CONNECTION_TYPE_NOT_SET);
|
|
722
731
|
return -1;
|
|
723
732
|
}
|
|
@@ -747,7 +756,7 @@ int SSL_do_handshake(SSL *ssl) {
|
|
|
747
756
|
}
|
|
748
757
|
|
|
749
758
|
int SSL_connect(SSL *ssl) {
|
|
750
|
-
if (ssl->do_handshake ==
|
|
759
|
+
if (ssl->do_handshake == nullptr) {
|
|
751
760
|
// Not properly initialized yet
|
|
752
761
|
SSL_set_connect_state(ssl);
|
|
753
762
|
}
|
|
@@ -756,7 +765,7 @@ int SSL_connect(SSL *ssl) {
|
|
|
756
765
|
}
|
|
757
766
|
|
|
758
767
|
int SSL_accept(SSL *ssl) {
|
|
759
|
-
if (ssl->do_handshake ==
|
|
768
|
+
if (ssl->do_handshake == nullptr) {
|
|
760
769
|
// Not properly initialized yet
|
|
761
770
|
SSL_set_accept_state(ssl);
|
|
762
771
|
}
|
|
@@ -830,7 +839,7 @@ int SSL_process_quic_post_handshake(SSL *ssl) {
|
|
|
830
839
|
static int ssl_read_impl(SSL *ssl) {
|
|
831
840
|
ssl_reset_error_state(ssl);
|
|
832
841
|
|
|
833
|
-
if (ssl->do_handshake ==
|
|
842
|
+
if (ssl->do_handshake == nullptr) {
|
|
834
843
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
835
844
|
return -1;
|
|
836
845
|
}
|
|
@@ -856,7 +865,7 @@ static int ssl_read_impl(SSL *ssl) {
|
|
|
856
865
|
}
|
|
857
866
|
|
|
858
867
|
// Complete the current handshake, if any. False Start will cause
|
|
859
|
-
//
|
|
868
|
+
// `SSL_do_handshake` to return mid-handshake, so this may require multiple
|
|
860
869
|
// iterations.
|
|
861
870
|
while (!ssl_can_read(ssl)) {
|
|
862
871
|
int ret = SSL_do_handshake(ssl);
|
|
@@ -948,7 +957,7 @@ int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
|
948
957
|
return -1;
|
|
949
958
|
}
|
|
950
959
|
|
|
951
|
-
if (ssl->do_handshake ==
|
|
960
|
+
if (ssl->do_handshake == nullptr) {
|
|
952
961
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
953
962
|
return -1;
|
|
954
963
|
}
|
|
@@ -983,7 +992,7 @@ int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
|
983
992
|
int SSL_key_update(SSL *ssl, int request_type) {
|
|
984
993
|
ssl_reset_error_state(ssl);
|
|
985
994
|
|
|
986
|
-
if (ssl->do_handshake ==
|
|
995
|
+
if (ssl->do_handshake == nullptr) {
|
|
987
996
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
988
997
|
return 0;
|
|
989
998
|
}
|
|
@@ -1009,13 +1018,13 @@ int SSL_key_update(SSL *ssl, int request_type) {
|
|
|
1009
1018
|
int SSL_shutdown(SSL *ssl) {
|
|
1010
1019
|
ssl_reset_error_state(ssl);
|
|
1011
1020
|
|
|
1012
|
-
if (ssl->do_handshake ==
|
|
1021
|
+
if (ssl->do_handshake == nullptr) {
|
|
1013
1022
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
1014
1023
|
return -1;
|
|
1015
1024
|
}
|
|
1016
1025
|
|
|
1017
1026
|
// If we are in the middle of a handshake, silently succeed. Consumers often
|
|
1018
|
-
// call this function before
|
|
1027
|
+
// call this function before `SSL_free`, whether the handshake succeeded or
|
|
1019
1028
|
// not. We assume the caller has already handled failed handshakes.
|
|
1020
1029
|
if (SSL_in_init(ssl)) {
|
|
1021
1030
|
return 1;
|
|
@@ -1104,7 +1113,7 @@ int SSL_set_quic_early_data_context(SSL *ssl, const uint8_t *context,
|
|
|
1104
1113
|
}
|
|
1105
1114
|
|
|
1106
1115
|
void SSL_CTX_set_early_data_enabled(SSL_CTX *ctx, int enabled) {
|
|
1107
|
-
ctx->enable_early_data = !!enabled;
|
|
1116
|
+
FromOpaque(ctx)->enable_early_data = !!enabled;
|
|
1108
1117
|
}
|
|
1109
1118
|
|
|
1110
1119
|
void SSL_set_early_data_enabled(SSL *ssl, int enabled) {
|
|
@@ -1112,7 +1121,7 @@ void SSL_set_early_data_enabled(SSL *ssl, int enabled) {
|
|
|
1112
1121
|
}
|
|
1113
1122
|
|
|
1114
1123
|
int SSL_in_early_data(const SSL *ssl) {
|
|
1115
|
-
if (ssl->s3->hs ==
|
|
1124
|
+
if (ssl->s3->hs == nullptr) {
|
|
1116
1125
|
return 0;
|
|
1117
1126
|
}
|
|
1118
1127
|
return ssl->s3->hs->in_early_data;
|
|
@@ -1124,7 +1133,7 @@ int SSL_early_data_accepted(const SSL *ssl) {
|
|
|
1124
1133
|
|
|
1125
1134
|
void SSL_reset_early_data_reject(SSL *ssl) {
|
|
1126
1135
|
SSL_HANDSHAKE *hs = ssl->s3->hs.get();
|
|
1127
|
-
if (hs ==
|
|
1136
|
+
if (hs == nullptr || //
|
|
1128
1137
|
hs->wait != ssl_hs_early_data_rejected) {
|
|
1129
1138
|
abort();
|
|
1130
1139
|
}
|
|
@@ -1133,10 +1142,11 @@ void SSL_reset_early_data_reject(SSL *ssl) {
|
|
|
1133
1142
|
hs->in_early_data = false;
|
|
1134
1143
|
hs->early_session.reset();
|
|
1135
1144
|
|
|
1136
|
-
// Discard any unfinished writes from the perspective of
|
|
1145
|
+
// Discard any unfinished writes from the perspective of `SSL_write`'s
|
|
1137
1146
|
// retry. The handshake will transparently flush out the pending record
|
|
1138
1147
|
// (discarded by the server) to keep the framing correct.
|
|
1139
1148
|
ssl->s3->pending_write = {};
|
|
1149
|
+
ssl->s3->unreported_bytes_written = 0;
|
|
1140
1150
|
}
|
|
1141
1151
|
|
|
1142
1152
|
enum ssl_early_data_reason_t SSL_get_early_data_reason(const SSL *ssl) {
|
|
@@ -1319,16 +1329,20 @@ const char *SSL_error_description(int err) {
|
|
|
1319
1329
|
}
|
|
1320
1330
|
|
|
1321
1331
|
uint32_t SSL_CTX_set_options(SSL_CTX *ctx, uint32_t options) {
|
|
1322
|
-
|
|
1323
|
-
|
|
1332
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1333
|
+
ctx_impl->options |= options;
|
|
1334
|
+
return ctx_impl->options;
|
|
1324
1335
|
}
|
|
1325
1336
|
|
|
1326
1337
|
uint32_t SSL_CTX_clear_options(SSL_CTX *ctx, uint32_t options) {
|
|
1327
|
-
|
|
1328
|
-
|
|
1338
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1339
|
+
ctx_impl->options &= ~options;
|
|
1340
|
+
return ctx_impl->options;
|
|
1329
1341
|
}
|
|
1330
1342
|
|
|
1331
|
-
uint32_t SSL_CTX_get_options(const SSL_CTX *ctx) {
|
|
1343
|
+
uint32_t SSL_CTX_get_options(const SSL_CTX *ctx) {
|
|
1344
|
+
return FromOpaque(ctx)->options;
|
|
1345
|
+
}
|
|
1332
1346
|
|
|
1333
1347
|
uint32_t SSL_set_options(SSL *ssl, uint32_t options) {
|
|
1334
1348
|
ssl->options |= options;
|
|
@@ -1343,16 +1357,18 @@ uint32_t SSL_clear_options(SSL *ssl, uint32_t options) {
|
|
|
1343
1357
|
uint32_t SSL_get_options(const SSL *ssl) { return ssl->options; }
|
|
1344
1358
|
|
|
1345
1359
|
uint32_t SSL_CTX_set_mode(SSL_CTX *ctx, uint32_t mode) {
|
|
1346
|
-
|
|
1347
|
-
|
|
1360
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1361
|
+
ctx_impl->mode |= mode;
|
|
1362
|
+
return ctx_impl->mode;
|
|
1348
1363
|
}
|
|
1349
1364
|
|
|
1350
1365
|
uint32_t SSL_CTX_clear_mode(SSL_CTX *ctx, uint32_t mode) {
|
|
1351
|
-
|
|
1352
|
-
|
|
1366
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1367
|
+
ctx_impl->mode &= ~mode;
|
|
1368
|
+
return ctx_impl->mode;
|
|
1353
1369
|
}
|
|
1354
1370
|
|
|
1355
|
-
uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx) { return ctx->mode; }
|
|
1371
|
+
uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx) { return FromOpaque(ctx)->mode; }
|
|
1356
1372
|
|
|
1357
1373
|
uint32_t SSL_set_mode(SSL *ssl, uint32_t mode) {
|
|
1358
1374
|
ssl->mode |= mode;
|
|
@@ -1366,8 +1382,17 @@ uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode) {
|
|
|
1366
1382
|
|
|
1367
1383
|
uint32_t SSL_get_mode(const SSL *ssl) { return ssl->mode; }
|
|
1368
1384
|
|
|
1385
|
+
void SSL_CTX_set1_buffer_pool(SSL_CTX *ctx, CRYPTO_BUFFER_POOL *pool) {
|
|
1386
|
+
FromOpaque(ctx)->pool = UpRef(pool);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1369
1389
|
void SSL_CTX_set0_buffer_pool(SSL_CTX *ctx, CRYPTO_BUFFER_POOL *pool) {
|
|
1370
|
-
|
|
1390
|
+
// Historically, `CRYPTO_BUFFER_POOL` was not reference-counted and this
|
|
1391
|
+
// function saved a non-owning pointer, expecting the caller to maintain a
|
|
1392
|
+
// lifetime relationship between the two objects. Now that pools are
|
|
1393
|
+
// reference-counted, the compatible behavior is to treat it as set0 rather
|
|
1394
|
+
// than ownership-transfering.
|
|
1395
|
+
return SSL_CTX_set1_buffer_pool(ctx, pool);
|
|
1371
1396
|
}
|
|
1372
1397
|
|
|
1373
1398
|
int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, size_t *out_len,
|
|
@@ -1385,7 +1410,7 @@ int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, size_t *out_len,
|
|
|
1385
1410
|
// is the client's in a full handshake and the server's for a resumption. See
|
|
1386
1411
|
// https://tools.ietf.org/html/rfc5929#section-3.1.
|
|
1387
1412
|
Span<const uint8_t> finished = ssl->s3->previous_client_finished;
|
|
1388
|
-
if (ssl->session !=
|
|
1413
|
+
if (ssl->session != nullptr) {
|
|
1389
1414
|
// tls-unique is broken for resumed sessions unless EMS is used.
|
|
1390
1415
|
if (!ssl->session->extended_master_secret) {
|
|
1391
1416
|
return 0;
|
|
@@ -1414,7 +1439,8 @@ static int set_session_id_context(CERT *cert, const uint8_t *sid_ctx,
|
|
|
1414
1439
|
|
|
1415
1440
|
int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const uint8_t *sid_ctx,
|
|
1416
1441
|
size_t sid_ctx_len) {
|
|
1417
|
-
return set_session_id_context(ctx->cert.get(), sid_ctx,
|
|
1442
|
+
return set_session_id_context(FromOpaque(ctx)->cert.get(), sid_ctx,
|
|
1443
|
+
sid_ctx_len);
|
|
1418
1444
|
}
|
|
1419
1445
|
|
|
1420
1446
|
int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
|
|
@@ -1429,7 +1455,7 @@ const uint8_t *SSL_get0_session_id_context(const SSL *ssl, size_t *out_len) {
|
|
|
1429
1455
|
if (!ssl->config) {
|
|
1430
1456
|
assert(ssl->config);
|
|
1431
1457
|
*out_len = 0;
|
|
1432
|
-
return
|
|
1458
|
+
return nullptr;
|
|
1433
1459
|
}
|
|
1434
1460
|
*out_len = ssl->config->cert->sid_ctx.size();
|
|
1435
1461
|
return ssl->config->cert->sid_ctx.data();
|
|
@@ -1440,7 +1466,7 @@ int SSL_get_fd(const SSL *ssl) { return SSL_get_rfd(ssl); }
|
|
|
1440
1466
|
int SSL_get_rfd(const SSL *ssl) {
|
|
1441
1467
|
int ret = -1;
|
|
1442
1468
|
BIO *b = BIO_find_type(SSL_get_rbio(ssl), BIO_TYPE_DESCRIPTOR);
|
|
1443
|
-
if (b !=
|
|
1469
|
+
if (b != nullptr) {
|
|
1444
1470
|
BIO_get_fd(b, &ret);
|
|
1445
1471
|
}
|
|
1446
1472
|
return ret;
|
|
@@ -1449,7 +1475,7 @@ int SSL_get_rfd(const SSL *ssl) {
|
|
|
1449
1475
|
int SSL_get_wfd(const SSL *ssl) {
|
|
1450
1476
|
int ret = -1;
|
|
1451
1477
|
BIO *b = BIO_find_type(SSL_get_wbio(ssl), BIO_TYPE_DESCRIPTOR);
|
|
1452
|
-
if (b !=
|
|
1478
|
+
if (b != nullptr) {
|
|
1453
1479
|
BIO_get_fd(b, &ret);
|
|
1454
1480
|
}
|
|
1455
1481
|
return ret;
|
|
@@ -1458,7 +1484,7 @@ int SSL_get_wfd(const SSL *ssl) {
|
|
|
1458
1484
|
#if !defined(OPENSSL_NO_SOCK)
|
|
1459
1485
|
int SSL_set_fd(SSL *ssl, int fd) {
|
|
1460
1486
|
BIO *bio = BIO_new(BIO_s_socket());
|
|
1461
|
-
if (bio ==
|
|
1487
|
+
if (bio == nullptr) {
|
|
1462
1488
|
OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB);
|
|
1463
1489
|
return 0;
|
|
1464
1490
|
}
|
|
@@ -1469,10 +1495,10 @@ int SSL_set_fd(SSL *ssl, int fd) {
|
|
|
1469
1495
|
|
|
1470
1496
|
int SSL_set_wfd(SSL *ssl, int fd) {
|
|
1471
1497
|
BIO *rbio = SSL_get_rbio(ssl);
|
|
1472
|
-
if (rbio ==
|
|
1473
|
-
BIO_get_fd(rbio,
|
|
1498
|
+
if (rbio == nullptr || BIO_method_type(rbio) != BIO_TYPE_SOCKET ||
|
|
1499
|
+
BIO_get_fd(rbio, nullptr) != fd) {
|
|
1474
1500
|
BIO *bio = BIO_new(BIO_s_socket());
|
|
1475
|
-
if (bio ==
|
|
1501
|
+
if (bio == nullptr) {
|
|
1476
1502
|
OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB);
|
|
1477
1503
|
return 0;
|
|
1478
1504
|
}
|
|
@@ -1489,10 +1515,10 @@ int SSL_set_wfd(SSL *ssl, int fd) {
|
|
|
1489
1515
|
|
|
1490
1516
|
int SSL_set_rfd(SSL *ssl, int fd) {
|
|
1491
1517
|
BIO *wbio = SSL_get_wbio(ssl);
|
|
1492
|
-
if (wbio ==
|
|
1493
|
-
BIO_get_fd(wbio,
|
|
1518
|
+
if (wbio == nullptr || BIO_method_type(wbio) != BIO_TYPE_SOCKET ||
|
|
1519
|
+
BIO_get_fd(wbio, nullptr) != fd) {
|
|
1494
1520
|
BIO *bio = BIO_new(BIO_s_socket());
|
|
1495
|
-
if (bio ==
|
|
1521
|
+
if (bio == nullptr) {
|
|
1496
1522
|
OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB);
|
|
1497
1523
|
return 0;
|
|
1498
1524
|
}
|
|
@@ -1560,12 +1586,12 @@ int SSL_get_extms_support(const SSL *ssl) {
|
|
|
1560
1586
|
}
|
|
1561
1587
|
|
|
1562
1588
|
// If the initial handshake completed, query the established session.
|
|
1563
|
-
if (ssl->s3->established_session !=
|
|
1589
|
+
if (ssl->s3->established_session != nullptr) {
|
|
1564
1590
|
return ssl->s3->established_session->extended_master_secret;
|
|
1565
1591
|
}
|
|
1566
1592
|
|
|
1567
1593
|
// Otherwise, query the in-progress handshake.
|
|
1568
|
-
if (ssl->s3->hs !=
|
|
1594
|
+
if (ssl->s3->hs != nullptr) {
|
|
1569
1595
|
return ssl->s3->hs->extended_master_secret;
|
|
1570
1596
|
}
|
|
1571
1597
|
assert(0);
|
|
@@ -1588,8 +1614,8 @@ int SSL_has_pending(const SSL *ssl) {
|
|
|
1588
1614
|
return SSL_pending(ssl) != 0 || !ssl->s3->read_buffer.empty();
|
|
1589
1615
|
}
|
|
1590
1616
|
|
|
1591
|
-
static bool has_cert_and_key(const
|
|
1592
|
-
// TODO(davidben): If
|
|
1617
|
+
static bool has_cert_and_key(const SSLCredential *cred) {
|
|
1618
|
+
// TODO(davidben): If `cred->key_method` is set, that should be fine too.
|
|
1593
1619
|
if (cred->privkey == nullptr) {
|
|
1594
1620
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED);
|
|
1595
1621
|
return false;
|
|
@@ -1607,7 +1633,7 @@ static bool has_cert_and_key(const SSL_CREDENTIAL *cred) {
|
|
|
1607
1633
|
int SSL_CTX_check_private_key(const SSL_CTX *ctx) {
|
|
1608
1634
|
// There is no need to actually check consistency because inconsistent values
|
|
1609
1635
|
// can never be configured.
|
|
1610
|
-
return has_cert_and_key(ctx->cert->legacy_credential.get());
|
|
1636
|
+
return has_cert_and_key(FromOpaque(ctx)->cert->legacy_credential.get());
|
|
1611
1637
|
}
|
|
1612
1638
|
|
|
1613
1639
|
int SSL_check_private_key(const SSL *ssl) {
|
|
@@ -1673,14 +1699,14 @@ int SSL_total_renegotiations(const SSL *ssl) {
|
|
|
1673
1699
|
}
|
|
1674
1700
|
|
|
1675
1701
|
size_t SSL_CTX_get_max_cert_list(const SSL_CTX *ctx) {
|
|
1676
|
-
return ctx->max_cert_list;
|
|
1702
|
+
return FromOpaque(ctx)->max_cert_list;
|
|
1677
1703
|
}
|
|
1678
1704
|
|
|
1679
1705
|
void SSL_CTX_set_max_cert_list(SSL_CTX *ctx, size_t max_cert_list) {
|
|
1680
1706
|
if (max_cert_list > kMaxHandshakeSize) {
|
|
1681
1707
|
max_cert_list = kMaxHandshakeSize;
|
|
1682
1708
|
}
|
|
1683
|
-
ctx->max_cert_list = (uint32_t)max_cert_list;
|
|
1709
|
+
FromOpaque(ctx)->max_cert_list = (uint32_t)max_cert_list;
|
|
1684
1710
|
}
|
|
1685
1711
|
|
|
1686
1712
|
size_t SSL_get_max_cert_list(const SSL *ssl) { return ssl->max_cert_list; }
|
|
@@ -1699,7 +1725,7 @@ int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, size_t max_send_fragment) {
|
|
|
1699
1725
|
if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
|
|
1700
1726
|
max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
|
|
1701
1727
|
}
|
|
1702
|
-
ctx->max_send_fragment = (uint16_t)max_send_fragment;
|
|
1728
|
+
FromOpaque(ctx)->max_send_fragment = (uint16_t)max_send_fragment;
|
|
1703
1729
|
|
|
1704
1730
|
return 1;
|
|
1705
1731
|
}
|
|
@@ -1733,33 +1759,31 @@ int SSL_get_secure_renegotiation_support(const SSL *ssl) {
|
|
|
1733
1759
|
}
|
|
1734
1760
|
|
|
1735
1761
|
size_t SSL_CTX_sess_number(const SSL_CTX *ctx) {
|
|
1736
|
-
|
|
1737
|
-
|
|
1762
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1763
|
+
MutexReadLock lock(&ctx_impl->lock);
|
|
1764
|
+
return lh_SSL_SESSION_num_items(ctx_impl->sessions);
|
|
1738
1765
|
}
|
|
1739
1766
|
|
|
1740
1767
|
unsigned long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, unsigned long size) {
|
|
1741
|
-
|
|
1742
|
-
ctx->session_cache_size = size;
|
|
1743
|
-
return ret;
|
|
1768
|
+
return std::exchange(FromOpaque(ctx)->session_cache_size, size);
|
|
1744
1769
|
}
|
|
1745
1770
|
|
|
1746
1771
|
unsigned long SSL_CTX_sess_get_cache_size(const SSL_CTX *ctx) {
|
|
1747
|
-
return ctx->session_cache_size;
|
|
1772
|
+
return FromOpaque(ctx)->session_cache_size;
|
|
1748
1773
|
}
|
|
1749
1774
|
|
|
1750
1775
|
int SSL_CTX_set_session_cache_mode(SSL_CTX *ctx, int mode) {
|
|
1751
|
-
|
|
1752
|
-
ctx->session_cache_mode = mode;
|
|
1753
|
-
return ret;
|
|
1776
|
+
return std::exchange(FromOpaque(ctx)->session_cache_mode, mode);
|
|
1754
1777
|
}
|
|
1755
1778
|
|
|
1756
1779
|
int SSL_CTX_get_session_cache_mode(const SSL_CTX *ctx) {
|
|
1757
|
-
return ctx->session_cache_mode;
|
|
1780
|
+
return FromOpaque(ctx)->session_cache_mode;
|
|
1758
1781
|
}
|
|
1759
1782
|
|
|
1760
1783
|
|
|
1761
1784
|
int SSL_CTX_get_tlsext_ticket_keys(SSL_CTX *ctx, void *out, size_t len) {
|
|
1762
|
-
|
|
1785
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1786
|
+
if (out == nullptr) {
|
|
1763
1787
|
return 48;
|
|
1764
1788
|
}
|
|
1765
1789
|
if (len != 48) {
|
|
@@ -1769,20 +1793,21 @@ int SSL_CTX_get_tlsext_ticket_keys(SSL_CTX *ctx, void *out, size_t len) {
|
|
|
1769
1793
|
|
|
1770
1794
|
// The default ticket keys are initialized lazily. Trigger a key
|
|
1771
1795
|
// rotation to initialize them.
|
|
1772
|
-
if (!ssl_ctx_rotate_ticket_encryption_key(
|
|
1796
|
+
if (!ssl_ctx_rotate_ticket_encryption_key(ctx_impl)) {
|
|
1773
1797
|
return 0;
|
|
1774
1798
|
}
|
|
1775
1799
|
|
|
1776
1800
|
uint8_t *out_bytes = reinterpret_cast<uint8_t *>(out);
|
|
1777
|
-
MutexReadLock lock(&
|
|
1778
|
-
OPENSSL_memcpy(out_bytes,
|
|
1779
|
-
OPENSSL_memcpy(out_bytes + 16,
|
|
1780
|
-
OPENSSL_memcpy(out_bytes + 32,
|
|
1801
|
+
MutexReadLock lock(&ctx_impl->lock);
|
|
1802
|
+
OPENSSL_memcpy(out_bytes, ctx_impl->ticket_key_current->name, 16);
|
|
1803
|
+
OPENSSL_memcpy(out_bytes + 16, ctx_impl->ticket_key_current->hmac_key, 16);
|
|
1804
|
+
OPENSSL_memcpy(out_bytes + 32, ctx_impl->ticket_key_current->aes_key, 16);
|
|
1781
1805
|
return 1;
|
|
1782
1806
|
}
|
|
1783
1807
|
|
|
1784
1808
|
int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in, size_t len) {
|
|
1785
|
-
|
|
1809
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1810
|
+
if (in == nullptr) {
|
|
1786
1811
|
return 48;
|
|
1787
1812
|
}
|
|
1788
1813
|
if (len != 48) {
|
|
@@ -1800,8 +1825,8 @@ int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in, size_t len) {
|
|
|
1800
1825
|
// Disable automatic key rotation for manually-configured keys. This is now
|
|
1801
1826
|
// the caller's responsibility.
|
|
1802
1827
|
key->next_rotation_tv_sec = 0;
|
|
1803
|
-
|
|
1804
|
-
|
|
1828
|
+
ctx_impl->ticket_key_current = std::move(key);
|
|
1829
|
+
ctx_impl->ticket_key_prev.reset();
|
|
1805
1830
|
return 1;
|
|
1806
1831
|
}
|
|
1807
1832
|
|
|
@@ -1809,10 +1834,25 @@ int SSL_CTX_set_tlsext_ticket_key_cb(
|
|
|
1809
1834
|
SSL_CTX *ctx,
|
|
1810
1835
|
int (*callback)(SSL *ssl, uint8_t *key_name, uint8_t *iv,
|
|
1811
1836
|
EVP_CIPHER_CTX *ctx, HMAC_CTX *hmac_ctx, int encrypt)) {
|
|
1812
|
-
ctx->ticket_key_cb = callback;
|
|
1837
|
+
FromOpaque(ctx)->ticket_key_cb = callback;
|
|
1813
1838
|
return 1;
|
|
1814
1839
|
}
|
|
1815
1840
|
|
|
1841
|
+
static bool check_no_duplicates(Span<const uint16_t> list) {
|
|
1842
|
+
if (list.size() < 2) {
|
|
1843
|
+
return true;
|
|
1844
|
+
}
|
|
1845
|
+
for (size_t i = 0; i < list.size() - 1; ++i) {
|
|
1846
|
+
for (size_t j = i + 1; j < list.size(); ++j) {
|
|
1847
|
+
if (list[i] == list[j]) {
|
|
1848
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_DUPLICATE_GROUP);
|
|
1849
|
+
return false;
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
return true;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1816
1856
|
static bool check_group_ids(Span<const uint16_t> group_ids) {
|
|
1817
1857
|
for (uint16_t group_id : group_ids) {
|
|
1818
1858
|
if (ssl_group_id_to_nid(group_id) == NID_undef) {
|
|
@@ -1820,27 +1860,111 @@ static bool check_group_ids(Span<const uint16_t> group_ids) {
|
|
|
1820
1860
|
return false;
|
|
1821
1861
|
}
|
|
1822
1862
|
}
|
|
1823
|
-
return
|
|
1863
|
+
return check_no_duplicates(group_ids);
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
// validate_key_shares returns whether the `requested_key_shares` are free of
|
|
1867
|
+
// duplicates and are a (correctly ordered) subsequence of the supported
|
|
1868
|
+
// `groups`.
|
|
1869
|
+
static bool validate_key_shares(Span<const uint16_t> requested_key_shares,
|
|
1870
|
+
Span<const uint16_t> groups) {
|
|
1871
|
+
if (!check_no_duplicates(requested_key_shares)) {
|
|
1872
|
+
return false;
|
|
1873
|
+
}
|
|
1874
|
+
if (requested_key_shares.size() > groups.size()) {
|
|
1875
|
+
return false;
|
|
1876
|
+
}
|
|
1877
|
+
size_t key_shares_idx = 0u, groups_idx = 0u;
|
|
1878
|
+
while (key_shares_idx < requested_key_shares.size() &&
|
|
1879
|
+
groups_idx < groups.size()) {
|
|
1880
|
+
if (requested_key_shares[key_shares_idx] == groups[groups_idx++]) {
|
|
1881
|
+
++key_shares_idx;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
return key_shares_idx == requested_key_shares.size();
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
static void clear_key_shares_if_invalid(SSL_CONFIG *config) {
|
|
1888
|
+
if (!config->client_key_share_selections) {
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
if (!validate_key_shares(*(config->client_key_share_selections),
|
|
1892
|
+
config->supported_group_list)) {
|
|
1893
|
+
config->client_key_share_selections.reset();
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
static bool check_group_flags(Span<const uint32_t> flags) {
|
|
1898
|
+
if (flags.empty()) {
|
|
1899
|
+
return true;
|
|
1900
|
+
}
|
|
1901
|
+
// The last element must not have the "equal preference with next" flag,
|
|
1902
|
+
// because there is no next element.
|
|
1903
|
+
return (flags.back() & SSL_GROUP_FLAG_EQUAL_PREFERENCE_WITH_NEXT) == 0;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
static bool set_group_ids_and_flags(const uint16_t *group_ids,
|
|
1907
|
+
const uint32_t *flags, size_t num_group_ids,
|
|
1908
|
+
Array<uint16_t> *groups_out,
|
|
1909
|
+
Array<uint32_t> *flags_out) {
|
|
1910
|
+
Span<const uint16_t> groups_span = num_group_ids == 0
|
|
1911
|
+
? DefaultSupportedGroupIds()
|
|
1912
|
+
: Span(group_ids, num_group_ids);
|
|
1913
|
+
if (!check_group_ids(groups_span)) {
|
|
1914
|
+
return false;
|
|
1915
|
+
}
|
|
1916
|
+
// If using default groups, always use default flags.
|
|
1917
|
+
if (flags == nullptr || num_group_ids == 0) {
|
|
1918
|
+
return groups_out->CopyFrom(groups_span) &&
|
|
1919
|
+
flags_out->Init(groups_span.size());
|
|
1920
|
+
}
|
|
1921
|
+
Span<const uint32_t> flags_span = Span(flags, num_group_ids);
|
|
1922
|
+
if (!check_group_flags(flags_span)) {
|
|
1923
|
+
return false;
|
|
1924
|
+
}
|
|
1925
|
+
return groups_out->CopyFrom(groups_span) && flags_out->CopyFrom(flags_span);
|
|
1824
1926
|
}
|
|
1825
1927
|
|
|
1826
1928
|
int SSL_CTX_set1_group_ids(SSL_CTX *ctx, const uint16_t *group_ids,
|
|
1827
1929
|
size_t num_group_ids) {
|
|
1828
|
-
|
|
1829
|
-
|
|
1930
|
+
return SSL_CTX_set1_group_ids_with_flags(ctx, group_ids, /*flags=*/nullptr,
|
|
1931
|
+
num_group_ids);
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
int SSL_CTX_set1_group_ids_with_flags(SSL_CTX *ctx, const uint16_t *group_ids,
|
|
1935
|
+
const uint32_t *flags,
|
|
1936
|
+
size_t num_group_ids) {
|
|
1937
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1938
|
+
return set_group_ids_and_flags(group_ids, flags, num_group_ids,
|
|
1939
|
+
&ctx_impl->supported_group_list,
|
|
1940
|
+
&ctx_impl->supported_group_list_flags);
|
|
1830
1941
|
}
|
|
1831
1942
|
|
|
1832
1943
|
int SSL_set1_group_ids(SSL *ssl, const uint16_t *group_ids,
|
|
1833
1944
|
size_t num_group_ids) {
|
|
1945
|
+
return SSL_set1_group_ids_with_flags(ssl, group_ids, /*flags=*/nullptr,
|
|
1946
|
+
num_group_ids);
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
int SSL_set1_group_ids_with_flags(SSL *ssl, const uint16_t *group_ids,
|
|
1950
|
+
const uint32_t *flags, size_t num_group_ids) {
|
|
1834
1951
|
if (!ssl->config) {
|
|
1835
1952
|
return 0;
|
|
1836
1953
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1954
|
+
if (set_group_ids_and_flags(group_ids, flags, num_group_ids,
|
|
1955
|
+
&ssl->config->supported_group_list,
|
|
1956
|
+
&ssl->config->supported_group_list_flags)) {
|
|
1957
|
+
clear_key_shares_if_invalid(ssl->config.get());
|
|
1958
|
+
return 1;
|
|
1959
|
+
}
|
|
1960
|
+
return 0;
|
|
1840
1961
|
}
|
|
1841
1962
|
|
|
1842
1963
|
static bool ssl_nids_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
1843
1964
|
Span<const int> nids) {
|
|
1965
|
+
if (nids.empty()) {
|
|
1966
|
+
return out_group_ids->CopyFrom(DefaultSupportedGroupIds());
|
|
1967
|
+
}
|
|
1844
1968
|
Array<uint16_t> group_ids;
|
|
1845
1969
|
if (!group_ids.InitForOverwrite(nids.size())) {
|
|
1846
1970
|
return false;
|
|
@@ -1852,22 +1976,34 @@ static bool ssl_nids_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
|
1852
1976
|
return false;
|
|
1853
1977
|
}
|
|
1854
1978
|
}
|
|
1979
|
+
if (!check_no_duplicates(group_ids)) {
|
|
1980
|
+
return false;
|
|
1981
|
+
}
|
|
1855
1982
|
|
|
1856
1983
|
*out_group_ids = std::move(group_ids);
|
|
1857
1984
|
return true;
|
|
1858
1985
|
}
|
|
1859
1986
|
|
|
1860
1987
|
int SSL_CTX_set1_groups(SSL_CTX *ctx, const int *groups, size_t num_groups) {
|
|
1861
|
-
|
|
1862
|
-
|
|
1988
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1989
|
+
return ssl_nids_to_group_ids(&ctx_impl->supported_group_list,
|
|
1990
|
+
Span(groups, num_groups)) &&
|
|
1991
|
+
ctx_impl->supported_group_list_flags.Init(
|
|
1992
|
+
ctx_impl->supported_group_list.size());
|
|
1863
1993
|
}
|
|
1864
1994
|
|
|
1865
1995
|
int SSL_set1_groups(SSL *ssl, const int *groups, size_t num_groups) {
|
|
1866
1996
|
if (!ssl->config) {
|
|
1867
1997
|
return 0;
|
|
1868
1998
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1999
|
+
if (ssl_nids_to_group_ids(&ssl->config->supported_group_list,
|
|
2000
|
+
Span(groups, num_groups)) &&
|
|
2001
|
+
ssl->config->supported_group_list_flags.Init(
|
|
2002
|
+
ssl->config->supported_group_list.size())) {
|
|
2003
|
+
clear_key_shares_if_invalid(ssl->config.get());
|
|
2004
|
+
return 1;
|
|
2005
|
+
}
|
|
2006
|
+
return 0;
|
|
1871
2007
|
}
|
|
1872
2008
|
|
|
1873
2009
|
static bool ssl_str_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
@@ -1903,24 +2039,36 @@ static bool ssl_str_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
|
1903
2039
|
} while (col);
|
|
1904
2040
|
|
|
1905
2041
|
assert(i == count);
|
|
2042
|
+
if (!check_no_duplicates(group_ids)) {
|
|
2043
|
+
return false;
|
|
2044
|
+
}
|
|
1906
2045
|
*out_group_ids = std::move(group_ids);
|
|
1907
2046
|
return true;
|
|
1908
2047
|
}
|
|
1909
2048
|
|
|
1910
2049
|
int SSL_CTX_set1_groups_list(SSL_CTX *ctx, const char *groups) {
|
|
1911
|
-
|
|
2050
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2051
|
+
return ssl_str_to_group_ids(&ctx_impl->supported_group_list, groups) &&
|
|
2052
|
+
ctx_impl->supported_group_list_flags.Init(
|
|
2053
|
+
ctx_impl->supported_group_list.size());
|
|
1912
2054
|
}
|
|
1913
2055
|
|
|
1914
2056
|
int SSL_set1_groups_list(SSL *ssl, const char *groups) {
|
|
1915
2057
|
if (!ssl->config) {
|
|
1916
2058
|
return 0;
|
|
1917
2059
|
}
|
|
1918
|
-
|
|
2060
|
+
if (ssl_str_to_group_ids(&ssl->config->supported_group_list, groups) &&
|
|
2061
|
+
ssl->config->supported_group_list_flags.Init(
|
|
2062
|
+
ssl->config->supported_group_list.size())) {
|
|
2063
|
+
clear_key_shares_if_invalid(ssl->config.get());
|
|
2064
|
+
return 1;
|
|
2065
|
+
}
|
|
2066
|
+
return 0;
|
|
1919
2067
|
}
|
|
1920
2068
|
|
|
1921
2069
|
uint16_t SSL_get_group_id(const SSL *ssl) {
|
|
1922
2070
|
SSL_SESSION *session = SSL_get_session(ssl);
|
|
1923
|
-
if (session ==
|
|
2071
|
+
if (session == nullptr) {
|
|
1924
2072
|
return 0;
|
|
1925
2073
|
}
|
|
1926
2074
|
|
|
@@ -1935,28 +2083,56 @@ int SSL_get_negotiated_group(const SSL *ssl) {
|
|
|
1935
2083
|
return ssl_group_id_to_nid(group_id);
|
|
1936
2084
|
}
|
|
1937
2085
|
|
|
2086
|
+
int SSL_set1_client_key_shares(SSL *ssl, const uint16_t *group_ids,
|
|
2087
|
+
size_t num_group_ids) {
|
|
2088
|
+
if (!ssl->config) {
|
|
2089
|
+
return 0;
|
|
2090
|
+
}
|
|
2091
|
+
auto requested_key_shares = Span(group_ids, num_group_ids);
|
|
2092
|
+
if (!validate_key_shares(requested_key_shares,
|
|
2093
|
+
ssl->config->supported_group_list)) {
|
|
2094
|
+
return 0;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
assert(requested_key_shares.size() <= kNumNamedGroups);
|
|
2098
|
+
ssl->config->client_key_share_selections.emplace();
|
|
2099
|
+
ssl->config->client_key_share_selections->CopyFrom(requested_key_shares);
|
|
2100
|
+
return 1;
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
int SSL_set1_server_supported_groups_hint(SSL *ssl,
|
|
2104
|
+
const uint16_t *server_groups,
|
|
2105
|
+
size_t num_server_groups) {
|
|
2106
|
+
if (!ssl->config) {
|
|
2107
|
+
return 0;
|
|
2108
|
+
}
|
|
2109
|
+
auto span = Span(server_groups, num_server_groups);
|
|
2110
|
+
return ssl->config->server_supported_groups_hint.CopyFrom(span);
|
|
2111
|
+
}
|
|
2112
|
+
|
|
1938
2113
|
int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh) { return 1; }
|
|
1939
2114
|
|
|
1940
2115
|
int SSL_set_tmp_dh(SSL *ssl, const DH *dh) { return 1; }
|
|
1941
2116
|
|
|
1942
2117
|
STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx) {
|
|
1943
|
-
return ctx->cipher_list->ciphers.get();
|
|
2118
|
+
return FromOpaque(ctx)->cipher_list->ciphers.get();
|
|
1944
2119
|
}
|
|
1945
2120
|
|
|
1946
2121
|
int SSL_CTX_cipher_in_group(const SSL_CTX *ctx, size_t i) {
|
|
1947
|
-
|
|
2122
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2123
|
+
if (i >= sk_SSL_CIPHER_num(ctx_impl->cipher_list->ciphers.get())) {
|
|
1948
2124
|
return 0;
|
|
1949
2125
|
}
|
|
1950
|
-
return
|
|
2126
|
+
return ctx_impl->cipher_list->in_group_flags[i];
|
|
1951
2127
|
}
|
|
1952
2128
|
|
|
1953
2129
|
STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl) {
|
|
1954
|
-
if (ssl ==
|
|
1955
|
-
return
|
|
2130
|
+
if (ssl == nullptr) {
|
|
2131
|
+
return nullptr;
|
|
1956
2132
|
}
|
|
1957
|
-
if (ssl->config ==
|
|
2133
|
+
if (ssl->config == nullptr) {
|
|
1958
2134
|
assert(ssl->config);
|
|
1959
|
-
return
|
|
2135
|
+
return nullptr;
|
|
1960
2136
|
}
|
|
1961
2137
|
|
|
1962
2138
|
return ssl->config->cipher_list ? ssl->config->cipher_list->ciphers.get()
|
|
@@ -1964,34 +2140,38 @@ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl) {
|
|
|
1964
2140
|
}
|
|
1965
2141
|
|
|
1966
2142
|
const char *SSL_get_cipher_list(const SSL *ssl, int n) {
|
|
1967
|
-
if (ssl ==
|
|
1968
|
-
return
|
|
2143
|
+
if (ssl == nullptr) {
|
|
2144
|
+
return nullptr;
|
|
1969
2145
|
}
|
|
1970
2146
|
|
|
1971
2147
|
STACK_OF(SSL_CIPHER) *sk = SSL_get_ciphers(ssl);
|
|
1972
|
-
if (sk ==
|
|
1973
|
-
return
|
|
2148
|
+
if (sk == nullptr || n < 0 || (size_t)n >= sk_SSL_CIPHER_num(sk)) {
|
|
2149
|
+
return nullptr;
|
|
1974
2150
|
}
|
|
1975
2151
|
|
|
1976
2152
|
const SSL_CIPHER *c = sk_SSL_CIPHER_value(sk, n);
|
|
1977
|
-
if (c ==
|
|
1978
|
-
return
|
|
2153
|
+
if (c == nullptr) {
|
|
2154
|
+
return nullptr;
|
|
1979
2155
|
}
|
|
1980
2156
|
|
|
1981
2157
|
return c->name;
|
|
1982
2158
|
}
|
|
1983
2159
|
|
|
1984
2160
|
int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2161
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2162
|
+
const bool has_aes_hw = ctx_impl->aes_hw_override
|
|
2163
|
+
? ctx_impl->aes_hw_override_value
|
|
2164
|
+
: EVP_has_aes_hardware();
|
|
2165
|
+
return ssl_create_cipher_list(&ctx_impl->cipher_list, has_aes_hw, str,
|
|
1988
2166
|
false /* not strict */);
|
|
1989
2167
|
}
|
|
1990
2168
|
|
|
1991
2169
|
int SSL_CTX_set_strict_cipher_list(SSL_CTX *ctx, const char *str) {
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2170
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2171
|
+
const bool has_aes_hw = ctx_impl->aes_hw_override
|
|
2172
|
+
? ctx_impl->aes_hw_override_value
|
|
2173
|
+
: EVP_has_aes_hardware();
|
|
2174
|
+
return ssl_create_cipher_list(&ctx_impl->cipher_list, has_aes_hw, str,
|
|
1995
2175
|
true /* strict */);
|
|
1996
2176
|
}
|
|
1997
2177
|
|
|
@@ -2019,11 +2199,11 @@ int SSL_set_strict_cipher_list(SSL *ssl, const char *str) {
|
|
|
2019
2199
|
|
|
2020
2200
|
const char *SSL_get_servername(const SSL *ssl, const int type) {
|
|
2021
2201
|
if (type != TLSEXT_NAMETYPE_host_name) {
|
|
2022
|
-
return
|
|
2202
|
+
return nullptr;
|
|
2023
2203
|
}
|
|
2024
2204
|
|
|
2025
|
-
// Historically,
|
|
2026
|
-
// corresponding to
|
|
2205
|
+
// Historically, `SSL_get_servername` was also the configuration getter
|
|
2206
|
+
// corresponding to `SSL_set_tlsext_host_name`.
|
|
2027
2207
|
if (ssl->hostname != nullptr) {
|
|
2028
2208
|
return ssl->hostname.get();
|
|
2029
2209
|
}
|
|
@@ -2032,7 +2212,7 @@ const char *SSL_get_servername(const SSL *ssl, const int type) {
|
|
|
2032
2212
|
}
|
|
2033
2213
|
|
|
2034
2214
|
int SSL_get_servername_type(const SSL *ssl) {
|
|
2035
|
-
if (SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name) ==
|
|
2215
|
+
if (SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name) == nullptr) {
|
|
2036
2216
|
return -1;
|
|
2037
2217
|
}
|
|
2038
2218
|
return TLSEXT_NAMETYPE_host_name;
|
|
@@ -2041,8 +2221,9 @@ int SSL_get_servername_type(const SSL *ssl) {
|
|
|
2041
2221
|
void SSL_CTX_set_custom_verify(
|
|
2042
2222
|
SSL_CTX *ctx, int mode,
|
|
2043
2223
|
enum ssl_verify_result_t (*callback)(SSL *ssl, uint8_t *out_alert)) {
|
|
2044
|
-
|
|
2045
|
-
|
|
2224
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2225
|
+
ctx_impl->verify_mode = mode;
|
|
2226
|
+
ctx_impl->custom_verify_callback = callback;
|
|
2046
2227
|
}
|
|
2047
2228
|
|
|
2048
2229
|
void SSL_set_custom_verify(
|
|
@@ -2056,7 +2237,7 @@ void SSL_set_custom_verify(
|
|
|
2056
2237
|
}
|
|
2057
2238
|
|
|
2058
2239
|
void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx) {
|
|
2059
|
-
ctx->signed_cert_timestamps_enabled = true;
|
|
2240
|
+
FromOpaque(ctx)->signed_cert_timestamps_enabled = true;
|
|
2060
2241
|
}
|
|
2061
2242
|
|
|
2062
2243
|
void SSL_enable_signed_cert_timestamps(SSL *ssl) {
|
|
@@ -2067,7 +2248,7 @@ void SSL_enable_signed_cert_timestamps(SSL *ssl) {
|
|
|
2067
2248
|
}
|
|
2068
2249
|
|
|
2069
2250
|
void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx) {
|
|
2070
|
-
ctx->ocsp_stapling_enabled = true;
|
|
2251
|
+
FromOpaque(ctx)->ocsp_stapling_enabled = true;
|
|
2071
2252
|
}
|
|
2072
2253
|
|
|
2073
2254
|
void SSL_enable_ocsp_stapling(SSL *ssl) {
|
|
@@ -2082,7 +2263,7 @@ void SSL_get0_signed_cert_timestamp_list(const SSL *ssl, const uint8_t **out,
|
|
|
2082
2263
|
SSL_SESSION *session = SSL_get_session(ssl);
|
|
2083
2264
|
if (ssl->server || !session || !session->signed_cert_timestamp_list) {
|
|
2084
2265
|
*out_len = 0;
|
|
2085
|
-
*out =
|
|
2266
|
+
*out = nullptr;
|
|
2086
2267
|
return;
|
|
2087
2268
|
}
|
|
2088
2269
|
|
|
@@ -2095,7 +2276,7 @@ void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
|
|
|
2095
2276
|
SSL_SESSION *session = SSL_get_session(ssl);
|
|
2096
2277
|
if (ssl->server || !session || !session->ocsp_response) {
|
|
2097
2278
|
*out_len = 0;
|
|
2098
|
-
*out =
|
|
2279
|
+
*out = nullptr;
|
|
2099
2280
|
return;
|
|
2100
2281
|
}
|
|
2101
2282
|
|
|
@@ -2123,12 +2304,12 @@ int SSL_set_tlsext_host_name(SSL *ssl, const char *name) {
|
|
|
2123
2304
|
|
|
2124
2305
|
int SSL_CTX_set_tlsext_servername_callback(
|
|
2125
2306
|
SSL_CTX *ctx, int (*callback)(SSL *ssl, int *out_alert, void *arg)) {
|
|
2126
|
-
ctx->servername_callback = callback;
|
|
2307
|
+
FromOpaque(ctx)->servername_callback = callback;
|
|
2127
2308
|
return 1;
|
|
2128
2309
|
}
|
|
2129
2310
|
|
|
2130
2311
|
int SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg) {
|
|
2131
|
-
ctx->servername_arg = arg;
|
|
2312
|
+
FromOpaque(ctx)->servername_arg = arg;
|
|
2132
2313
|
return 1;
|
|
2133
2314
|
}
|
|
2134
2315
|
|
|
@@ -2138,7 +2319,7 @@ int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer,
|
|
|
2138
2319
|
*out = nullptr;
|
|
2139
2320
|
*out_len = 0;
|
|
2140
2321
|
|
|
2141
|
-
// Both
|
|
2322
|
+
// Both `peer` and `supported` must be valid protocol lists, but `peer` may be
|
|
2142
2323
|
// empty in NPN.
|
|
2143
2324
|
auto peer_span = Span(peer, peer_len);
|
|
2144
2325
|
auto supported_span = Span(supported, supported_len);
|
|
@@ -2159,7 +2340,7 @@ int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer,
|
|
|
2159
2340
|
// This function is not const-correct for compatibility with existing
|
|
2160
2341
|
// callers.
|
|
2161
2342
|
*out = const_cast<uint8_t *>(CBS_data(&proto));
|
|
2162
|
-
// A u8 length prefix will fit in
|
|
2343
|
+
// A u8 length prefix will fit in `uint8_t`.
|
|
2163
2344
|
*out_len = static_cast<uint8_t>(CBS_len(&proto));
|
|
2164
2345
|
return OPENSSL_NPN_NEGOTIATED;
|
|
2165
2346
|
}
|
|
@@ -2182,7 +2363,7 @@ int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer,
|
|
|
2182
2363
|
|
|
2183
2364
|
void SSL_get0_next_proto_negotiated(const SSL *ssl, const uint8_t **out_data,
|
|
2184
2365
|
unsigned *out_len) {
|
|
2185
|
-
// NPN protocols have one-byte lengths, so they must fit in
|
|
2366
|
+
// NPN protocols have one-byte lengths, so they must fit in `unsigned`.
|
|
2186
2367
|
assert(ssl->s3->next_proto_negotiated.size() <= UINT_MAX);
|
|
2187
2368
|
*out_data = ssl->s3->next_proto_negotiated.data();
|
|
2188
2369
|
*out_len = static_cast<unsigned>(ssl->s3->next_proto_negotiated.size());
|
|
@@ -2192,8 +2373,9 @@ void SSL_CTX_set_next_protos_advertised_cb(
|
|
|
2192
2373
|
SSL_CTX *ctx,
|
|
2193
2374
|
int (*cb)(SSL *ssl, const uint8_t **out, unsigned *out_len, void *arg),
|
|
2194
2375
|
void *arg) {
|
|
2195
|
-
|
|
2196
|
-
|
|
2376
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2377
|
+
ctx_impl->next_protos_advertised_cb = cb;
|
|
2378
|
+
ctx_impl->next_protos_advertised_cb_arg = arg;
|
|
2197
2379
|
}
|
|
2198
2380
|
|
|
2199
2381
|
void SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx,
|
|
@@ -2202,8 +2384,9 @@ void SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx,
|
|
|
2202
2384
|
const uint8_t *in,
|
|
2203
2385
|
unsigned in_len, void *arg),
|
|
2204
2386
|
void *arg) {
|
|
2205
|
-
|
|
2206
|
-
|
|
2387
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2388
|
+
ctx_impl->next_proto_select_cb = cb;
|
|
2389
|
+
ctx_impl->next_proto_select_cb_arg = arg;
|
|
2207
2390
|
}
|
|
2208
2391
|
|
|
2209
2392
|
int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const uint8_t *protos,
|
|
@@ -2214,7 +2397,7 @@ int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const uint8_t *protos,
|
|
|
2214
2397
|
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_ALPN_PROTOCOL_LIST);
|
|
2215
2398
|
return 1;
|
|
2216
2399
|
}
|
|
2217
|
-
return ctx->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
|
|
2400
|
+
return FromOpaque(ctx)->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
|
|
2218
2401
|
}
|
|
2219
2402
|
|
|
2220
2403
|
int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos, size_t protos_len) {
|
|
@@ -2235,8 +2418,9 @@ void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
|
|
|
2235
2418
|
uint8_t *out_len, const uint8_t *in,
|
|
2236
2419
|
unsigned in_len, void *arg),
|
|
2237
2420
|
void *arg) {
|
|
2238
|
-
|
|
2239
|
-
|
|
2421
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2422
|
+
ctx_impl->alpn_select_cb = cb;
|
|
2423
|
+
ctx_impl->alpn_select_cb_arg = arg;
|
|
2240
2424
|
}
|
|
2241
2425
|
|
|
2242
2426
|
void SSL_get0_alpn_selected(const SSL *ssl, const uint8_t **out_data,
|
|
@@ -2247,14 +2431,14 @@ void SSL_get0_alpn_selected(const SSL *ssl, const uint8_t **out_data,
|
|
|
2247
2431
|
} else {
|
|
2248
2432
|
protocol = ssl->s3->alpn_selected;
|
|
2249
2433
|
}
|
|
2250
|
-
// ALPN protocols have one-byte lengths, so they must fit in
|
|
2434
|
+
// ALPN protocols have one-byte lengths, so they must fit in `unsigned`.
|
|
2251
2435
|
assert(protocol.size() < UINT_MAX);
|
|
2252
2436
|
*out_data = protocol.data();
|
|
2253
2437
|
*out_len = static_cast<unsigned>(protocol.size());
|
|
2254
2438
|
}
|
|
2255
2439
|
|
|
2256
2440
|
void SSL_CTX_set_allow_unknown_alpn_protos(SSL_CTX *ctx, int enabled) {
|
|
2257
|
-
ctx->allow_unknown_alpn_protos = !!enabled;
|
|
2441
|
+
FromOpaque(ctx)->allow_unknown_alpn_protos = !!enabled;
|
|
2258
2442
|
}
|
|
2259
2443
|
|
|
2260
2444
|
int SSL_add_application_settings(SSL *ssl, const uint8_t *proto,
|
|
@@ -2299,7 +2483,8 @@ int SSL_CTX_add_cert_compression_alg(SSL_CTX *ctx, uint16_t alg_id,
|
|
|
2299
2483
|
ssl_cert_decompression_func_t decompress) {
|
|
2300
2484
|
assert(compress != nullptr || decompress != nullptr);
|
|
2301
2485
|
|
|
2302
|
-
|
|
2486
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2487
|
+
for (const auto &alg : ctx_impl->cert_compression_algs) {
|
|
2303
2488
|
if (alg.alg_id == alg_id) {
|
|
2304
2489
|
return 0;
|
|
2305
2490
|
}
|
|
@@ -2309,11 +2494,11 @@ int SSL_CTX_add_cert_compression_alg(SSL_CTX *ctx, uint16_t alg_id,
|
|
|
2309
2494
|
alg.alg_id = alg_id;
|
|
2310
2495
|
alg.compress = compress;
|
|
2311
2496
|
alg.decompress = decompress;
|
|
2312
|
-
return
|
|
2497
|
+
return ctx_impl->cert_compression_algs.Push(alg);
|
|
2313
2498
|
}
|
|
2314
2499
|
|
|
2315
2500
|
void SSL_CTX_set_tls_channel_id_enabled(SSL_CTX *ctx, int enabled) {
|
|
2316
|
-
ctx->channel_id_enabled = !!enabled;
|
|
2501
|
+
FromOpaque(ctx)->channel_id_enabled = !!enabled;
|
|
2317
2502
|
}
|
|
2318
2503
|
|
|
2319
2504
|
int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx) {
|
|
@@ -2333,19 +2518,13 @@ int SSL_enable_tls_channel_id(SSL *ssl) {
|
|
|
2333
2518
|
return 1;
|
|
2334
2519
|
}
|
|
2335
2520
|
|
|
2336
|
-
static int is_p256_key(EVP_PKEY *private_key) {
|
|
2337
|
-
const EC_KEY *ec_key = EVP_PKEY_get0_EC_KEY(private_key);
|
|
2338
|
-
return ec_key != NULL && EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key)) ==
|
|
2339
|
-
NID_X9_62_prime256v1;
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
2521
|
int SSL_CTX_set1_tls_channel_id(SSL_CTX *ctx, EVP_PKEY *private_key) {
|
|
2343
|
-
if (
|
|
2522
|
+
if (EVP_PKEY_get_ec_curve_nid(private_key) != NID_X9_62_prime256v1) {
|
|
2344
2523
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CHANNEL_ID_NOT_P256);
|
|
2345
2524
|
return 0;
|
|
2346
2525
|
}
|
|
2347
2526
|
|
|
2348
|
-
ctx->channel_id_private = UpRef(private_key);
|
|
2527
|
+
FromOpaque(ctx)->channel_id_private = UpRef(private_key);
|
|
2349
2528
|
return 1;
|
|
2350
2529
|
}
|
|
2351
2530
|
|
|
@@ -2353,7 +2532,7 @@ int SSL_set1_tls_channel_id(SSL *ssl, EVP_PKEY *private_key) {
|
|
|
2353
2532
|
if (!ssl->config) {
|
|
2354
2533
|
return 0;
|
|
2355
2534
|
}
|
|
2356
|
-
if (
|
|
2535
|
+
if (EVP_PKEY_get_ec_curve_nid(private_key) != NID_X9_62_prime256v1) {
|
|
2357
2536
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CHANNEL_ID_NOT_P256);
|
|
2358
2537
|
return 0;
|
|
2359
2538
|
}
|
|
@@ -2408,7 +2587,7 @@ EVP_PKEY *SSL_get_privatekey(const SSL *ssl) {
|
|
|
2408
2587
|
}
|
|
2409
2588
|
|
|
2410
2589
|
EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx) {
|
|
2411
|
-
return ctx->cert->legacy_credential->privkey.get();
|
|
2590
|
+
return FromOpaque(ctx)->cert->legacy_credential->privkey.get();
|
|
2412
2591
|
}
|
|
2413
2592
|
|
|
2414
2593
|
const SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl) {
|
|
@@ -2420,18 +2599,18 @@ int SSL_session_reused(const SSL *ssl) {
|
|
|
2420
2599
|
return ssl->s3->session_reused || SSL_in_early_data(ssl);
|
|
2421
2600
|
}
|
|
2422
2601
|
|
|
2423
|
-
const COMP_METHOD *SSL_get_current_compression(SSL *ssl) { return
|
|
2602
|
+
const COMP_METHOD *SSL_get_current_compression(SSL *ssl) { return nullptr; }
|
|
2424
2603
|
|
|
2425
|
-
const COMP_METHOD *SSL_get_current_expansion(SSL *ssl) { return
|
|
2604
|
+
const COMP_METHOD *SSL_get_current_expansion(SSL *ssl) { return nullptr; }
|
|
2426
2605
|
|
|
2427
2606
|
int SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key) { return 0; }
|
|
2428
2607
|
|
|
2429
2608
|
void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode) {
|
|
2430
|
-
ctx->quiet_shutdown = (mode != 0);
|
|
2609
|
+
FromOpaque(ctx)->quiet_shutdown = (mode != 0);
|
|
2431
2610
|
}
|
|
2432
2611
|
|
|
2433
2612
|
int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx) {
|
|
2434
|
-
return ctx->quiet_shutdown;
|
|
2613
|
+
return FromOpaque(ctx)->quiet_shutdown;
|
|
2435
2614
|
}
|
|
2436
2615
|
|
|
2437
2616
|
void SSL_set_quiet_shutdown(SSL *ssl, int mode) {
|
|
@@ -2459,12 +2638,12 @@ void SSL_set_shutdown(SSL *ssl, int mode) {
|
|
|
2459
2638
|
int SSL_get_shutdown(const SSL *ssl) {
|
|
2460
2639
|
int ret = 0;
|
|
2461
2640
|
if (ssl->s3->read_shutdown != ssl_shutdown_none) {
|
|
2462
|
-
// Historically, OpenSSL set
|
|
2641
|
+
// Historically, OpenSSL set `SSL_RECEIVED_SHUTDOWN` on both close_notify
|
|
2463
2642
|
// and fatal alert.
|
|
2464
2643
|
ret |= SSL_RECEIVED_SHUTDOWN;
|
|
2465
2644
|
}
|
|
2466
2645
|
if (ssl->s3->write_shutdown == ssl_shutdown_close_notify) {
|
|
2467
|
-
// Historically, OpenSSL set
|
|
2646
|
+
// Historically, OpenSSL set `SSL_SENT_SHUTDOWN` on only close_notify.
|
|
2468
2647
|
ret |= SSL_SENT_SHUTDOWN;
|
|
2469
2648
|
}
|
|
2470
2649
|
return ret;
|
|
@@ -2474,25 +2653,26 @@ SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl) { return ssl->ctx.get(); }
|
|
|
2474
2653
|
|
|
2475
2654
|
SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) {
|
|
2476
2655
|
if (!ssl->config) {
|
|
2477
|
-
return
|
|
2656
|
+
return nullptr;
|
|
2478
2657
|
}
|
|
2479
2658
|
if (ssl->ctx.get() == ctx) {
|
|
2480
2659
|
return ssl->ctx.get();
|
|
2481
2660
|
}
|
|
2482
2661
|
|
|
2483
2662
|
// One cannot change the X.509 callbacks during a connection.
|
|
2484
|
-
|
|
2663
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2664
|
+
if (ssl->ctx->x509_method != ctx_impl->x509_method) {
|
|
2485
2665
|
assert(0);
|
|
2486
|
-
return
|
|
2666
|
+
return nullptr;
|
|
2487
2667
|
}
|
|
2488
2668
|
|
|
2489
|
-
UniquePtr<CERT> new_cert = ssl_cert_dup(
|
|
2669
|
+
UniquePtr<CERT> new_cert = ssl_cert_dup(ctx_impl->cert.get());
|
|
2490
2670
|
if (!new_cert) {
|
|
2491
2671
|
return nullptr;
|
|
2492
2672
|
}
|
|
2493
2673
|
|
|
2494
2674
|
ssl->config->cert = std::move(new_cert);
|
|
2495
|
-
ssl->ctx = UpRef(
|
|
2675
|
+
ssl->ctx = UpRef(ctx_impl);
|
|
2496
2676
|
ssl->enable_early_data = ssl->ctx->enable_early_data;
|
|
2497
2677
|
|
|
2498
2678
|
return ssl->ctx.get();
|
|
@@ -2516,7 +2696,7 @@ void SSL_set_state(SSL *ssl, int state) {}
|
|
|
2516
2696
|
|
|
2517
2697
|
char *SSL_get_shared_ciphers(const SSL *ssl, char *buf, int len) {
|
|
2518
2698
|
if (len <= 0) {
|
|
2519
|
-
return
|
|
2699
|
+
return nullptr;
|
|
2520
2700
|
}
|
|
2521
2701
|
buf[0] = '\0';
|
|
2522
2702
|
return buf;
|
|
@@ -2528,10 +2708,11 @@ int SSL_get_shared_sigalgs(SSL *ssl, int idx, int *psign, int *phash,
|
|
|
2528
2708
|
}
|
|
2529
2709
|
|
|
2530
2710
|
int SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method) {
|
|
2531
|
-
|
|
2711
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2712
|
+
if (ctx_impl->method->is_dtls) {
|
|
2532
2713
|
return 0;
|
|
2533
2714
|
}
|
|
2534
|
-
|
|
2715
|
+
ctx_impl->quic_method = quic_method;
|
|
2535
2716
|
return 1;
|
|
2536
2717
|
}
|
|
2537
2718
|
|
|
@@ -2565,16 +2746,16 @@ int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
|
|
|
2565
2746
|
}
|
|
2566
2747
|
|
|
2567
2748
|
int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *data) {
|
|
2568
|
-
return CRYPTO_set_ex_data(&ctx->ex_data, idx, data);
|
|
2749
|
+
return CRYPTO_set_ex_data(&FromOpaque(ctx)->ex_data, idx, data);
|
|
2569
2750
|
}
|
|
2570
2751
|
|
|
2571
2752
|
void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
|
|
2572
|
-
return CRYPTO_get_ex_data(&ctx->ex_data, idx);
|
|
2753
|
+
return CRYPTO_get_ex_data(&FromOpaque(ctx)->ex_data, idx);
|
|
2573
2754
|
}
|
|
2574
2755
|
|
|
2575
2756
|
int SSL_want(const SSL *ssl) {
|
|
2576
|
-
// Historically, OpenSSL did not track
|
|
2577
|
-
// value. We do, but map it back to
|
|
2757
|
+
// Historically, OpenSSL did not track `SSL_ERROR_ZERO_RETURN` as an `rwstate`
|
|
2758
|
+
// value. We do, but map it back to `SSL_ERROR_NONE` to preserve the original
|
|
2578
2759
|
// behavior.
|
|
2579
2760
|
return ssl->s3->rwstate == SSL_ERROR_ZERO_RETURN ? SSL_ERROR_NONE
|
|
2580
2761
|
: ssl->s3->rwstate;
|
|
@@ -2596,7 +2777,8 @@ void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*cb)(SSL *ssl, int is_export,
|
|
|
2596
2777
|
|
|
2597
2778
|
static int use_psk_identity_hint(UniquePtr<char> *out,
|
|
2598
2779
|
const char *identity_hint) {
|
|
2599
|
-
if (identity_hint !=
|
|
2780
|
+
if (identity_hint != nullptr &&
|
|
2781
|
+
strlen(identity_hint) > PSK_MAX_IDENTITY_LEN) {
|
|
2600
2782
|
OPENSSL_PUT_ERROR(SSL, SSL_R_DATA_LENGTH_TOO_LONG);
|
|
2601
2783
|
return 0;
|
|
2602
2784
|
}
|
|
@@ -2608,7 +2790,7 @@ static int use_psk_identity_hint(UniquePtr<char> *out,
|
|
|
2608
2790
|
// send either no hint (omit ServerKeyExchange) or an empty hint, while
|
|
2609
2791
|
// ECDHE_PSK can only spell empty hint. Having different capabilities is odd,
|
|
2610
2792
|
// so we interpret empty and missing as identical.
|
|
2611
|
-
if (identity_hint !=
|
|
2793
|
+
if (identity_hint != nullptr && identity_hint[0] != '\0') {
|
|
2612
2794
|
out->reset(OPENSSL_strdup(identity_hint));
|
|
2613
2795
|
if (*out == nullptr) {
|
|
2614
2796
|
return 0;
|
|
@@ -2619,7 +2801,8 @@ static int use_psk_identity_hint(UniquePtr<char> *out,
|
|
|
2619
2801
|
}
|
|
2620
2802
|
|
|
2621
2803
|
int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) {
|
|
2622
|
-
return use_psk_identity_hint(&ctx->psk_identity_hint,
|
|
2804
|
+
return use_psk_identity_hint(&FromOpaque(ctx)->psk_identity_hint,
|
|
2805
|
+
identity_hint);
|
|
2623
2806
|
}
|
|
2624
2807
|
|
|
2625
2808
|
int SSL_use_psk_identity_hint(SSL *ssl, const char *identity_hint) {
|
|
@@ -2630,23 +2813,23 @@ int SSL_use_psk_identity_hint(SSL *ssl, const char *identity_hint) {
|
|
|
2630
2813
|
}
|
|
2631
2814
|
|
|
2632
2815
|
const char *SSL_get_psk_identity_hint(const SSL *ssl) {
|
|
2633
|
-
if (ssl ==
|
|
2634
|
-
return
|
|
2816
|
+
if (ssl == nullptr) {
|
|
2817
|
+
return nullptr;
|
|
2635
2818
|
}
|
|
2636
|
-
if (ssl->config ==
|
|
2819
|
+
if (ssl->config == nullptr) {
|
|
2637
2820
|
assert(ssl->config);
|
|
2638
|
-
return
|
|
2821
|
+
return nullptr;
|
|
2639
2822
|
}
|
|
2640
2823
|
return ssl->config->psk_identity_hint.get();
|
|
2641
2824
|
}
|
|
2642
2825
|
|
|
2643
2826
|
const char *SSL_get_psk_identity(const SSL *ssl) {
|
|
2644
|
-
if (ssl ==
|
|
2645
|
-
return
|
|
2827
|
+
if (ssl == nullptr) {
|
|
2828
|
+
return nullptr;
|
|
2646
2829
|
}
|
|
2647
2830
|
SSL_SESSION *session = SSL_get_session(ssl);
|
|
2648
|
-
if (session ==
|
|
2649
|
-
return
|
|
2831
|
+
if (session == nullptr) {
|
|
2832
|
+
return nullptr;
|
|
2650
2833
|
}
|
|
2651
2834
|
return session->psk_identity.get();
|
|
2652
2835
|
}
|
|
@@ -2665,7 +2848,7 @@ void SSL_CTX_set_psk_client_callback(
|
|
|
2665
2848
|
SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
|
|
2666
2849
|
unsigned max_identity_len, uint8_t *psk,
|
|
2667
2850
|
unsigned max_psk_len)) {
|
|
2668
|
-
ctx->psk_client_callback = cb;
|
|
2851
|
+
FromOpaque(ctx)->psk_client_callback = cb;
|
|
2669
2852
|
}
|
|
2670
2853
|
|
|
2671
2854
|
void SSL_set_psk_server_callback(SSL *ssl,
|
|
@@ -2681,18 +2864,18 @@ void SSL_set_psk_server_callback(SSL *ssl,
|
|
|
2681
2864
|
void SSL_CTX_set_psk_server_callback(
|
|
2682
2865
|
SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *identity, uint8_t *psk,
|
|
2683
2866
|
unsigned max_psk_len)) {
|
|
2684
|
-
ctx->psk_server_callback = cb;
|
|
2867
|
+
FromOpaque(ctx)->psk_server_callback = cb;
|
|
2685
2868
|
}
|
|
2686
2869
|
|
|
2687
2870
|
void SSL_CTX_set_msg_callback(SSL_CTX *ctx,
|
|
2688
2871
|
void (*cb)(int write_p, int version,
|
|
2689
2872
|
int content_type, const void *buf,
|
|
2690
2873
|
size_t len, SSL *ssl, void *arg)) {
|
|
2691
|
-
ctx->msg_callback = cb;
|
|
2874
|
+
FromOpaque(ctx)->msg_callback = cb;
|
|
2692
2875
|
}
|
|
2693
2876
|
|
|
2694
2877
|
void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg) {
|
|
2695
|
-
ctx->msg_callback_arg = arg;
|
|
2878
|
+
FromOpaque(ctx)->msg_callback_arg = arg;
|
|
2696
2879
|
}
|
|
2697
2880
|
|
|
2698
2881
|
void SSL_set_msg_callback(SSL *ssl,
|
|
@@ -2708,18 +2891,18 @@ void SSL_set_msg_callback_arg(SSL *ssl, void *arg) {
|
|
|
2708
2891
|
|
|
2709
2892
|
void SSL_CTX_set_keylog_callback(SSL_CTX *ctx,
|
|
2710
2893
|
void (*cb)(const SSL *ssl, const char *line)) {
|
|
2711
|
-
ctx->keylog_callback = cb;
|
|
2894
|
+
FromOpaque(ctx)->keylog_callback = cb;
|
|
2712
2895
|
}
|
|
2713
2896
|
|
|
2714
2897
|
void (*SSL_CTX_get_keylog_callback(const SSL_CTX *ctx))(const SSL *ssl,
|
|
2715
2898
|
const char *line) {
|
|
2716
|
-
return ctx->keylog_callback;
|
|
2899
|
+
return FromOpaque(ctx)->keylog_callback;
|
|
2717
2900
|
}
|
|
2718
2901
|
|
|
2719
2902
|
void SSL_CTX_set_current_time_cb(SSL_CTX *ctx,
|
|
2720
2903
|
void (*cb)(const SSL *ssl,
|
|
2721
2904
|
struct timeval *out_clock)) {
|
|
2722
|
-
ctx->current_time_cb = cb;
|
|
2905
|
+
FromOpaque(ctx)->current_time_cb = cb;
|
|
2723
2906
|
}
|
|
2724
2907
|
|
|
2725
2908
|
int SSL_can_release_private_key(const SSL *ssl) {
|
|
@@ -2744,7 +2927,7 @@ int SSL_in_init(const SSL *ssl) {
|
|
|
2744
2927
|
}
|
|
2745
2928
|
|
|
2746
2929
|
int SSL_in_false_start(const SSL *ssl) {
|
|
2747
|
-
if (ssl->s3->hs ==
|
|
2930
|
+
if (ssl->s3->hs == nullptr) {
|
|
2748
2931
|
return 0;
|
|
2749
2932
|
}
|
|
2750
2933
|
return ssl->s3->hs->in_false_start;
|
|
@@ -2761,16 +2944,16 @@ int SSL_is_quic(const SSL *ssl) { return ssl->quic_method != nullptr; }
|
|
|
2761
2944
|
void SSL_CTX_set_select_certificate_cb(
|
|
2762
2945
|
SSL_CTX *ctx,
|
|
2763
2946
|
enum ssl_select_cert_result_t (*cb)(const SSL_CLIENT_HELLO *)) {
|
|
2764
|
-
ctx->select_certificate_cb = cb;
|
|
2947
|
+
FromOpaque(ctx)->select_certificate_cb = cb;
|
|
2765
2948
|
}
|
|
2766
2949
|
|
|
2767
2950
|
void SSL_CTX_set_dos_protection_cb(SSL_CTX *ctx,
|
|
2768
2951
|
int (*cb)(const SSL_CLIENT_HELLO *)) {
|
|
2769
|
-
ctx->dos_protection_cb = cb;
|
|
2952
|
+
FromOpaque(ctx)->dos_protection_cb = cb;
|
|
2770
2953
|
}
|
|
2771
2954
|
|
|
2772
2955
|
void SSL_CTX_set_reverify_on_resume(SSL_CTX *ctx, int enabled) {
|
|
2773
|
-
ctx->reverify_on_resume = !!enabled;
|
|
2956
|
+
FromOpaque(ctx)->reverify_on_resume = !!enabled;
|
|
2774
2957
|
}
|
|
2775
2958
|
|
|
2776
2959
|
void SSL_set_enforce_rsa_key_usage(SSL *ssl, int enabled) {
|
|
@@ -2787,7 +2970,7 @@ int SSL_was_key_usage_invalid(const SSL *ssl) {
|
|
|
2787
2970
|
void SSL_set_renegotiate_mode(SSL *ssl, enum ssl_renegotiate_mode_t mode) {
|
|
2788
2971
|
ssl->renegotiate_mode = mode;
|
|
2789
2972
|
|
|
2790
|
-
// Check if
|
|
2973
|
+
// Check if `ssl_can_renegotiate` has changed and the configuration may now be
|
|
2791
2974
|
// shed. HTTP clients may initially allow renegotiation for HTTP/1.1, and then
|
|
2792
2975
|
// disable after the handshake once the ALPN protocol is known to be HTTP/2.
|
|
2793
2976
|
ssl_maybe_shed_handshake_config(ssl);
|
|
@@ -2840,7 +3023,7 @@ int SSL_is_dtls_handshake_idle(const SSL *ssl) {
|
|
|
2840
3023
|
|
|
2841
3024
|
return !SSL_in_init(ssl) &&
|
|
2842
3025
|
// No unacknowledged messages in DTLS 1.3. In DTLS 1.2, there no ACKs
|
|
2843
|
-
// and we currently never clear
|
|
3026
|
+
// and we currently never clear `outgoing_messages` on the side that
|
|
2844
3027
|
// speaks last.
|
|
2845
3028
|
(ssl_protocol_version(ssl) < TLS1_3_VERSION ||
|
|
2846
3029
|
ssl->d1->outgoing_messages.empty()) &&
|
|
@@ -2891,7 +3074,7 @@ uint64_t SSL_get_dtls_read_sequence(const SSL *ssl, uint16_t epoch) {
|
|
|
2891
3074
|
// Increment to get to an available sequence number.
|
|
2892
3075
|
max_seq_num++;
|
|
2893
3076
|
} else {
|
|
2894
|
-
// If
|
|
3077
|
+
// If `max_seq_num` was available, the bitmap must have been empty.
|
|
2895
3078
|
assert(max_seq_num == 0);
|
|
2896
3079
|
}
|
|
2897
3080
|
return max_seq_num;
|
|
@@ -2940,7 +3123,7 @@ int SSL_get_dtls_write_traffic_secret(const SSL *ssl, const uint8_t **out_data,
|
|
|
2940
3123
|
|
|
2941
3124
|
uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl) {
|
|
2942
3125
|
SSL_SESSION *session = SSL_get_session(ssl);
|
|
2943
|
-
if (session ==
|
|
3126
|
+
if (session == nullptr) {
|
|
2944
3127
|
return 0;
|
|
2945
3128
|
}
|
|
2946
3129
|
|
|
@@ -2969,10 +3152,18 @@ size_t SSL_get_server_random(const SSL *ssl, uint8_t *out, size_t max_out) {
|
|
|
2969
3152
|
return max_out;
|
|
2970
3153
|
}
|
|
2971
3154
|
|
|
3155
|
+
uint16_t SSL_get_signature_algorithm_used(const SSL *ssl) {
|
|
3156
|
+
SSL_HANDSHAKE *hs = ssl->s3->hs.get();
|
|
3157
|
+
if (hs == nullptr) {
|
|
3158
|
+
return 0;
|
|
3159
|
+
}
|
|
3160
|
+
return hs->signature_algorithm;
|
|
3161
|
+
}
|
|
3162
|
+
|
|
2972
3163
|
const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl) {
|
|
2973
3164
|
SSL_HANDSHAKE *hs = ssl->s3->hs.get();
|
|
2974
|
-
if (hs ==
|
|
2975
|
-
return
|
|
3165
|
+
if (hs == nullptr) {
|
|
3166
|
+
return nullptr;
|
|
2976
3167
|
}
|
|
2977
3168
|
return hs->new_cipher;
|
|
2978
3169
|
}
|
|
@@ -2985,15 +3176,15 @@ void SSL_set_retain_only_sha256_of_client_certs(SSL *ssl, int enabled) {
|
|
|
2985
3176
|
}
|
|
2986
3177
|
|
|
2987
3178
|
void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx, int enabled) {
|
|
2988
|
-
ctx->retain_only_sha256_of_client_certs = !!enabled;
|
|
3179
|
+
FromOpaque(ctx)->retain_only_sha256_of_client_certs = !!enabled;
|
|
2989
3180
|
}
|
|
2990
3181
|
|
|
2991
3182
|
void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled) {
|
|
2992
|
-
ctx->grease_enabled = !!enabled;
|
|
3183
|
+
FromOpaque(ctx)->grease_enabled = !!enabled;
|
|
2993
3184
|
}
|
|
2994
3185
|
|
|
2995
3186
|
void SSL_CTX_set_permute_extensions(SSL_CTX *ctx, int enabled) {
|
|
2996
|
-
ctx->permute_extensions = !!enabled;
|
|
3187
|
+
FromOpaque(ctx)->permute_extensions = !!enabled;
|
|
2997
3188
|
}
|
|
2998
3189
|
|
|
2999
3190
|
void SSL_set_permute_extensions(SSL *ssl, int enabled) {
|
|
@@ -3008,7 +3199,7 @@ int32_t SSL_get_ticket_age_skew(const SSL *ssl) {
|
|
|
3008
3199
|
}
|
|
3009
3200
|
|
|
3010
3201
|
void SSL_CTX_set_false_start_allowed_without_alpn(SSL_CTX *ctx, int allowed) {
|
|
3011
|
-
ctx->false_start_allowed_without_alpn = !!allowed;
|
|
3202
|
+
FromOpaque(ctx)->false_start_allowed_without_alpn = !!allowed;
|
|
3012
3203
|
}
|
|
3013
3204
|
|
|
3014
3205
|
int SSL_used_hello_retry_request(const SSL *ssl) {
|
|
@@ -3041,11 +3232,11 @@ int SSL_clear(SSL *ssl) {
|
|
|
3041
3232
|
return 0; // SSL_clear may not be used after shedding config.
|
|
3042
3233
|
}
|
|
3043
3234
|
|
|
3044
|
-
// In OpenSSL, reusing a client
|
|
3235
|
+
// In OpenSSL, reusing a client `SSL` with `SSL_clear` causes the previously
|
|
3045
3236
|
// established session to be offered the next time around. wpa_supplicant
|
|
3046
3237
|
// depends on this behavior, so emulate it.
|
|
3047
3238
|
UniquePtr<SSL_SESSION> session;
|
|
3048
|
-
if (!ssl->server && ssl->s3->established_session !=
|
|
3239
|
+
if (!ssl->server && ssl->s3->established_session != nullptr) {
|
|
3049
3240
|
session = UpRef(ssl->s3->established_session);
|
|
3050
3241
|
}
|
|
3051
3242
|
|
|
@@ -3054,7 +3245,7 @@ int SSL_clear(SSL *ssl) {
|
|
|
3054
3245
|
//
|
|
3055
3246
|
// TODO(davidben): Avoid this.
|
|
3056
3247
|
unsigned mtu = 0;
|
|
3057
|
-
if (ssl->d1 !=
|
|
3248
|
+
if (ssl->d1 != nullptr) {
|
|
3058
3249
|
mtu = ssl->d1->mtu;
|
|
3059
3250
|
}
|
|
3060
3251
|
|
|
@@ -3094,12 +3285,12 @@ int SSL_CTX_need_tmp_RSA(const SSL_CTX *ctx) { return 0; }
|
|
|
3094
3285
|
int SSL_need_tmp_RSA(const SSL *ssl) { return 0; }
|
|
3095
3286
|
int SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, const RSA *rsa) { return 1; }
|
|
3096
3287
|
int SSL_set_tmp_rsa(SSL *ssl, const RSA *rsa) { return 1; }
|
|
3097
|
-
void ERR_load_SSL_strings(
|
|
3098
|
-
void SSL_load_error_strings(
|
|
3288
|
+
void ERR_load_SSL_strings() {}
|
|
3289
|
+
void SSL_load_error_strings() {}
|
|
3099
3290
|
int SSL_cache_hit(SSL *ssl) { return SSL_session_reused(ssl); }
|
|
3100
3291
|
|
|
3101
3292
|
int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key) {
|
|
3102
|
-
if (ec_key ==
|
|
3293
|
+
if (ec_key == nullptr || EC_KEY_get0_group(ec_key) == nullptr) {
|
|
3103
3294
|
OPENSSL_PUT_ERROR(SSL, ERR_R_PASSED_NULL_PARAMETER);
|
|
3104
3295
|
return 0;
|
|
3105
3296
|
}
|
|
@@ -3108,7 +3299,7 @@ int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key) {
|
|
|
3108
3299
|
}
|
|
3109
3300
|
|
|
3110
3301
|
int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key) {
|
|
3111
|
-
if (ec_key ==
|
|
3302
|
+
if (ec_key == nullptr || EC_KEY_get0_group(ec_key) == nullptr) {
|
|
3112
3303
|
OPENSSL_PUT_ERROR(SSL, ERR_R_PASSED_NULL_PARAMETER);
|
|
3113
3304
|
return 0;
|
|
3114
3305
|
}
|
|
@@ -3118,7 +3309,7 @@ int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key) {
|
|
|
3118
3309
|
|
|
3119
3310
|
void SSL_CTX_set_ticket_aead_method(SSL_CTX *ctx,
|
|
3120
3311
|
const SSL_TICKET_AEAD_METHOD *aead_method) {
|
|
3121
|
-
ctx->ticket_aead_method = aead_method;
|
|
3312
|
+
FromOpaque(ctx)->ticket_aead_method = aead_method;
|
|
3122
3313
|
}
|
|
3123
3314
|
|
|
3124
3315
|
SSL_SESSION *SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf,
|
|
@@ -3143,7 +3334,7 @@ SSL_SESSION *SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf,
|
|
|
3143
3334
|
|
|
3144
3335
|
UniquePtr<SSL_SESSION> session = tls13_create_session_with_ticket(ssl, &body);
|
|
3145
3336
|
if (!session) {
|
|
3146
|
-
//
|
|
3337
|
+
// `tls13_create_session_with_ticket` puts the correct error.
|
|
3147
3338
|
return nullptr;
|
|
3148
3339
|
}
|
|
3149
3340
|
return session.release();
|
|
@@ -3152,11 +3343,13 @@ SSL_SESSION *SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf,
|
|
|
3152
3343
|
int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets) {
|
|
3153
3344
|
num_tickets = std::min(num_tickets, kMaxTickets);
|
|
3154
3345
|
static_assert(kMaxTickets <= 0xff, "Too many tickets.");
|
|
3155
|
-
ctx->num_tickets = static_cast<uint8_t>(num_tickets);
|
|
3346
|
+
FromOpaque(ctx)->num_tickets = static_cast<uint8_t>(num_tickets);
|
|
3156
3347
|
return 1;
|
|
3157
3348
|
}
|
|
3158
3349
|
|
|
3159
|
-
size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx) {
|
|
3350
|
+
size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx) {
|
|
3351
|
+
return FromOpaque(ctx)->num_tickets;
|
|
3352
|
+
}
|
|
3160
3353
|
|
|
3161
3354
|
int SSL_set_tlsext_status_type(SSL *ssl, int type) {
|
|
3162
3355
|
if (!ssl->config) {
|
|
@@ -3195,12 +3388,12 @@ size_t SSL_get_tlsext_status_ocsp_resp(const SSL *ssl, const uint8_t **out) {
|
|
|
3195
3388
|
|
|
3196
3389
|
int SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx,
|
|
3197
3390
|
int (*callback)(SSL *ssl, void *arg)) {
|
|
3198
|
-
ctx->legacy_ocsp_callback = callback;
|
|
3391
|
+
FromOpaque(ctx)->legacy_ocsp_callback = callback;
|
|
3199
3392
|
return 1;
|
|
3200
3393
|
}
|
|
3201
3394
|
|
|
3202
3395
|
int SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg) {
|
|
3203
|
-
ctx->legacy_ocsp_callback_arg = arg;
|
|
3396
|
+
FromOpaque(ctx)->legacy_ocsp_callback_arg = arg;
|
|
3204
3397
|
return 1;
|
|
3205
3398
|
}
|
|
3206
3399
|
|
|
@@ -3262,7 +3455,7 @@ static const char kTLS12Ciphers[] =
|
|
|
3262
3455
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3263
3456
|
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
|
|
3264
3457
|
|
|
3265
|
-
static int Configure(
|
|
3458
|
+
static int Configure(SSLContext *ctx) {
|
|
3266
3459
|
ctx->compliance_policy = ssl_compliance_policy_fips_202205;
|
|
3267
3460
|
|
|
3268
3461
|
return
|
|
@@ -3278,25 +3471,21 @@ static int Configure(SSL_CTX *ctx) {
|
|
|
3278
3471
|
// Encrypt-then-MAC extension is required for all CBC cipher suites and so
|
|
3279
3472
|
// it's easier to drop them.
|
|
3280
3473
|
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3281
|
-
SSL_CTX_set1_group_ids(ctx, kGroups,
|
|
3282
|
-
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3283
|
-
|
|
3284
|
-
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs,
|
|
3285
|
-
OPENSSL_ARRAY_SIZE(kSigAlgs));
|
|
3474
|
+
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3475
|
+
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3476
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3286
3477
|
}
|
|
3287
3478
|
|
|
3288
3479
|
static int Configure(SSL *ssl) {
|
|
3289
3480
|
ssl->config->compliance_policy = ssl_compliance_policy_fips_202205;
|
|
3290
3481
|
|
|
3291
|
-
// See
|
|
3482
|
+
// See `Configure(SSL_CTX)`, above, for reasoning.
|
|
3292
3483
|
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3293
3484
|
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3294
3485
|
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3295
|
-
SSL_set1_group_ids(ssl, kGroups,
|
|
3296
|
-
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs,
|
|
3297
|
-
|
|
3298
|
-
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs,
|
|
3299
|
-
OPENSSL_ARRAY_SIZE(kSigAlgs));
|
|
3486
|
+
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3487
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3488
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3300
3489
|
}
|
|
3301
3490
|
|
|
3302
3491
|
} // namespace fips202205
|
|
@@ -3319,17 +3508,16 @@ static const char kTLS12Ciphers[] =
|
|
|
3319
3508
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3320
3509
|
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
|
|
3321
3510
|
|
|
3322
|
-
static int Configure(
|
|
3511
|
+
static int Configure(SSLContext *ctx) {
|
|
3323
3512
|
ctx->compliance_policy = ssl_compliance_policy_wpa3_192_202304;
|
|
3324
3513
|
|
|
3325
3514
|
return SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION) &&
|
|
3326
3515
|
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3327
3516
|
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3328
|
-
SSL_CTX_set1_group_ids(ctx, kGroups,
|
|
3517
|
+
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3329
3518
|
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3330
|
-
|
|
3331
|
-
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs,
|
|
3332
|
-
OPENSSL_ARRAY_SIZE(kSigAlgs));
|
|
3519
|
+
std::size(kSigAlgs)) &&
|
|
3520
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3333
3521
|
}
|
|
3334
3522
|
|
|
3335
3523
|
static int Configure(SSL *ssl) {
|
|
@@ -3338,18 +3526,16 @@ static int Configure(SSL *ssl) {
|
|
|
3338
3526
|
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3339
3527
|
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3340
3528
|
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3341
|
-
SSL_set1_group_ids(ssl, kGroups,
|
|
3342
|
-
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs,
|
|
3343
|
-
|
|
3344
|
-
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs,
|
|
3345
|
-
OPENSSL_ARRAY_SIZE(kSigAlgs));
|
|
3529
|
+
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3530
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3531
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3346
3532
|
}
|
|
3347
3533
|
|
|
3348
3534
|
} // namespace wpa202304
|
|
3349
3535
|
|
|
3350
3536
|
namespace cnsa202407 {
|
|
3351
3537
|
|
|
3352
|
-
static int Configure(
|
|
3538
|
+
static int Configure(SSLContext *ctx) {
|
|
3353
3539
|
ctx->compliance_policy = ssl_compliance_policy_cnsa_202407;
|
|
3354
3540
|
return 1;
|
|
3355
3541
|
}
|
|
@@ -3361,22 +3547,108 @@ static int Configure(SSL *ssl) {
|
|
|
3361
3547
|
|
|
3362
3548
|
} // namespace cnsa202407
|
|
3363
3549
|
|
|
3550
|
+
namespace cnsa1_202603 {
|
|
3551
|
+
|
|
3552
|
+
// Approximates CNSA 1.0 (RFC 9151).
|
|
3553
|
+
|
|
3554
|
+
static const uint16_t kGroups[] = {SSL_GROUP_MLKEM1024, SSL_GROUP_SECP384R1};
|
|
3555
|
+
|
|
3556
|
+
// Prefer ML-KEM-1024 if the client supports it.
|
|
3557
|
+
static const uint32_t kOptions = SSL_OP_CIPHER_SERVER_PREFERENCE;
|
|
3558
|
+
|
|
3559
|
+
static const uint16_t kSigAlgs[] = {
|
|
3560
|
+
SSL_SIGN_ECDSA_SECP384R1_SHA384,
|
|
3561
|
+
SSL_SIGN_RSA_PSS_RSAE_SHA384,
|
|
3562
|
+
SSL_SIGN_RSA_PKCS1_SHA384,
|
|
3563
|
+
};
|
|
3564
|
+
|
|
3565
|
+
static const char kTLS12Ciphers[] =
|
|
3566
|
+
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3567
|
+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
|
|
3568
|
+
|
|
3569
|
+
static int Configure(SSLContext *ctx) {
|
|
3570
|
+
ctx->compliance_policy = ssl_compliance_policy_cnsa1_202603;
|
|
3571
|
+
|
|
3572
|
+
return SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION) &&
|
|
3573
|
+
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3574
|
+
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3575
|
+
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3576
|
+
SSL_CTX_set_options(ctx, kOptions) &&
|
|
3577
|
+
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3578
|
+
std::size(kSigAlgs)) &&
|
|
3579
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
static int Configure(SSL *ssl) {
|
|
3583
|
+
ssl->config->compliance_policy = ssl_compliance_policy_cnsa1_202603;
|
|
3584
|
+
|
|
3585
|
+
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3586
|
+
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3587
|
+
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3588
|
+
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3589
|
+
SSL_set_options(ssl, kOptions) &&
|
|
3590
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3591
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3594
|
+
} // namespace cnsa1_202603
|
|
3595
|
+
|
|
3596
|
+
namespace cnsa2_202603 {
|
|
3597
|
+
|
|
3598
|
+
// Approximates CNSA 2.0 (draft-becker-cnsa2-tls-profile).
|
|
3599
|
+
|
|
3600
|
+
static const uint16_t kGroups[] = {SSL_GROUP_MLKEM1024};
|
|
3601
|
+
|
|
3602
|
+
static const uint16_t kSigAlgs[] = {
|
|
3603
|
+
SSL_SIGN_ECDSA_SECP384R1_SHA384,
|
|
3604
|
+
SSL_SIGN_RSA_PSS_RSAE_SHA384,
|
|
3605
|
+
SSL_SIGN_RSA_PKCS1_SHA384,
|
|
3606
|
+
};
|
|
3607
|
+
|
|
3608
|
+
static int Configure(SSLContext *ctx) {
|
|
3609
|
+
ctx->compliance_policy = ssl_compliance_policy_cnsa2_202603;
|
|
3610
|
+
|
|
3611
|
+
return SSL_CTX_set_min_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3612
|
+
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3613
|
+
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3614
|
+
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3615
|
+
std::size(kSigAlgs)) &&
|
|
3616
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
static int Configure(SSL *ssl) {
|
|
3620
|
+
ssl->config->compliance_policy = ssl_compliance_policy_cnsa2_202603;
|
|
3621
|
+
|
|
3622
|
+
return SSL_set_min_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3623
|
+
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3624
|
+
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3625
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3626
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3627
|
+
}
|
|
3628
|
+
|
|
3629
|
+
} // namespace cnsa2_202603
|
|
3630
|
+
|
|
3364
3631
|
int SSL_CTX_set_compliance_policy(SSL_CTX *ctx,
|
|
3365
3632
|
enum ssl_compliance_policy_t policy) {
|
|
3633
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
3366
3634
|
switch (policy) {
|
|
3367
3635
|
case ssl_compliance_policy_fips_202205:
|
|
3368
|
-
return fips202205::Configure(
|
|
3636
|
+
return fips202205::Configure(ctx_impl);
|
|
3369
3637
|
case ssl_compliance_policy_wpa3_192_202304:
|
|
3370
|
-
return wpa202304::Configure(
|
|
3638
|
+
return wpa202304::Configure(ctx_impl);
|
|
3371
3639
|
case ssl_compliance_policy_cnsa_202407:
|
|
3372
|
-
return cnsa202407::Configure(
|
|
3640
|
+
return cnsa202407::Configure(ctx_impl);
|
|
3641
|
+
case ssl_compliance_policy_cnsa1_202603:
|
|
3642
|
+
return cnsa1_202603::Configure(ctx_impl);
|
|
3643
|
+
case ssl_compliance_policy_cnsa2_202603:
|
|
3644
|
+
return cnsa2_202603::Configure(ctx_impl);
|
|
3373
3645
|
default:
|
|
3374
3646
|
return 0;
|
|
3375
3647
|
}
|
|
3376
3648
|
}
|
|
3377
3649
|
|
|
3378
3650
|
enum ssl_compliance_policy_t SSL_CTX_get_compliance_policy(const SSL_CTX *ctx) {
|
|
3379
|
-
return ctx->compliance_policy;
|
|
3651
|
+
return FromOpaque(ctx)->compliance_policy;
|
|
3380
3652
|
}
|
|
3381
3653
|
|
|
3382
3654
|
int SSL_set_compliance_policy(SSL *ssl, enum ssl_compliance_policy_t policy) {
|
|
@@ -3387,6 +3659,10 @@ int SSL_set_compliance_policy(SSL *ssl, enum ssl_compliance_policy_t policy) {
|
|
|
3387
3659
|
return wpa202304::Configure(ssl);
|
|
3388
3660
|
case ssl_compliance_policy_cnsa_202407:
|
|
3389
3661
|
return cnsa202407::Configure(ssl);
|
|
3662
|
+
case ssl_compliance_policy_cnsa1_202603:
|
|
3663
|
+
return cnsa1_202603::Configure(ssl);
|
|
3664
|
+
case ssl_compliance_policy_cnsa2_202603:
|
|
3665
|
+
return cnsa2_202603::Configure(ssl);
|
|
3390
3666
|
default:
|
|
3391
3667
|
return 0;
|
|
3392
3668
|
}
|
|
@@ -3410,6 +3686,29 @@ void SSL_get0_peer_available_trust_anchors(const SSL *ssl, const uint8_t **out,
|
|
|
3410
3686
|
*out_len = ret.size();
|
|
3411
3687
|
}
|
|
3412
3688
|
|
|
3689
|
+
int SSL_CTX_set1_available_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
3690
|
+
size_t ids_len) {
|
|
3691
|
+
auto span = Span(ids, ids_len);
|
|
3692
|
+
if (span.empty() || !ssl_is_valid_trust_anchor_list(span)) {
|
|
3693
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_TRUST_ANCHOR_LIST);
|
|
3694
|
+
return 0;
|
|
3695
|
+
}
|
|
3696
|
+
return FromOpaque(ctx)->cert->available_trust_anchors.CopyFrom(span);
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
int SSL_set1_available_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
3700
|
+
size_t ids_len) {
|
|
3701
|
+
if (!ssl->config) {
|
|
3702
|
+
return 0;
|
|
3703
|
+
}
|
|
3704
|
+
auto span = Span(ids, ids_len);
|
|
3705
|
+
if (span.empty() || !ssl_is_valid_trust_anchor_list(span)) {
|
|
3706
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_TRUST_ANCHOR_LIST);
|
|
3707
|
+
return 0;
|
|
3708
|
+
}
|
|
3709
|
+
return ssl->config->cert->available_trust_anchors.CopyFrom(span);
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3413
3712
|
int SSL_CTX_set1_requested_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
3414
3713
|
size_t ids_len) {
|
|
3415
3714
|
auto span = Span(ids, ids_len);
|
|
@@ -3421,7 +3720,7 @@ int SSL_CTX_set1_requested_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
|
3421
3720
|
if (!copy.CopyFrom(span)) {
|
|
3422
3721
|
return 0;
|
|
3423
3722
|
}
|
|
3424
|
-
ctx->requested_trust_anchors = std::move(copy);
|
|
3723
|
+
FromOpaque(ctx)->requested_trust_anchors = std::move(copy);
|
|
3425
3724
|
return 1;
|
|
3426
3725
|
}
|
|
3427
3726
|
|
|
@@ -3442,3 +3741,100 @@ int SSL_set1_requested_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
|
3442
3741
|
ssl->config->requested_trust_anchors = std::move(copy);
|
|
3443
3742
|
return 1;
|
|
3444
3743
|
}
|
|
3744
|
+
|
|
3745
|
+
int SSL_CTX_get_security_level(const SSL_CTX *ctx) { return 0; }
|
|
3746
|
+
|
|
3747
|
+
static bool is_valid_cert_types_list(Span<const uint8_t> list) {
|
|
3748
|
+
if (list.empty() || list.size() > kNumCertTypes) {
|
|
3749
|
+
return false;
|
|
3750
|
+
}
|
|
3751
|
+
for (size_t i = 0u; i < list.size(); ++i) {
|
|
3752
|
+
// Check that each value is a recognized cert type.
|
|
3753
|
+
if (std::find(std::begin(kAllCertTypes), std::end(kAllCertTypes),
|
|
3754
|
+
list[i]) == std::end(kAllCertTypes)) {
|
|
3755
|
+
return false;
|
|
3756
|
+
}
|
|
3757
|
+
// Reject duplicates.
|
|
3758
|
+
for (size_t j = 0u; j < i; ++j) {
|
|
3759
|
+
if (list[i] == list[j]) {
|
|
3760
|
+
return false;
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
return true;
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
static bool set1_cert_types(InplaceVector<uint8_t, kNumCertTypes> *out,
|
|
3768
|
+
Span<const uint8_t> values) {
|
|
3769
|
+
if (!is_valid_cert_types_list(values)) {
|
|
3770
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_CERT_TYPES_LIST);
|
|
3771
|
+
return false;
|
|
3772
|
+
}
|
|
3773
|
+
out->CopyFrom(values);
|
|
3774
|
+
return true;
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
int SSL_CTX_set1_accepted_peer_cert_types(SSL_CTX *ctx, const uint8_t *values,
|
|
3778
|
+
size_t num_values) {
|
|
3779
|
+
return set1_cert_types(&FromOpaque(ctx)->accepted_peer_cert_types,
|
|
3780
|
+
Span(values, num_values));
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
int SSL_set1_accepted_peer_cert_types(SSL *ssl, const uint8_t *values,
|
|
3784
|
+
size_t num_values) {
|
|
3785
|
+
if (!ssl->config) {
|
|
3786
|
+
return 0;
|
|
3787
|
+
}
|
|
3788
|
+
return set1_cert_types(&ssl->config->accepted_peer_cert_types,
|
|
3789
|
+
Span(values, num_values));
|
|
3790
|
+
}
|
|
3791
|
+
|
|
3792
|
+
int SSL_CTX_set1_available_client_cert_types(SSL_CTX *ctx,
|
|
3793
|
+
const uint8_t *values,
|
|
3794
|
+
size_t num_values) {
|
|
3795
|
+
return set1_cert_types(&FromOpaque(ctx)->available_client_cert_types,
|
|
3796
|
+
Span(values, num_values));
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3799
|
+
int SSL_set1_available_client_cert_types(SSL *ssl, const uint8_t *values,
|
|
3800
|
+
size_t num_values) {
|
|
3801
|
+
if (!ssl->config) {
|
|
3802
|
+
return 0;
|
|
3803
|
+
}
|
|
3804
|
+
return set1_cert_types(&ssl->config->available_client_cert_types,
|
|
3805
|
+
Span(values, num_values));
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3808
|
+
int SSL_get_peer_cert_type(const SSL *ssl) {
|
|
3809
|
+
if (const SSL_SESSION *session = SSL_get_session(ssl); session != nullptr) {
|
|
3810
|
+
return session->peer_cert_type;
|
|
3811
|
+
}
|
|
3812
|
+
return kDefaultCertType;
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
EVP_PKEY *SSL_get0_peer_rpk(const SSL *ssl) {
|
|
3816
|
+
if (const SSL_SESSION *session = SSL_get_session(ssl); session != nullptr) {
|
|
3817
|
+
return session->peer_raw_public_key.get();
|
|
3818
|
+
}
|
|
3819
|
+
return nullptr;
|
|
3820
|
+
}
|
|
3821
|
+
|
|
3822
|
+
void SSL_set_server_padding_request(SSL *ssl, uint16_t num_bytes) {
|
|
3823
|
+
if (!ssl->config) {
|
|
3824
|
+
return;
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
ssl->config->server_padding_request = num_bytes;
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
void SSL_set_server_padding_enabled(SSL *ssl, int enabled) {
|
|
3831
|
+
if (!ssl->config) {
|
|
3832
|
+
return;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
ssl->config->server_padding_enabled = enabled;
|
|
3836
|
+
}
|
|
3837
|
+
|
|
3838
|
+
int SSL_server_sent_requested_padding(const SSL *ssl) {
|
|
3839
|
+
return ssl->s3->server_sent_requested_padding;
|
|
3840
|
+
}
|