grpc 1.84.1 → 1.86.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 +48 -31
- data/etc/roots.pem +0 -583
- data/include/grpc/channel_factory.h +78 -0
- data/include/grpc/credentials.h +21 -0
- data/include/grpc/event_engine/memory_allocator.h +1 -0
- data/include/grpc/grpc.h +10 -0
- data/include/grpc/grpc_security_constants.h +4 -0
- data/include/grpc/impl/channel_arg_names.h +4 -0
- data/include/grpc/module.modulemap +1 -0
- data/src/core/call/call_filters.cc +4 -1
- data/src/core/call/call_filters.h +13 -11
- data/src/core/call/call_spine.h +12 -6
- data/src/core/call/call_state.h +3 -3
- data/src/core/call/client_call.cc +4 -1
- data/src/core/call/client_call.h +1 -0
- data/src/core/{lib/security/authorization → call}/evaluate_args.cc +34 -12
- data/src/core/{lib/security/authorization → call}/evaluate_args.h +19 -5
- data/src/core/call/filter_fusion.h +17 -30
- data/src/core/call/interception_chain.h +5 -10
- data/src/core/call/metadata_batch.cc +6 -0
- data/src/core/call/metadata_batch.h +79 -36
- data/src/core/call/parsed_metadata.h +3 -3
- data/src/core/call/request_buffer.cc +7 -7
- data/src/core/call/request_buffer.h +1 -1
- data/src/core/call/server_call.cc +3 -3
- data/src/core/call/server_call.h +15 -0
- 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 +14 -14
- data/src/core/channelz/ztrace_collector.h +16 -7
- data/src/core/client_channel/backup_poller.cc +1 -2
- data/src/core/client_channel/channel_factory.cc +110 -0
- data/src/core/client_channel/channel_factory.h +45 -0
- 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 +6 -6
- data/src/core/client_channel/lame_channel.cc +59 -0
- data/src/core/client_channel/lame_channel.h +86 -0
- 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 +18 -1
- data/src/core/credentials/call/external/external_account_credentials.cc +4 -4
- data/src/core/credentials/call/external/url_external_account_credentials.cc +6 -17
- data/src/core/credentials/call/external/url_external_account_credentials.h +0 -1
- data/src/core/credentials/call/jwt/jwt_verifier.cc +25 -13
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +6 -4
- data/src/core/credentials/call/regional_access_boundary_fetcher.cc +25 -9
- data/src/core/credentials/call/regional_access_boundary_fetcher.h +6 -2
- 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_credentials_options.cc +14 -0
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +12 -2
- data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +4 -4
- data/src/core/credentials/transport/tls/ssl_utils.cc +30 -0
- data/src/core/credentials/transport/tls/ssl_utils.h +4 -0
- data/src/core/credentials/transport/tls/tls_security_connector.cc +16 -12
- 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/http/server/http_server_filter.cc +6 -1
- data/src/core/ext/filters/rbac/rbac_filter.cc +3 -41
- data/src/core/ext/filters/rbac/rbac_filter.h +3 -12
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +7 -7
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +61 -45
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +6 -13
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +80 -110
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -1
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +2 -6
- data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame.cc +15 -19
- data/src/core/ext/transport/chttp2/transport/frame.h +10 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +18 -61
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +0 -4
- data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +9 -0
- data/src/core/ext/transport/chttp2/transport/goaway.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/goaway.h +0 -5
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +1 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +8 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +45 -9
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +4 -2
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +50 -37
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +7 -3
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +407 -267
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +70 -32
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +4 -3
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +21 -57
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +4 -35
- data/src/core/ext/transport/chttp2/transport/http2_transport_stats.h +60 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +8 -3
- data/src/core/ext/transport/chttp2/transport/keepalive.h +1 -4
- data/src/core/ext/transport/chttp2/transport/parsing.cc +7 -10
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +35 -11
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +52 -47
- data/src/core/ext/transport/chttp2/transport/read_context.h +115 -8
- 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 +15 -14
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +24 -14
- data/src/core/ext/transport/chttp2/transport/transport_common.cc +47 -0
- data/src/core/ext/transport/chttp2/transport/transport_common.h +29 -0
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +1 -1
- 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/transport/inproc/legacy_inproc_transport.cc +1 -7
- data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb.h +16 -0
- data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb_minitable.c +4 -3
- data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +129 -81
- data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +50 -39
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +411 -163
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +95 -44
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.h +3 -0
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb.h +41 -8
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb_minitable.c +8 -5
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +427 -222
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +97 -66
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb.h +130 -99
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb_minitable.c +29 -27
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +49 -33
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +19 -8
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +95 -3
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +33 -6
- data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb.h +93 -11
- data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb_minitable.c +8 -5
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +656 -134
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +117 -51
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +45 -23
- data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +19 -10
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +99 -34
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +12 -7
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +344 -273
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +62 -69
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +1 -3
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +53 -22
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +9 -7
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +108 -0
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.c +26 -2
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +809 -231
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +183 -77
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +3 -0
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +151 -26
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +17 -9
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +24 -8
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +6 -5
- data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb.h +224 -16
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.c +83 -10
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +95 -79
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +23 -22
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb.h +34 -18
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.c +10 -9
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +243 -2
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +53 -5
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h +3 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb.h +53 -22
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb_minitable.c +9 -7
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +23 -7
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +9 -4
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +516 -215
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +99 -60
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +60 -28
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +12 -10
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +109 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +32 -2
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +37 -4
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +7 -4
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +65 -47
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +29 -12
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +20 -4
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb_minitable.c +6 -3
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +776 -88
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +195 -35
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +5 -0
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb.h +23 -7
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.c +10 -3
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb.h +44 -0
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.c +11 -2
- data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.h +1 -0
- data/src/core/ext/upb-gen/envoy/type/v3/scope.upb.h +218 -0
- data/src/core/ext/upb-gen/envoy/type/v3/scope.upb_minitable.c +70 -0
- data/src/core/ext/upb-gen/envoy/type/v3/scope.upb_minitable.h +31 -0
- 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/envoy/admin/v3/clusters.upbdefs.c +30 -24
- data/src/core/ext/upbdefs-gen/envoy/admin/v3/server_info.upbdefs.c +166 -152
- data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +467 -422
- data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +120 -110
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +912 -857
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/outlier_detection.upbdefs.c +26 -19
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +59 -54
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +356 -346
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/http_service.upbdefs.c +49 -37
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +599 -483
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +65 -49
- data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +165 -161
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +369 -327
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -15
- data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +129 -121
- data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +224 -204
- data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +2046 -1932
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +70 -37
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +7 -3
- data/src/core/ext/upbdefs-gen/envoy/data/accesslog/v3/accesslog.upbdefs.c +5 -3
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.c +121 -78
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +165 -160
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +121 -118
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.c +68 -37
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h +15 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/router/v3/router.upbdefs.c +48 -40
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +44 -37
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +919 -870
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +26 -14
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +44 -36
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +372 -371
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +32 -28
- data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.c +17 -15
- data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.c +4 -1
- data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/type/v3/scope.upbdefs.c +76 -0
- data/src/core/ext/upbdefs-gen/envoy/type/v3/scope.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/envoy/type/v3/token_bucket.upbdefs.c +1 -1
- 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 +1883 -48
- data/src/core/filter/ext_proc/ext_proc_filter.h +88 -22
- data/src/core/filter/ext_proc/ext_proc_messages.cc +141 -65
- data/src/core/filter/ext_proc/ext_proc_messages.h +55 -16
- data/src/core/filter/filter_args.h +5 -60
- data/src/core/handshaker/handshaker.cc +4 -4
- data/src/core/handshaker/http_connect/http_connect_client_handshaker.cc +4 -4
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +33 -32
- data/src/core/handshaker/security/secure_endpoint.cc +29 -29
- 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/channel_stack.cc +0 -12
- data/src/core/lib/channel/channel_stack.h +0 -8
- data/src/core/lib/channel/promise_based_filter.cc +59 -46
- data/src/core/lib/channel/promise_based_filter.h +94 -67
- 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 +24 -18
- 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/cf_engine/cfstream_endpoint.cc +1 -1
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +3 -3
- data/src/core/lib/event_engine/default_event_engine.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +10 -14
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +26 -26
- data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +8 -22
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +24 -4
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +6 -6
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +7 -7
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +27 -29
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
- data/src/core/lib/event_engine/posix_engine/timer.cc +7 -7
- 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/shim.cc +1 -6
- data/src/core/lib/event_engine/shim.h +0 -5
- 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 +19 -19
- data/src/core/lib/event_engine/windows/windows_listener.cc +7 -7
- data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +6 -6
- data/src/core/lib/experiments/experiments.cc +177 -246
- data/src/core/lib/experiments/experiments.h +61 -109
- 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/iomgr_windows.cc +1 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_posix.cc +28 -28
- data/src/core/lib/iomgr/tcp_server_posix.cc +64 -242
- data/src/core/lib/iomgr/tcp_server_windows.cc +0 -469
- data/src/core/lib/promise/activity.cc +9 -9
- data/src/core/lib/promise/activity.h +6 -6
- 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 +4 -4
- data/src/core/lib/promise/observable.h +3 -3
- data/src/core/lib/promise/party.cc +6 -6
- data/src/core/lib/promise/status_flag.h +7 -2
- 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 +18 -18
- 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/security/authorization/rbac_policy.h +2 -2
- data/src/core/lib/surface/call.cc +20 -9
- data/src/core/lib/surface/call.h +24 -7
- 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_create.cc +7 -1
- data/src/core/lib/surface/channel_init.cc +1 -1
- data/src/core/lib/surface/channel_init.h +1 -8
- data/src/core/lib/surface/filter_stack_call.cc +16 -0
- data/src/core/lib/surface/filter_stack_call.h +1 -0
- data/src/core/lib/surface/init.cc +10 -10
- data/src/core/lib/surface/lame_client.cc +1 -1
- data/src/core/lib/surface/legacy_channel.cc +6 -3
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/transport.cc +15 -8
- data/src/core/lib/transport/transport_framing_endpoint_extension.h +9 -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 +101 -10
- data/src/core/load_balancing/outlier_detection/outlier_detection_metrics.cc +38 -0
- data/src/core/load_balancing/outlier_detection/outlier_detection_metrics.h +55 -0
- data/src/core/load_balancing/ring_hash/ring_hash.cc +111 -38
- data/src/core/load_balancing/rls/rls.cc +44 -18
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +10 -10
- data/src/core/load_balancing/xds/cds.cc +10 -56
- 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 +12 -13
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -7
- 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/resolver/xds/xds_resolver.cc +1 -1
- data/src/core/server/server.cc +88 -32
- data/src/core/server/server.h +4 -3
- data/src/core/server/server_config_selector.h +4 -18
- data/src/core/server/server_config_selector_filter.cc +20 -146
- data/src/core/server/server_config_selector_filter.h +2 -2
- data/src/core/server/xds_server_config_fetcher.cc +5 -20
- 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/transport/auth_context.cc +15 -5
- data/src/core/transport/auth_context.h +5 -0
- 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_telemetry_utils.cc +9 -1
- data/src/core/tsi/ssl_transport_security.cc +203 -64
- data/src/core/tsi/ssl_transport_security.h +25 -2
- data/src/core/tsi/ssl_transport_security_utils.cc +139 -18
- data/src/core/tsi/ssl_transport_security_utils.h +19 -0
- 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 +188 -39
- data/src/core/util/latent_see.h +71 -13
- data/src/core/util/linux/cpu.cc +12 -6
- data/src/core/util/mpscq.cc +3 -3
- data/src/core/util/notification.h +4 -4
- data/src/core/util/sync.h +20 -6
- data/src/core/util/sync_abseil.cc +3 -3
- data/src/core/util/table.h +20 -22
- data/src/core/util/trie_lookup.h +5 -1
- data/src/core/util/windows/env.cc +1 -0
- data/src/core/util/work_serializer.cc +3 -3
- 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/file_watcher_certificate_provider_factory.cc +10 -9
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +3 -3
- data/src/core/xds/grpc/streaming_call_promise_wrapper.cc +184 -0
- data/src/core/xds/grpc/streaming_call_promise_wrapper.h +210 -0
- data/src/core/xds/grpc/xds_audit_logger_registry.cc +0 -54
- data/src/core/xds/grpc/xds_audit_logger_registry.h +0 -8
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +4 -30
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +0 -20
- data/src/core/xds/grpc/xds_client_grpc.cc +12 -12
- data/src/core/xds/grpc/xds_client_grpc.h +1 -1
- data/src/core/xds/grpc/xds_cluster_parser.cc +5 -1
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
- data/src/core/xds/grpc/xds_common_types_parser.cc +12 -0
- data/src/core/xds/grpc/xds_endpoint.cc +1 -1
- data/src/core/xds/grpc/xds_endpoint_parser.cc +14 -3
- data/src/core/xds/grpc/xds_grpc_service_parser.cc +12 -10
- data/src/core/xds/grpc/xds_http_composite_filter.cc +0 -5
- data/src/core/xds/grpc/xds_http_composite_filter.h +1 -27
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +18 -19
- data/src/core/xds/grpc/xds_http_ext_proc_filter.h +3 -29
- data/src/core/xds/grpc/xds_http_fault_filter.cc +0 -4
- data/src/core/xds/grpc/xds_http_fault_filter.h +0 -26
- data/src/core/xds/grpc/xds_http_filter.h +1 -63
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +0 -5
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +1 -27
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +0 -527
- data/src/core/xds/grpc/xds_http_rbac_filter.h +0 -15
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +0 -5
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +0 -26
- data/src/core/xds/grpc/xds_listener.cc +0 -2
- data/src/core/xds/grpc/xds_listener.h +0 -2
- data/src/core/xds/grpc/xds_listener_parser.cc +0 -7
- data/src/core/xds/grpc/xds_matcher.cc +17 -11
- data/src/core/xds/grpc/xds_matcher.h +4 -3
- data/src/core/xds/grpc/xds_matcher_context.cc +11 -0
- data/src/core/xds/grpc/xds_matcher_context.h +3 -2
- data/src/core/xds/grpc/xds_matcher_input.cc +19 -1
- data/src/core/xds/grpc/xds_matcher_parse.cc +3 -2
- data/src/core/xds/grpc/xds_route_config.cc +0 -2
- data/src/core/xds/grpc/xds_route_config.h +0 -2
- data/src/core/xds/grpc/xds_route_config_parser.cc +0 -5
- data/src/core/xds/grpc/xds_routing.cc +22 -112
- data/src/core/xds/grpc/xds_routing.h +2 -27
- data/src/core/xds/grpc/xds_transport_factory_grpc.cc +236 -0
- data/src/core/xds/grpc/xds_transport_factory_grpc.h +95 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +176 -299
- data/src/core/xds/grpc/xds_transport_grpc.h +60 -55
- data/src/core/xds/xds_client/lrs_client.cc +23 -22
- data/src/core/xds/xds_client/lrs_client.h +2 -1
- data/src/core/xds/xds_client/xds_client.cc +53 -37
- data/src/core/xds/xds_client/xds_client.h +6 -5
- data/src/core/xds/xds_client/xds_transport.h +113 -65
- data/src/core/xds/xds_client/xds_transport_factory.h +43 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +6 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +9 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
- 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 +325 -30
- data/third_party/boringssl-with-bazel/crypto/asn1/a_utctm.cc +32 -13
- data/third_party/boringssl-with-bazel/crypto/asn1/asn1_lib.cc +129 -31
- 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 +307 -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 +376 -728
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_enc.cc +215 -528
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_fre.cc +30 -31
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_new.cc +50 -52
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_typ.cc +18 -6
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_utl.cc +63 -74
- 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 -177
- data/third_party/boringssl-with-bazel/crypto/bio/bio_mem.cc +78 -86
- data/third_party/boringssl-with-bazel/crypto/bio/connect.cc +154 -200
- data/third_party/boringssl-with-bazel/crypto/bio/errno.cc +3 -1
- data/third_party/boringssl-with-bazel/crypto/bio/fd.cc +55 -55
- data/third_party/boringssl-with-bazel/crypto/bio/file.cc +69 -78
- data/third_party/boringssl-with-bazel/crypto/bio/hexdump.cc +6 -4
- data/third_party/boringssl-with-bazel/crypto/bio/internal.h +69 -18
- data/third_party/boringssl-with-bazel/crypto/bio/pair.cc +116 -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 +182 -97
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbs.cc +114 -49
- data/third_party/boringssl-with-bazel/crypto/bytestring/internal.h +84 -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 +363 -367
- 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 +253 -237
- data/third_party/boringssl-with-bazel/crypto/cipher/get_cipher.cc +12 -12
- data/third_party/boringssl-with-bazel/crypto/cipher/internal.h +217 -58
- 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 +323 -41
- data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519_tables.h +6 -6
- data/third_party/boringssl-with-bazel/crypto/curve25519/internal.h +39 -29
- 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 +45 -42
- 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 +459 -196
- 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 +119 -107
- data/third_party/boringssl-with-bazel/crypto/err/internal.h +8 -21
- data/third_party/boringssl-with-bazel/crypto/evp/evp.cc +241 -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 +101 -0
- data/third_party/boringssl-with-bazel/crypto/evp/internal.h +296 -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 +548 -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 +510 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_rsa.cc +734 -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 +300 -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 +120 -122
- 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 +41 -31
- 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 -18
- 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 +16 -9
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +64 -45
- 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 +98 -95
- 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 +339 -255
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/jacobi.cc.inc +13 -20
- 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 +55 -98
- 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 +167 -216
- 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 +18 -16
- 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 +40 -129
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/aead.cc.inc +429 -105
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/cipher.cc.inc +381 -216
- 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 +375 -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 +157 -199
- 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 +254 -203
- 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 +78 -138
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/felem.cc.inc +151 -5
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/internal.h +332 -289
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/oct.cc.inc +45 -166
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.cc.inc +44 -45
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.h +18 -18
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256.cc.inc +75 -246
- 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 +73 -106
- 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 +48 -38
- 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/fips_shared_support.cc +4 -4
- 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 +109 -14
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/keccak.cc.inc +424 -56
- 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 +1796 -773
- 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 +902 -443
- 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 +395 -695
- 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 +29 -15
- 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 +531 -112
- data/third_party/boringssl-with-bazel/crypto/hrss/hrss.cc +165 -161
- data/third_party/boringssl-with-bazel/crypto/hrss/internal.h +9 -13
- data/third_party/boringssl-with-bazel/crypto/internal.h +594 -394
- 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 +706 -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 +175 -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 +106 -15
- data/third_party/boringssl-with-bazel/crypto/pem/pem_all.cc +28 -24
- data/third_party/boringssl-with-bazel/crypto/pem/pem_info.cc +72 -76
- data/third_party/boringssl-with-bazel/crypto/pem/pem_lib.cc +239 -273
- data/third_party/boringssl-with-bazel/crypto/pem/pem_oth.cc +6 -6
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pk8.cc +16 -13
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pkey.cc +21 -15
- data/third_party/boringssl-with-bazel/crypto/pem/pem_x509.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/pem/pem_xaux.cc +3 -0
- 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 +140 -139
- data/third_party/boringssl-with-bazel/crypto/poly1305/internal.h +20 -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 -59
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_vec.cc +32 -29
- 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 +60 -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 +96 -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 +39 -36
- 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 +346 -216
- 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 +95 -272
- 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 +27 -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 +123 -209
- 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 +149 -159
- data/third_party/boringssl-with-bazel/crypto/x509/v3_skey.cc +23 -26
- data/third_party/boringssl-with-bazel/crypto/x509/v3_utl.cc +161 -192
- 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 -90
- 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_mtc.cc +598 -0
- data/third_party/boringssl-with-bazel/crypto/x509/x509_obj.cc +23 -18
- data/third_party/boringssl-with-bazel/crypto/x509/x509_req.cc +37 -46
- data/third_party/boringssl-with-bazel/crypto/x509/x509_set.cc +58 -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 +398 -474
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vpm.cc +57 -48
- data/third_party/boringssl-with-bazel/crypto/x509/x509cset.cc +27 -40
- data/third_party/boringssl-with-bazel/crypto/x509/x509name.cc +91 -79
- 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 +73 -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 +76 -93
- data/third_party/boringssl-with-bazel/crypto/x509/x_exten.cc +6 -0
- data/third_party/boringssl-with-bazel/crypto/x509/x_name.cc +294 -388
- data/third_party/boringssl-with-bazel/crypto/x509/x_pubkey.cc +113 -84
- data/third_party/boringssl-with-bazel/crypto/x509/x_req.cc +12 -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 +282 -277
- 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 +325 -0
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +325 -0
- data/third_party/boringssl-with-bazel/gen/crypto/err_data.cc +538 -500
- data/third_party/boringssl-with-bazel/include/openssl/aead.h +279 -119
- data/third_party/boringssl-with-bazel/include/openssl/aes.h +43 -43
- data/third_party/boringssl-with-bazel/include/openssl/asm_base.h +30 -17
- data/third_party/boringssl-with-bazel/include/openssl/asn1.h +641 -635
- data/third_party/boringssl-with-bazel/include/openssl/asn1t.h +7 -9
- data/third_party/boringssl-with-bazel/include/openssl/base.h +76 -69
- data/third_party/boringssl-with-bazel/include/openssl/base64.h +30 -30
- data/third_party/boringssl-with-bazel/include/openssl/bio.h +394 -322
- 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 +305 -208
- 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 +345 -161
- 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/configuration.h +18 -0
- 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 +60 -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 +144 -75
- data/third_party/boringssl-with-bazel/include/openssl/dsa.h +101 -101
- data/third_party/boringssl-with-bazel/include/openssl/ec.h +178 -120
- data/third_party/boringssl-with-bazel/include/openssl/ec_key.h +99 -99
- 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 +941 -344
- data/third_party/boringssl-with-bazel/include/openssl/evp_errors.h +10 -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 +33 -33
- data/third_party/boringssl-with-bazel/include/openssl/hpke.h +170 -123
- 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 +42 -42
- 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 +1339 -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 +669 -361
- 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 +8 -8
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols.h +7992 -0
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_S.h +633 -0
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_c.h +329 -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 +125 -49
- data/third_party/boringssl-with-bazel/include/openssl/span.h +190 -75
- data/third_party/boringssl-with-bazel/include/openssl/ssl.h +2403 -1633
- data/third_party/boringssl-with-bazel/include/openssl/ssl3.h +11 -69
- data/third_party/boringssl-with-bazel/include/openssl/stack.h +144 -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/types.h +18 -0
- data/third_party/boringssl-with-bazel/include/openssl/x509.h +1839 -1872
- 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 +22 -19
- data/third_party/boringssl-with-bazel/ssl/d1_both.cc +202 -135
- data/third_party/boringssl-with-bazel/ssl/d1_lib.cc +84 -68
- data/third_party/boringssl-with-bazel/ssl/d1_pkt.cc +10 -10
- data/third_party/boringssl-with-bazel/ssl/d1_srtp.cc +12 -10
- data/third_party/boringssl-with-bazel/ssl/dtls_method.cc +14 -14
- data/third_party/boringssl-with-bazel/ssl/dtls_record.cc +21 -20
- data/third_party/boringssl-with-bazel/ssl/encrypted_client_hello.cc +102 -96
- data/third_party/boringssl-with-bazel/ssl/extensions.cc +1083 -500
- data/third_party/boringssl-with-bazel/ssl/handoff.cc +154 -100
- data/third_party/boringssl-with-bazel/ssl/handshake.cc +76 -44
- data/third_party/boringssl-with-bazel/ssl/handshake_client.cc +153 -152
- data/third_party/boringssl-with-bazel/ssl/handshake_server.cc +180 -212
- data/third_party/boringssl-with-bazel/ssl/internal.h +1368 -1481
- data/third_party/boringssl-with-bazel/ssl/s3_both.cc +40 -168
- data/third_party/boringssl-with-bazel/ssl/s3_lib.cc +5 -5
- data/third_party/boringssl-with-bazel/ssl/s3_pkt.cc +22 -21
- data/third_party/boringssl-with-bazel/ssl/ssl_aead_ctx.cc +5 -5
- data/third_party/boringssl-with-bazel/ssl/ssl_asn1.cc +123 -68
- data/third_party/boringssl-with-bazel/ssl/ssl_buffer.cc +25 -26
- data/third_party/boringssl-with-bazel/ssl/ssl_cert.cc +156 -84
- data/third_party/boringssl-with-bazel/ssl/ssl_cipher.cc +341 -160
- data/third_party/boringssl-with-bazel/ssl/ssl_credential.cc +349 -124
- data/third_party/boringssl-with-bazel/ssl/ssl_file.cc +134 -225
- data/third_party/boringssl-with-bazel/ssl/ssl_key_share.cc +80 -101
- data/third_party/boringssl-with-bazel/ssl/ssl_lib.cc +1403 -694
- data/third_party/boringssl-with-bazel/ssl/ssl_privkey.cc +173 -105
- data/third_party/boringssl-with-bazel/ssl/ssl_session.cc +287 -235
- data/third_party/boringssl-with-bazel/ssl/ssl_stat.cc +6 -3
- data/third_party/boringssl-with-bazel/ssl/ssl_transcript.cc +4 -4
- data/third_party/boringssl-with-bazel/ssl/ssl_versions.cc +47 -41
- data/third_party/boringssl-with-bazel/ssl/ssl_x509.cc +321 -273
- data/third_party/boringssl-with-bazel/ssl/t1_enc.cc +40 -29
- data/third_party/boringssl-with-bazel/ssl/tls13_both.cc +109 -75
- data/third_party/boringssl-with-bazel/ssl/tls13_client.cc +201 -115
- data/third_party/boringssl-with-bazel/ssl/tls13_enc.cc +179 -124
- data/third_party/boringssl-with-bazel/ssl/tls13_server.cc +241 -158
- data/third_party/boringssl-with-bazel/ssl/tls_method.cc +35 -35
- data/third_party/boringssl-with-bazel/ssl/tls_record.cc +40 -34
- 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 +29 -80
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64_msvc.h +6 -69
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_field.c.inc +26 -0
- 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 +112 -0
- data/third_party/cares/cares/include/ares.h +8 -0
- data/third_party/cares/cares/include/ares_dns_record.h +3 -2
- data/third_party/cares/cares/include/ares_version.h +3 -3
- data/third_party/cares/cares/src/lib/ares_addrinfo_localhost.c +20 -20
- data/third_party/cares/cares/src/lib/ares_cancel.c +17 -8
- data/third_party/cares/cares/src/lib/ares_close_sockets.c +81 -16
- data/third_party/cares/cares/src/lib/ares_conn.c +256 -10
- data/third_party/cares/cares/src/lib/ares_conn.h +40 -3
- data/third_party/cares/cares/src/lib/ares_cookie.c +2 -2
- data/third_party/cares/cares/src/lib/ares_destroy.c +75 -10
- data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +85 -10
- data/third_party/cares/cares/src/lib/ares_gethostbyaddr.c +5 -0
- data/third_party/cares/cares/src/lib/ares_gethostbyname.c +4 -0
- data/third_party/cares/cares/src/lib/ares_getnameinfo.c +10 -2
- data/third_party/cares/cares/src/lib/ares_hosts_file.c +8 -0
- data/third_party/cares/cares/src/lib/ares_inet_net_pton.h +28 -0
- data/third_party/cares/cares/src/lib/ares_init.c +55 -10
- data/third_party/cares/cares/src/lib/ares_library_init.c +25 -7
- data/third_party/cares/cares/src/lib/ares_options.c +38 -10
- data/third_party/cares/cares/src/lib/ares_parse_into_addrinfo.c +1 -1
- data/third_party/cares/cares/src/lib/ares_private.h +186 -27
- data/third_party/cares/cares/src/lib/ares_process.c +604 -112
- data/third_party/cares/cares/src/lib/ares_qcache.c +200 -36
- data/third_party/cares/cares/src/lib/ares_query.c +5 -0
- data/third_party/cares/cares/src/lib/ares_search.c +10 -0
- data/third_party/cares/cares/src/lib/ares_send.c +81 -10
- data/third_party/cares/cares/src/lib/ares_set_socket_functions.c +3 -1
- data/third_party/cares/cares/src/lib/ares_socket.c +28 -0
- data/third_party/cares/cares/src/lib/ares_socket.h +23 -0
- data/third_party/cares/cares/src/lib/ares_sysconfig.c +6 -3
- data/third_party/cares/cares/src/lib/ares_sysconfig_files.c +33 -11
- data/third_party/cares/cares/src/lib/ares_sysconfig_win.c +132 -80
- data/third_party/cares/cares/src/lib/ares_timeout.c +11 -0
- data/third_party/cares/cares/src/lib/ares_update_servers.c +55 -11
- data/third_party/cares/cares/src/lib/dsa/ares_array.c +20 -5
- data/third_party/cares/cares/src/lib/dsa/ares_htable.c +8 -4
- data/third_party/cares/cares/src/lib/dsa/ares_htable_dict.c +2 -0
- data/third_party/cares/cares/src/lib/dsa/ares_llist.c +4 -1
- data/third_party/cares/cares/src/lib/event/ares_event_configchg.c +5 -2
- data/third_party/cares/cares/src/lib/event/ares_event_select.c +14 -1
- data/third_party/cares/cares/src/lib/event/ares_event_thread.c +8 -0
- data/third_party/cares/cares/src/lib/event/ares_event_wake_pipe.c +7 -1
- data/third_party/cares/cares/src/lib/event/ares_event_win32.c +3 -0
- data/third_party/cares/cares/src/lib/include/ares_mem.h +3 -0
- data/third_party/cares/cares/src/lib/include/ares_str.h +17 -0
- data/third_party/cares/cares/src/lib/inet_net_pton.c +37 -28
- data/third_party/cares/cares/src/lib/legacy/ares_expand_name.c +1 -1
- data/third_party/cares/cares/src/lib/legacy/ares_parse_a_reply.c +5 -2
- data/third_party/cares/cares/src/lib/legacy/ares_parse_aaaa_reply.c +5 -2
- data/third_party/cares/cares/src/lib/legacy/ares_parse_ns_reply.c +2 -2
- data/third_party/cares/cares/src/lib/legacy/ares_parse_ptr_reply.c +2 -2
- data/third_party/cares/cares/src/lib/legacy/ares_parse_uri_reply.c +1 -1
- data/third_party/cares/cares/src/lib/record/ares_dns_mapping.c +19 -4
- data/third_party/cares/cares/src/lib/record/ares_dns_multistring.c +3 -1
- data/third_party/cares/cares/src/lib/record/ares_dns_name.c +67 -4
- data/third_party/cares/cares/src/lib/record/ares_dns_parse.c +62 -34
- data/third_party/cares/cares/src/lib/record/ares_dns_private.h +4 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_record.c +47 -7
- data/third_party/cares/cares/src/lib/record/ares_dns_write.c +13 -5
- data/third_party/cares/cares/src/lib/str/ares_buf.c +33 -16
- data/third_party/cares/cares/src/lib/str/ares_str.c +54 -0
- data/third_party/cares/cares/src/lib/util/ares_iface_ips.c +22 -10
- data/third_party/cares/cares/src/lib/util/ares_iface_ips.h +1 -0
- data/third_party/cares/cares/src/lib/util/ares_math.c +17 -2
- data/third_party/cares/cares/src/lib/util/ares_math.h +32 -7
- data/third_party/cares/cares/src/lib/util/ares_rand.c +4 -4
- data/third_party/cares/cares/src/lib/util/ares_threads.c +1 -2
- data/third_party/cares/cares/src/lib/util/ares_time.h +1 -0
- data/third_party/cares/cares/src/lib/util/ares_uri.c +9 -3
- data/third_party/zlib/compress.c +34 -10
- data/third_party/zlib/crc32.c +49 -115
- data/third_party/zlib/deflate.c +107 -61
- data/third_party/zlib/deflate.h +7 -1
- data/third_party/zlib/gzguts.h +33 -31
- data/third_party/zlib/infback.c +20 -67
- data/third_party/zlib/inffast.c +7 -6
- data/third_party/zlib/inffixed.h +91 -91
- data/third_party/zlib/inflate.c +38 -151
- data/third_party/zlib/inflate.h +1 -1
- data/third_party/zlib/inftrees.c +134 -9
- data/third_party/zlib/inftrees.h +3 -1
- data/third_party/zlib/trees.c +14 -12
- data/third_party/zlib/uncompr.c +39 -23
- data/third_party/zlib/zconf.h +27 -19
- data/third_party/zlib/zlib.h +215 -96
- data/third_party/zlib/zutil.c +49 -35
- data/third_party/zlib/zutil.h +87 -10
- metadata +4095 -4024
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +0 -916
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +0 -84
- 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/src/core/server/xds_channel_stack_modifier.cc +0 -108
- data/src/core/server/xds_channel_stack_modifier.h +0 -62
- data/src/core/server/xds_server_config_fetcher_legacy.cc +0 -1340
- 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/rsa/blinding.cc.inc +0 -147
- data/third_party/boringssl-with-bazel/crypto/kyber/internal.h +0 -60
- data/third_party/boringssl-with-bazel/crypto/kyber/kyber.cc +0 -869
- 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,36 +69,23 @@ 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
|
+
static ExDataClass g_ex_data_class_ssl(/*with_app_data=*/true);
|
|
73
|
+
static ExDataClass g_ex_data_class_ssl_ctx(/*with_app_data=*/true);
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
}
|
|
83
|
-
|
|
84
|
-
void ssl_reset_error_state(SSL *ssl) {
|
|
85
|
-
// Functions which use |SSL_get_error| must reset I/O and error state on
|
|
75
|
+
void ssl_reset_error_state(SSLImpl *ssl) {
|
|
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();
|
|
89
80
|
ERR_clear_system_error();
|
|
90
81
|
}
|
|
91
82
|
|
|
92
|
-
void ssl_set_read_error(
|
|
83
|
+
void ssl_set_read_error(SSLImpl *ssl) {
|
|
93
84
|
ssl->s3->read_shutdown = ssl_shutdown_error;
|
|
94
85
|
ssl->s3->read_error.reset(ERR_save_state());
|
|
95
86
|
}
|
|
96
87
|
|
|
97
|
-
static bool check_read_error(const
|
|
88
|
+
static bool check_read_error(const SSLImpl *ssl) {
|
|
98
89
|
if (ssl->s3->read_shutdown == ssl_shutdown_error) {
|
|
99
90
|
ERR_restore_state(ssl->s3->read_error.get());
|
|
100
91
|
return false;
|
|
@@ -102,15 +93,15 @@ static bool check_read_error(const SSL *ssl) {
|
|
|
102
93
|
return true;
|
|
103
94
|
}
|
|
104
95
|
|
|
105
|
-
bool ssl_can_write(const
|
|
96
|
+
bool ssl_can_write(const SSLImpl *ssl) {
|
|
106
97
|
return !SSL_in_init(ssl) || ssl->s3->hs->can_early_write;
|
|
107
98
|
}
|
|
108
99
|
|
|
109
|
-
bool ssl_can_read(const
|
|
100
|
+
bool ssl_can_read(const SSLImpl *ssl) {
|
|
110
101
|
return !SSL_in_init(ssl) || ssl->s3->hs->can_early_read;
|
|
111
102
|
}
|
|
112
103
|
|
|
113
|
-
ssl_open_record_t ssl_open_handshake(
|
|
104
|
+
ssl_open_record_t ssl_open_handshake(SSLImpl *ssl, size_t *out_consumed,
|
|
114
105
|
uint8_t *out_alert, Span<uint8_t> in) {
|
|
115
106
|
*out_consumed = 0;
|
|
116
107
|
if (!check_read_error(ssl)) {
|
|
@@ -124,7 +115,8 @@ ssl_open_record_t ssl_open_handshake(SSL *ssl, size_t *out_consumed,
|
|
|
124
115
|
return ret;
|
|
125
116
|
}
|
|
126
117
|
|
|
127
|
-
ssl_open_record_t ssl_open_change_cipher_spec(
|
|
118
|
+
ssl_open_record_t ssl_open_change_cipher_spec(SSLImpl *ssl,
|
|
119
|
+
size_t *out_consumed,
|
|
128
120
|
uint8_t *out_alert,
|
|
129
121
|
Span<uint8_t> in) {
|
|
130
122
|
*out_consumed = 0;
|
|
@@ -140,7 +132,7 @@ ssl_open_record_t ssl_open_change_cipher_spec(SSL *ssl, size_t *out_consumed,
|
|
|
140
132
|
return ret;
|
|
141
133
|
}
|
|
142
134
|
|
|
143
|
-
ssl_open_record_t ssl_open_app_data(
|
|
135
|
+
ssl_open_record_t ssl_open_app_data(SSLImpl *ssl, Span<uint8_t> *out,
|
|
144
136
|
size_t *out_consumed, uint8_t *out_alert,
|
|
145
137
|
Span<uint8_t> in) {
|
|
146
138
|
*out_consumed = 0;
|
|
@@ -175,9 +167,9 @@ static bool cbb_add_hex_consttime(CBB *cbb, Span<const uint8_t> in) {
|
|
|
175
167
|
return true;
|
|
176
168
|
}
|
|
177
169
|
|
|
178
|
-
bool ssl_log_secret(const
|
|
170
|
+
bool ssl_log_secret(const SSLImpl *ssl, const char *label,
|
|
179
171
|
Span<const uint8_t> secret) {
|
|
180
|
-
if (ssl->ctx->keylog_callback ==
|
|
172
|
+
if (ssl->ctx->keylog_callback == nullptr) {
|
|
181
173
|
return true;
|
|
182
174
|
}
|
|
183
175
|
|
|
@@ -190,7 +182,7 @@ bool ssl_log_secret(const SSL *ssl, const char *label,
|
|
|
190
182
|
!CBB_add_u8(cbb.get(), ' ') ||
|
|
191
183
|
!cbb_add_hex_consttime(cbb.get(), ssl->s3->client_random) ||
|
|
192
184
|
!CBB_add_u8(cbb.get(), ' ') ||
|
|
193
|
-
// Convert to hex in constant time to avoid leaking
|
|
185
|
+
// Convert to hex in constant time to avoid leaking `secret`. If the
|
|
194
186
|
// callback discards the data, we should not introduce side channels.
|
|
195
187
|
!cbb_add_hex_consttime(cbb.get(), secret) ||
|
|
196
188
|
!CBB_add_u8(cbb.get(), 0 /* NUL */) ||
|
|
@@ -202,26 +194,26 @@ bool ssl_log_secret(const SSL *ssl, const char *label,
|
|
|
202
194
|
return true;
|
|
203
195
|
}
|
|
204
196
|
|
|
205
|
-
void ssl_do_info_callback(const
|
|
206
|
-
void (*cb)(const SSL *ssl, int type, int value) =
|
|
207
|
-
if (ssl->info_callback !=
|
|
197
|
+
void ssl_do_info_callback(const SSLImpl *ssl, int type, int value) {
|
|
198
|
+
void (*cb)(const SSL *ssl, int type, int value) = nullptr;
|
|
199
|
+
if (ssl->info_callback != nullptr) {
|
|
208
200
|
cb = ssl->info_callback;
|
|
209
|
-
} else if (ssl->ctx->info_callback !=
|
|
201
|
+
} else if (ssl->ctx->info_callback != nullptr) {
|
|
210
202
|
cb = ssl->ctx->info_callback;
|
|
211
203
|
}
|
|
212
204
|
|
|
213
|
-
if (cb !=
|
|
205
|
+
if (cb != nullptr) {
|
|
214
206
|
cb(ssl, type, value);
|
|
215
207
|
}
|
|
216
208
|
}
|
|
217
209
|
|
|
218
|
-
void ssl_do_msg_callback(const
|
|
210
|
+
void ssl_do_msg_callback(const SSLImpl *ssl, int is_write, int content_type,
|
|
219
211
|
Span<const uint8_t> in) {
|
|
220
|
-
if (ssl->msg_callback ==
|
|
212
|
+
if (ssl->msg_callback == nullptr) {
|
|
221
213
|
return;
|
|
222
214
|
}
|
|
223
215
|
|
|
224
|
-
//
|
|
216
|
+
// `version` is zero when calling for `SSL3_RT_HEADER` and `SSL2_VERSION` for
|
|
225
217
|
// a V2ClientHello.
|
|
226
218
|
int version;
|
|
227
219
|
switch (content_type) {
|
|
@@ -237,11 +229,11 @@ void ssl_do_msg_callback(const SSL *ssl, int is_write, int content_type,
|
|
|
237
229
|
}
|
|
238
230
|
|
|
239
231
|
ssl->msg_callback(is_write, version, content_type, in.data(), in.size(),
|
|
240
|
-
const_cast<
|
|
232
|
+
const_cast<SSLImpl *>(ssl), ssl->msg_callback_arg);
|
|
241
233
|
}
|
|
242
234
|
|
|
243
|
-
OPENSSL_timeval ssl_ctx_get_current_time(const
|
|
244
|
-
if (ctx->current_time_cb !=
|
|
235
|
+
OPENSSL_timeval ssl_ctx_get_current_time(const SSLContext *ctx) {
|
|
236
|
+
if (ctx->current_time_cb != nullptr) {
|
|
245
237
|
// TODO(davidben): Update current_time_cb to use OPENSSL_timeval. See
|
|
246
238
|
// https://crbug.com/boringssl/155.
|
|
247
239
|
struct timeval clock;
|
|
@@ -267,7 +259,7 @@ OPENSSL_timeval ssl_ctx_get_current_time(const SSL_CTX *ctx) {
|
|
|
267
259
|
}
|
|
268
260
|
#else
|
|
269
261
|
struct timeval clock;
|
|
270
|
-
gettimeofday(&clock,
|
|
262
|
+
gettimeofday(&clock, nullptr);
|
|
271
263
|
if (clock.tv_sec < 0) {
|
|
272
264
|
assert(0);
|
|
273
265
|
return {0, 0};
|
|
@@ -278,9 +270,11 @@ OPENSSL_timeval ssl_ctx_get_current_time(const SSL_CTX *ctx) {
|
|
|
278
270
|
#endif
|
|
279
271
|
}
|
|
280
272
|
|
|
281
|
-
void SSL_CTX_set_handoff_mode(SSL_CTX *ctx, bool on) {
|
|
273
|
+
void SSL_CTX_set_handoff_mode(SSL_CTX *ctx, bool on) {
|
|
274
|
+
FromOpaque(ctx)->handoff = on;
|
|
275
|
+
}
|
|
282
276
|
|
|
283
|
-
static bool ssl_can_renegotiate(const
|
|
277
|
+
static bool ssl_can_renegotiate(const SSLImpl *ssl) {
|
|
284
278
|
if (ssl->server || SSL_is_dtls(ssl)) {
|
|
285
279
|
return false;
|
|
286
280
|
}
|
|
@@ -311,7 +305,7 @@ static bool ssl_can_renegotiate(const SSL *ssl) {
|
|
|
311
305
|
return false;
|
|
312
306
|
}
|
|
313
307
|
|
|
314
|
-
static void ssl_maybe_shed_handshake_config(
|
|
308
|
+
static void ssl_maybe_shed_handshake_config(SSLImpl *ssl) {
|
|
315
309
|
if (ssl->s3->hs != nullptr || //
|
|
316
310
|
ssl->config == nullptr || //
|
|
317
311
|
!ssl->config->shed_handshake_config || //
|
|
@@ -323,68 +317,61 @@ static void ssl_maybe_shed_handshake_config(SSL *ssl) {
|
|
|
323
317
|
}
|
|
324
318
|
|
|
325
319
|
void SSL_set_handoff_mode(SSL *ssl, bool on) {
|
|
326
|
-
|
|
320
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
321
|
+
if (!ssl_impl->config) {
|
|
327
322
|
return;
|
|
328
323
|
}
|
|
329
|
-
|
|
324
|
+
ssl_impl->config->handoff = on;
|
|
330
325
|
}
|
|
331
326
|
|
|
332
327
|
bool SSL_get_traffic_secrets(const SSL *ssl,
|
|
333
328
|
Span<const uint8_t> *out_read_traffic_secret,
|
|
334
329
|
Span<const uint8_t> *out_write_traffic_secret) {
|
|
330
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
335
331
|
// This API is not well-defined for DTLS, where multiple epochs may be alive
|
|
336
|
-
// at once. Callers should use
|
|
332
|
+
// at once. Callers should use `SSL_get_dtls_*_traffic_secret` instead. In
|
|
337
333
|
// QUIC, the application is already handed the traffic secret.
|
|
338
|
-
if (SSL_is_dtls(
|
|
334
|
+
if (SSL_is_dtls(ssl_impl) || SSL_is_quic(ssl_impl)) {
|
|
339
335
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
340
336
|
return false;
|
|
341
337
|
}
|
|
342
338
|
|
|
343
|
-
if (!
|
|
339
|
+
if (!ssl_impl->s3->initial_handshake_complete) {
|
|
344
340
|
OPENSSL_PUT_ERROR(SSL, SSL_R_HANDSHAKE_NOT_COMPLETE);
|
|
345
341
|
return false;
|
|
346
342
|
}
|
|
347
343
|
|
|
348
|
-
if (SSL_version(
|
|
344
|
+
if (SSL_version(ssl_impl) < TLS1_3_VERSION) {
|
|
349
345
|
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_SSL_VERSION);
|
|
350
346
|
return false;
|
|
351
347
|
}
|
|
352
348
|
|
|
353
|
-
*out_read_traffic_secret =
|
|
354
|
-
*out_write_traffic_secret =
|
|
349
|
+
*out_read_traffic_secret = ssl_impl->s3->read_traffic_secret;
|
|
350
|
+
*out_write_traffic_secret = ssl_impl->s3->write_traffic_secret;
|
|
355
351
|
return true;
|
|
356
352
|
}
|
|
357
353
|
|
|
358
|
-
void SSL_CTX_set_aes_hw_override_for_testing(SSL_CTX *ctx,
|
|
359
|
-
bool override_value) {
|
|
360
|
-
ctx->aes_hw_override = true;
|
|
361
|
-
ctx->aes_hw_override_value = override_value;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
void SSL_set_aes_hw_override_for_testing(SSL *ssl, bool override_value) {
|
|
365
|
-
ssl->config->aes_hw_override = true;
|
|
366
|
-
ssl->config->aes_hw_override_value = override_value;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
354
|
BSSL_NAMESPACE_END
|
|
370
355
|
|
|
371
356
|
using namespace bssl;
|
|
372
357
|
|
|
373
|
-
int SSL_library_init(
|
|
358
|
+
int SSL_library_init() { return 1; }
|
|
374
359
|
|
|
375
360
|
int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) {
|
|
376
361
|
return 1;
|
|
377
362
|
}
|
|
378
363
|
|
|
364
|
+
// TODO(crbug.com/565766495): Take `SSLSession` when the lhash does.
|
|
379
365
|
static uint32_t ssl_session_hash(const SSL_SESSION *sess) {
|
|
380
|
-
return ssl_hash_session_id(sess->session_id);
|
|
366
|
+
return ssl_hash_session_id(FromOpaque(sess)->session_id);
|
|
381
367
|
}
|
|
382
368
|
|
|
369
|
+
// TODO(crbug.com/565766495): Take `SSLSession` when the lhash does.
|
|
383
370
|
static int ssl_session_cmp(const SSL_SESSION *a, const SSL_SESSION *b) {
|
|
384
|
-
return Span(a->session_id) == b->session_id ? 0 : 1;
|
|
371
|
+
return Span(FromOpaque(a)->session_id) == FromOpaque(b)->session_id ? 0 : 1;
|
|
385
372
|
}
|
|
386
373
|
|
|
387
|
-
|
|
374
|
+
bssl::SSLContext::SSLContext(const SSL_METHOD *ssl_method)
|
|
388
375
|
: RefCounted(CheckSubClass()),
|
|
389
376
|
method(ssl_method->method),
|
|
390
377
|
x509_method(ssl_method->x509_method),
|
|
@@ -394,38 +381,35 @@ ssl_ctx_st::ssl_ctx_st(const SSL_METHOD *ssl_method)
|
|
|
394
381
|
signed_cert_timestamps_enabled(false),
|
|
395
382
|
channel_id_enabled(false),
|
|
396
383
|
grease_enabled(false),
|
|
384
|
+
grease_sigalgs_enabled(false),
|
|
397
385
|
permute_extensions(false),
|
|
398
386
|
allow_unknown_alpn_protos(false),
|
|
399
387
|
false_start_allowed_without_alpn(false),
|
|
400
388
|
handoff(false),
|
|
401
389
|
enable_early_data(false),
|
|
402
|
-
aes_hw_override(false),
|
|
403
|
-
aes_hw_override_value(false),
|
|
404
390
|
resumption_across_names_enabled(false) {
|
|
405
|
-
CRYPTO_MUTEX_init(&lock);
|
|
406
391
|
CRYPTO_new_ex_data(&ex_data);
|
|
407
392
|
}
|
|
408
393
|
|
|
409
|
-
|
|
394
|
+
bssl::SSLContext::~SSLContext() {
|
|
410
395
|
// Free the internal session cache. Note that this calls the caller-supplied
|
|
411
396
|
// remove callback, so we must do it before clearing ex_data. (See ticket
|
|
412
397
|
// [openssl.org #212].)
|
|
413
398
|
SSL_CTX_flush_sessions(this, 0);
|
|
414
399
|
|
|
415
|
-
CRYPTO_free_ex_data(&g_ex_data_class_ssl_ctx,
|
|
400
|
+
CRYPTO_free_ex_data(&g_ex_data_class_ssl_ctx, &ex_data);
|
|
416
401
|
|
|
417
|
-
CRYPTO_MUTEX_cleanup(&lock);
|
|
418
402
|
lh_SSL_SESSION_free(sessions);
|
|
419
403
|
x509_method->ssl_ctx_free(this);
|
|
420
404
|
}
|
|
421
405
|
|
|
422
406
|
SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
423
|
-
if (method ==
|
|
407
|
+
if (method == nullptr) {
|
|
424
408
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NULL_SSL_METHOD_PASSED);
|
|
425
409
|
return nullptr;
|
|
426
410
|
}
|
|
427
411
|
|
|
428
|
-
UniquePtr<
|
|
412
|
+
UniquePtr<SSLContext> ret = MakeUnique<SSLContext>(method);
|
|
429
413
|
if (!ret) {
|
|
430
414
|
return nullptr;
|
|
431
415
|
}
|
|
@@ -444,6 +428,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
|
444
428
|
}
|
|
445
429
|
|
|
446
430
|
if (!SSL_CTX_set_strict_cipher_list(ret.get(), SSL_DEFAULT_CIPHER_LIST) ||
|
|
431
|
+
!ssl_create_default_tls13_cipher_list(&ret->tls13_cipher_list) ||
|
|
447
432
|
// Lock the SSL_CTX to the specified version, for compatibility with
|
|
448
433
|
// legacy uses of SSL_METHOD.
|
|
449
434
|
!SSL_CTX_set_max_proto_version(ret.get(), method->version) ||
|
|
@@ -452,21 +437,29 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
|
452
437
|
return nullptr;
|
|
453
438
|
}
|
|
454
439
|
|
|
440
|
+
if (!ret->supported_group_list.CopyFrom(DefaultSupportedGroupIds())) {
|
|
441
|
+
return nullptr;
|
|
442
|
+
}
|
|
443
|
+
if (!ret->supported_group_list_flags.Init(ret->supported_group_list.size())) {
|
|
444
|
+
return nullptr;
|
|
445
|
+
}
|
|
446
|
+
ret->accepted_peer_cert_types.PushBack(kDefaultCertType);
|
|
447
|
+
|
|
455
448
|
return ret.release();
|
|
456
449
|
}
|
|
457
450
|
|
|
458
451
|
int SSL_CTX_up_ref(SSL_CTX *ctx) {
|
|
459
|
-
ctx->UpRefInternal();
|
|
452
|
+
FromOpaque(ctx)->UpRefInternal();
|
|
460
453
|
return 1;
|
|
461
454
|
}
|
|
462
455
|
|
|
463
456
|
void SSL_CTX_free(SSL_CTX *ctx) {
|
|
464
457
|
if (ctx != nullptr) {
|
|
465
|
-
ctx->DecRefInternal();
|
|
458
|
+
FromOpaque(ctx)->DecRefInternal();
|
|
466
459
|
}
|
|
467
460
|
}
|
|
468
461
|
|
|
469
|
-
|
|
462
|
+
bssl::SSLImpl::SSLImpl(SSLContext *ctx_arg)
|
|
470
463
|
: method(ctx_arg->method),
|
|
471
464
|
max_send_fragment(ctx_arg->max_send_fragment),
|
|
472
465
|
msg_callback(ctx_arg->msg_callback),
|
|
@@ -483,22 +476,23 @@ ssl_st::ssl_st(SSL_CTX *ctx_arg)
|
|
|
483
476
|
CRYPTO_new_ex_data(&ex_data);
|
|
484
477
|
}
|
|
485
478
|
|
|
486
|
-
|
|
487
|
-
CRYPTO_free_ex_data(&g_ex_data_class_ssl,
|
|
488
|
-
//
|
|
479
|
+
bssl::SSLImpl::~SSLImpl() {
|
|
480
|
+
CRYPTO_free_ex_data(&g_ex_data_class_ssl, &ex_data);
|
|
481
|
+
// `config` refers to `this`, so we must release it earlier.
|
|
489
482
|
config.reset();
|
|
490
|
-
if (method !=
|
|
483
|
+
if (method != nullptr) {
|
|
491
484
|
method->ssl_free(this);
|
|
492
485
|
}
|
|
493
486
|
}
|
|
494
487
|
|
|
495
488
|
SSL *SSL_new(SSL_CTX *ctx) {
|
|
496
|
-
|
|
489
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
490
|
+
if (ctx_impl == nullptr) {
|
|
497
491
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NULL_SSL_CTX);
|
|
498
492
|
return nullptr;
|
|
499
493
|
}
|
|
500
494
|
|
|
501
|
-
UniquePtr<
|
|
495
|
+
UniquePtr<SSLImpl> ssl = MakeUnique<SSLImpl>(ctx_impl);
|
|
502
496
|
if (ssl == nullptr) {
|
|
503
497
|
return nullptr;
|
|
504
498
|
}
|
|
@@ -507,57 +501,66 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
|
507
501
|
if (ssl->config == nullptr) {
|
|
508
502
|
return nullptr;
|
|
509
503
|
}
|
|
510
|
-
ssl->config->conf_min_version =
|
|
511
|
-
ssl->config->conf_max_version =
|
|
504
|
+
ssl->config->conf_min_version = ctx_impl->conf_min_version;
|
|
505
|
+
ssl->config->conf_max_version = ctx_impl->conf_max_version;
|
|
512
506
|
|
|
513
|
-
ssl->config->cert = ssl_cert_dup(
|
|
507
|
+
ssl->config->cert = ssl_cert_dup(ctx_impl->cert.get());
|
|
514
508
|
if (ssl->config->cert == nullptr) {
|
|
515
509
|
return nullptr;
|
|
516
510
|
}
|
|
517
511
|
|
|
518
|
-
ssl->config->verify_mode =
|
|
519
|
-
ssl->config->verify_callback =
|
|
520
|
-
ssl->config->custom_verify_callback =
|
|
512
|
+
ssl->config->verify_mode = ctx_impl->verify_mode;
|
|
513
|
+
ssl->config->verify_callback = ctx_impl->default_verify_callback;
|
|
514
|
+
ssl->config->custom_verify_callback = ctx_impl->custom_verify_callback;
|
|
521
515
|
ssl->config->retain_only_sha256_of_client_certs =
|
|
522
|
-
|
|
523
|
-
ssl->config->permute_extensions =
|
|
524
|
-
ssl->config->
|
|
525
|
-
|
|
526
|
-
ssl->config->
|
|
516
|
+
ctx_impl->retain_only_sha256_of_client_certs;
|
|
517
|
+
ssl->config->permute_extensions = ctx_impl->permute_extensions;
|
|
518
|
+
ssl->config->compliance_policy = ctx_impl->compliance_policy;
|
|
519
|
+
|
|
520
|
+
if (!ssl->config->tls13_cipher_list.CopyFrom(ctx_impl->tls13_cipher_list)) {
|
|
521
|
+
return nullptr;
|
|
522
|
+
}
|
|
527
523
|
|
|
528
|
-
if (!ssl->config->supported_group_list.CopyFrom(
|
|
524
|
+
if (!ssl->config->supported_group_list.CopyFrom(
|
|
525
|
+
ctx_impl->supported_group_list) ||
|
|
526
|
+
!ssl->config->supported_group_list_flags.CopyFrom(
|
|
527
|
+
ctx_impl->supported_group_list_flags) ||
|
|
529
528
|
!ssl->config->alpn_client_proto_list.CopyFrom(
|
|
530
|
-
|
|
531
|
-
!ssl->config->verify_sigalgs.CopyFrom(
|
|
529
|
+
ctx_impl->alpn_client_proto_list) ||
|
|
530
|
+
!ssl->config->verify_sigalgs.CopyFrom(ctx_impl->verify_sigalgs) ||
|
|
531
|
+
!ssl->config->accepted_peer_cert_types.TryCopyFrom(
|
|
532
|
+
ctx_impl->accepted_peer_cert_types) ||
|
|
533
|
+
!ssl->config->available_client_cert_types.TryCopyFrom(
|
|
534
|
+
ctx_impl->available_client_cert_types)) {
|
|
532
535
|
return nullptr;
|
|
533
536
|
}
|
|
534
537
|
|
|
535
|
-
if (
|
|
538
|
+
if (ctx_impl->requested_trust_anchors) {
|
|
536
539
|
ssl->config->requested_trust_anchors.emplace();
|
|
537
540
|
if (!ssl->config->requested_trust_anchors->CopyFrom(
|
|
538
|
-
*
|
|
541
|
+
*ctx_impl->requested_trust_anchors)) {
|
|
539
542
|
return nullptr;
|
|
540
543
|
}
|
|
541
544
|
}
|
|
542
545
|
|
|
543
|
-
if (
|
|
546
|
+
if (ctx_impl->psk_identity_hint) {
|
|
544
547
|
ssl->config->psk_identity_hint.reset(
|
|
545
|
-
OPENSSL_strdup(
|
|
548
|
+
OPENSSL_strdup(ctx_impl->psk_identity_hint.get()));
|
|
546
549
|
if (ssl->config->psk_identity_hint == nullptr) {
|
|
547
550
|
return nullptr;
|
|
548
551
|
}
|
|
549
552
|
}
|
|
550
|
-
ssl->config->psk_client_callback =
|
|
551
|
-
ssl->config->psk_server_callback =
|
|
553
|
+
ssl->config->psk_client_callback = ctx_impl->psk_client_callback;
|
|
554
|
+
ssl->config->psk_server_callback = ctx_impl->psk_server_callback;
|
|
552
555
|
|
|
553
|
-
ssl->config->channel_id_enabled =
|
|
554
|
-
ssl->config->channel_id_private = UpRef(
|
|
556
|
+
ssl->config->channel_id_enabled = ctx_impl->channel_id_enabled;
|
|
557
|
+
ssl->config->channel_id_private = UpRef(ctx_impl->channel_id_private);
|
|
555
558
|
|
|
556
559
|
ssl->config->signed_cert_timestamps_enabled =
|
|
557
|
-
|
|
558
|
-
ssl->config->ocsp_stapling_enabled =
|
|
559
|
-
ssl->config->handoff =
|
|
560
|
-
ssl->quic_method =
|
|
560
|
+
ctx_impl->signed_cert_timestamps_enabled;
|
|
561
|
+
ssl->config->ocsp_stapling_enabled = ctx_impl->ocsp_stapling_enabled;
|
|
562
|
+
ssl->config->handoff = ctx_impl->handoff;
|
|
563
|
+
ssl->quic_method = ctx_impl->quic_method;
|
|
561
564
|
|
|
562
565
|
if (!ssl->method->ssl_new(ssl.get()) ||
|
|
563
566
|
!ssl->ctx->x509_method->ssl_new(ssl->s3->hs.get())) {
|
|
@@ -567,20 +570,21 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
|
567
570
|
return ssl.release();
|
|
568
571
|
}
|
|
569
572
|
|
|
570
|
-
SSL_CONFIG::SSL_CONFIG(
|
|
573
|
+
SSL_CONFIG::SSL_CONFIG(SSLImpl *ssl_arg)
|
|
571
574
|
: ssl(ssl_arg),
|
|
572
575
|
ech_grease_enabled(false),
|
|
576
|
+
reject_unusable_ech_config(false),
|
|
573
577
|
signed_cert_timestamps_enabled(false),
|
|
574
578
|
ocsp_stapling_enabled(false),
|
|
575
579
|
channel_id_enabled(false),
|
|
576
|
-
enforce_rsa_key_usage(true),
|
|
577
580
|
retain_only_sha256_of_client_certs(false),
|
|
578
581
|
handoff(false),
|
|
579
582
|
shed_handshake_config(false),
|
|
580
583
|
jdk11_workaround(false),
|
|
581
584
|
quic_use_legacy_codepoint(false),
|
|
582
585
|
permute_extensions(false),
|
|
583
|
-
alps_use_new_codepoint(true)
|
|
586
|
+
alps_use_new_codepoint(true),
|
|
587
|
+
server_padding_enabled(false) {
|
|
584
588
|
assert(ssl);
|
|
585
589
|
}
|
|
586
590
|
|
|
@@ -590,21 +594,23 @@ SSL_CONFIG::~SSL_CONFIG() {
|
|
|
590
594
|
}
|
|
591
595
|
}
|
|
592
596
|
|
|
593
|
-
void SSL_free(SSL *ssl) { Delete(ssl); }
|
|
597
|
+
void SSL_free(SSL *ssl) { Delete(FromOpaque(ssl)); }
|
|
594
598
|
|
|
595
599
|
void SSL_set_connect_state(SSL *ssl) {
|
|
596
|
-
|
|
597
|
-
|
|
600
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
601
|
+
ssl_impl->server = false;
|
|
602
|
+
ssl_impl->do_handshake = ssl_client_handshake;
|
|
598
603
|
}
|
|
599
604
|
|
|
600
605
|
void SSL_set_accept_state(SSL *ssl) {
|
|
601
|
-
|
|
602
|
-
|
|
606
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
607
|
+
ssl_impl->server = true;
|
|
608
|
+
ssl_impl->do_handshake = ssl_server_handshake;
|
|
603
609
|
}
|
|
604
610
|
|
|
605
|
-
void SSL_set0_rbio(SSL *ssl, BIO *rbio) { ssl->rbio.reset(rbio); }
|
|
611
|
+
void SSL_set0_rbio(SSL *ssl, BIO *rbio) { FromOpaque(ssl)->rbio.reset(rbio); }
|
|
606
612
|
|
|
607
|
-
void SSL_set0_wbio(SSL *ssl, BIO *wbio) { ssl->wbio.reset(wbio); }
|
|
613
|
+
void SSL_set0_wbio(SSL *ssl, BIO *wbio) { FromOpaque(ssl)->wbio.reset(wbio); }
|
|
608
614
|
|
|
609
615
|
void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
|
|
610
616
|
// For historical reasons, this function has many different cases in ownership
|
|
@@ -617,7 +623,7 @@ void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
|
|
|
617
623
|
|
|
618
624
|
// If the two arguments are equal, one fewer reference is granted than
|
|
619
625
|
// taken.
|
|
620
|
-
if (rbio !=
|
|
626
|
+
if (rbio != nullptr && rbio == wbio) {
|
|
621
627
|
BIO_up_ref(rbio);
|
|
622
628
|
}
|
|
623
629
|
|
|
@@ -640,12 +646,13 @@ void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
|
|
|
640
646
|
SSL_set0_wbio(ssl, wbio);
|
|
641
647
|
}
|
|
642
648
|
|
|
643
|
-
BIO *SSL_get_rbio(const SSL *ssl) { return ssl->rbio.get(); }
|
|
649
|
+
BIO *SSL_get_rbio(const SSL *ssl) { return FromOpaque(ssl)->rbio.get(); }
|
|
644
650
|
|
|
645
|
-
BIO *SSL_get_wbio(const SSL *ssl) { return ssl->wbio.get(); }
|
|
651
|
+
BIO *SSL_get_wbio(const SSL *ssl) { return FromOpaque(ssl)->wbio.get(); }
|
|
646
652
|
|
|
647
653
|
size_t SSL_quic_max_handshake_flight_len(const SSL *ssl,
|
|
648
654
|
enum ssl_encryption_level_t level) {
|
|
655
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
649
656
|
// Limits flights to 16K by default when there are no large
|
|
650
657
|
// (certificate-carrying) messages.
|
|
651
658
|
static const size_t kDefaultLimit = 16384;
|
|
@@ -657,18 +664,18 @@ size_t SSL_quic_max_handshake_flight_len(const SSL *ssl,
|
|
|
657
664
|
// QUIC does not send EndOfEarlyData.
|
|
658
665
|
return 0;
|
|
659
666
|
case ssl_encryption_handshake:
|
|
660
|
-
if (
|
|
667
|
+
if (ssl_impl->server) {
|
|
661
668
|
// Servers may receive Certificate message if configured to request
|
|
662
669
|
// client certificates.
|
|
663
|
-
if (!!(
|
|
664
|
-
|
|
665
|
-
return
|
|
670
|
+
if (!!(ssl_impl->config->verify_mode & SSL_VERIFY_PEER) &&
|
|
671
|
+
ssl_impl->max_cert_list > kDefaultLimit) {
|
|
672
|
+
return ssl_impl->max_cert_list;
|
|
666
673
|
}
|
|
667
674
|
} else {
|
|
668
675
|
// Clients may receive both Certificate message and a CertificateRequest
|
|
669
676
|
// message.
|
|
670
|
-
if (2 *
|
|
671
|
-
return 2 *
|
|
677
|
+
if (2 * ssl_impl->max_cert_list > kDefaultLimit) {
|
|
678
|
+
return 2 * ssl_impl->max_cert_list;
|
|
672
679
|
}
|
|
673
680
|
}
|
|
674
681
|
return kDefaultLimit;
|
|
@@ -684,70 +691,74 @@ size_t SSL_quic_max_handshake_flight_len(const SSL *ssl,
|
|
|
684
691
|
|
|
685
692
|
enum ssl_encryption_level_t SSL_quic_read_level(const SSL *ssl) {
|
|
686
693
|
assert(SSL_is_quic(ssl));
|
|
687
|
-
return ssl->s3->quic_read_level;
|
|
694
|
+
return FromOpaque(ssl)->s3->quic_read_level;
|
|
688
695
|
}
|
|
689
696
|
|
|
690
697
|
enum ssl_encryption_level_t SSL_quic_write_level(const SSL *ssl) {
|
|
691
698
|
assert(SSL_is_quic(ssl));
|
|
692
|
-
return ssl->s3->quic_write_level;
|
|
699
|
+
return FromOpaque(ssl)->s3->quic_write_level;
|
|
693
700
|
}
|
|
694
701
|
|
|
695
702
|
int SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level,
|
|
696
703
|
const uint8_t *data, size_t len) {
|
|
697
|
-
|
|
704
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
705
|
+
if (!SSL_is_quic(ssl_impl)) {
|
|
698
706
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
699
707
|
return 0;
|
|
700
708
|
}
|
|
701
709
|
|
|
702
|
-
if (level !=
|
|
710
|
+
if (level != ssl_impl->s3->quic_read_level) {
|
|
703
711
|
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_ENCRYPTION_LEVEL_RECEIVED);
|
|
704
712
|
return 0;
|
|
705
713
|
}
|
|
706
714
|
|
|
707
|
-
size_t new_len =
|
|
715
|
+
size_t new_len =
|
|
716
|
+
(ssl_impl->s3->hs_buf ? ssl_impl->s3->hs_buf->length : 0) + len;
|
|
708
717
|
if (new_len < len ||
|
|
709
|
-
new_len > SSL_quic_max_handshake_flight_len(
|
|
718
|
+
new_len > SSL_quic_max_handshake_flight_len(ssl_impl, level)) {
|
|
710
719
|
OPENSSL_PUT_ERROR(SSL, SSL_R_EXCESSIVE_MESSAGE_SIZE);
|
|
711
720
|
return 0;
|
|
712
721
|
}
|
|
713
722
|
|
|
714
|
-
return tls_append_handshake_data(
|
|
723
|
+
return tls_append_handshake_data(ssl_impl, Span(data, len));
|
|
715
724
|
}
|
|
716
725
|
|
|
717
726
|
int SSL_do_handshake(SSL *ssl) {
|
|
718
|
-
|
|
727
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
728
|
+
ssl_reset_error_state(ssl_impl);
|
|
719
729
|
|
|
720
|
-
if (
|
|
730
|
+
if (ssl_impl->do_handshake == nullptr) {
|
|
721
731
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CONNECTION_TYPE_NOT_SET);
|
|
722
732
|
return -1;
|
|
723
733
|
}
|
|
724
734
|
|
|
725
|
-
if (!SSL_in_init(
|
|
735
|
+
if (!SSL_in_init(ssl_impl)) {
|
|
726
736
|
return 1;
|
|
727
737
|
}
|
|
728
738
|
|
|
729
739
|
// Run the handshake.
|
|
730
|
-
SSL_HANDSHAKE *hs =
|
|
740
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
731
741
|
|
|
732
742
|
bool early_return = false;
|
|
733
743
|
int ret = ssl_run_handshake(hs, &early_return);
|
|
734
744
|
ssl_do_info_callback(
|
|
735
|
-
|
|
745
|
+
ssl_impl, ssl_impl->server ? SSL_CB_ACCEPT_EXIT : SSL_CB_CONNECT_EXIT,
|
|
746
|
+
ret);
|
|
736
747
|
if (ret <= 0) {
|
|
737
748
|
return ret;
|
|
738
749
|
}
|
|
739
750
|
|
|
740
751
|
// Destroy the handshake object if the handshake has completely finished.
|
|
741
752
|
if (!early_return) {
|
|
742
|
-
|
|
743
|
-
ssl_maybe_shed_handshake_config(
|
|
753
|
+
ssl_impl->s3->hs.reset();
|
|
754
|
+
ssl_maybe_shed_handshake_config(ssl_impl);
|
|
744
755
|
}
|
|
745
756
|
|
|
746
757
|
return 1;
|
|
747
758
|
}
|
|
748
759
|
|
|
749
760
|
int SSL_connect(SSL *ssl) {
|
|
750
|
-
if (ssl->do_handshake ==
|
|
761
|
+
if (FromOpaque(ssl)->do_handshake == nullptr) {
|
|
751
762
|
// Not properly initialized yet
|
|
752
763
|
SSL_set_connect_state(ssl);
|
|
753
764
|
}
|
|
@@ -756,7 +767,7 @@ int SSL_connect(SSL *ssl) {
|
|
|
756
767
|
}
|
|
757
768
|
|
|
758
769
|
int SSL_accept(SSL *ssl) {
|
|
759
|
-
if (ssl->do_handshake ==
|
|
770
|
+
if (FromOpaque(ssl)->do_handshake == nullptr) {
|
|
760
771
|
// Not properly initialized yet
|
|
761
772
|
SSL_set_accept_state(ssl);
|
|
762
773
|
}
|
|
@@ -764,7 +775,7 @@ int SSL_accept(SSL *ssl) {
|
|
|
764
775
|
return SSL_do_handshake(ssl);
|
|
765
776
|
}
|
|
766
777
|
|
|
767
|
-
static int ssl_do_post_handshake(
|
|
778
|
+
static int ssl_do_post_handshake(SSLImpl *ssl, const SSLMessage &msg) {
|
|
768
779
|
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
|
769
780
|
return tls13_post_handshake(ssl, msg);
|
|
770
781
|
}
|
|
@@ -801,36 +812,37 @@ static int ssl_do_post_handshake(SSL *ssl, const SSLMessage &msg) {
|
|
|
801
812
|
}
|
|
802
813
|
|
|
803
814
|
int SSL_process_quic_post_handshake(SSL *ssl) {
|
|
804
|
-
|
|
815
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
816
|
+
ssl_reset_error_state(ssl_impl);
|
|
805
817
|
|
|
806
|
-
if (!SSL_is_quic(
|
|
818
|
+
if (!SSL_is_quic(ssl_impl) || SSL_in_init(ssl_impl)) {
|
|
807
819
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
808
820
|
return 0;
|
|
809
821
|
}
|
|
810
822
|
|
|
811
823
|
// Replay post-handshake message errors.
|
|
812
|
-
if (!check_read_error(
|
|
824
|
+
if (!check_read_error(ssl_impl)) {
|
|
813
825
|
return 0;
|
|
814
826
|
}
|
|
815
827
|
|
|
816
828
|
// Process any buffered post-handshake messages.
|
|
817
829
|
SSLMessage msg;
|
|
818
|
-
while (
|
|
830
|
+
while (ssl_impl->method->get_message(ssl_impl, &msg)) {
|
|
819
831
|
// Handle the post-handshake message and try again.
|
|
820
|
-
if (!ssl_do_post_handshake(
|
|
821
|
-
ssl_set_read_error(
|
|
832
|
+
if (!ssl_do_post_handshake(ssl_impl, msg)) {
|
|
833
|
+
ssl_set_read_error(ssl_impl);
|
|
822
834
|
return 0;
|
|
823
835
|
}
|
|
824
|
-
|
|
836
|
+
ssl_impl->method->next_message(ssl_impl);
|
|
825
837
|
}
|
|
826
838
|
|
|
827
839
|
return 1;
|
|
828
840
|
}
|
|
829
841
|
|
|
830
|
-
static int ssl_read_impl(
|
|
842
|
+
static int ssl_read_impl(SSLImpl *ssl) {
|
|
831
843
|
ssl_reset_error_state(ssl);
|
|
832
844
|
|
|
833
|
-
if (ssl->do_handshake ==
|
|
845
|
+
if (ssl->do_handshake == nullptr) {
|
|
834
846
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
835
847
|
return -1;
|
|
836
848
|
}
|
|
@@ -856,7 +868,7 @@ static int ssl_read_impl(SSL *ssl) {
|
|
|
856
868
|
}
|
|
857
869
|
|
|
858
870
|
// Complete the current handshake, if any. False Start will cause
|
|
859
|
-
//
|
|
871
|
+
// `SSL_do_handshake` to return mid-handshake, so this may require multiple
|
|
860
872
|
// iterations.
|
|
861
873
|
while (!ssl_can_read(ssl)) {
|
|
862
874
|
int ret = SSL_do_handshake(ssl);
|
|
@@ -907,27 +919,29 @@ static int ssl_read_impl(SSL *ssl) {
|
|
|
907
919
|
}
|
|
908
920
|
|
|
909
921
|
int SSL_read(SSL *ssl, void *buf, int num) {
|
|
910
|
-
|
|
922
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
923
|
+
int ret = SSL_peek(ssl_impl, buf, num);
|
|
911
924
|
if (ret <= 0) {
|
|
912
925
|
return ret;
|
|
913
926
|
}
|
|
914
927
|
// TODO(davidben): In DTLS, should the rest of the record be discarded? DTLS
|
|
915
928
|
// is not a stream. See https://crbug.com/boringssl/65.
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
if (
|
|
919
|
-
|
|
929
|
+
ssl_impl->s3->pending_app_data =
|
|
930
|
+
ssl_impl->s3->pending_app_data.subspan(static_cast<size_t>(ret));
|
|
931
|
+
if (ssl_impl->s3->pending_app_data.empty()) {
|
|
932
|
+
ssl_impl->s3->read_buffer.DiscardConsumed();
|
|
920
933
|
}
|
|
921
934
|
return ret;
|
|
922
935
|
}
|
|
923
936
|
|
|
924
937
|
int SSL_peek(SSL *ssl, void *buf, int num) {
|
|
925
|
-
|
|
938
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
939
|
+
if (SSL_is_quic(ssl_impl)) {
|
|
926
940
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
927
941
|
return -1;
|
|
928
942
|
}
|
|
929
943
|
|
|
930
|
-
int ret = ssl_read_impl(
|
|
944
|
+
int ret = ssl_read_impl(ssl_impl);
|
|
931
945
|
if (ret <= 0) {
|
|
932
946
|
return ret;
|
|
933
947
|
}
|
|
@@ -935,20 +949,21 @@ int SSL_peek(SSL *ssl, void *buf, int num) {
|
|
|
935
949
|
return num;
|
|
936
950
|
}
|
|
937
951
|
size_t todo =
|
|
938
|
-
std::min(
|
|
939
|
-
OPENSSL_memcpy(buf,
|
|
952
|
+
std::min(ssl_impl->s3->pending_app_data.size(), static_cast<size_t>(num));
|
|
953
|
+
OPENSSL_memcpy(buf, ssl_impl->s3->pending_app_data.data(), todo);
|
|
940
954
|
return static_cast<int>(todo);
|
|
941
955
|
}
|
|
942
956
|
|
|
943
957
|
int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
944
|
-
|
|
958
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
959
|
+
ssl_reset_error_state(ssl_impl);
|
|
945
960
|
|
|
946
|
-
if (SSL_is_quic(
|
|
961
|
+
if (SSL_is_quic(ssl_impl)) {
|
|
947
962
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
948
963
|
return -1;
|
|
949
964
|
}
|
|
950
965
|
|
|
951
|
-
if (
|
|
966
|
+
if (ssl_impl->do_handshake == nullptr) {
|
|
952
967
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
953
968
|
return -1;
|
|
954
969
|
}
|
|
@@ -958,8 +973,8 @@ int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
|
958
973
|
bool needs_handshake = false;
|
|
959
974
|
do {
|
|
960
975
|
// If necessary, complete the handshake implicitly.
|
|
961
|
-
if (!ssl_can_write(
|
|
962
|
-
ret = SSL_do_handshake(
|
|
976
|
+
if (!ssl_can_write(ssl_impl)) {
|
|
977
|
+
ret = SSL_do_handshake(ssl_impl);
|
|
963
978
|
if (ret < 0) {
|
|
964
979
|
return ret;
|
|
965
980
|
}
|
|
@@ -973,58 +988,60 @@ int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
|
973
988
|
OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_LENGTH);
|
|
974
989
|
return -1;
|
|
975
990
|
}
|
|
976
|
-
ret =
|
|
977
|
-
|
|
991
|
+
ret = ssl_impl->method->write_app_data(
|
|
992
|
+
ssl_impl, &needs_handshake, &bytes_written,
|
|
978
993
|
Span(static_cast<const uint8_t *>(buf), static_cast<size_t>(num)));
|
|
979
994
|
} while (needs_handshake);
|
|
980
995
|
return ret <= 0 ? ret : static_cast<int>(bytes_written);
|
|
981
996
|
}
|
|
982
997
|
|
|
983
998
|
int SSL_key_update(SSL *ssl, int request_type) {
|
|
984
|
-
|
|
999
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1000
|
+
ssl_reset_error_state(ssl_impl);
|
|
985
1001
|
|
|
986
|
-
if (
|
|
1002
|
+
if (ssl_impl->do_handshake == nullptr) {
|
|
987
1003
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
988
1004
|
return 0;
|
|
989
1005
|
}
|
|
990
1006
|
|
|
991
|
-
if (SSL_is_quic(
|
|
1007
|
+
if (SSL_is_quic(ssl_impl)) {
|
|
992
1008
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
993
1009
|
return 0;
|
|
994
1010
|
}
|
|
995
1011
|
|
|
996
|
-
if (!
|
|
1012
|
+
if (!ssl_impl->s3->initial_handshake_complete) {
|
|
997
1013
|
OPENSSL_PUT_ERROR(SSL, SSL_R_HANDSHAKE_NOT_COMPLETE);
|
|
998
1014
|
return 0;
|
|
999
1015
|
}
|
|
1000
1016
|
|
|
1001
|
-
if (ssl_protocol_version(
|
|
1017
|
+
if (ssl_protocol_version(ssl_impl) < TLS1_3_VERSION) {
|
|
1002
1018
|
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_SSL_VERSION);
|
|
1003
1019
|
return 0;
|
|
1004
1020
|
}
|
|
1005
1021
|
|
|
1006
|
-
return tls13_add_key_update(
|
|
1022
|
+
return tls13_add_key_update(ssl_impl, request_type);
|
|
1007
1023
|
}
|
|
1008
1024
|
|
|
1009
1025
|
int SSL_shutdown(SSL *ssl) {
|
|
1010
|
-
|
|
1026
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1027
|
+
ssl_reset_error_state(ssl_impl);
|
|
1011
1028
|
|
|
1012
|
-
if (
|
|
1029
|
+
if (ssl_impl->do_handshake == nullptr) {
|
|
1013
1030
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
1014
1031
|
return -1;
|
|
1015
1032
|
}
|
|
1016
1033
|
|
|
1017
1034
|
// If we are in the middle of a handshake, silently succeed. Consumers often
|
|
1018
|
-
// call this function before
|
|
1035
|
+
// call this function before `SSL_free`, whether the handshake succeeded or
|
|
1019
1036
|
// not. We assume the caller has already handled failed handshakes.
|
|
1020
|
-
if (SSL_in_init(
|
|
1037
|
+
if (SSL_in_init(ssl_impl)) {
|
|
1021
1038
|
return 1;
|
|
1022
1039
|
}
|
|
1023
1040
|
|
|
1024
|
-
if (
|
|
1041
|
+
if (ssl_impl->quiet_shutdown) {
|
|
1025
1042
|
// Do nothing if configured not to send a close_notify.
|
|
1026
|
-
|
|
1027
|
-
|
|
1043
|
+
ssl_impl->s3->write_shutdown = ssl_shutdown_close_notify;
|
|
1044
|
+
ssl_impl->s3->read_shutdown = ssl_shutdown_close_notify;
|
|
1028
1045
|
return 1;
|
|
1029
1046
|
}
|
|
1030
1047
|
|
|
@@ -1032,99 +1049,106 @@ int SSL_shutdown(SSL *ssl) {
|
|
|
1032
1049
|
// waits for a close_notify to come in. Perform exactly one action and return
|
|
1033
1050
|
// whether or not it succeeds.
|
|
1034
1051
|
|
|
1035
|
-
if (
|
|
1052
|
+
if (ssl_impl->s3->write_shutdown != ssl_shutdown_close_notify) {
|
|
1036
1053
|
// Send a close_notify.
|
|
1037
|
-
if (ssl_send_alert_impl(
|
|
1054
|
+
if (ssl_send_alert_impl(ssl_impl, SSL3_AL_WARNING, SSL_AD_CLOSE_NOTIFY) <=
|
|
1055
|
+
0) {
|
|
1038
1056
|
return -1;
|
|
1039
1057
|
}
|
|
1040
|
-
} else if (
|
|
1058
|
+
} else if (ssl_impl->s3->alert_dispatch) {
|
|
1041
1059
|
// Finish sending the close_notify.
|
|
1042
|
-
if (
|
|
1060
|
+
if (ssl_impl->method->dispatch_alert(ssl_impl) <= 0) {
|
|
1043
1061
|
return -1;
|
|
1044
1062
|
}
|
|
1045
|
-
} else if (
|
|
1046
|
-
if (SSL_is_dtls(
|
|
1063
|
+
} else if (ssl_impl->s3->read_shutdown != ssl_shutdown_close_notify) {
|
|
1064
|
+
if (SSL_is_dtls(ssl_impl)) {
|
|
1047
1065
|
// Bidirectional shutdown doesn't make sense for an unordered
|
|
1048
1066
|
// transport. DTLS alerts also aren't delivered reliably, so we may even
|
|
1049
1067
|
// time out because the peer never received our close_notify. Report to
|
|
1050
1068
|
// the caller that the channel has fully shut down.
|
|
1051
|
-
if (
|
|
1052
|
-
ERR_restore_state(
|
|
1069
|
+
if (ssl_impl->s3->read_shutdown == ssl_shutdown_error) {
|
|
1070
|
+
ERR_restore_state(ssl_impl->s3->read_error.get());
|
|
1053
1071
|
return -1;
|
|
1054
1072
|
}
|
|
1055
|
-
|
|
1073
|
+
ssl_impl->s3->read_shutdown = ssl_shutdown_close_notify;
|
|
1056
1074
|
} else {
|
|
1057
1075
|
// Process records until an error, close_notify, or application data.
|
|
1058
|
-
if (ssl_read_impl(
|
|
1076
|
+
if (ssl_read_impl(ssl_impl) > 0) {
|
|
1059
1077
|
// We received some unexpected application data.
|
|
1060
1078
|
OPENSSL_PUT_ERROR(SSL, SSL_R_APPLICATION_DATA_ON_SHUTDOWN);
|
|
1061
1079
|
return -1;
|
|
1062
1080
|
}
|
|
1063
|
-
if (
|
|
1081
|
+
if (ssl_impl->s3->read_shutdown != ssl_shutdown_close_notify) {
|
|
1064
1082
|
return -1;
|
|
1065
1083
|
}
|
|
1066
1084
|
}
|
|
1067
1085
|
}
|
|
1068
1086
|
|
|
1069
1087
|
// Return 0 for unidirectional shutdown and 1 for bidirectional shutdown.
|
|
1070
|
-
return
|
|
1088
|
+
return ssl_impl->s3->read_shutdown == ssl_shutdown_close_notify;
|
|
1071
1089
|
}
|
|
1072
1090
|
|
|
1073
1091
|
int SSL_send_fatal_alert(SSL *ssl, uint8_t alert) {
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1092
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1093
|
+
if (ssl_impl->s3->alert_dispatch) {
|
|
1094
|
+
if (ssl_impl->s3->send_alert[0] != SSL3_AL_FATAL ||
|
|
1095
|
+
ssl_impl->s3->send_alert[1] != alert) {
|
|
1077
1096
|
// We are already attempting to write a different alert.
|
|
1078
1097
|
OPENSSL_PUT_ERROR(SSL, SSL_R_PROTOCOL_IS_SHUTDOWN);
|
|
1079
1098
|
return -1;
|
|
1080
1099
|
}
|
|
1081
|
-
return
|
|
1100
|
+
return ssl_impl->method->dispatch_alert(ssl_impl);
|
|
1082
1101
|
}
|
|
1083
1102
|
|
|
1084
|
-
return ssl_send_alert_impl(
|
|
1103
|
+
return ssl_send_alert_impl(ssl_impl, SSL3_AL_FATAL, alert);
|
|
1085
1104
|
}
|
|
1086
1105
|
|
|
1087
1106
|
int SSL_set_quic_transport_params(SSL *ssl, const uint8_t *params,
|
|
1088
1107
|
size_t params_len) {
|
|
1089
|
-
|
|
1090
|
-
|
|
1108
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1109
|
+
return ssl_impl->config && ssl_impl->config->quic_transport_params.CopyFrom(
|
|
1110
|
+
Span(params, params_len));
|
|
1091
1111
|
}
|
|
1092
1112
|
|
|
1093
1113
|
void SSL_get_peer_quic_transport_params(const SSL *ssl,
|
|
1094
1114
|
const uint8_t **out_params,
|
|
1095
1115
|
size_t *out_params_len) {
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1116
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1117
|
+
*out_params = ssl_impl->s3->peer_quic_transport_params.data();
|
|
1118
|
+
*out_params_len = ssl_impl->s3->peer_quic_transport_params.size();
|
|
1098
1119
|
}
|
|
1099
1120
|
|
|
1100
1121
|
int SSL_set_quic_early_data_context(SSL *ssl, const uint8_t *context,
|
|
1101
1122
|
size_t context_len) {
|
|
1102
|
-
|
|
1103
|
-
|
|
1123
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1124
|
+
return ssl_impl->config && ssl_impl->config->quic_early_data_context.CopyFrom(
|
|
1125
|
+
Span(context, context_len));
|
|
1104
1126
|
}
|
|
1105
1127
|
|
|
1106
1128
|
void SSL_CTX_set_early_data_enabled(SSL_CTX *ctx, int enabled) {
|
|
1107
|
-
ctx->enable_early_data = !!enabled;
|
|
1129
|
+
FromOpaque(ctx)->enable_early_data = !!enabled;
|
|
1108
1130
|
}
|
|
1109
1131
|
|
|
1110
1132
|
void SSL_set_early_data_enabled(SSL *ssl, int enabled) {
|
|
1111
|
-
ssl->enable_early_data = !!enabled;
|
|
1133
|
+
FromOpaque(ssl)->enable_early_data = !!enabled;
|
|
1112
1134
|
}
|
|
1113
1135
|
|
|
1114
1136
|
int SSL_in_early_data(const SSL *ssl) {
|
|
1115
|
-
|
|
1137
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1138
|
+
if (ssl_impl->s3->hs == nullptr) {
|
|
1116
1139
|
return 0;
|
|
1117
1140
|
}
|
|
1118
|
-
return
|
|
1141
|
+
return ssl_impl->s3->hs->in_early_data;
|
|
1119
1142
|
}
|
|
1120
1143
|
|
|
1121
1144
|
int SSL_early_data_accepted(const SSL *ssl) {
|
|
1122
|
-
return ssl->s3->early_data_accepted;
|
|
1145
|
+
return FromOpaque(ssl)->s3->early_data_accepted;
|
|
1123
1146
|
}
|
|
1124
1147
|
|
|
1125
1148
|
void SSL_reset_early_data_reject(SSL *ssl) {
|
|
1126
|
-
|
|
1127
|
-
|
|
1149
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1150
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
1151
|
+
if (hs == nullptr || //
|
|
1128
1152
|
hs->wait != ssl_hs_early_data_rejected) {
|
|
1129
1153
|
abort();
|
|
1130
1154
|
}
|
|
@@ -1133,14 +1157,15 @@ void SSL_reset_early_data_reject(SSL *ssl) {
|
|
|
1133
1157
|
hs->in_early_data = false;
|
|
1134
1158
|
hs->early_session.reset();
|
|
1135
1159
|
|
|
1136
|
-
// Discard any unfinished writes from the perspective of
|
|
1160
|
+
// Discard any unfinished writes from the perspective of `SSL_write`'s
|
|
1137
1161
|
// retry. The handshake will transparently flush out the pending record
|
|
1138
1162
|
// (discarded by the server) to keep the framing correct.
|
|
1139
|
-
|
|
1163
|
+
ssl_impl->s3->pending_write = {};
|
|
1164
|
+
ssl_impl->s3->unreported_bytes_written = 0;
|
|
1140
1165
|
}
|
|
1141
1166
|
|
|
1142
1167
|
enum ssl_early_data_reason_t SSL_get_early_data_reason(const SSL *ssl) {
|
|
1143
|
-
return ssl->s3->early_data_reason;
|
|
1168
|
+
return FromOpaque(ssl)->s3->early_data_reason;
|
|
1144
1169
|
}
|
|
1145
1170
|
|
|
1146
1171
|
const char *SSL_early_data_reason_string(enum ssl_early_data_reason_t reason) {
|
|
@@ -1190,6 +1215,7 @@ static int bio_retry_reason_to_error(int reason) {
|
|
|
1190
1215
|
}
|
|
1191
1216
|
|
|
1192
1217
|
int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
1218
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1193
1219
|
if (ret_code > 0) {
|
|
1194
1220
|
return SSL_ERROR_NONE;
|
|
1195
1221
|
}
|
|
@@ -1205,7 +1231,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
|
1205
1231
|
}
|
|
1206
1232
|
|
|
1207
1233
|
if (ret_code == 0) {
|
|
1208
|
-
if (
|
|
1234
|
+
if (ssl_impl->s3->rwstate == SSL_ERROR_ZERO_RETURN) {
|
|
1209
1235
|
return SSL_ERROR_ZERO_RETURN;
|
|
1210
1236
|
}
|
|
1211
1237
|
// An EOF was observed which violates the protocol, and the underlying
|
|
@@ -1214,7 +1240,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
|
1214
1240
|
return SSL_ERROR_SYSCALL;
|
|
1215
1241
|
}
|
|
1216
1242
|
|
|
1217
|
-
switch (
|
|
1243
|
+
switch (ssl_impl->s3->rwstate) {
|
|
1218
1244
|
case SSL_ERROR_PENDING_SESSION:
|
|
1219
1245
|
case SSL_ERROR_PENDING_CERTIFICATE:
|
|
1220
1246
|
case SSL_ERROR_HANDOFF:
|
|
@@ -1226,13 +1252,13 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
|
1226
1252
|
case SSL_ERROR_WANT_CERTIFICATE_VERIFY:
|
|
1227
1253
|
case SSL_ERROR_WANT_RENEGOTIATE:
|
|
1228
1254
|
case SSL_ERROR_HANDSHAKE_HINTS_READY:
|
|
1229
|
-
return
|
|
1255
|
+
return ssl_impl->s3->rwstate;
|
|
1230
1256
|
|
|
1231
1257
|
case SSL_ERROR_WANT_READ: {
|
|
1232
|
-
if (SSL_is_quic(
|
|
1258
|
+
if (SSL_is_quic(ssl_impl)) {
|
|
1233
1259
|
return SSL_ERROR_WANT_READ;
|
|
1234
1260
|
}
|
|
1235
|
-
BIO *bio = SSL_get_rbio(
|
|
1261
|
+
BIO *bio = SSL_get_rbio(ssl_impl);
|
|
1236
1262
|
if (BIO_should_read(bio)) {
|
|
1237
1263
|
return SSL_ERROR_WANT_READ;
|
|
1238
1264
|
}
|
|
@@ -1251,7 +1277,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
|
1251
1277
|
}
|
|
1252
1278
|
|
|
1253
1279
|
case SSL_ERROR_WANT_WRITE: {
|
|
1254
|
-
BIO *bio = SSL_get_wbio(
|
|
1280
|
+
BIO *bio = SSL_get_wbio(ssl_impl);
|
|
1255
1281
|
if (BIO_should_write(bio)) {
|
|
1256
1282
|
return SSL_ERROR_WANT_WRITE;
|
|
1257
1283
|
}
|
|
@@ -1319,78 +1345,98 @@ const char *SSL_error_description(int err) {
|
|
|
1319
1345
|
}
|
|
1320
1346
|
|
|
1321
1347
|
uint32_t SSL_CTX_set_options(SSL_CTX *ctx, uint32_t options) {
|
|
1322
|
-
|
|
1323
|
-
|
|
1348
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1349
|
+
ctx_impl->options |= options;
|
|
1350
|
+
return ctx_impl->options;
|
|
1324
1351
|
}
|
|
1325
1352
|
|
|
1326
1353
|
uint32_t SSL_CTX_clear_options(SSL_CTX *ctx, uint32_t options) {
|
|
1327
|
-
|
|
1328
|
-
|
|
1354
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1355
|
+
ctx_impl->options &= ~options;
|
|
1356
|
+
return ctx_impl->options;
|
|
1329
1357
|
}
|
|
1330
1358
|
|
|
1331
|
-
uint32_t SSL_CTX_get_options(const SSL_CTX *ctx) {
|
|
1359
|
+
uint32_t SSL_CTX_get_options(const SSL_CTX *ctx) {
|
|
1360
|
+
return FromOpaque(ctx)->options;
|
|
1361
|
+
}
|
|
1332
1362
|
|
|
1333
1363
|
uint32_t SSL_set_options(SSL *ssl, uint32_t options) {
|
|
1334
|
-
|
|
1335
|
-
|
|
1364
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1365
|
+
ssl_impl->options |= options;
|
|
1366
|
+
return ssl_impl->options;
|
|
1336
1367
|
}
|
|
1337
1368
|
|
|
1338
1369
|
uint32_t SSL_clear_options(SSL *ssl, uint32_t options) {
|
|
1339
|
-
|
|
1340
|
-
|
|
1370
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1371
|
+
ssl_impl->options &= ~options;
|
|
1372
|
+
return ssl_impl->options;
|
|
1341
1373
|
}
|
|
1342
1374
|
|
|
1343
|
-
uint32_t SSL_get_options(const SSL *ssl) { return ssl->options; }
|
|
1375
|
+
uint32_t SSL_get_options(const SSL *ssl) { return FromOpaque(ssl)->options; }
|
|
1344
1376
|
|
|
1345
1377
|
uint32_t SSL_CTX_set_mode(SSL_CTX *ctx, uint32_t mode) {
|
|
1346
|
-
|
|
1347
|
-
|
|
1378
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1379
|
+
ctx_impl->mode |= mode;
|
|
1380
|
+
return ctx_impl->mode;
|
|
1348
1381
|
}
|
|
1349
1382
|
|
|
1350
1383
|
uint32_t SSL_CTX_clear_mode(SSL_CTX *ctx, uint32_t mode) {
|
|
1351
|
-
|
|
1352
|
-
|
|
1384
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1385
|
+
ctx_impl->mode &= ~mode;
|
|
1386
|
+
return ctx_impl->mode;
|
|
1353
1387
|
}
|
|
1354
1388
|
|
|
1355
|
-
uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx) { return ctx->mode; }
|
|
1389
|
+
uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx) { return FromOpaque(ctx)->mode; }
|
|
1356
1390
|
|
|
1357
1391
|
uint32_t SSL_set_mode(SSL *ssl, uint32_t mode) {
|
|
1358
|
-
|
|
1359
|
-
|
|
1392
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1393
|
+
ssl_impl->mode |= mode;
|
|
1394
|
+
return ssl_impl->mode;
|
|
1360
1395
|
}
|
|
1361
1396
|
|
|
1362
1397
|
uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode) {
|
|
1363
|
-
|
|
1364
|
-
|
|
1398
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1399
|
+
ssl_impl->mode &= ~mode;
|
|
1400
|
+
return ssl_impl->mode;
|
|
1365
1401
|
}
|
|
1366
1402
|
|
|
1367
|
-
uint32_t SSL_get_mode(const SSL *ssl) { return ssl->mode; }
|
|
1403
|
+
uint32_t SSL_get_mode(const SSL *ssl) { return FromOpaque(ssl)->mode; }
|
|
1404
|
+
|
|
1405
|
+
void SSL_CTX_set1_buffer_pool(SSL_CTX *ctx, CRYPTO_BUFFER_POOL *pool) {
|
|
1406
|
+
FromOpaque(ctx)->pool = UpRef(pool);
|
|
1407
|
+
}
|
|
1368
1408
|
|
|
1369
1409
|
void SSL_CTX_set0_buffer_pool(SSL_CTX *ctx, CRYPTO_BUFFER_POOL *pool) {
|
|
1370
|
-
|
|
1410
|
+
// Historically, `CRYPTO_BUFFER_POOL` was not reference-counted and this
|
|
1411
|
+
// function saved a non-owning pointer, expecting the caller to maintain a
|
|
1412
|
+
// lifetime relationship between the two objects. Now that pools are
|
|
1413
|
+
// reference-counted, the compatible behavior is to treat it as set0 rather
|
|
1414
|
+
// than ownership-transfering.
|
|
1415
|
+
return SSL_CTX_set1_buffer_pool(ctx, pool);
|
|
1371
1416
|
}
|
|
1372
1417
|
|
|
1373
1418
|
int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, size_t *out_len,
|
|
1374
1419
|
size_t max_out) {
|
|
1420
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1375
1421
|
*out_len = 0;
|
|
1376
1422
|
OPENSSL_memset(out, 0, max_out);
|
|
1377
1423
|
|
|
1378
1424
|
// tls-unique is not defined for TLS 1.3.
|
|
1379
|
-
if (!
|
|
1380
|
-
ssl_protocol_version(
|
|
1425
|
+
if (!ssl_impl->s3->initial_handshake_complete ||
|
|
1426
|
+
ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION) {
|
|
1381
1427
|
return 0;
|
|
1382
1428
|
}
|
|
1383
1429
|
|
|
1384
1430
|
// The tls-unique value is the first Finished message in the handshake, which
|
|
1385
1431
|
// is the client's in a full handshake and the server's for a resumption. See
|
|
1386
1432
|
// https://tools.ietf.org/html/rfc5929#section-3.1.
|
|
1387
|
-
Span<const uint8_t> finished =
|
|
1388
|
-
if (
|
|
1433
|
+
Span<const uint8_t> finished = ssl_impl->s3->previous_client_finished;
|
|
1434
|
+
if (ssl_impl->session != nullptr) {
|
|
1389
1435
|
// tls-unique is broken for resumed sessions unless EMS is used.
|
|
1390
|
-
if (!
|
|
1436
|
+
if (!ssl_impl->session->extended_master_secret) {
|
|
1391
1437
|
return 0;
|
|
1392
1438
|
}
|
|
1393
|
-
finished =
|
|
1439
|
+
finished = ssl_impl->s3->previous_server_finished;
|
|
1394
1440
|
}
|
|
1395
1441
|
|
|
1396
1442
|
*out_len = finished.size();
|
|
@@ -1414,25 +1460,29 @@ static int set_session_id_context(CERT *cert, const uint8_t *sid_ctx,
|
|
|
1414
1460
|
|
|
1415
1461
|
int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const uint8_t *sid_ctx,
|
|
1416
1462
|
size_t sid_ctx_len) {
|
|
1417
|
-
return set_session_id_context(ctx->cert.get(), sid_ctx,
|
|
1463
|
+
return set_session_id_context(FromOpaque(ctx)->cert.get(), sid_ctx,
|
|
1464
|
+
sid_ctx_len);
|
|
1418
1465
|
}
|
|
1419
1466
|
|
|
1420
1467
|
int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
|
|
1421
1468
|
size_t sid_ctx_len) {
|
|
1422
|
-
|
|
1469
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1470
|
+
if (!ssl_impl->config) {
|
|
1423
1471
|
return 0;
|
|
1424
1472
|
}
|
|
1425
|
-
return set_session_id_context(
|
|
1473
|
+
return set_session_id_context(ssl_impl->config->cert.get(), sid_ctx,
|
|
1474
|
+
sid_ctx_len);
|
|
1426
1475
|
}
|
|
1427
1476
|
|
|
1428
1477
|
const uint8_t *SSL_get0_session_id_context(const SSL *ssl, size_t *out_len) {
|
|
1429
|
-
|
|
1430
|
-
|
|
1478
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1479
|
+
if (!ssl_impl->config) {
|
|
1480
|
+
assert(ssl_impl->config);
|
|
1431
1481
|
*out_len = 0;
|
|
1432
|
-
return
|
|
1482
|
+
return nullptr;
|
|
1433
1483
|
}
|
|
1434
|
-
*out_len =
|
|
1435
|
-
return
|
|
1484
|
+
*out_len = ssl_impl->config->cert->sid_ctx.size();
|
|
1485
|
+
return ssl_impl->config->cert->sid_ctx.data();
|
|
1436
1486
|
}
|
|
1437
1487
|
|
|
1438
1488
|
int SSL_get_fd(const SSL *ssl) { return SSL_get_rfd(ssl); }
|
|
@@ -1440,7 +1490,7 @@ int SSL_get_fd(const SSL *ssl) { return SSL_get_rfd(ssl); }
|
|
|
1440
1490
|
int SSL_get_rfd(const SSL *ssl) {
|
|
1441
1491
|
int ret = -1;
|
|
1442
1492
|
BIO *b = BIO_find_type(SSL_get_rbio(ssl), BIO_TYPE_DESCRIPTOR);
|
|
1443
|
-
if (b !=
|
|
1493
|
+
if (b != nullptr) {
|
|
1444
1494
|
BIO_get_fd(b, &ret);
|
|
1445
1495
|
}
|
|
1446
1496
|
return ret;
|
|
@@ -1449,7 +1499,7 @@ int SSL_get_rfd(const SSL *ssl) {
|
|
|
1449
1499
|
int SSL_get_wfd(const SSL *ssl) {
|
|
1450
1500
|
int ret = -1;
|
|
1451
1501
|
BIO *b = BIO_find_type(SSL_get_wbio(ssl), BIO_TYPE_DESCRIPTOR);
|
|
1452
|
-
if (b !=
|
|
1502
|
+
if (b != nullptr) {
|
|
1453
1503
|
BIO_get_fd(b, &ret);
|
|
1454
1504
|
}
|
|
1455
1505
|
return ret;
|
|
@@ -1458,7 +1508,7 @@ int SSL_get_wfd(const SSL *ssl) {
|
|
|
1458
1508
|
#if !defined(OPENSSL_NO_SOCK)
|
|
1459
1509
|
int SSL_set_fd(SSL *ssl, int fd) {
|
|
1460
1510
|
BIO *bio = BIO_new(BIO_s_socket());
|
|
1461
|
-
if (bio ==
|
|
1511
|
+
if (bio == nullptr) {
|
|
1462
1512
|
OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB);
|
|
1463
1513
|
return 0;
|
|
1464
1514
|
}
|
|
@@ -1469,10 +1519,10 @@ int SSL_set_fd(SSL *ssl, int fd) {
|
|
|
1469
1519
|
|
|
1470
1520
|
int SSL_set_wfd(SSL *ssl, int fd) {
|
|
1471
1521
|
BIO *rbio = SSL_get_rbio(ssl);
|
|
1472
|
-
if (rbio ==
|
|
1473
|
-
BIO_get_fd(rbio,
|
|
1522
|
+
if (rbio == nullptr || BIO_method_type(rbio) != BIO_TYPE_SOCKET ||
|
|
1523
|
+
BIO_get_fd(rbio, nullptr) != fd) {
|
|
1474
1524
|
BIO *bio = BIO_new(BIO_s_socket());
|
|
1475
|
-
if (bio ==
|
|
1525
|
+
if (bio == nullptr) {
|
|
1476
1526
|
OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB);
|
|
1477
1527
|
return 0;
|
|
1478
1528
|
}
|
|
@@ -1489,10 +1539,10 @@ int SSL_set_wfd(SSL *ssl, int fd) {
|
|
|
1489
1539
|
|
|
1490
1540
|
int SSL_set_rfd(SSL *ssl, int fd) {
|
|
1491
1541
|
BIO *wbio = SSL_get_wbio(ssl);
|
|
1492
|
-
if (wbio ==
|
|
1493
|
-
BIO_get_fd(wbio,
|
|
1542
|
+
if (wbio == nullptr || BIO_method_type(wbio) != BIO_TYPE_SOCKET ||
|
|
1543
|
+
BIO_get_fd(wbio, nullptr) != fd) {
|
|
1494
1544
|
BIO *bio = BIO_new(BIO_s_socket());
|
|
1495
|
-
if (bio ==
|
|
1545
|
+
if (bio == nullptr) {
|
|
1496
1546
|
OPENSSL_PUT_ERROR(SSL, ERR_R_BUF_LIB);
|
|
1497
1547
|
return 0;
|
|
1498
1548
|
}
|
|
@@ -1516,57 +1566,61 @@ static size_t copy_finished(void *out, size_t out_len, Span<const uint8_t> in) {
|
|
|
1516
1566
|
}
|
|
1517
1567
|
|
|
1518
1568
|
size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count) {
|
|
1519
|
-
|
|
1520
|
-
|
|
1569
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1570
|
+
if (!ssl_impl->s3->initial_handshake_complete ||
|
|
1571
|
+
ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION) {
|
|
1521
1572
|
return 0;
|
|
1522
1573
|
}
|
|
1523
1574
|
|
|
1524
|
-
if (
|
|
1525
|
-
return copy_finished(buf, count,
|
|
1575
|
+
if (ssl_impl->server) {
|
|
1576
|
+
return copy_finished(buf, count, ssl_impl->s3->previous_server_finished);
|
|
1526
1577
|
}
|
|
1527
1578
|
|
|
1528
|
-
return copy_finished(buf, count,
|
|
1579
|
+
return copy_finished(buf, count, ssl_impl->s3->previous_client_finished);
|
|
1529
1580
|
}
|
|
1530
1581
|
|
|
1531
1582
|
size_t SSL_get_peer_finished(const SSL *ssl, void *buf, size_t count) {
|
|
1532
|
-
|
|
1533
|
-
|
|
1583
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1584
|
+
if (!ssl_impl->s3->initial_handshake_complete ||
|
|
1585
|
+
ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION) {
|
|
1534
1586
|
return 0;
|
|
1535
1587
|
}
|
|
1536
1588
|
|
|
1537
|
-
if (
|
|
1538
|
-
return copy_finished(buf, count,
|
|
1589
|
+
if (ssl_impl->server) {
|
|
1590
|
+
return copy_finished(buf, count, ssl_impl->s3->previous_client_finished);
|
|
1539
1591
|
}
|
|
1540
1592
|
|
|
1541
|
-
return copy_finished(buf, count,
|
|
1593
|
+
return copy_finished(buf, count, ssl_impl->s3->previous_server_finished);
|
|
1542
1594
|
}
|
|
1543
1595
|
|
|
1544
1596
|
int SSL_get_verify_mode(const SSL *ssl) {
|
|
1545
|
-
|
|
1546
|
-
|
|
1597
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1598
|
+
if (!ssl_impl->config) {
|
|
1599
|
+
assert(ssl_impl->config);
|
|
1547
1600
|
return -1;
|
|
1548
1601
|
}
|
|
1549
|
-
return
|
|
1602
|
+
return ssl_impl->config->verify_mode;
|
|
1550
1603
|
}
|
|
1551
1604
|
|
|
1552
1605
|
int SSL_get_extms_support(const SSL *ssl) {
|
|
1606
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1553
1607
|
// TLS 1.3 does not require extended master secret and always reports as
|
|
1554
1608
|
// supporting it.
|
|
1555
|
-
if (
|
|
1609
|
+
if (ssl_impl->s3->version == 0) {
|
|
1556
1610
|
return 0;
|
|
1557
1611
|
}
|
|
1558
|
-
if (ssl_protocol_version(
|
|
1612
|
+
if (ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION) {
|
|
1559
1613
|
return 1;
|
|
1560
1614
|
}
|
|
1561
1615
|
|
|
1562
1616
|
// If the initial handshake completed, query the established session.
|
|
1563
|
-
if (
|
|
1564
|
-
return
|
|
1617
|
+
if (ssl_impl->s3->established_session != nullptr) {
|
|
1618
|
+
return ssl_impl->s3->established_session->extended_master_secret;
|
|
1565
1619
|
}
|
|
1566
1620
|
|
|
1567
1621
|
// Otherwise, query the in-progress handshake.
|
|
1568
|
-
if (
|
|
1569
|
-
return
|
|
1622
|
+
if (ssl_impl->s3->hs != nullptr) {
|
|
1623
|
+
return ssl_impl->s3->hs->extended_master_secret;
|
|
1570
1624
|
}
|
|
1571
1625
|
assert(0);
|
|
1572
1626
|
return 0;
|
|
@@ -1581,15 +1635,15 @@ int SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes) { return 1; }
|
|
|
1581
1635
|
int SSL_set_read_ahead(SSL *ssl, int yes) { return 1; }
|
|
1582
1636
|
|
|
1583
1637
|
int SSL_pending(const SSL *ssl) {
|
|
1584
|
-
return static_cast<int>(ssl->s3->pending_app_data.size());
|
|
1638
|
+
return static_cast<int>(FromOpaque(ssl)->s3->pending_app_data.size());
|
|
1585
1639
|
}
|
|
1586
1640
|
|
|
1587
1641
|
int SSL_has_pending(const SSL *ssl) {
|
|
1588
|
-
return SSL_pending(ssl) != 0 || !ssl->s3->read_buffer.empty();
|
|
1642
|
+
return SSL_pending(ssl) != 0 || !FromOpaque(ssl)->s3->read_buffer.empty();
|
|
1589
1643
|
}
|
|
1590
1644
|
|
|
1591
|
-
static bool has_cert_and_key(const
|
|
1592
|
-
// TODO(davidben): If
|
|
1645
|
+
static bool has_cert_and_key(const SSLCredential *cred) {
|
|
1646
|
+
// TODO(davidben): If `cred->key_method` is set, that should be fine too.
|
|
1593
1647
|
if (cred->privkey == nullptr) {
|
|
1594
1648
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED);
|
|
1595
1649
|
return false;
|
|
@@ -1607,17 +1661,18 @@ static bool has_cert_and_key(const SSL_CREDENTIAL *cred) {
|
|
|
1607
1661
|
int SSL_CTX_check_private_key(const SSL_CTX *ctx) {
|
|
1608
1662
|
// There is no need to actually check consistency because inconsistent values
|
|
1609
1663
|
// can never be configured.
|
|
1610
|
-
return has_cert_and_key(ctx->cert->legacy_credential.get());
|
|
1664
|
+
return has_cert_and_key(FromOpaque(ctx)->cert->legacy_credential.get());
|
|
1611
1665
|
}
|
|
1612
1666
|
|
|
1613
1667
|
int SSL_check_private_key(const SSL *ssl) {
|
|
1614
|
-
|
|
1668
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1669
|
+
if (!ssl_impl->config) {
|
|
1615
1670
|
return 0;
|
|
1616
1671
|
}
|
|
1617
1672
|
|
|
1618
1673
|
// There is no need to actually check consistency because inconsistent values
|
|
1619
1674
|
// can never be configured.
|
|
1620
|
-
return has_cert_and_key(
|
|
1675
|
+
return has_cert_and_key(ssl_impl->config->cert->legacy_credential.get());
|
|
1621
1676
|
}
|
|
1622
1677
|
|
|
1623
1678
|
long SSL_get_default_timeout(const SSL *ssl) {
|
|
@@ -1625,71 +1680,74 @@ long SSL_get_default_timeout(const SSL *ssl) {
|
|
|
1625
1680
|
}
|
|
1626
1681
|
|
|
1627
1682
|
int SSL_renegotiate(SSL *ssl) {
|
|
1683
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1628
1684
|
// Caller-initiated renegotiation is not supported.
|
|
1629
|
-
if (!
|
|
1685
|
+
if (!ssl_impl->s3->renegotiate_pending) {
|
|
1630
1686
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
1631
1687
|
return 0;
|
|
1632
1688
|
}
|
|
1633
1689
|
|
|
1634
|
-
if (!ssl_can_renegotiate(
|
|
1690
|
+
if (!ssl_can_renegotiate(ssl_impl)) {
|
|
1635
1691
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_RENEGOTIATION);
|
|
1636
1692
|
return 0;
|
|
1637
1693
|
}
|
|
1638
1694
|
|
|
1639
1695
|
// We should not have told the caller to release the private key.
|
|
1640
|
-
assert(!SSL_can_release_private_key(
|
|
1696
|
+
assert(!SSL_can_release_private_key(ssl_impl));
|
|
1641
1697
|
|
|
1642
1698
|
// Renegotiation is only supported at quiescent points in the application
|
|
1643
1699
|
// protocol, namely in HTTPS, just before reading the HTTP response.
|
|
1644
1700
|
// Require the record-layer be idle and avoid complexities of sending a
|
|
1645
1701
|
// handshake record while an application_data record is being written.
|
|
1646
|
-
if (!
|
|
1647
|
-
|
|
1702
|
+
if (!ssl_impl->s3->write_buffer.empty() ||
|
|
1703
|
+
ssl_impl->s3->write_shutdown != ssl_shutdown_none) {
|
|
1648
1704
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_RENEGOTIATION);
|
|
1649
1705
|
return 0;
|
|
1650
1706
|
}
|
|
1651
1707
|
|
|
1652
1708
|
// Begin a new handshake.
|
|
1653
|
-
if (
|
|
1709
|
+
if (ssl_impl->s3->hs != nullptr) {
|
|
1654
1710
|
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
|
1655
1711
|
return 0;
|
|
1656
1712
|
}
|
|
1657
|
-
|
|
1658
|
-
if (
|
|
1713
|
+
ssl_impl->s3->hs = ssl_handshake_new(ssl_impl);
|
|
1714
|
+
if (ssl_impl->s3->hs == nullptr) {
|
|
1659
1715
|
return 0;
|
|
1660
1716
|
}
|
|
1661
1717
|
|
|
1662
|
-
|
|
1663
|
-
|
|
1718
|
+
ssl_impl->s3->renegotiate_pending = false;
|
|
1719
|
+
ssl_impl->s3->total_renegotiations++;
|
|
1664
1720
|
return 1;
|
|
1665
1721
|
}
|
|
1666
1722
|
|
|
1667
1723
|
int SSL_renegotiate_pending(SSL *ssl) {
|
|
1668
|
-
return SSL_in_init(ssl) && ssl->s3->initial_handshake_complete;
|
|
1724
|
+
return SSL_in_init(ssl) && FromOpaque(ssl)->s3->initial_handshake_complete;
|
|
1669
1725
|
}
|
|
1670
1726
|
|
|
1671
1727
|
int SSL_total_renegotiations(const SSL *ssl) {
|
|
1672
|
-
return ssl->s3->total_renegotiations;
|
|
1728
|
+
return FromOpaque(ssl)->s3->total_renegotiations;
|
|
1673
1729
|
}
|
|
1674
1730
|
|
|
1675
1731
|
size_t SSL_CTX_get_max_cert_list(const SSL_CTX *ctx) {
|
|
1676
|
-
return ctx->max_cert_list;
|
|
1732
|
+
return FromOpaque(ctx)->max_cert_list;
|
|
1677
1733
|
}
|
|
1678
1734
|
|
|
1679
1735
|
void SSL_CTX_set_max_cert_list(SSL_CTX *ctx, size_t max_cert_list) {
|
|
1680
1736
|
if (max_cert_list > kMaxHandshakeSize) {
|
|
1681
1737
|
max_cert_list = kMaxHandshakeSize;
|
|
1682
1738
|
}
|
|
1683
|
-
ctx->max_cert_list = (uint32_t)max_cert_list;
|
|
1739
|
+
FromOpaque(ctx)->max_cert_list = (uint32_t)max_cert_list;
|
|
1684
1740
|
}
|
|
1685
1741
|
|
|
1686
|
-
size_t SSL_get_max_cert_list(const SSL *ssl) {
|
|
1742
|
+
size_t SSL_get_max_cert_list(const SSL *ssl) {
|
|
1743
|
+
return FromOpaque(ssl)->max_cert_list;
|
|
1744
|
+
}
|
|
1687
1745
|
|
|
1688
1746
|
void SSL_set_max_cert_list(SSL *ssl, size_t max_cert_list) {
|
|
1689
1747
|
if (max_cert_list > kMaxHandshakeSize) {
|
|
1690
1748
|
max_cert_list = kMaxHandshakeSize;
|
|
1691
1749
|
}
|
|
1692
|
-
ssl->max_cert_list = (uint32_t)max_cert_list;
|
|
1750
|
+
FromOpaque(ssl)->max_cert_list = (uint32_t)max_cert_list;
|
|
1693
1751
|
}
|
|
1694
1752
|
|
|
1695
1753
|
int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, size_t max_send_fragment) {
|
|
@@ -1699,7 +1757,7 @@ int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, size_t max_send_fragment) {
|
|
|
1699
1757
|
if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
|
|
1700
1758
|
max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
|
|
1701
1759
|
}
|
|
1702
|
-
ctx->max_send_fragment = (uint16_t)max_send_fragment;
|
|
1760
|
+
FromOpaque(ctx)->max_send_fragment = (uint16_t)max_send_fragment;
|
|
1703
1761
|
|
|
1704
1762
|
return 1;
|
|
1705
1763
|
}
|
|
@@ -1711,7 +1769,7 @@ int SSL_set_max_send_fragment(SSL *ssl, size_t max_send_fragment) {
|
|
|
1711
1769
|
if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
|
|
1712
1770
|
max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
|
|
1713
1771
|
}
|
|
1714
|
-
ssl->max_send_fragment = (uint16_t)max_send_fragment;
|
|
1772
|
+
FromOpaque(ssl)->max_send_fragment = (uint16_t)max_send_fragment;
|
|
1715
1773
|
|
|
1716
1774
|
return 1;
|
|
1717
1775
|
}
|
|
@@ -1720,46 +1778,45 @@ int SSL_set_mtu(SSL *ssl, unsigned mtu) {
|
|
|
1720
1778
|
if (!SSL_is_dtls(ssl) || mtu < dtls1_min_mtu()) {
|
|
1721
1779
|
return 0;
|
|
1722
1780
|
}
|
|
1723
|
-
ssl->d1->mtu = mtu;
|
|
1781
|
+
FromOpaque(ssl)->d1->mtu = mtu;
|
|
1724
1782
|
return 1;
|
|
1725
1783
|
}
|
|
1726
1784
|
|
|
1727
1785
|
int SSL_get_secure_renegotiation_support(const SSL *ssl) {
|
|
1728
|
-
|
|
1786
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1787
|
+
if (ssl_impl->s3->version == 0) {
|
|
1729
1788
|
return 0;
|
|
1730
1789
|
}
|
|
1731
|
-
return ssl_protocol_version(
|
|
1732
|
-
|
|
1790
|
+
return ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION ||
|
|
1791
|
+
ssl_impl->s3->send_connection_binding;
|
|
1733
1792
|
}
|
|
1734
1793
|
|
|
1735
1794
|
size_t SSL_CTX_sess_number(const SSL_CTX *ctx) {
|
|
1736
|
-
|
|
1737
|
-
|
|
1795
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1796
|
+
MutexReadLock lock(&ctx_impl->lock);
|
|
1797
|
+
return lh_SSL_SESSION_num_items(ctx_impl->sessions);
|
|
1738
1798
|
}
|
|
1739
1799
|
|
|
1740
1800
|
unsigned long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, unsigned long size) {
|
|
1741
|
-
|
|
1742
|
-
ctx->session_cache_size = size;
|
|
1743
|
-
return ret;
|
|
1801
|
+
return std::exchange(FromOpaque(ctx)->session_cache_size, size);
|
|
1744
1802
|
}
|
|
1745
1803
|
|
|
1746
1804
|
unsigned long SSL_CTX_sess_get_cache_size(const SSL_CTX *ctx) {
|
|
1747
|
-
return ctx->session_cache_size;
|
|
1805
|
+
return FromOpaque(ctx)->session_cache_size;
|
|
1748
1806
|
}
|
|
1749
1807
|
|
|
1750
1808
|
int SSL_CTX_set_session_cache_mode(SSL_CTX *ctx, int mode) {
|
|
1751
|
-
|
|
1752
|
-
ctx->session_cache_mode = mode;
|
|
1753
|
-
return ret;
|
|
1809
|
+
return std::exchange(FromOpaque(ctx)->session_cache_mode, mode);
|
|
1754
1810
|
}
|
|
1755
1811
|
|
|
1756
1812
|
int SSL_CTX_get_session_cache_mode(const SSL_CTX *ctx) {
|
|
1757
|
-
return ctx->session_cache_mode;
|
|
1813
|
+
return FromOpaque(ctx)->session_cache_mode;
|
|
1758
1814
|
}
|
|
1759
1815
|
|
|
1760
1816
|
|
|
1761
1817
|
int SSL_CTX_get_tlsext_ticket_keys(SSL_CTX *ctx, void *out, size_t len) {
|
|
1762
|
-
|
|
1818
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1819
|
+
if (out == nullptr) {
|
|
1763
1820
|
return 48;
|
|
1764
1821
|
}
|
|
1765
1822
|
if (len != 48) {
|
|
@@ -1769,20 +1826,21 @@ int SSL_CTX_get_tlsext_ticket_keys(SSL_CTX *ctx, void *out, size_t len) {
|
|
|
1769
1826
|
|
|
1770
1827
|
// The default ticket keys are initialized lazily. Trigger a key
|
|
1771
1828
|
// rotation to initialize them.
|
|
1772
|
-
if (!ssl_ctx_rotate_ticket_encryption_key(
|
|
1829
|
+
if (!ssl_ctx_rotate_ticket_encryption_key(ctx_impl)) {
|
|
1773
1830
|
return 0;
|
|
1774
1831
|
}
|
|
1775
1832
|
|
|
1776
1833
|
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,
|
|
1834
|
+
MutexReadLock lock(&ctx_impl->lock);
|
|
1835
|
+
OPENSSL_memcpy(out_bytes, ctx_impl->ticket_key_current->name, 16);
|
|
1836
|
+
OPENSSL_memcpy(out_bytes + 16, ctx_impl->ticket_key_current->hmac_key, 16);
|
|
1837
|
+
OPENSSL_memcpy(out_bytes + 32, ctx_impl->ticket_key_current->aes_key, 16);
|
|
1781
1838
|
return 1;
|
|
1782
1839
|
}
|
|
1783
1840
|
|
|
1784
1841
|
int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in, size_t len) {
|
|
1785
|
-
|
|
1842
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1843
|
+
if (in == nullptr) {
|
|
1786
1844
|
return 48;
|
|
1787
1845
|
}
|
|
1788
1846
|
if (len != 48) {
|
|
@@ -1800,8 +1858,8 @@ int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in, size_t len) {
|
|
|
1800
1858
|
// Disable automatic key rotation for manually-configured keys. This is now
|
|
1801
1859
|
// the caller's responsibility.
|
|
1802
1860
|
key->next_rotation_tv_sec = 0;
|
|
1803
|
-
|
|
1804
|
-
|
|
1861
|
+
ctx_impl->ticket_key_current = std::move(key);
|
|
1862
|
+
ctx_impl->ticket_key_prev.reset();
|
|
1805
1863
|
return 1;
|
|
1806
1864
|
}
|
|
1807
1865
|
|
|
@@ -1809,10 +1867,25 @@ int SSL_CTX_set_tlsext_ticket_key_cb(
|
|
|
1809
1867
|
SSL_CTX *ctx,
|
|
1810
1868
|
int (*callback)(SSL *ssl, uint8_t *key_name, uint8_t *iv,
|
|
1811
1869
|
EVP_CIPHER_CTX *ctx, HMAC_CTX *hmac_ctx, int encrypt)) {
|
|
1812
|
-
ctx->ticket_key_cb = callback;
|
|
1870
|
+
FromOpaque(ctx)->ticket_key_cb = callback;
|
|
1813
1871
|
return 1;
|
|
1814
1872
|
}
|
|
1815
1873
|
|
|
1874
|
+
static bool check_no_duplicates(Span<const uint16_t> list, int reason) {
|
|
1875
|
+
if (list.size() < 2) {
|
|
1876
|
+
return true;
|
|
1877
|
+
}
|
|
1878
|
+
for (size_t i = 0; i < list.size() - 1; ++i) {
|
|
1879
|
+
for (size_t j = i + 1; j < list.size(); ++j) {
|
|
1880
|
+
if (list[i] == list[j]) {
|
|
1881
|
+
OPENSSL_PUT_ERROR(SSL, reason);
|
|
1882
|
+
return false;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
return true;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1816
1889
|
static bool check_group_ids(Span<const uint16_t> group_ids) {
|
|
1817
1890
|
for (uint16_t group_id : group_ids) {
|
|
1818
1891
|
if (ssl_group_id_to_nid(group_id) == NID_undef) {
|
|
@@ -1820,27 +1893,182 @@ static bool check_group_ids(Span<const uint16_t> group_ids) {
|
|
|
1820
1893
|
return false;
|
|
1821
1894
|
}
|
|
1822
1895
|
}
|
|
1823
|
-
return
|
|
1896
|
+
return check_no_duplicates(group_ids, SSL_R_DUPLICATE_GROUP);
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
// validate_key_shares returns whether the `requested_key_shares` are free of
|
|
1900
|
+
// duplicates and are a (correctly ordered) subsequence of the supported
|
|
1901
|
+
// `groups`.
|
|
1902
|
+
static bool validate_key_shares(Span<const uint16_t> requested_key_shares,
|
|
1903
|
+
Span<const uint16_t> groups) {
|
|
1904
|
+
if (!check_no_duplicates(requested_key_shares, SSL_R_DUPLICATE_GROUP)) {
|
|
1905
|
+
return false;
|
|
1906
|
+
}
|
|
1907
|
+
if (requested_key_shares.size() > groups.size()) {
|
|
1908
|
+
return false;
|
|
1909
|
+
}
|
|
1910
|
+
size_t key_shares_idx = 0u, groups_idx = 0u;
|
|
1911
|
+
while (key_shares_idx < requested_key_shares.size() &&
|
|
1912
|
+
groups_idx < groups.size()) {
|
|
1913
|
+
if (requested_key_shares[key_shares_idx] == groups[groups_idx++]) {
|
|
1914
|
+
++key_shares_idx;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
return key_shares_idx == requested_key_shares.size();
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
static void clear_key_shares_if_invalid(SSL_CONFIG *config) {
|
|
1921
|
+
if (!config->client_key_share_selections) {
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
if (!validate_key_shares(*(config->client_key_share_selections),
|
|
1925
|
+
config->supported_group_list)) {
|
|
1926
|
+
config->client_key_share_selections.reset();
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
static bool check_group_flags(Span<const uint32_t> flags) {
|
|
1931
|
+
if (flags.empty()) {
|
|
1932
|
+
return true;
|
|
1933
|
+
}
|
|
1934
|
+
// The last element must not have the "equal preference with next" flag,
|
|
1935
|
+
// because there is no next element.
|
|
1936
|
+
return (flags.back() & SSL_GROUP_FLAG_EQUAL_PREFERENCE_WITH_NEXT) == 0;
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
static bool set_group_ids_and_flags(const uint16_t *group_ids,
|
|
1940
|
+
const uint32_t *flags, size_t num_group_ids,
|
|
1941
|
+
Array<uint16_t> *groups_out,
|
|
1942
|
+
Array<uint32_t> *flags_out) {
|
|
1943
|
+
Span<const uint16_t> groups_span = num_group_ids == 0
|
|
1944
|
+
? DefaultSupportedGroupIds()
|
|
1945
|
+
: Span(group_ids, num_group_ids);
|
|
1946
|
+
if (!check_group_ids(groups_span)) {
|
|
1947
|
+
return false;
|
|
1948
|
+
}
|
|
1949
|
+
// If using default groups, always use default flags.
|
|
1950
|
+
if (flags == nullptr || num_group_ids == 0) {
|
|
1951
|
+
return groups_out->CopyFrom(groups_span) &&
|
|
1952
|
+
flags_out->Init(groups_span.size());
|
|
1953
|
+
}
|
|
1954
|
+
Span<const uint32_t> flags_span = Span(flags, num_group_ids);
|
|
1955
|
+
if (!check_group_flags(flags_span)) {
|
|
1956
|
+
return false;
|
|
1957
|
+
}
|
|
1958
|
+
return groups_out->CopyFrom(groups_span) && flags_out->CopyFrom(flags_span);
|
|
1824
1959
|
}
|
|
1825
1960
|
|
|
1826
1961
|
int SSL_CTX_set1_group_ids(SSL_CTX *ctx, const uint16_t *group_ids,
|
|
1827
1962
|
size_t num_group_ids) {
|
|
1828
|
-
|
|
1829
|
-
|
|
1963
|
+
return SSL_CTX_set1_group_ids_with_flags(ctx, group_ids, /*flags=*/nullptr,
|
|
1964
|
+
num_group_ids);
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
int SSL_CTX_set1_group_ids_with_flags(SSL_CTX *ctx, const uint16_t *group_ids,
|
|
1968
|
+
const uint32_t *flags,
|
|
1969
|
+
size_t num_group_ids) {
|
|
1970
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
1971
|
+
return set_group_ids_and_flags(group_ids, flags, num_group_ids,
|
|
1972
|
+
&ctx_impl->supported_group_list,
|
|
1973
|
+
&ctx_impl->supported_group_list_flags);
|
|
1830
1974
|
}
|
|
1831
1975
|
|
|
1832
1976
|
int SSL_set1_group_ids(SSL *ssl, const uint16_t *group_ids,
|
|
1833
1977
|
size_t num_group_ids) {
|
|
1834
|
-
|
|
1978
|
+
return SSL_set1_group_ids_with_flags(ssl, group_ids, /*flags=*/nullptr,
|
|
1979
|
+
num_group_ids);
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
int SSL_set1_group_ids_with_flags(SSL *ssl, const uint16_t *group_ids,
|
|
1983
|
+
const uint32_t *flags, size_t num_group_ids) {
|
|
1984
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1985
|
+
if (!ssl_impl->config) {
|
|
1986
|
+
return 0;
|
|
1987
|
+
}
|
|
1988
|
+
if (set_group_ids_and_flags(group_ids, flags, num_group_ids,
|
|
1989
|
+
&ssl_impl->config->supported_group_list,
|
|
1990
|
+
&ssl_impl->config->supported_group_list_flags)) {
|
|
1991
|
+
clear_key_shares_if_invalid(ssl_impl->config.get());
|
|
1992
|
+
return 1;
|
|
1993
|
+
}
|
|
1994
|
+
return 0;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
static bool check_tls13_cipher_flags(Span<const uint32_t> flags) {
|
|
1998
|
+
if (flags.empty()) {
|
|
1999
|
+
return true;
|
|
2000
|
+
}
|
|
2001
|
+
// The last element must not have the "equal preference with next" flag,
|
|
2002
|
+
// because there is no next element.
|
|
2003
|
+
if ((flags.back() & SSL_CIPHER_FLAG_EQUAL_PREFERENCE_WITH_NEXT) != 0) {
|
|
2004
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_CIPHER_FLAGS);
|
|
2005
|
+
return false;
|
|
2006
|
+
}
|
|
2007
|
+
return true;
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
static bool check_tls13_cipher_ids(Span<const uint16_t> cipher_ids) {
|
|
2011
|
+
for (uint16_t cipher_id : cipher_ids) {
|
|
2012
|
+
const SSL_CIPHER *cipher = SSL_get_cipher_by_value(cipher_id);
|
|
2013
|
+
if (cipher == nullptr ||
|
|
2014
|
+
SSL_CIPHER_get_min_version(cipher) != TLS1_3_VERSION) {
|
|
2015
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_UNKNOWN_CIPHER_TYPE);
|
|
2016
|
+
return false;
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
return check_no_duplicates(cipher_ids, SSL_R_DUPLICATE_CIPHER);
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
static bool set_tls13_ciphers(const uint16_t *cipher_ids, const uint32_t *flags,
|
|
2023
|
+
size_t num_cipher_ids,
|
|
2024
|
+
SSLCipherPreferenceList *out) {
|
|
2025
|
+
if (num_cipher_ids == 0) {
|
|
2026
|
+
return ssl_create_default_tls13_cipher_list(out);
|
|
2027
|
+
}
|
|
2028
|
+
Span<const uint16_t> ciphers_span(cipher_ids, num_cipher_ids);
|
|
2029
|
+
if (!check_tls13_cipher_ids(ciphers_span)) {
|
|
2030
|
+
return false;
|
|
2031
|
+
}
|
|
2032
|
+
Array<bool> in_group_flags;
|
|
2033
|
+
if (!in_group_flags.Init(num_cipher_ids)) {
|
|
2034
|
+
return false;
|
|
2035
|
+
}
|
|
2036
|
+
if (flags == nullptr) {
|
|
2037
|
+
return out->Init(ciphers_span, in_group_flags);
|
|
2038
|
+
}
|
|
2039
|
+
Span<const uint32_t> flags_span = Span(flags, num_cipher_ids);
|
|
2040
|
+
if (!check_tls13_cipher_flags(flags_span)) {
|
|
2041
|
+
return false;
|
|
2042
|
+
}
|
|
2043
|
+
for (size_t i = 0; i < flags_span.size(); ++i) {
|
|
2044
|
+
in_group_flags[i] =
|
|
2045
|
+
(flags_span[i] & SSL_CIPHER_FLAG_EQUAL_PREFERENCE_WITH_NEXT) != 0;
|
|
2046
|
+
}
|
|
2047
|
+
return out->Init(ciphers_span, in_group_flags);
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
int SSL_CTX_set1_tls13_ciphers(SSL_CTX *ctx, const uint16_t *cipher_ids,
|
|
2051
|
+
const uint32_t *flags, size_t num_cipher_ids) {
|
|
2052
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2053
|
+
return set_tls13_ciphers(cipher_ids, flags, num_cipher_ids,
|
|
2054
|
+
&ctx_impl->tls13_cipher_list);
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
int SSL_set1_tls13_ciphers(SSL *ssl, const uint16_t *cipher_ids,
|
|
2058
|
+
const uint32_t *flags, size_t num_cipher_ids) {
|
|
2059
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2060
|
+
if (!ssl_impl->config) {
|
|
1835
2061
|
return 0;
|
|
1836
2062
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
ssl->config->supported_group_list.CopyFrom(span);
|
|
2063
|
+
return set_tls13_ciphers(cipher_ids, flags, num_cipher_ids,
|
|
2064
|
+
&ssl_impl->config->tls13_cipher_list);
|
|
1840
2065
|
}
|
|
1841
2066
|
|
|
1842
2067
|
static bool ssl_nids_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
1843
2068
|
Span<const int> nids) {
|
|
2069
|
+
if (nids.empty()) {
|
|
2070
|
+
return out_group_ids->CopyFrom(DefaultSupportedGroupIds());
|
|
2071
|
+
}
|
|
1844
2072
|
Array<uint16_t> group_ids;
|
|
1845
2073
|
if (!group_ids.InitForOverwrite(nids.size())) {
|
|
1846
2074
|
return false;
|
|
@@ -1852,22 +2080,35 @@ static bool ssl_nids_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
|
1852
2080
|
return false;
|
|
1853
2081
|
}
|
|
1854
2082
|
}
|
|
2083
|
+
if (!check_no_duplicates(group_ids, SSL_R_DUPLICATE_GROUP)) {
|
|
2084
|
+
return false;
|
|
2085
|
+
}
|
|
1855
2086
|
|
|
1856
2087
|
*out_group_ids = std::move(group_ids);
|
|
1857
2088
|
return true;
|
|
1858
2089
|
}
|
|
1859
2090
|
|
|
1860
2091
|
int SSL_CTX_set1_groups(SSL_CTX *ctx, const int *groups, size_t num_groups) {
|
|
1861
|
-
|
|
1862
|
-
|
|
2092
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2093
|
+
return ssl_nids_to_group_ids(&ctx_impl->supported_group_list,
|
|
2094
|
+
Span(groups, num_groups)) &&
|
|
2095
|
+
ctx_impl->supported_group_list_flags.Init(
|
|
2096
|
+
ctx_impl->supported_group_list.size());
|
|
1863
2097
|
}
|
|
1864
2098
|
|
|
1865
2099
|
int SSL_set1_groups(SSL *ssl, const int *groups, size_t num_groups) {
|
|
1866
|
-
|
|
2100
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2101
|
+
if (!ssl_impl->config) {
|
|
1867
2102
|
return 0;
|
|
1868
2103
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
2104
|
+
if (ssl_nids_to_group_ids(&ssl_impl->config->supported_group_list,
|
|
2105
|
+
Span(groups, num_groups)) &&
|
|
2106
|
+
ssl_impl->config->supported_group_list_flags.Init(
|
|
2107
|
+
ssl_impl->config->supported_group_list.size())) {
|
|
2108
|
+
clear_key_shares_if_invalid(ssl_impl->config.get());
|
|
2109
|
+
return 1;
|
|
2110
|
+
}
|
|
2111
|
+
return 0;
|
|
1871
2112
|
}
|
|
1872
2113
|
|
|
1873
2114
|
static bool ssl_str_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
@@ -1903,24 +2144,37 @@ static bool ssl_str_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
|
1903
2144
|
} while (col);
|
|
1904
2145
|
|
|
1905
2146
|
assert(i == count);
|
|
2147
|
+
if (!check_no_duplicates(group_ids, SSL_R_DUPLICATE_GROUP)) {
|
|
2148
|
+
return false;
|
|
2149
|
+
}
|
|
1906
2150
|
*out_group_ids = std::move(group_ids);
|
|
1907
2151
|
return true;
|
|
1908
2152
|
}
|
|
1909
2153
|
|
|
1910
2154
|
int SSL_CTX_set1_groups_list(SSL_CTX *ctx, const char *groups) {
|
|
1911
|
-
|
|
2155
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2156
|
+
return ssl_str_to_group_ids(&ctx_impl->supported_group_list, groups) &&
|
|
2157
|
+
ctx_impl->supported_group_list_flags.Init(
|
|
2158
|
+
ctx_impl->supported_group_list.size());
|
|
1912
2159
|
}
|
|
1913
2160
|
|
|
1914
2161
|
int SSL_set1_groups_list(SSL *ssl, const char *groups) {
|
|
1915
|
-
|
|
2162
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2163
|
+
if (!ssl_impl->config) {
|
|
1916
2164
|
return 0;
|
|
1917
2165
|
}
|
|
1918
|
-
|
|
2166
|
+
if (ssl_str_to_group_ids(&ssl_impl->config->supported_group_list, groups) &&
|
|
2167
|
+
ssl_impl->config->supported_group_list_flags.Init(
|
|
2168
|
+
ssl_impl->config->supported_group_list.size())) {
|
|
2169
|
+
clear_key_shares_if_invalid(ssl_impl->config.get());
|
|
2170
|
+
return 1;
|
|
2171
|
+
}
|
|
2172
|
+
return 0;
|
|
1919
2173
|
}
|
|
1920
2174
|
|
|
1921
2175
|
uint16_t SSL_get_group_id(const SSL *ssl) {
|
|
1922
|
-
|
|
1923
|
-
if (session ==
|
|
2176
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2177
|
+
if (session == nullptr) {
|
|
1924
2178
|
return 0;
|
|
1925
2179
|
}
|
|
1926
2180
|
|
|
@@ -1935,104 +2189,131 @@ int SSL_get_negotiated_group(const SSL *ssl) {
|
|
|
1935
2189
|
return ssl_group_id_to_nid(group_id);
|
|
1936
2190
|
}
|
|
1937
2191
|
|
|
2192
|
+
int SSL_set1_client_key_shares(SSL *ssl, const uint16_t *group_ids,
|
|
2193
|
+
size_t num_group_ids) {
|
|
2194
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2195
|
+
if (!ssl_impl->config) {
|
|
2196
|
+
return 0;
|
|
2197
|
+
}
|
|
2198
|
+
auto requested_key_shares = Span(group_ids, num_group_ids);
|
|
2199
|
+
if (!validate_key_shares(requested_key_shares,
|
|
2200
|
+
ssl_impl->config->supported_group_list)) {
|
|
2201
|
+
return 0;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
assert(requested_key_shares.size() <= kNumNamedGroups);
|
|
2205
|
+
ssl_impl->config->client_key_share_selections.emplace();
|
|
2206
|
+
ssl_impl->config->client_key_share_selections->CopyFrom(requested_key_shares);
|
|
2207
|
+
return 1;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
int SSL_set1_server_supported_groups_hint(SSL *ssl,
|
|
2211
|
+
const uint16_t *server_groups,
|
|
2212
|
+
size_t num_server_groups) {
|
|
2213
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2214
|
+
if (!ssl_impl->config) {
|
|
2215
|
+
return 0;
|
|
2216
|
+
}
|
|
2217
|
+
auto span = Span(server_groups, num_server_groups);
|
|
2218
|
+
return ssl_impl->config->server_supported_groups_hint.CopyFrom(span);
|
|
2219
|
+
}
|
|
2220
|
+
|
|
1938
2221
|
int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh) { return 1; }
|
|
1939
2222
|
|
|
1940
2223
|
int SSL_set_tmp_dh(SSL *ssl, const DH *dh) { return 1; }
|
|
1941
2224
|
|
|
1942
2225
|
STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx) {
|
|
1943
|
-
return ctx->cipher_list->ciphers
|
|
2226
|
+
return FromOpaque(ctx)->cipher_list->ciphers();
|
|
1944
2227
|
}
|
|
1945
2228
|
|
|
1946
2229
|
int SSL_CTX_cipher_in_group(const SSL_CTX *ctx, size_t i) {
|
|
1947
|
-
|
|
2230
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2231
|
+
if (i >= sk_SSL_CIPHER_num(ctx_impl->cipher_list->ciphers())) {
|
|
1948
2232
|
return 0;
|
|
1949
2233
|
}
|
|
1950
|
-
return
|
|
2234
|
+
return ctx_impl->cipher_list->in_group_flags()[i];
|
|
1951
2235
|
}
|
|
1952
2236
|
|
|
1953
2237
|
STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl) {
|
|
1954
|
-
if (ssl ==
|
|
1955
|
-
return
|
|
2238
|
+
if (ssl == nullptr) {
|
|
2239
|
+
return nullptr;
|
|
1956
2240
|
}
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
2241
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2242
|
+
if (ssl_impl->config == nullptr) {
|
|
2243
|
+
assert(ssl_impl->config);
|
|
2244
|
+
return nullptr;
|
|
1960
2245
|
}
|
|
1961
2246
|
|
|
1962
|
-
return
|
|
1963
|
-
|
|
2247
|
+
return ssl_impl->config->cipher_list
|
|
2248
|
+
? ssl_impl->config->cipher_list->ciphers()
|
|
2249
|
+
: ssl_impl->ctx->cipher_list->ciphers();
|
|
1964
2250
|
}
|
|
1965
2251
|
|
|
1966
2252
|
const char *SSL_get_cipher_list(const SSL *ssl, int n) {
|
|
1967
|
-
if (ssl ==
|
|
1968
|
-
return
|
|
2253
|
+
if (ssl == nullptr) {
|
|
2254
|
+
return nullptr;
|
|
1969
2255
|
}
|
|
1970
2256
|
|
|
1971
|
-
STACK_OF(SSL_CIPHER) *sk = SSL_get_ciphers(ssl);
|
|
1972
|
-
if (sk ==
|
|
1973
|
-
|
|
2257
|
+
const STACK_OF(SSL_CIPHER) *sk = SSL_get_ciphers(ssl);
|
|
2258
|
+
if (sk == nullptr || n < 0 ||
|
|
2259
|
+
static_cast<size_t>(n) >= sk_SSL_CIPHER_num(sk)) {
|
|
2260
|
+
return nullptr;
|
|
1974
2261
|
}
|
|
1975
2262
|
|
|
1976
2263
|
const SSL_CIPHER *c = sk_SSL_CIPHER_value(sk, n);
|
|
1977
|
-
if (c ==
|
|
1978
|
-
return
|
|
2264
|
+
if (c == nullptr) {
|
|
2265
|
+
return nullptr;
|
|
1979
2266
|
}
|
|
1980
2267
|
|
|
1981
2268
|
return c->name;
|
|
1982
2269
|
}
|
|
1983
2270
|
|
|
1984
2271
|
int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
return ssl_create_cipher_list(&ctx->cipher_list, has_aes_hw, str,
|
|
2272
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2273
|
+
return ssl_create_cipher_list(&ctx_impl->cipher_list, str,
|
|
1988
2274
|
false /* not strict */);
|
|
1989
2275
|
}
|
|
1990
2276
|
|
|
1991
2277
|
int SSL_CTX_set_strict_cipher_list(SSL_CTX *ctx, const char *str) {
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
return ssl_create_cipher_list(&ctx->cipher_list, has_aes_hw, str,
|
|
1995
|
-
true /* strict */);
|
|
2278
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2279
|
+
return ssl_create_cipher_list(&ctx_impl->cipher_list, str, true /* strict */);
|
|
1996
2280
|
}
|
|
1997
2281
|
|
|
1998
2282
|
int SSL_set_cipher_list(SSL *ssl, const char *str) {
|
|
1999
|
-
|
|
2283
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2284
|
+
if (!ssl_impl->config) {
|
|
2000
2285
|
return 0;
|
|
2001
2286
|
}
|
|
2002
|
-
|
|
2003
|
-
? ssl->config->aes_hw_override_value
|
|
2004
|
-
: EVP_has_aes_hardware();
|
|
2005
|
-
return ssl_create_cipher_list(&ssl->config->cipher_list, has_aes_hw, str,
|
|
2287
|
+
return ssl_create_cipher_list(&ssl_impl->config->cipher_list, str,
|
|
2006
2288
|
false /* not strict */);
|
|
2007
2289
|
}
|
|
2008
2290
|
|
|
2009
2291
|
int SSL_set_strict_cipher_list(SSL *ssl, const char *str) {
|
|
2010
|
-
|
|
2292
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2293
|
+
if (!ssl_impl->config) {
|
|
2011
2294
|
return 0;
|
|
2012
2295
|
}
|
|
2013
|
-
|
|
2014
|
-
? ssl->config->aes_hw_override_value
|
|
2015
|
-
: EVP_has_aes_hardware();
|
|
2016
|
-
return ssl_create_cipher_list(&ssl->config->cipher_list, has_aes_hw, str,
|
|
2296
|
+
return ssl_create_cipher_list(&ssl_impl->config->cipher_list, str,
|
|
2017
2297
|
true /* strict */);
|
|
2018
2298
|
}
|
|
2019
2299
|
|
|
2020
2300
|
const char *SSL_get_servername(const SSL *ssl, const int type) {
|
|
2021
2301
|
if (type != TLSEXT_NAMETYPE_host_name) {
|
|
2022
|
-
return
|
|
2302
|
+
return nullptr;
|
|
2023
2303
|
}
|
|
2024
2304
|
|
|
2025
|
-
|
|
2026
|
-
//
|
|
2027
|
-
|
|
2028
|
-
|
|
2305
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2306
|
+
// Historically, `SSL_get_servername` was also the configuration getter
|
|
2307
|
+
// corresponding to `SSL_set_tlsext_host_name`.
|
|
2308
|
+
if (ssl_impl->hostname != nullptr) {
|
|
2309
|
+
return ssl_impl->hostname.get();
|
|
2029
2310
|
}
|
|
2030
2311
|
|
|
2031
|
-
return
|
|
2312
|
+
return ssl_impl->s3->hostname.get();
|
|
2032
2313
|
}
|
|
2033
2314
|
|
|
2034
2315
|
int SSL_get_servername_type(const SSL *ssl) {
|
|
2035
|
-
if (SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name) ==
|
|
2316
|
+
if (SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name) == nullptr) {
|
|
2036
2317
|
return -1;
|
|
2037
2318
|
}
|
|
2038
2319
|
return TLSEXT_NAMETYPE_host_name;
|
|
@@ -2041,48 +2322,53 @@ int SSL_get_servername_type(const SSL *ssl) {
|
|
|
2041
2322
|
void SSL_CTX_set_custom_verify(
|
|
2042
2323
|
SSL_CTX *ctx, int mode,
|
|
2043
2324
|
enum ssl_verify_result_t (*callback)(SSL *ssl, uint8_t *out_alert)) {
|
|
2044
|
-
|
|
2045
|
-
|
|
2325
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2326
|
+
ctx_impl->verify_mode = mode;
|
|
2327
|
+
ctx_impl->custom_verify_callback = callback;
|
|
2046
2328
|
}
|
|
2047
2329
|
|
|
2048
2330
|
void SSL_set_custom_verify(
|
|
2049
2331
|
SSL *ssl, int mode,
|
|
2050
2332
|
enum ssl_verify_result_t (*callback)(SSL *ssl, uint8_t *out_alert)) {
|
|
2051
|
-
|
|
2333
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2334
|
+
if (!ssl_impl->config) {
|
|
2052
2335
|
return;
|
|
2053
2336
|
}
|
|
2054
|
-
|
|
2055
|
-
|
|
2337
|
+
ssl_impl->config->verify_mode = mode;
|
|
2338
|
+
ssl_impl->config->custom_verify_callback = callback;
|
|
2056
2339
|
}
|
|
2057
2340
|
|
|
2058
2341
|
void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx) {
|
|
2059
|
-
ctx->signed_cert_timestamps_enabled = true;
|
|
2342
|
+
FromOpaque(ctx)->signed_cert_timestamps_enabled = true;
|
|
2060
2343
|
}
|
|
2061
2344
|
|
|
2062
2345
|
void SSL_enable_signed_cert_timestamps(SSL *ssl) {
|
|
2063
|
-
|
|
2346
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2347
|
+
if (!ssl_impl->config) {
|
|
2064
2348
|
return;
|
|
2065
2349
|
}
|
|
2066
|
-
|
|
2350
|
+
ssl_impl->config->signed_cert_timestamps_enabled = true;
|
|
2067
2351
|
}
|
|
2068
2352
|
|
|
2069
2353
|
void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx) {
|
|
2070
|
-
ctx->ocsp_stapling_enabled = true;
|
|
2354
|
+
FromOpaque(ctx)->ocsp_stapling_enabled = true;
|
|
2071
2355
|
}
|
|
2072
2356
|
|
|
2073
2357
|
void SSL_enable_ocsp_stapling(SSL *ssl) {
|
|
2074
|
-
|
|
2358
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2359
|
+
if (!ssl_impl->config) {
|
|
2075
2360
|
return;
|
|
2076
2361
|
}
|
|
2077
|
-
|
|
2362
|
+
ssl_impl->config->ocsp_stapling_enabled = true;
|
|
2078
2363
|
}
|
|
2079
2364
|
|
|
2080
2365
|
void SSL_get0_signed_cert_timestamp_list(const SSL *ssl, const uint8_t **out,
|
|
2081
2366
|
size_t *out_len) {
|
|
2082
|
-
|
|
2083
|
-
if (ssl->server || !session ||
|
|
2367
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2368
|
+
if (FromOpaque(ssl)->server || !session ||
|
|
2369
|
+
!session->signed_cert_timestamp_list) {
|
|
2084
2370
|
*out_len = 0;
|
|
2085
|
-
*out =
|
|
2371
|
+
*out = nullptr;
|
|
2086
2372
|
return;
|
|
2087
2373
|
}
|
|
2088
2374
|
|
|
@@ -2092,10 +2378,10 @@ void SSL_get0_signed_cert_timestamp_list(const SSL *ssl, const uint8_t **out,
|
|
|
2092
2378
|
|
|
2093
2379
|
void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
|
|
2094
2380
|
size_t *out_len) {
|
|
2095
|
-
|
|
2096
|
-
if (ssl->server || !session || !session->ocsp_response) {
|
|
2381
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2382
|
+
if (FromOpaque(ssl)->server || !session || !session->ocsp_response) {
|
|
2097
2383
|
*out_len = 0;
|
|
2098
|
-
*out =
|
|
2384
|
+
*out = nullptr;
|
|
2099
2385
|
return;
|
|
2100
2386
|
}
|
|
2101
2387
|
|
|
@@ -2104,7 +2390,8 @@ void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
|
|
|
2104
2390
|
}
|
|
2105
2391
|
|
|
2106
2392
|
int SSL_set_tlsext_host_name(SSL *ssl, const char *name) {
|
|
2107
|
-
ssl
|
|
2393
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2394
|
+
ssl_impl->hostname.reset();
|
|
2108
2395
|
if (name == nullptr) {
|
|
2109
2396
|
return 1;
|
|
2110
2397
|
}
|
|
@@ -2114,8 +2401,8 @@ int SSL_set_tlsext_host_name(SSL *ssl, const char *name) {
|
|
|
2114
2401
|
OPENSSL_PUT_ERROR(SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME);
|
|
2115
2402
|
return 0;
|
|
2116
2403
|
}
|
|
2117
|
-
|
|
2118
|
-
if (
|
|
2404
|
+
ssl_impl->hostname.reset(OPENSSL_strdup(name));
|
|
2405
|
+
if (ssl_impl->hostname == nullptr) {
|
|
2119
2406
|
return 0;
|
|
2120
2407
|
}
|
|
2121
2408
|
return 1;
|
|
@@ -2123,12 +2410,12 @@ int SSL_set_tlsext_host_name(SSL *ssl, const char *name) {
|
|
|
2123
2410
|
|
|
2124
2411
|
int SSL_CTX_set_tlsext_servername_callback(
|
|
2125
2412
|
SSL_CTX *ctx, int (*callback)(SSL *ssl, int *out_alert, void *arg)) {
|
|
2126
|
-
ctx->servername_callback = callback;
|
|
2413
|
+
FromOpaque(ctx)->servername_callback = callback;
|
|
2127
2414
|
return 1;
|
|
2128
2415
|
}
|
|
2129
2416
|
|
|
2130
2417
|
int SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg) {
|
|
2131
|
-
ctx->servername_arg = arg;
|
|
2418
|
+
FromOpaque(ctx)->servername_arg = arg;
|
|
2132
2419
|
return 1;
|
|
2133
2420
|
}
|
|
2134
2421
|
|
|
@@ -2138,7 +2425,7 @@ int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer,
|
|
|
2138
2425
|
*out = nullptr;
|
|
2139
2426
|
*out_len = 0;
|
|
2140
2427
|
|
|
2141
|
-
// Both
|
|
2428
|
+
// Both `peer` and `supported` must be valid protocol lists, but `peer` may be
|
|
2142
2429
|
// empty in NPN.
|
|
2143
2430
|
auto peer_span = Span(peer, peer_len);
|
|
2144
2431
|
auto supported_span = Span(supported, supported_len);
|
|
@@ -2159,7 +2446,7 @@ int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer,
|
|
|
2159
2446
|
// This function is not const-correct for compatibility with existing
|
|
2160
2447
|
// callers.
|
|
2161
2448
|
*out = const_cast<uint8_t *>(CBS_data(&proto));
|
|
2162
|
-
// A u8 length prefix will fit in
|
|
2449
|
+
// A u8 length prefix will fit in `uint8_t`.
|
|
2163
2450
|
*out_len = static_cast<uint8_t>(CBS_len(&proto));
|
|
2164
2451
|
return OPENSSL_NPN_NEGOTIATED;
|
|
2165
2452
|
}
|
|
@@ -2182,18 +2469,20 @@ int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer,
|
|
|
2182
2469
|
|
|
2183
2470
|
void SSL_get0_next_proto_negotiated(const SSL *ssl, const uint8_t **out_data,
|
|
2184
2471
|
unsigned *out_len) {
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
*
|
|
2472
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2473
|
+
// NPN protocols have one-byte lengths, so they must fit in `unsigned`.
|
|
2474
|
+
assert(ssl_impl->s3->next_proto_negotiated.size() <= UINT_MAX);
|
|
2475
|
+
*out_data = ssl_impl->s3->next_proto_negotiated.data();
|
|
2476
|
+
*out_len = static_cast<unsigned>(ssl_impl->s3->next_proto_negotiated.size());
|
|
2189
2477
|
}
|
|
2190
2478
|
|
|
2191
2479
|
void SSL_CTX_set_next_protos_advertised_cb(
|
|
2192
2480
|
SSL_CTX *ctx,
|
|
2193
2481
|
int (*cb)(SSL *ssl, const uint8_t **out, unsigned *out_len, void *arg),
|
|
2194
2482
|
void *arg) {
|
|
2195
|
-
|
|
2196
|
-
|
|
2483
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2484
|
+
ctx_impl->next_protos_advertised_cb = cb;
|
|
2485
|
+
ctx_impl->next_protos_advertised_cb_arg = arg;
|
|
2197
2486
|
}
|
|
2198
2487
|
|
|
2199
2488
|
void SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx,
|
|
@@ -2202,8 +2491,9 @@ void SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx,
|
|
|
2202
2491
|
const uint8_t *in,
|
|
2203
2492
|
unsigned in_len, void *arg),
|
|
2204
2493
|
void *arg) {
|
|
2205
|
-
|
|
2206
|
-
|
|
2494
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2495
|
+
ctx_impl->next_proto_select_cb = cb;
|
|
2496
|
+
ctx_impl->next_proto_select_cb_arg = arg;
|
|
2207
2497
|
}
|
|
2208
2498
|
|
|
2209
2499
|
int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const uint8_t *protos,
|
|
@@ -2214,12 +2504,13 @@ int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const uint8_t *protos,
|
|
|
2214
2504
|
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_ALPN_PROTOCOL_LIST);
|
|
2215
2505
|
return 1;
|
|
2216
2506
|
}
|
|
2217
|
-
return ctx->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
|
|
2507
|
+
return FromOpaque(ctx)->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
|
|
2218
2508
|
}
|
|
2219
2509
|
|
|
2220
2510
|
int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos, size_t protos_len) {
|
|
2221
2511
|
// Note this function's return value is backwards.
|
|
2222
|
-
|
|
2512
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2513
|
+
if (!ssl_impl->config) {
|
|
2223
2514
|
return 1;
|
|
2224
2515
|
}
|
|
2225
2516
|
auto span = Span(protos, protos_len);
|
|
@@ -2227,7 +2518,7 @@ int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos, size_t protos_len) {
|
|
|
2227
2518
|
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_ALPN_PROTOCOL_LIST);
|
|
2228
2519
|
return 1;
|
|
2229
2520
|
}
|
|
2230
|
-
return
|
|
2521
|
+
return ssl_impl->config->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
|
|
2231
2522
|
}
|
|
2232
2523
|
|
|
2233
2524
|
void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
|
|
@@ -2235,38 +2526,41 @@ void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
|
|
|
2235
2526
|
uint8_t *out_len, const uint8_t *in,
|
|
2236
2527
|
unsigned in_len, void *arg),
|
|
2237
2528
|
void *arg) {
|
|
2238
|
-
|
|
2239
|
-
|
|
2529
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2530
|
+
ctx_impl->alpn_select_cb = cb;
|
|
2531
|
+
ctx_impl->alpn_select_cb_arg = arg;
|
|
2240
2532
|
}
|
|
2241
2533
|
|
|
2242
2534
|
void SSL_get0_alpn_selected(const SSL *ssl, const uint8_t **out_data,
|
|
2243
2535
|
unsigned *out_len) {
|
|
2536
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2244
2537
|
Span<const uint8_t> protocol;
|
|
2245
|
-
if (SSL_in_early_data(
|
|
2246
|
-
protocol =
|
|
2538
|
+
if (SSL_in_early_data(ssl_impl) && !ssl_impl->server) {
|
|
2539
|
+
protocol = ssl_impl->s3->hs->early_session->early_alpn;
|
|
2247
2540
|
} else {
|
|
2248
|
-
protocol =
|
|
2541
|
+
protocol = ssl_impl->s3->alpn_selected;
|
|
2249
2542
|
}
|
|
2250
|
-
// ALPN protocols have one-byte lengths, so they must fit in
|
|
2543
|
+
// ALPN protocols have one-byte lengths, so they must fit in `unsigned`.
|
|
2251
2544
|
assert(protocol.size() < UINT_MAX);
|
|
2252
2545
|
*out_data = protocol.data();
|
|
2253
2546
|
*out_len = static_cast<unsigned>(protocol.size());
|
|
2254
2547
|
}
|
|
2255
2548
|
|
|
2256
2549
|
void SSL_CTX_set_allow_unknown_alpn_protos(SSL_CTX *ctx, int enabled) {
|
|
2257
|
-
ctx->allow_unknown_alpn_protos = !!enabled;
|
|
2550
|
+
FromOpaque(ctx)->allow_unknown_alpn_protos = !!enabled;
|
|
2258
2551
|
}
|
|
2259
2552
|
|
|
2260
2553
|
int SSL_add_application_settings(SSL *ssl, const uint8_t *proto,
|
|
2261
2554
|
size_t proto_len, const uint8_t *settings,
|
|
2262
2555
|
size_t settings_len) {
|
|
2263
|
-
|
|
2556
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2557
|
+
if (!ssl_impl->config) {
|
|
2264
2558
|
return 0;
|
|
2265
2559
|
}
|
|
2266
2560
|
ALPSConfig config;
|
|
2267
2561
|
if (!config.protocol.CopyFrom(Span(proto, proto_len)) ||
|
|
2268
2562
|
!config.settings.CopyFrom(Span(settings, settings_len)) ||
|
|
2269
|
-
!
|
|
2563
|
+
!ssl_impl->config->alps_configs.Push(std::move(config))) {
|
|
2270
2564
|
return 0;
|
|
2271
2565
|
}
|
|
2272
2566
|
return 1;
|
|
@@ -2275,7 +2569,7 @@ int SSL_add_application_settings(SSL *ssl, const uint8_t *proto,
|
|
|
2275
2569
|
void SSL_get0_peer_application_settings(const SSL *ssl,
|
|
2276
2570
|
const uint8_t **out_data,
|
|
2277
2571
|
size_t *out_len) {
|
|
2278
|
-
const
|
|
2572
|
+
const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2279
2573
|
Span<const uint8_t> settings =
|
|
2280
2574
|
session ? session->peer_application_settings : Span<const uint8_t>();
|
|
2281
2575
|
*out_data = settings.data();
|
|
@@ -2283,15 +2577,16 @@ void SSL_get0_peer_application_settings(const SSL *ssl,
|
|
|
2283
2577
|
}
|
|
2284
2578
|
|
|
2285
2579
|
int SSL_has_application_settings(const SSL *ssl) {
|
|
2286
|
-
const
|
|
2580
|
+
const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2287
2581
|
return session && session->has_application_settings;
|
|
2288
2582
|
}
|
|
2289
2583
|
|
|
2290
2584
|
void SSL_set_alps_use_new_codepoint(SSL *ssl, int use_new) {
|
|
2291
|
-
|
|
2585
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2586
|
+
if (!ssl_impl->config) {
|
|
2292
2587
|
return;
|
|
2293
2588
|
}
|
|
2294
|
-
|
|
2589
|
+
ssl_impl->config->alps_use_new_codepoint = !!use_new;
|
|
2295
2590
|
}
|
|
2296
2591
|
|
|
2297
2592
|
int SSL_CTX_add_cert_compression_alg(SSL_CTX *ctx, uint16_t alg_id,
|
|
@@ -2299,7 +2594,8 @@ int SSL_CTX_add_cert_compression_alg(SSL_CTX *ctx, uint16_t alg_id,
|
|
|
2299
2594
|
ssl_cert_decompression_func_t decompress) {
|
|
2300
2595
|
assert(compress != nullptr || decompress != nullptr);
|
|
2301
2596
|
|
|
2302
|
-
|
|
2597
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2598
|
+
for (const auto &alg : ctx_impl->cert_compression_algs) {
|
|
2303
2599
|
if (alg.alg_id == alg_id) {
|
|
2304
2600
|
return 0;
|
|
2305
2601
|
}
|
|
@@ -2309,11 +2605,11 @@ int SSL_CTX_add_cert_compression_alg(SSL_CTX *ctx, uint16_t alg_id,
|
|
|
2309
2605
|
alg.alg_id = alg_id;
|
|
2310
2606
|
alg.compress = compress;
|
|
2311
2607
|
alg.decompress = decompress;
|
|
2312
|
-
return
|
|
2608
|
+
return ctx_impl->cert_compression_algs.Push(alg);
|
|
2313
2609
|
}
|
|
2314
2610
|
|
|
2315
2611
|
void SSL_CTX_set_tls_channel_id_enabled(SSL_CTX *ctx, int enabled) {
|
|
2316
|
-
ctx->channel_id_enabled = !!enabled;
|
|
2612
|
+
FromOpaque(ctx)->channel_id_enabled = !!enabled;
|
|
2317
2613
|
}
|
|
2318
2614
|
|
|
2319
2615
|
int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx) {
|
|
@@ -2322,10 +2618,11 @@ int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx) {
|
|
|
2322
2618
|
}
|
|
2323
2619
|
|
|
2324
2620
|
void SSL_set_tls_channel_id_enabled(SSL *ssl, int enabled) {
|
|
2325
|
-
|
|
2621
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2622
|
+
if (!ssl_impl->config) {
|
|
2326
2623
|
return;
|
|
2327
2624
|
}
|
|
2328
|
-
|
|
2625
|
+
ssl_impl->config->channel_id_enabled = !!enabled;
|
|
2329
2626
|
}
|
|
2330
2627
|
|
|
2331
2628
|
int SSL_enable_tls_channel_id(SSL *ssl) {
|
|
@@ -2333,47 +2630,44 @@ int SSL_enable_tls_channel_id(SSL *ssl) {
|
|
|
2333
2630
|
return 1;
|
|
2334
2631
|
}
|
|
2335
2632
|
|
|
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
2633
|
int SSL_CTX_set1_tls_channel_id(SSL_CTX *ctx, EVP_PKEY *private_key) {
|
|
2343
|
-
if (
|
|
2634
|
+
if (EVP_PKEY_get_ec_curve_nid(private_key) != NID_X9_62_prime256v1) {
|
|
2344
2635
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CHANNEL_ID_NOT_P256);
|
|
2345
2636
|
return 0;
|
|
2346
2637
|
}
|
|
2347
2638
|
|
|
2348
|
-
ctx->channel_id_private = UpRef(private_key);
|
|
2639
|
+
FromOpaque(ctx)->channel_id_private = UpRef(private_key);
|
|
2349
2640
|
return 1;
|
|
2350
2641
|
}
|
|
2351
2642
|
|
|
2352
2643
|
int SSL_set1_tls_channel_id(SSL *ssl, EVP_PKEY *private_key) {
|
|
2353
|
-
|
|
2644
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2645
|
+
if (!ssl_impl->config) {
|
|
2354
2646
|
return 0;
|
|
2355
2647
|
}
|
|
2356
|
-
if (
|
|
2648
|
+
if (EVP_PKEY_get_ec_curve_nid(private_key) != NID_X9_62_prime256v1) {
|
|
2357
2649
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CHANNEL_ID_NOT_P256);
|
|
2358
2650
|
return 0;
|
|
2359
2651
|
}
|
|
2360
2652
|
|
|
2361
|
-
|
|
2653
|
+
ssl_impl->config->channel_id_private = UpRef(private_key);
|
|
2362
2654
|
return 1;
|
|
2363
2655
|
}
|
|
2364
2656
|
|
|
2365
2657
|
size_t SSL_get_tls_channel_id(SSL *ssl, uint8_t *out, size_t max_out) {
|
|
2366
|
-
|
|
2658
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2659
|
+
if (!ssl_impl->s3->channel_id_valid) {
|
|
2367
2660
|
return 0;
|
|
2368
2661
|
}
|
|
2369
|
-
OPENSSL_memcpy(out,
|
|
2662
|
+
OPENSSL_memcpy(out, ssl_impl->s3->channel_id, (max_out < 64) ? max_out : 64);
|
|
2370
2663
|
return 64;
|
|
2371
2664
|
}
|
|
2372
2665
|
|
|
2373
2666
|
size_t SSL_get0_certificate_types(const SSL *ssl, const uint8_t **out_types) {
|
|
2667
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2374
2668
|
Span<const uint8_t> types;
|
|
2375
|
-
if (!
|
|
2376
|
-
types =
|
|
2669
|
+
if (!ssl_impl->server && ssl_impl->s3->hs != nullptr) {
|
|
2670
|
+
types = ssl_impl->s3->hs->certificate_types;
|
|
2377
2671
|
}
|
|
2378
2672
|
*out_types = types.data();
|
|
2379
2673
|
return types.size();
|
|
@@ -2381,9 +2675,10 @@ size_t SSL_get0_certificate_types(const SSL *ssl, const uint8_t **out_types) {
|
|
|
2381
2675
|
|
|
2382
2676
|
size_t SSL_get0_peer_verify_algorithms(const SSL *ssl,
|
|
2383
2677
|
const uint16_t **out_sigalgs) {
|
|
2678
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2384
2679
|
Span<const uint16_t> sigalgs;
|
|
2385
|
-
if (
|
|
2386
|
-
sigalgs =
|
|
2680
|
+
if (ssl_impl->s3->hs != nullptr) {
|
|
2681
|
+
sigalgs = ssl_impl->s3->hs->peer_sigalgs;
|
|
2387
2682
|
}
|
|
2388
2683
|
*out_sigalgs = sigalgs.data();
|
|
2389
2684
|
return sigalgs.size();
|
|
@@ -2391,121 +2686,131 @@ size_t SSL_get0_peer_verify_algorithms(const SSL *ssl,
|
|
|
2391
2686
|
|
|
2392
2687
|
size_t SSL_get0_peer_delegation_algorithms(const SSL *ssl,
|
|
2393
2688
|
const uint16_t **out_sigalgs) {
|
|
2689
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2394
2690
|
Span<const uint16_t> sigalgs;
|
|
2395
|
-
if (
|
|
2396
|
-
sigalgs =
|
|
2691
|
+
if (ssl_impl->s3->hs != nullptr) {
|
|
2692
|
+
sigalgs = ssl_impl->s3->hs->peer_delegated_credential_sigalgs;
|
|
2397
2693
|
}
|
|
2398
2694
|
*out_sigalgs = sigalgs.data();
|
|
2399
2695
|
return sigalgs.size();
|
|
2400
2696
|
}
|
|
2401
2697
|
|
|
2402
2698
|
EVP_PKEY *SSL_get_privatekey(const SSL *ssl) {
|
|
2403
|
-
|
|
2404
|
-
|
|
2699
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2700
|
+
if (!ssl_impl->config) {
|
|
2701
|
+
assert(ssl_impl->config);
|
|
2405
2702
|
return nullptr;
|
|
2406
2703
|
}
|
|
2407
|
-
return
|
|
2704
|
+
return ssl_impl->config->cert->legacy_credential->privkey.get();
|
|
2408
2705
|
}
|
|
2409
2706
|
|
|
2410
2707
|
EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx) {
|
|
2411
|
-
return ctx->cert->legacy_credential->privkey.get();
|
|
2708
|
+
return FromOpaque(ctx)->cert->legacy_credential->privkey.get();
|
|
2412
2709
|
}
|
|
2413
2710
|
|
|
2414
2711
|
const SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl) {
|
|
2415
|
-
const
|
|
2712
|
+
const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2416
2713
|
return session == nullptr ? nullptr : session->cipher;
|
|
2417
2714
|
}
|
|
2418
2715
|
|
|
2419
2716
|
int SSL_session_reused(const SSL *ssl) {
|
|
2420
|
-
return ssl->s3->session_reused || SSL_in_early_data(ssl);
|
|
2717
|
+
return FromOpaque(ssl)->s3->session_reused || SSL_in_early_data(ssl);
|
|
2421
2718
|
}
|
|
2422
2719
|
|
|
2423
|
-
const COMP_METHOD *SSL_get_current_compression(SSL *ssl) { return
|
|
2720
|
+
const COMP_METHOD *SSL_get_current_compression(SSL *ssl) { return nullptr; }
|
|
2424
2721
|
|
|
2425
|
-
const COMP_METHOD *SSL_get_current_expansion(SSL *ssl) { return
|
|
2722
|
+
const COMP_METHOD *SSL_get_current_expansion(SSL *ssl) { return nullptr; }
|
|
2426
2723
|
|
|
2427
2724
|
int SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key) { return 0; }
|
|
2428
2725
|
|
|
2726
|
+
int SSL_get_peer_tmp_key(SSL *ssl, EVP_PKEY **out_key) { return 0; }
|
|
2727
|
+
|
|
2429
2728
|
void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode) {
|
|
2430
|
-
ctx->quiet_shutdown = (mode != 0);
|
|
2729
|
+
FromOpaque(ctx)->quiet_shutdown = (mode != 0);
|
|
2431
2730
|
}
|
|
2432
2731
|
|
|
2433
2732
|
int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx) {
|
|
2434
|
-
return ctx->quiet_shutdown;
|
|
2733
|
+
return FromOpaque(ctx)->quiet_shutdown;
|
|
2435
2734
|
}
|
|
2436
2735
|
|
|
2437
2736
|
void SSL_set_quiet_shutdown(SSL *ssl, int mode) {
|
|
2438
|
-
ssl->quiet_shutdown = (mode != 0);
|
|
2737
|
+
FromOpaque(ssl)->quiet_shutdown = (mode != 0);
|
|
2439
2738
|
}
|
|
2440
2739
|
|
|
2441
|
-
int SSL_get_quiet_shutdown(const SSL *ssl) {
|
|
2740
|
+
int SSL_get_quiet_shutdown(const SSL *ssl) {
|
|
2741
|
+
return FromOpaque(ssl)->quiet_shutdown;
|
|
2742
|
+
}
|
|
2442
2743
|
|
|
2443
2744
|
void SSL_set_shutdown(SSL *ssl, int mode) {
|
|
2745
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2444
2746
|
// It is an error to clear any bits that have already been set. (We can't try
|
|
2445
2747
|
// to get a second close_notify or send two.)
|
|
2446
2748
|
assert((SSL_get_shutdown(ssl) & mode) == SSL_get_shutdown(ssl));
|
|
2447
2749
|
|
|
2448
2750
|
if (mode & SSL_RECEIVED_SHUTDOWN &&
|
|
2449
|
-
|
|
2450
|
-
|
|
2751
|
+
ssl_impl->s3->read_shutdown == ssl_shutdown_none) {
|
|
2752
|
+
ssl_impl->s3->read_shutdown = ssl_shutdown_close_notify;
|
|
2451
2753
|
}
|
|
2452
2754
|
|
|
2453
2755
|
if (mode & SSL_SENT_SHUTDOWN &&
|
|
2454
|
-
|
|
2455
|
-
|
|
2756
|
+
ssl_impl->s3->write_shutdown == ssl_shutdown_none) {
|
|
2757
|
+
ssl_impl->s3->write_shutdown = ssl_shutdown_close_notify;
|
|
2456
2758
|
}
|
|
2457
2759
|
}
|
|
2458
2760
|
|
|
2459
2761
|
int SSL_get_shutdown(const SSL *ssl) {
|
|
2762
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2460
2763
|
int ret = 0;
|
|
2461
|
-
if (
|
|
2462
|
-
// Historically, OpenSSL set
|
|
2764
|
+
if (ssl_impl->s3->read_shutdown != ssl_shutdown_none) {
|
|
2765
|
+
// Historically, OpenSSL set `SSL_RECEIVED_SHUTDOWN` on both close_notify
|
|
2463
2766
|
// and fatal alert.
|
|
2464
2767
|
ret |= SSL_RECEIVED_SHUTDOWN;
|
|
2465
2768
|
}
|
|
2466
|
-
if (
|
|
2467
|
-
// Historically, OpenSSL set
|
|
2769
|
+
if (ssl_impl->s3->write_shutdown == ssl_shutdown_close_notify) {
|
|
2770
|
+
// Historically, OpenSSL set `SSL_SENT_SHUTDOWN` on only close_notify.
|
|
2468
2771
|
ret |= SSL_SENT_SHUTDOWN;
|
|
2469
2772
|
}
|
|
2470
2773
|
return ret;
|
|
2471
2774
|
}
|
|
2472
2775
|
|
|
2473
|
-
SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl) { return ssl->ctx.get(); }
|
|
2776
|
+
SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl) { return FromOpaque(ssl)->ctx.get(); }
|
|
2474
2777
|
|
|
2475
2778
|
SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) {
|
|
2476
|
-
|
|
2477
|
-
|
|
2779
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2780
|
+
if (!ssl_impl->config) {
|
|
2781
|
+
return nullptr;
|
|
2478
2782
|
}
|
|
2479
|
-
if (
|
|
2480
|
-
return
|
|
2783
|
+
if (ssl_impl->ctx.get() == ctx) {
|
|
2784
|
+
return ssl_impl->ctx.get();
|
|
2481
2785
|
}
|
|
2482
2786
|
|
|
2483
2787
|
// One cannot change the X.509 callbacks during a connection.
|
|
2484
|
-
|
|
2788
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2789
|
+
if (ssl_impl->ctx->x509_method != ctx_impl->x509_method) {
|
|
2485
2790
|
assert(0);
|
|
2486
|
-
return
|
|
2791
|
+
return nullptr;
|
|
2487
2792
|
}
|
|
2488
2793
|
|
|
2489
|
-
UniquePtr<CERT> new_cert = ssl_cert_dup(
|
|
2794
|
+
UniquePtr<CERT> new_cert = ssl_cert_dup(ctx_impl->cert.get());
|
|
2490
2795
|
if (!new_cert) {
|
|
2491
2796
|
return nullptr;
|
|
2492
2797
|
}
|
|
2493
2798
|
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2799
|
+
ssl_impl->config->cert = std::move(new_cert);
|
|
2800
|
+
ssl_impl->ctx = UpRef(ctx_impl);
|
|
2801
|
+
ssl_impl->enable_early_data = ssl_impl->ctx->enable_early_data;
|
|
2497
2802
|
|
|
2498
|
-
return
|
|
2803
|
+
return ssl_impl->ctx.get();
|
|
2499
2804
|
}
|
|
2500
2805
|
|
|
2501
2806
|
void SSL_set_info_callback(SSL *ssl,
|
|
2502
2807
|
void (*cb)(const SSL *ssl, int type, int value)) {
|
|
2503
|
-
ssl->info_callback = cb;
|
|
2808
|
+
FromOpaque(ssl)->info_callback = cb;
|
|
2504
2809
|
}
|
|
2505
2810
|
|
|
2506
2811
|
void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type,
|
|
2507
2812
|
int value) {
|
|
2508
|
-
return ssl->info_callback;
|
|
2813
|
+
return FromOpaque(ssl)->info_callback;
|
|
2509
2814
|
}
|
|
2510
2815
|
|
|
2511
2816
|
int SSL_state(const SSL *ssl) {
|
|
@@ -2516,7 +2821,7 @@ void SSL_set_state(SSL *ssl, int state) {}
|
|
|
2516
2821
|
|
|
2517
2822
|
char *SSL_get_shared_ciphers(const SSL *ssl, char *buf, int len) {
|
|
2518
2823
|
if (len <= 0) {
|
|
2519
|
-
return
|
|
2824
|
+
return nullptr;
|
|
2520
2825
|
}
|
|
2521
2826
|
buf[0] = '\0';
|
|
2522
2827
|
return buf;
|
|
@@ -2528,18 +2833,20 @@ int SSL_get_shared_sigalgs(SSL *ssl, int idx, int *psign, int *phash,
|
|
|
2528
2833
|
}
|
|
2529
2834
|
|
|
2530
2835
|
int SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method) {
|
|
2531
|
-
|
|
2836
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
2837
|
+
if (ctx_impl->method->is_dtls) {
|
|
2532
2838
|
return 0;
|
|
2533
2839
|
}
|
|
2534
|
-
|
|
2840
|
+
ctx_impl->quic_method = quic_method;
|
|
2535
2841
|
return 1;
|
|
2536
2842
|
}
|
|
2537
2843
|
|
|
2538
2844
|
int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method) {
|
|
2539
|
-
|
|
2845
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2846
|
+
if (ssl_impl->method->is_dtls) {
|
|
2540
2847
|
return 0;
|
|
2541
2848
|
}
|
|
2542
|
-
|
|
2849
|
+
ssl_impl->quic_method = quic_method;
|
|
2543
2850
|
return 1;
|
|
2544
2851
|
}
|
|
2545
2852
|
|
|
@@ -2550,11 +2857,11 @@ int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
|
|
|
2550
2857
|
}
|
|
2551
2858
|
|
|
2552
2859
|
int SSL_set_ex_data(SSL *ssl, int idx, void *data) {
|
|
2553
|
-
return CRYPTO_set_ex_data(&ssl->ex_data, idx, data);
|
|
2860
|
+
return CRYPTO_set_ex_data(&FromOpaque(ssl)->ex_data, idx, data);
|
|
2554
2861
|
}
|
|
2555
2862
|
|
|
2556
2863
|
void *SSL_get_ex_data(const SSL *ssl, int idx) {
|
|
2557
|
-
return CRYPTO_get_ex_data(&ssl->ex_data, idx);
|
|
2864
|
+
return CRYPTO_get_ex_data(&FromOpaque(ssl)->ex_data, idx);
|
|
2558
2865
|
}
|
|
2559
2866
|
|
|
2560
2867
|
int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
|
|
@@ -2565,19 +2872,20 @@ int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
|
|
|
2565
2872
|
}
|
|
2566
2873
|
|
|
2567
2874
|
int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *data) {
|
|
2568
|
-
return CRYPTO_set_ex_data(&ctx->ex_data, idx, data);
|
|
2875
|
+
return CRYPTO_set_ex_data(&FromOpaque(ctx)->ex_data, idx, data);
|
|
2569
2876
|
}
|
|
2570
2877
|
|
|
2571
2878
|
void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
|
|
2572
|
-
return CRYPTO_get_ex_data(&ctx->ex_data, idx);
|
|
2879
|
+
return CRYPTO_get_ex_data(&FromOpaque(ctx)->ex_data, idx);
|
|
2573
2880
|
}
|
|
2574
2881
|
|
|
2575
2882
|
int SSL_want(const SSL *ssl) {
|
|
2576
|
-
|
|
2577
|
-
//
|
|
2883
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2884
|
+
// Historically, OpenSSL did not track `SSL_ERROR_ZERO_RETURN` as an `rwstate`
|
|
2885
|
+
// value. We do, but map it back to `SSL_ERROR_NONE` to preserve the original
|
|
2578
2886
|
// behavior.
|
|
2579
|
-
return
|
|
2580
|
-
|
|
2887
|
+
return ssl_impl->s3->rwstate == SSL_ERROR_ZERO_RETURN ? SSL_ERROR_NONE
|
|
2888
|
+
: ssl_impl->s3->rwstate;
|
|
2581
2889
|
}
|
|
2582
2890
|
|
|
2583
2891
|
void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
|
|
@@ -2596,7 +2904,8 @@ void SSL_set_tmp_dh_callback(SSL *ssl, DH *(*cb)(SSL *ssl, int is_export,
|
|
|
2596
2904
|
|
|
2597
2905
|
static int use_psk_identity_hint(UniquePtr<char> *out,
|
|
2598
2906
|
const char *identity_hint) {
|
|
2599
|
-
if (identity_hint !=
|
|
2907
|
+
if (identity_hint != nullptr &&
|
|
2908
|
+
strlen(identity_hint) > PSK_MAX_IDENTITY_LEN) {
|
|
2600
2909
|
OPENSSL_PUT_ERROR(SSL, SSL_R_DATA_LENGTH_TOO_LONG);
|
|
2601
2910
|
return 0;
|
|
2602
2911
|
}
|
|
@@ -2608,7 +2917,7 @@ static int use_psk_identity_hint(UniquePtr<char> *out,
|
|
|
2608
2917
|
// send either no hint (omit ServerKeyExchange) or an empty hint, while
|
|
2609
2918
|
// ECDHE_PSK can only spell empty hint. Having different capabilities is odd,
|
|
2610
2919
|
// so we interpret empty and missing as identical.
|
|
2611
|
-
if (identity_hint !=
|
|
2920
|
+
if (identity_hint != nullptr && identity_hint[0] != '\0') {
|
|
2612
2921
|
out->reset(OPENSSL_strdup(identity_hint));
|
|
2613
2922
|
if (*out == nullptr) {
|
|
2614
2923
|
return 0;
|
|
@@ -2619,34 +2928,38 @@ static int use_psk_identity_hint(UniquePtr<char> *out,
|
|
|
2619
2928
|
}
|
|
2620
2929
|
|
|
2621
2930
|
int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) {
|
|
2622
|
-
return use_psk_identity_hint(&ctx->psk_identity_hint,
|
|
2931
|
+
return use_psk_identity_hint(&FromOpaque(ctx)->psk_identity_hint,
|
|
2932
|
+
identity_hint);
|
|
2623
2933
|
}
|
|
2624
2934
|
|
|
2625
2935
|
int SSL_use_psk_identity_hint(SSL *ssl, const char *identity_hint) {
|
|
2626
|
-
|
|
2936
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2937
|
+
if (!ssl_impl->config) {
|
|
2627
2938
|
return 0;
|
|
2628
2939
|
}
|
|
2629
|
-
return use_psk_identity_hint(&
|
|
2940
|
+
return use_psk_identity_hint(&ssl_impl->config->psk_identity_hint,
|
|
2941
|
+
identity_hint);
|
|
2630
2942
|
}
|
|
2631
2943
|
|
|
2632
2944
|
const char *SSL_get_psk_identity_hint(const SSL *ssl) {
|
|
2633
|
-
if (ssl ==
|
|
2634
|
-
return
|
|
2945
|
+
if (ssl == nullptr) {
|
|
2946
|
+
return nullptr;
|
|
2635
2947
|
}
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2948
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2949
|
+
if (ssl_impl->config == nullptr) {
|
|
2950
|
+
assert(ssl_impl->config);
|
|
2951
|
+
return nullptr;
|
|
2639
2952
|
}
|
|
2640
|
-
return
|
|
2953
|
+
return ssl_impl->config->psk_identity_hint.get();
|
|
2641
2954
|
}
|
|
2642
2955
|
|
|
2643
2956
|
const char *SSL_get_psk_identity(const SSL *ssl) {
|
|
2644
|
-
if (ssl ==
|
|
2645
|
-
return
|
|
2957
|
+
if (ssl == nullptr) {
|
|
2958
|
+
return nullptr;
|
|
2646
2959
|
}
|
|
2647
|
-
|
|
2648
|
-
if (session ==
|
|
2649
|
-
return
|
|
2960
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2961
|
+
if (session == nullptr) {
|
|
2962
|
+
return nullptr;
|
|
2650
2963
|
}
|
|
2651
2964
|
return session->psk_identity.get();
|
|
2652
2965
|
}
|
|
@@ -2655,82 +2968,85 @@ void SSL_set_psk_client_callback(
|
|
|
2655
2968
|
SSL *ssl, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
|
|
2656
2969
|
unsigned max_identity_len, uint8_t *psk,
|
|
2657
2970
|
unsigned max_psk_len)) {
|
|
2658
|
-
|
|
2971
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2972
|
+
if (!ssl_impl->config) {
|
|
2659
2973
|
return;
|
|
2660
2974
|
}
|
|
2661
|
-
|
|
2975
|
+
ssl_impl->config->psk_client_callback = cb;
|
|
2662
2976
|
}
|
|
2663
2977
|
|
|
2664
2978
|
void SSL_CTX_set_psk_client_callback(
|
|
2665
2979
|
SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
|
|
2666
2980
|
unsigned max_identity_len, uint8_t *psk,
|
|
2667
2981
|
unsigned max_psk_len)) {
|
|
2668
|
-
ctx->psk_client_callback = cb;
|
|
2982
|
+
FromOpaque(ctx)->psk_client_callback = cb;
|
|
2669
2983
|
}
|
|
2670
2984
|
|
|
2671
2985
|
void SSL_set_psk_server_callback(SSL *ssl,
|
|
2672
2986
|
unsigned (*cb)(SSL *ssl, const char *identity,
|
|
2673
2987
|
uint8_t *psk,
|
|
2674
2988
|
unsigned max_psk_len)) {
|
|
2675
|
-
|
|
2989
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2990
|
+
if (!ssl_impl->config) {
|
|
2676
2991
|
return;
|
|
2677
2992
|
}
|
|
2678
|
-
|
|
2993
|
+
ssl_impl->config->psk_server_callback = cb;
|
|
2679
2994
|
}
|
|
2680
2995
|
|
|
2681
2996
|
void SSL_CTX_set_psk_server_callback(
|
|
2682
2997
|
SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *identity, uint8_t *psk,
|
|
2683
2998
|
unsigned max_psk_len)) {
|
|
2684
|
-
ctx->psk_server_callback = cb;
|
|
2999
|
+
FromOpaque(ctx)->psk_server_callback = cb;
|
|
2685
3000
|
}
|
|
2686
3001
|
|
|
2687
3002
|
void SSL_CTX_set_msg_callback(SSL_CTX *ctx,
|
|
2688
3003
|
void (*cb)(int write_p, int version,
|
|
2689
3004
|
int content_type, const void *buf,
|
|
2690
3005
|
size_t len, SSL *ssl, void *arg)) {
|
|
2691
|
-
ctx->msg_callback = cb;
|
|
3006
|
+
FromOpaque(ctx)->msg_callback = cb;
|
|
2692
3007
|
}
|
|
2693
3008
|
|
|
2694
3009
|
void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg) {
|
|
2695
|
-
ctx->msg_callback_arg = arg;
|
|
3010
|
+
FromOpaque(ctx)->msg_callback_arg = arg;
|
|
2696
3011
|
}
|
|
2697
3012
|
|
|
2698
3013
|
void SSL_set_msg_callback(SSL *ssl,
|
|
2699
3014
|
void (*cb)(int write_p, int version, int content_type,
|
|
2700
3015
|
const void *buf, size_t len, SSL *ssl,
|
|
2701
3016
|
void *arg)) {
|
|
2702
|
-
ssl->msg_callback = cb;
|
|
3017
|
+
FromOpaque(ssl)->msg_callback = cb;
|
|
2703
3018
|
}
|
|
2704
3019
|
|
|
2705
3020
|
void SSL_set_msg_callback_arg(SSL *ssl, void *arg) {
|
|
2706
|
-
ssl->msg_callback_arg = arg;
|
|
3021
|
+
FromOpaque(ssl)->msg_callback_arg = arg;
|
|
2707
3022
|
}
|
|
2708
3023
|
|
|
2709
3024
|
void SSL_CTX_set_keylog_callback(SSL_CTX *ctx,
|
|
2710
3025
|
void (*cb)(const SSL *ssl, const char *line)) {
|
|
2711
|
-
ctx->keylog_callback = cb;
|
|
3026
|
+
FromOpaque(ctx)->keylog_callback = cb;
|
|
2712
3027
|
}
|
|
2713
3028
|
|
|
2714
3029
|
void (*SSL_CTX_get_keylog_callback(const SSL_CTX *ctx))(const SSL *ssl,
|
|
2715
3030
|
const char *line) {
|
|
2716
|
-
return ctx->keylog_callback;
|
|
3031
|
+
return FromOpaque(ctx)->keylog_callback;
|
|
2717
3032
|
}
|
|
2718
3033
|
|
|
2719
3034
|
void SSL_CTX_set_current_time_cb(SSL_CTX *ctx,
|
|
2720
3035
|
void (*cb)(const SSL *ssl,
|
|
2721
3036
|
struct timeval *out_clock)) {
|
|
2722
|
-
ctx->current_time_cb = cb;
|
|
3037
|
+
FromOpaque(ctx)->current_time_cb = cb;
|
|
2723
3038
|
}
|
|
2724
3039
|
|
|
2725
3040
|
int SSL_can_release_private_key(const SSL *ssl) {
|
|
2726
|
-
|
|
3041
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3042
|
+
if (ssl_can_renegotiate(ssl_impl)) {
|
|
2727
3043
|
// If the connection can renegotiate (client only), the private key may be
|
|
2728
3044
|
// used in a future handshake.
|
|
2729
3045
|
return 0;
|
|
2730
3046
|
}
|
|
2731
3047
|
|
|
2732
3048
|
// Otherwise, this is determined by the current handshake.
|
|
2733
|
-
return !
|
|
3049
|
+
return !ssl_impl->s3->hs || ssl_impl->s3->hs->can_release_private_key;
|
|
2734
3050
|
}
|
|
2735
3051
|
|
|
2736
3052
|
int SSL_is_init_finished(const SSL *ssl) { return !SSL_in_init(ssl); }
|
|
@@ -2739,58 +3055,52 @@ int SSL_in_init(const SSL *ssl) {
|
|
|
2739
3055
|
// This returns false once all the handshake state has been finalized, to
|
|
2740
3056
|
// allow callbacks and getters based on SSL_in_init to return the correct
|
|
2741
3057
|
// values.
|
|
2742
|
-
|
|
3058
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3059
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
2743
3060
|
return hs != nullptr && !hs->handshake_finalized;
|
|
2744
3061
|
}
|
|
2745
3062
|
|
|
2746
3063
|
int SSL_in_false_start(const SSL *ssl) {
|
|
2747
|
-
|
|
3064
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3065
|
+
if (ssl_impl->s3->hs == nullptr) {
|
|
2748
3066
|
return 0;
|
|
2749
3067
|
}
|
|
2750
|
-
return
|
|
3068
|
+
return ssl_impl->s3->hs->in_false_start;
|
|
2751
3069
|
}
|
|
2752
3070
|
|
|
2753
3071
|
int SSL_cutthrough_complete(const SSL *ssl) { return SSL_in_false_start(ssl); }
|
|
2754
3072
|
|
|
2755
|
-
int SSL_is_server(const SSL *ssl) { return ssl->server; }
|
|
3073
|
+
int SSL_is_server(const SSL *ssl) { return FromOpaque(ssl)->server; }
|
|
2756
3074
|
|
|
2757
|
-
int SSL_is_dtls(const SSL *ssl) { return ssl->method->is_dtls; }
|
|
3075
|
+
int SSL_is_dtls(const SSL *ssl) { return FromOpaque(ssl)->method->is_dtls; }
|
|
2758
3076
|
|
|
2759
|
-
int SSL_is_quic(const SSL *ssl) {
|
|
3077
|
+
int SSL_is_quic(const SSL *ssl) {
|
|
3078
|
+
return FromOpaque(ssl)->quic_method != nullptr;
|
|
3079
|
+
}
|
|
2760
3080
|
|
|
2761
3081
|
void SSL_CTX_set_select_certificate_cb(
|
|
2762
3082
|
SSL_CTX *ctx,
|
|
2763
3083
|
enum ssl_select_cert_result_t (*cb)(const SSL_CLIENT_HELLO *)) {
|
|
2764
|
-
ctx->select_certificate_cb = cb;
|
|
3084
|
+
FromOpaque(ctx)->select_certificate_cb = cb;
|
|
2765
3085
|
}
|
|
2766
3086
|
|
|
2767
3087
|
void SSL_CTX_set_dos_protection_cb(SSL_CTX *ctx,
|
|
2768
3088
|
int (*cb)(const SSL_CLIENT_HELLO *)) {
|
|
2769
|
-
ctx->dos_protection_cb = cb;
|
|
3089
|
+
FromOpaque(ctx)->dos_protection_cb = cb;
|
|
2770
3090
|
}
|
|
2771
3091
|
|
|
2772
3092
|
void SSL_CTX_set_reverify_on_resume(SSL_CTX *ctx, int enabled) {
|
|
2773
|
-
ctx->reverify_on_resume = !!enabled;
|
|
2774
|
-
}
|
|
2775
|
-
|
|
2776
|
-
void SSL_set_enforce_rsa_key_usage(SSL *ssl, int enabled) {
|
|
2777
|
-
if (!ssl->config) {
|
|
2778
|
-
return;
|
|
2779
|
-
}
|
|
2780
|
-
ssl->config->enforce_rsa_key_usage = !!enabled;
|
|
2781
|
-
}
|
|
2782
|
-
|
|
2783
|
-
int SSL_was_key_usage_invalid(const SSL *ssl) {
|
|
2784
|
-
return ssl->s3->was_key_usage_invalid;
|
|
3093
|
+
FromOpaque(ctx)->reverify_on_resume = !!enabled;
|
|
2785
3094
|
}
|
|
2786
3095
|
|
|
2787
3096
|
void SSL_set_renegotiate_mode(SSL *ssl, enum ssl_renegotiate_mode_t mode) {
|
|
2788
|
-
|
|
3097
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3098
|
+
ssl_impl->renegotiate_mode = mode;
|
|
2789
3099
|
|
|
2790
|
-
// Check if
|
|
3100
|
+
// Check if `ssl_can_renegotiate` has changed and the configuration may now be
|
|
2791
3101
|
// shed. HTTP clients may initially allow renegotiation for HTTP/1.1, and then
|
|
2792
3102
|
// disable after the handshake once the ALPN protocol is known to be HTTP/2.
|
|
2793
|
-
ssl_maybe_shed_handshake_config(
|
|
3103
|
+
ssl_maybe_shed_handshake_config(ssl_impl);
|
|
2794
3104
|
}
|
|
2795
3105
|
|
|
2796
3106
|
int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
|
|
@@ -2802,9 +3112,10 @@ int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
|
|
|
2802
3112
|
return 0;
|
|
2803
3113
|
}
|
|
2804
3114
|
|
|
3115
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2805
3116
|
size_t write_iv_len;
|
|
2806
|
-
if (!
|
|
2807
|
-
!
|
|
3117
|
+
if (!ssl_impl->s3->aead_read_ctx->GetIV(out_read_iv, out_iv_len) ||
|
|
3118
|
+
!ssl_impl->s3->aead_write_ctx->GetIV(out_write_iv, &write_iv_len) ||
|
|
2808
3119
|
*out_iv_len != write_iv_len) {
|
|
2809
3120
|
return 0;
|
|
2810
3121
|
}
|
|
@@ -2813,14 +3124,15 @@ int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
|
|
|
2813
3124
|
}
|
|
2814
3125
|
|
|
2815
3126
|
uint64_t SSL_get_read_sequence(const SSL *ssl) {
|
|
3127
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2816
3128
|
if (SSL_is_dtls(ssl)) {
|
|
2817
3129
|
// TODO(crbug.com/42290608): This API should not be implemented for DTLS or
|
|
2818
3130
|
// QUIC. In QUIC we do not maintain a sequence number.
|
|
2819
|
-
const DTLSReadEpoch *read_epoch = &
|
|
3131
|
+
const DTLSReadEpoch *read_epoch = &ssl_impl->d1->read_epoch;
|
|
2820
3132
|
return DTLSRecordNumber(read_epoch->epoch, read_epoch->bitmap.max_seq_num())
|
|
2821
3133
|
.combined();
|
|
2822
3134
|
}
|
|
2823
|
-
return
|
|
3135
|
+
return ssl_impl->s3->read_sequence;
|
|
2824
3136
|
}
|
|
2825
3137
|
|
|
2826
3138
|
uint64_t SSL_get_write_sequence(const SSL *ssl) {
|
|
@@ -2828,60 +3140,66 @@ uint64_t SSL_get_write_sequence(const SSL *ssl) {
|
|
|
2828
3140
|
// QUIC. In QUIC we do not maintain a sequence number. In DTLS, this API isn't
|
|
2829
3141
|
// harmful per se, but the caller already needs to use a DTLS-specific API on
|
|
2830
3142
|
// the read side.
|
|
3143
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2831
3144
|
if (SSL_is_dtls(ssl)) {
|
|
2832
|
-
return
|
|
3145
|
+
return ssl_impl->d1->write_epoch.next_record.combined();
|
|
2833
3146
|
}
|
|
2834
3147
|
|
|
2835
|
-
return
|
|
3148
|
+
return ssl_impl->s3->write_sequence;
|
|
2836
3149
|
}
|
|
2837
3150
|
|
|
2838
3151
|
int SSL_is_dtls_handshake_idle(const SSL *ssl) {
|
|
2839
3152
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3153
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2840
3154
|
|
|
2841
3155
|
return !SSL_in_init(ssl) &&
|
|
2842
3156
|
// No unacknowledged messages in DTLS 1.3. In DTLS 1.2, there no ACKs
|
|
2843
|
-
// and we currently never clear
|
|
3157
|
+
// and we currently never clear `outgoing_messages` on the side that
|
|
2844
3158
|
// speaks last.
|
|
2845
|
-
(ssl_protocol_version(
|
|
2846
|
-
|
|
3159
|
+
(ssl_protocol_version(ssl_impl) < TLS1_3_VERSION ||
|
|
3160
|
+
ssl_impl->d1->outgoing_messages.empty()) &&
|
|
2847
3161
|
// No partial or out-of-order messages.
|
|
2848
|
-
std::all_of(std::begin(
|
|
2849
|
-
std::end(
|
|
3162
|
+
std::all_of(std::begin(ssl_impl->d1->incoming_messages),
|
|
3163
|
+
std::end(ssl_impl->d1->incoming_messages),
|
|
2850
3164
|
[](const auto &msg) { return msg == nullptr; }) &&
|
|
2851
3165
|
// Not trying to send a KeyUpdate.
|
|
2852
|
-
!
|
|
2853
|
-
|
|
3166
|
+
!ssl_impl->s3->key_update_pending &&
|
|
3167
|
+
ssl_impl->d1->queued_key_update == bssl::QueuedKeyUpdate::kNone;
|
|
2854
3168
|
}
|
|
2855
3169
|
|
|
2856
3170
|
uint32_t SSL_get_dtls_handshake_read_seq(const SSL *ssl) {
|
|
2857
3171
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
2858
|
-
|
|
3172
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3173
|
+
return ssl_impl->d1->handshake_read_overflow
|
|
2859
3174
|
? uint32_t{0x10000}
|
|
2860
|
-
: uint32_t{
|
|
3175
|
+
: uint32_t{ssl_impl->d1->handshake_read_seq};
|
|
2861
3176
|
}
|
|
2862
3177
|
|
|
2863
3178
|
uint32_t SSL_get_dtls_handshake_write_seq(const SSL *ssl) {
|
|
2864
3179
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
2865
|
-
|
|
3180
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3181
|
+
return ssl_impl->d1->handshake_write_overflow
|
|
2866
3182
|
? uint32_t{0x10000}
|
|
2867
|
-
: uint32_t{
|
|
3183
|
+
: uint32_t{ssl_impl->d1->handshake_write_seq};
|
|
2868
3184
|
}
|
|
2869
3185
|
|
|
2870
3186
|
uint16_t SSL_get_dtls_read_epoch(const SSL *ssl) {
|
|
2871
3187
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3188
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2872
3189
|
// Return the highest available epoch.
|
|
2873
|
-
return
|
|
2874
|
-
|
|
3190
|
+
return ssl_impl->d1->next_read_epoch ? ssl_impl->d1->next_read_epoch->epoch
|
|
3191
|
+
: ssl_impl->d1->read_epoch.epoch;
|
|
2875
3192
|
}
|
|
2876
3193
|
|
|
2877
3194
|
uint16_t SSL_get_dtls_write_epoch(const SSL *ssl) {
|
|
2878
3195
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
2879
|
-
return ssl->d1->write_epoch.epoch();
|
|
3196
|
+
return FromOpaque(ssl)->d1->write_epoch.epoch();
|
|
2880
3197
|
}
|
|
2881
3198
|
|
|
2882
3199
|
uint64_t SSL_get_dtls_read_sequence(const SSL *ssl, uint16_t epoch) {
|
|
2883
3200
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
2884
|
-
const
|
|
3201
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3202
|
+
const DTLSReadEpoch *read_epoch = dtls_get_read_epoch(ssl_impl, epoch);
|
|
2885
3203
|
if (read_epoch == nullptr) {
|
|
2886
3204
|
return UINT64_MAX;
|
|
2887
3205
|
}
|
|
@@ -2891,7 +3209,7 @@ uint64_t SSL_get_dtls_read_sequence(const SSL *ssl, uint16_t epoch) {
|
|
|
2891
3209
|
// Increment to get to an available sequence number.
|
|
2892
3210
|
max_seq_num++;
|
|
2893
3211
|
} else {
|
|
2894
|
-
// If
|
|
3212
|
+
// If `max_seq_num` was available, the bitmap must have been empty.
|
|
2895
3213
|
assert(max_seq_num == 0);
|
|
2896
3214
|
}
|
|
2897
3215
|
return max_seq_num;
|
|
@@ -2899,7 +3217,8 @@ uint64_t SSL_get_dtls_read_sequence(const SSL *ssl, uint16_t epoch) {
|
|
|
2899
3217
|
|
|
2900
3218
|
uint64_t SSL_get_dtls_write_sequence(const SSL *ssl, uint16_t epoch) {
|
|
2901
3219
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
2902
|
-
const
|
|
3220
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3221
|
+
const DTLSWriteEpoch *write_epoch = dtls_get_write_epoch(ssl_impl, epoch);
|
|
2903
3222
|
if (write_epoch == nullptr) {
|
|
2904
3223
|
return UINT64_MAX;
|
|
2905
3224
|
}
|
|
@@ -2908,7 +3227,7 @@ uint64_t SSL_get_dtls_write_sequence(const SSL *ssl, uint16_t epoch) {
|
|
|
2908
3227
|
|
|
2909
3228
|
template <typename EpochState>
|
|
2910
3229
|
static int get_dtls_traffic_secret(
|
|
2911
|
-
const
|
|
3230
|
+
const SSLImpl *ssl, EpochState *(*get_epoch)(const SSLImpl *, uint16_t),
|
|
2912
3231
|
const uint8_t **out_data, size_t *out_len, uint16_t epoch) {
|
|
2913
3232
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
2914
3233
|
// This function only applies to encrypted DTLS 1.3 epochs.
|
|
@@ -2928,19 +3247,19 @@ static int get_dtls_traffic_secret(
|
|
|
2928
3247
|
|
|
2929
3248
|
int SSL_get_dtls_read_traffic_secret(const SSL *ssl, const uint8_t **out_data,
|
|
2930
3249
|
size_t *out_len, uint16_t epoch) {
|
|
2931
|
-
return get_dtls_traffic_secret(ssl, dtls_get_read_epoch, out_data,
|
|
2932
|
-
epoch);
|
|
3250
|
+
return get_dtls_traffic_secret(FromOpaque(ssl), dtls_get_read_epoch, out_data,
|
|
3251
|
+
out_len, epoch);
|
|
2933
3252
|
}
|
|
2934
3253
|
|
|
2935
3254
|
int SSL_get_dtls_write_traffic_secret(const SSL *ssl, const uint8_t **out_data,
|
|
2936
3255
|
size_t *out_len, uint16_t epoch) {
|
|
2937
|
-
return get_dtls_traffic_secret(ssl, dtls_get_write_epoch,
|
|
2938
|
-
epoch);
|
|
3256
|
+
return get_dtls_traffic_secret(FromOpaque(ssl), dtls_get_write_epoch,
|
|
3257
|
+
out_data, out_len, epoch);
|
|
2939
3258
|
}
|
|
2940
3259
|
|
|
2941
3260
|
uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl) {
|
|
2942
|
-
|
|
2943
|
-
if (session ==
|
|
3261
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
3262
|
+
if (session == nullptr) {
|
|
2944
3263
|
return 0;
|
|
2945
3264
|
}
|
|
2946
3265
|
|
|
@@ -2948,105 +3267,127 @@ uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl) {
|
|
|
2948
3267
|
}
|
|
2949
3268
|
|
|
2950
3269
|
size_t SSL_get_client_random(const SSL *ssl, uint8_t *out, size_t max_out) {
|
|
3270
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2951
3271
|
if (max_out == 0) {
|
|
2952
|
-
return sizeof(
|
|
3272
|
+
return sizeof(ssl_impl->s3->client_random);
|
|
2953
3273
|
}
|
|
2954
|
-
if (max_out > sizeof(
|
|
2955
|
-
max_out = sizeof(
|
|
3274
|
+
if (max_out > sizeof(ssl_impl->s3->client_random)) {
|
|
3275
|
+
max_out = sizeof(ssl_impl->s3->client_random);
|
|
2956
3276
|
}
|
|
2957
|
-
OPENSSL_memcpy(out,
|
|
3277
|
+
OPENSSL_memcpy(out, ssl_impl->s3->client_random, max_out);
|
|
2958
3278
|
return max_out;
|
|
2959
3279
|
}
|
|
2960
3280
|
|
|
2961
3281
|
size_t SSL_get_server_random(const SSL *ssl, uint8_t *out, size_t max_out) {
|
|
3282
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2962
3283
|
if (max_out == 0) {
|
|
2963
|
-
return sizeof(
|
|
3284
|
+
return sizeof(ssl_impl->s3->server_random);
|
|
2964
3285
|
}
|
|
2965
|
-
if (max_out > sizeof(
|
|
2966
|
-
max_out = sizeof(
|
|
3286
|
+
if (max_out > sizeof(ssl_impl->s3->server_random)) {
|
|
3287
|
+
max_out = sizeof(ssl_impl->s3->server_random);
|
|
2967
3288
|
}
|
|
2968
|
-
OPENSSL_memcpy(out,
|
|
3289
|
+
OPENSSL_memcpy(out, ssl_impl->s3->server_random, max_out);
|
|
2969
3290
|
return max_out;
|
|
2970
3291
|
}
|
|
2971
3292
|
|
|
3293
|
+
uint16_t SSL_get_signature_algorithm_used(const SSL *ssl) {
|
|
3294
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3295
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
3296
|
+
if (hs == nullptr) {
|
|
3297
|
+
return 0;
|
|
3298
|
+
}
|
|
3299
|
+
return hs->signature_algorithm;
|
|
3300
|
+
}
|
|
3301
|
+
|
|
2972
3302
|
const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl) {
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
3303
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3304
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
3305
|
+
if (hs == nullptr) {
|
|
3306
|
+
return nullptr;
|
|
2976
3307
|
}
|
|
2977
3308
|
return hs->new_cipher;
|
|
2978
3309
|
}
|
|
2979
3310
|
|
|
2980
3311
|
void SSL_set_retain_only_sha256_of_client_certs(SSL *ssl, int enabled) {
|
|
2981
|
-
|
|
3312
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3313
|
+
if (!ssl_impl->config) {
|
|
2982
3314
|
return;
|
|
2983
3315
|
}
|
|
2984
|
-
|
|
3316
|
+
ssl_impl->config->retain_only_sha256_of_client_certs = !!enabled;
|
|
2985
3317
|
}
|
|
2986
3318
|
|
|
2987
3319
|
void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx, int enabled) {
|
|
2988
|
-
ctx->retain_only_sha256_of_client_certs = !!enabled;
|
|
3320
|
+
FromOpaque(ctx)->retain_only_sha256_of_client_certs = !!enabled;
|
|
2989
3321
|
}
|
|
2990
3322
|
|
|
2991
3323
|
void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled) {
|
|
2992
|
-
ctx->grease_enabled = !!enabled;
|
|
3324
|
+
FromOpaque(ctx)->grease_enabled = !!enabled;
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
void SSL_CTX_set_grease_sigalgs_enabled(SSL_CTX *ctx, int enabled) {
|
|
3328
|
+
FromOpaque(ctx)->grease_sigalgs_enabled = !!enabled;
|
|
2993
3329
|
}
|
|
2994
3330
|
|
|
2995
3331
|
void SSL_CTX_set_permute_extensions(SSL_CTX *ctx, int enabled) {
|
|
2996
|
-
ctx->permute_extensions = !!enabled;
|
|
3332
|
+
FromOpaque(ctx)->permute_extensions = !!enabled;
|
|
2997
3333
|
}
|
|
2998
3334
|
|
|
2999
3335
|
void SSL_set_permute_extensions(SSL *ssl, int enabled) {
|
|
3000
|
-
|
|
3336
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3337
|
+
if (!ssl_impl->config) {
|
|
3001
3338
|
return;
|
|
3002
3339
|
}
|
|
3003
|
-
|
|
3340
|
+
ssl_impl->config->permute_extensions = !!enabled;
|
|
3004
3341
|
}
|
|
3005
3342
|
|
|
3006
3343
|
int32_t SSL_get_ticket_age_skew(const SSL *ssl) {
|
|
3007
|
-
return ssl->s3->ticket_age_skew;
|
|
3344
|
+
return FromOpaque(ssl)->s3->ticket_age_skew;
|
|
3008
3345
|
}
|
|
3009
3346
|
|
|
3010
3347
|
void SSL_CTX_set_false_start_allowed_without_alpn(SSL_CTX *ctx, int allowed) {
|
|
3011
|
-
ctx->false_start_allowed_without_alpn = !!allowed;
|
|
3348
|
+
FromOpaque(ctx)->false_start_allowed_without_alpn = !!allowed;
|
|
3012
3349
|
}
|
|
3013
3350
|
|
|
3014
3351
|
int SSL_used_hello_retry_request(const SSL *ssl) {
|
|
3015
|
-
return ssl->s3->used_hello_retry_request;
|
|
3352
|
+
return FromOpaque(ssl)->s3->used_hello_retry_request;
|
|
3016
3353
|
}
|
|
3017
3354
|
|
|
3018
3355
|
void SSL_set_shed_handshake_config(SSL *ssl, int enable) {
|
|
3019
|
-
|
|
3356
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3357
|
+
if (!ssl_impl->config) {
|
|
3020
3358
|
return;
|
|
3021
3359
|
}
|
|
3022
|
-
|
|
3360
|
+
ssl_impl->config->shed_handshake_config = !!enable;
|
|
3023
3361
|
}
|
|
3024
3362
|
|
|
3025
3363
|
void SSL_set_jdk11_workaround(SSL *ssl, int enable) {
|
|
3026
|
-
|
|
3364
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3365
|
+
if (!ssl_impl->config) {
|
|
3027
3366
|
return;
|
|
3028
3367
|
}
|
|
3029
|
-
|
|
3368
|
+
ssl_impl->config->jdk11_workaround = !!enable;
|
|
3030
3369
|
}
|
|
3031
3370
|
|
|
3032
3371
|
void SSL_set_quic_use_legacy_codepoint(SSL *ssl, int use_legacy) {
|
|
3033
|
-
|
|
3372
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3373
|
+
if (!ssl_impl->config) {
|
|
3034
3374
|
return;
|
|
3035
3375
|
}
|
|
3036
|
-
|
|
3376
|
+
ssl_impl->config->quic_use_legacy_codepoint = !!use_legacy;
|
|
3037
3377
|
}
|
|
3038
3378
|
|
|
3039
3379
|
int SSL_clear(SSL *ssl) {
|
|
3040
|
-
|
|
3380
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3381
|
+
if (!ssl_impl->config) {
|
|
3041
3382
|
return 0; // SSL_clear may not be used after shedding config.
|
|
3042
3383
|
}
|
|
3043
3384
|
|
|
3044
|
-
// In OpenSSL, reusing a client
|
|
3385
|
+
// In OpenSSL, reusing a client `SSL` with `SSL_clear` causes the previously
|
|
3045
3386
|
// established session to be offered the next time around. wpa_supplicant
|
|
3046
3387
|
// depends on this behavior, so emulate it.
|
|
3047
|
-
UniquePtr<
|
|
3048
|
-
if (!
|
|
3049
|
-
session = UpRef(
|
|
3388
|
+
UniquePtr<SSLSession> session;
|
|
3389
|
+
if (!ssl_impl->server && ssl_impl->s3->established_session != nullptr) {
|
|
3390
|
+
session = UpRef(ssl_impl->s3->established_session);
|
|
3050
3391
|
}
|
|
3051
3392
|
|
|
3052
3393
|
// The ssl->d1->mtu is simultaneously configuration (preserved across
|
|
@@ -3054,17 +3395,17 @@ int SSL_clear(SSL *ssl) {
|
|
|
3054
3395
|
//
|
|
3055
3396
|
// TODO(davidben): Avoid this.
|
|
3056
3397
|
unsigned mtu = 0;
|
|
3057
|
-
if (
|
|
3058
|
-
mtu =
|
|
3398
|
+
if (ssl_impl->d1 != nullptr) {
|
|
3399
|
+
mtu = ssl_impl->d1->mtu;
|
|
3059
3400
|
}
|
|
3060
3401
|
|
|
3061
|
-
|
|
3062
|
-
if (!
|
|
3402
|
+
ssl_impl->method->ssl_free(ssl_impl);
|
|
3403
|
+
if (!ssl_impl->method->ssl_new(ssl_impl)) {
|
|
3063
3404
|
return 0;
|
|
3064
3405
|
}
|
|
3065
3406
|
|
|
3066
3407
|
if (SSL_is_dtls(ssl) && (SSL_get_options(ssl) & SSL_OP_NO_QUERY_MTU)) {
|
|
3067
|
-
|
|
3408
|
+
ssl_impl->d1->mtu = mtu;
|
|
3068
3409
|
}
|
|
3069
3410
|
|
|
3070
3411
|
if (session != nullptr) {
|
|
@@ -3094,12 +3435,12 @@ int SSL_CTX_need_tmp_RSA(const SSL_CTX *ctx) { return 0; }
|
|
|
3094
3435
|
int SSL_need_tmp_RSA(const SSL *ssl) { return 0; }
|
|
3095
3436
|
int SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, const RSA *rsa) { return 1; }
|
|
3096
3437
|
int SSL_set_tmp_rsa(SSL *ssl, const RSA *rsa) { return 1; }
|
|
3097
|
-
void ERR_load_SSL_strings(
|
|
3098
|
-
void SSL_load_error_strings(
|
|
3438
|
+
void ERR_load_SSL_strings() {}
|
|
3439
|
+
void SSL_load_error_strings() {}
|
|
3099
3440
|
int SSL_cache_hit(SSL *ssl) { return SSL_session_reused(ssl); }
|
|
3100
3441
|
|
|
3101
3442
|
int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key) {
|
|
3102
|
-
if (ec_key ==
|
|
3443
|
+
if (ec_key == nullptr || EC_KEY_get0_group(ec_key) == nullptr) {
|
|
3103
3444
|
OPENSSL_PUT_ERROR(SSL, ERR_R_PASSED_NULL_PARAMETER);
|
|
3104
3445
|
return 0;
|
|
3105
3446
|
}
|
|
@@ -3108,7 +3449,7 @@ int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key) {
|
|
|
3108
3449
|
}
|
|
3109
3450
|
|
|
3110
3451
|
int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key) {
|
|
3111
|
-
if (ec_key ==
|
|
3452
|
+
if (ec_key == nullptr || EC_KEY_get0_group(ec_key) == nullptr) {
|
|
3112
3453
|
OPENSSL_PUT_ERROR(SSL, ERR_R_PASSED_NULL_PARAMETER);
|
|
3113
3454
|
return 0;
|
|
3114
3455
|
}
|
|
@@ -3118,14 +3459,15 @@ int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key) {
|
|
|
3118
3459
|
|
|
3119
3460
|
void SSL_CTX_set_ticket_aead_method(SSL_CTX *ctx,
|
|
3120
3461
|
const SSL_TICKET_AEAD_METHOD *aead_method) {
|
|
3121
|
-
ctx->ticket_aead_method = aead_method;
|
|
3462
|
+
FromOpaque(ctx)->ticket_aead_method = aead_method;
|
|
3122
3463
|
}
|
|
3123
3464
|
|
|
3124
3465
|
SSL_SESSION *SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf,
|
|
3125
3466
|
size_t buf_len) {
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3467
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3468
|
+
if (SSL_in_init(ssl_impl) || //
|
|
3469
|
+
ssl_protocol_version(ssl_impl) != TLS1_3_VERSION || //
|
|
3470
|
+
ssl_impl->server) {
|
|
3129
3471
|
// Only TLS 1.3 clients are supported.
|
|
3130
3472
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
3131
3473
|
return nullptr;
|
|
@@ -3141,9 +3483,10 @@ SSL_SESSION *SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf,
|
|
|
3141
3483
|
return nullptr;
|
|
3142
3484
|
}
|
|
3143
3485
|
|
|
3144
|
-
UniquePtr<
|
|
3486
|
+
UniquePtr<SSLSession> session =
|
|
3487
|
+
tls13_create_session_with_ticket(ssl_impl, &body);
|
|
3145
3488
|
if (!session) {
|
|
3146
|
-
//
|
|
3489
|
+
// `tls13_create_session_with_ticket` puts the correct error.
|
|
3147
3490
|
return nullptr;
|
|
3148
3491
|
}
|
|
3149
3492
|
return session.release();
|
|
@@ -3152,29 +3495,33 @@ SSL_SESSION *SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf,
|
|
|
3152
3495
|
int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets) {
|
|
3153
3496
|
num_tickets = std::min(num_tickets, kMaxTickets);
|
|
3154
3497
|
static_assert(kMaxTickets <= 0xff, "Too many tickets.");
|
|
3155
|
-
ctx->num_tickets = static_cast<uint8_t>(num_tickets);
|
|
3498
|
+
FromOpaque(ctx)->num_tickets = static_cast<uint8_t>(num_tickets);
|
|
3156
3499
|
return 1;
|
|
3157
3500
|
}
|
|
3158
3501
|
|
|
3159
|
-
size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx) {
|
|
3502
|
+
size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx) {
|
|
3503
|
+
return FromOpaque(ctx)->num_tickets;
|
|
3504
|
+
}
|
|
3160
3505
|
|
|
3161
3506
|
int SSL_set_tlsext_status_type(SSL *ssl, int type) {
|
|
3162
|
-
|
|
3507
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3508
|
+
if (!ssl_impl->config) {
|
|
3163
3509
|
return 0;
|
|
3164
3510
|
}
|
|
3165
|
-
|
|
3511
|
+
ssl_impl->config->ocsp_stapling_enabled = type == TLSEXT_STATUSTYPE_ocsp;
|
|
3166
3512
|
return 1;
|
|
3167
3513
|
}
|
|
3168
3514
|
|
|
3169
3515
|
int SSL_get_tlsext_status_type(const SSL *ssl) {
|
|
3170
|
-
|
|
3171
|
-
|
|
3516
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3517
|
+
if (ssl_impl->server) {
|
|
3518
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
3172
3519
|
return hs != nullptr && hs->ocsp_stapling_requested
|
|
3173
3520
|
? TLSEXT_STATUSTYPE_ocsp
|
|
3174
3521
|
: TLSEXT_STATUSTYPE_nothing;
|
|
3175
3522
|
}
|
|
3176
3523
|
|
|
3177
|
-
return
|
|
3524
|
+
return ssl_impl->config != nullptr && ssl_impl->config->ocsp_stapling_enabled
|
|
3178
3525
|
? TLSEXT_STATUSTYPE_ocsp
|
|
3179
3526
|
: TLSEXT_STATUSTYPE_nothing;
|
|
3180
3527
|
}
|
|
@@ -3195,12 +3542,12 @@ size_t SSL_get_tlsext_status_ocsp_resp(const SSL *ssl, const uint8_t **out) {
|
|
|
3195
3542
|
|
|
3196
3543
|
int SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx,
|
|
3197
3544
|
int (*callback)(SSL *ssl, void *arg)) {
|
|
3198
|
-
ctx->legacy_ocsp_callback = callback;
|
|
3545
|
+
FromOpaque(ctx)->legacy_ocsp_callback = callback;
|
|
3199
3546
|
return 1;
|
|
3200
3547
|
}
|
|
3201
3548
|
|
|
3202
3549
|
int SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg) {
|
|
3203
|
-
ctx->legacy_ocsp_callback_arg = arg;
|
|
3550
|
+
FromOpaque(ctx)->legacy_ocsp_callback_arg = arg;
|
|
3204
3551
|
return 1;
|
|
3205
3552
|
}
|
|
3206
3553
|
|
|
@@ -3262,7 +3609,16 @@ static const char kTLS12Ciphers[] =
|
|
|
3262
3609
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3263
3610
|
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
|
|
3264
3611
|
|
|
3265
|
-
static
|
|
3612
|
+
static const uint16_t kTLS13Ciphers[] = {
|
|
3613
|
+
SSL_CIPHER_AES_128_GCM_SHA256,
|
|
3614
|
+
SSL_CIPHER_AES_256_GCM_SHA384,
|
|
3615
|
+
};
|
|
3616
|
+
static const bool kTLS13CiphersInGroup[] = {
|
|
3617
|
+
true,
|
|
3618
|
+
false,
|
|
3619
|
+
};
|
|
3620
|
+
|
|
3621
|
+
static int Configure(SSLContext *ctx) {
|
|
3266
3622
|
ctx->compliance_policy = ssl_compliance_policy_fips_202205;
|
|
3267
3623
|
|
|
3268
3624
|
return
|
|
@@ -3278,29 +3634,120 @@ static int Configure(SSL_CTX *ctx) {
|
|
|
3278
3634
|
// Encrypt-then-MAC extension is required for all CBC cipher suites and so
|
|
3279
3635
|
// it's easier to drop them.
|
|
3280
3636
|
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3637
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3638
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3639
|
+
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3640
|
+
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3641
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3286
3642
|
}
|
|
3287
3643
|
|
|
3288
|
-
static int Configure(
|
|
3644
|
+
static int Configure(SSLImpl *ssl) {
|
|
3289
3645
|
ssl->config->compliance_policy = ssl_compliance_policy_fips_202205;
|
|
3290
3646
|
|
|
3291
|
-
// See
|
|
3647
|
+
// See `Configure(SSL_CTX)`, above, for reasoning.
|
|
3292
3648
|
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3293
3649
|
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3294
3650
|
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3651
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3652
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3653
|
+
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3654
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3655
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3300
3656
|
}
|
|
3301
3657
|
|
|
3302
3658
|
} // namespace fips202205
|
|
3303
3659
|
|
|
3660
|
+
namespace fips202609 {
|
|
3661
|
+
|
|
3662
|
+
// (References are to SP 800-52r2):
|
|
3663
|
+
|
|
3664
|
+
static const uint16_t kGroups[] = {
|
|
3665
|
+
SSL_GROUP_X25519_MLKEM768,
|
|
3666
|
+
SSL_GROUP_MLKEM1024,
|
|
3667
|
+
SSL_GROUP_SECP256R1,
|
|
3668
|
+
SSL_GROUP_SECP384R1,
|
|
3669
|
+
};
|
|
3670
|
+
static const uint32_t kGroupsFlags[] = {
|
|
3671
|
+
SSL_GROUP_FLAG_EQUAL_PREFERENCE_WITH_NEXT,
|
|
3672
|
+
0,
|
|
3673
|
+
0,
|
|
3674
|
+
0,
|
|
3675
|
+
};
|
|
3676
|
+
|
|
3677
|
+
// Prefer post-quantum groups equally if the client supports them.
|
|
3678
|
+
static const uint32_t kOptions = SSL_OP_CIPHER_SERVER_PREFERENCE;
|
|
3679
|
+
|
|
3680
|
+
static const uint16_t kSigAlgs[] = {
|
|
3681
|
+
SSL_SIGN_RSA_PKCS1_SHA256,
|
|
3682
|
+
SSL_SIGN_RSA_PKCS1_SHA384,
|
|
3683
|
+
SSL_SIGN_RSA_PKCS1_SHA512,
|
|
3684
|
+
// Table 4.1:
|
|
3685
|
+
// "The curve should be P-256 or P-384"
|
|
3686
|
+
SSL_SIGN_ECDSA_SECP256R1_SHA256,
|
|
3687
|
+
SSL_SIGN_ECDSA_SECP384R1_SHA384,
|
|
3688
|
+
SSL_SIGN_RSA_PSS_RSAE_SHA256,
|
|
3689
|
+
SSL_SIGN_RSA_PSS_RSAE_SHA384,
|
|
3690
|
+
SSL_SIGN_RSA_PSS_RSAE_SHA512,
|
|
3691
|
+
};
|
|
3692
|
+
|
|
3693
|
+
static const char kTLS12Ciphers[] =
|
|
3694
|
+
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:"
|
|
3695
|
+
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:"
|
|
3696
|
+
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3697
|
+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
|
|
3698
|
+
|
|
3699
|
+
static const uint16_t kTLS13Ciphers[] = {
|
|
3700
|
+
SSL_CIPHER_AES_128_GCM_SHA256,
|
|
3701
|
+
SSL_CIPHER_AES_256_GCM_SHA384,
|
|
3702
|
+
};
|
|
3703
|
+
static const bool kTLS13CiphersInGroup[] = {
|
|
3704
|
+
true,
|
|
3705
|
+
false,
|
|
3706
|
+
};
|
|
3707
|
+
|
|
3708
|
+
static int Configure(SSLContext *ctx) {
|
|
3709
|
+
ctx->compliance_policy = ssl_compliance_policy_fips_202609;
|
|
3710
|
+
|
|
3711
|
+
return
|
|
3712
|
+
// Section 3.1:
|
|
3713
|
+
// "Servers that support government-only applications shall be
|
|
3714
|
+
// configured to use TLS 1.2 and should be configured to use TLS 1.3
|
|
3715
|
+
// as well. These servers should not be configured to use TLS 1.1 and
|
|
3716
|
+
// shall not use TLS 1.0, SSL 3.0, or SSL 2.0.
|
|
3717
|
+
SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION) &&
|
|
3718
|
+
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3719
|
+
// Sections 3.3.1.1.1 and 3.3.1.1.2 are ambiguous about whether
|
|
3720
|
+
// HMAC-SHA-1 cipher suites are permitted with TLS 1.2. However, later the
|
|
3721
|
+
// Encrypt-then-MAC extension is required for all CBC cipher suites and so
|
|
3722
|
+
// it's easier to drop them.
|
|
3723
|
+
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3724
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3725
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3726
|
+
SSL_CTX_set1_group_ids_with_flags(ctx, kGroups, kGroupsFlags,
|
|
3727
|
+
std::size(kGroups)) &&
|
|
3728
|
+
SSL_CTX_set_options(ctx, kOptions) &&
|
|
3729
|
+
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3730
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
static int Configure(SSLImpl *ssl) {
|
|
3734
|
+
ssl->config->compliance_policy = ssl_compliance_policy_fips_202609;
|
|
3735
|
+
|
|
3736
|
+
// See `Configure(SSL_CTX)`, above, for reasoning.
|
|
3737
|
+
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3738
|
+
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3739
|
+
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3740
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3741
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3742
|
+
SSL_set1_group_ids_with_flags(ssl, kGroups, kGroupsFlags,
|
|
3743
|
+
std::size(kGroups)) &&
|
|
3744
|
+
SSL_set_options(ssl, kOptions) &&
|
|
3745
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3746
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3747
|
+
}
|
|
3748
|
+
|
|
3749
|
+
} // namespace fips202609
|
|
3750
|
+
|
|
3304
3751
|
namespace wpa202304 {
|
|
3305
3752
|
|
|
3306
3753
|
// See WPA version 3.1, section 3.5.
|
|
@@ -3319,97 +3766,260 @@ static const char kTLS12Ciphers[] =
|
|
|
3319
3766
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3320
3767
|
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
|
|
3321
3768
|
|
|
3322
|
-
static
|
|
3769
|
+
static const uint16_t kTLS13Ciphers[] = {
|
|
3770
|
+
SSL_CIPHER_AES_256_GCM_SHA384,
|
|
3771
|
+
};
|
|
3772
|
+
static const bool kTLS13CiphersInGroup[] = {
|
|
3773
|
+
false,
|
|
3774
|
+
};
|
|
3775
|
+
|
|
3776
|
+
static int Configure(SSLContext *ctx) {
|
|
3323
3777
|
ctx->compliance_policy = ssl_compliance_policy_wpa3_192_202304;
|
|
3324
3778
|
|
|
3325
3779
|
return SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION) &&
|
|
3326
3780
|
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3327
3781
|
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3328
|
-
SSL_CTX_set1_group_ids(ctx, kGroups,
|
|
3782
|
+
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3783
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3784
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3329
3785
|
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3330
|
-
|
|
3331
|
-
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs,
|
|
3332
|
-
OPENSSL_ARRAY_SIZE(kSigAlgs));
|
|
3786
|
+
std::size(kSigAlgs)) &&
|
|
3787
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3333
3788
|
}
|
|
3334
3789
|
|
|
3335
|
-
static int Configure(
|
|
3790
|
+
static int Configure(SSLImpl *ssl) {
|
|
3336
3791
|
ssl->config->compliance_policy = ssl_compliance_policy_wpa3_192_202304;
|
|
3337
3792
|
|
|
3338
3793
|
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3339
3794
|
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3340
3795
|
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3796
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3797
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3798
|
+
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3799
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3800
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3346
3801
|
}
|
|
3347
3802
|
|
|
3348
3803
|
} // namespace wpa202304
|
|
3349
3804
|
|
|
3350
3805
|
namespace cnsa202407 {
|
|
3351
3806
|
|
|
3352
|
-
static
|
|
3807
|
+
static const uint16_t kTLS13Ciphers[] = {
|
|
3808
|
+
SSL_CIPHER_AES_256_GCM_SHA384,
|
|
3809
|
+
SSL_CIPHER_AES_128_GCM_SHA256,
|
|
3810
|
+
SSL_CIPHER_CHACHA20_POLY1305_SHA256,
|
|
3811
|
+
};
|
|
3812
|
+
static const bool kTLS13CiphersInGroup[] = {
|
|
3813
|
+
false,
|
|
3814
|
+
false,
|
|
3815
|
+
false,
|
|
3816
|
+
};
|
|
3817
|
+
|
|
3818
|
+
static int Configure(SSLContext *ctx) {
|
|
3353
3819
|
ctx->compliance_policy = ssl_compliance_policy_cnsa_202407;
|
|
3354
|
-
return
|
|
3820
|
+
return ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3821
|
+
Span(kTLS13CiphersInGroup));
|
|
3355
3822
|
}
|
|
3356
3823
|
|
|
3357
|
-
static int Configure(
|
|
3824
|
+
static int Configure(SSLImpl *ssl) {
|
|
3358
3825
|
ssl->config->compliance_policy = ssl_compliance_policy_cnsa_202407;
|
|
3359
|
-
return
|
|
3826
|
+
return ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3827
|
+
Span(kTLS13CiphersInGroup));
|
|
3360
3828
|
}
|
|
3361
3829
|
|
|
3362
3830
|
} // namespace cnsa202407
|
|
3363
3831
|
|
|
3832
|
+
namespace cnsa1_202603 {
|
|
3833
|
+
|
|
3834
|
+
// Approximates CNSA 1.0 (RFC 9151).
|
|
3835
|
+
|
|
3836
|
+
static const uint16_t kGroups[] = {SSL_GROUP_MLKEM1024, SSL_GROUP_SECP384R1};
|
|
3837
|
+
|
|
3838
|
+
// Prefer ML-KEM-1024 if the client supports it.
|
|
3839
|
+
static const uint32_t kOptions = SSL_OP_CIPHER_SERVER_PREFERENCE;
|
|
3840
|
+
|
|
3841
|
+
static const uint16_t kSigAlgs[] = {
|
|
3842
|
+
SSL_SIGN_ECDSA_SECP384R1_SHA384,
|
|
3843
|
+
SSL_SIGN_RSA_PSS_RSAE_SHA384,
|
|
3844
|
+
SSL_SIGN_RSA_PKCS1_SHA384,
|
|
3845
|
+
};
|
|
3846
|
+
|
|
3847
|
+
static const char kTLS12Ciphers[] =
|
|
3848
|
+
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3849
|
+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:"
|
|
3850
|
+
"TLS_RSA_WITH_AES_256_GCM_SHA384";
|
|
3851
|
+
|
|
3852
|
+
static const uint16_t kTLS13Ciphers[] = {
|
|
3853
|
+
SSL_CIPHER_AES_256_GCM_SHA384,
|
|
3854
|
+
};
|
|
3855
|
+
static const bool kTLS13CiphersInGroup[] = {
|
|
3856
|
+
false,
|
|
3857
|
+
};
|
|
3858
|
+
|
|
3859
|
+
static int Configure(SSLContext *ctx) {
|
|
3860
|
+
ctx->compliance_policy = ssl_compliance_policy_cnsa1_202603;
|
|
3861
|
+
|
|
3862
|
+
return SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION) &&
|
|
3863
|
+
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3864
|
+
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3865
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3866
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3867
|
+
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3868
|
+
SSL_CTX_set_options(ctx, kOptions) &&
|
|
3869
|
+
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3870
|
+
std::size(kSigAlgs)) &&
|
|
3871
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3874
|
+
static int Configure(SSLImpl *ssl) {
|
|
3875
|
+
ssl->config->compliance_policy = ssl_compliance_policy_cnsa1_202603;
|
|
3876
|
+
|
|
3877
|
+
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3878
|
+
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3879
|
+
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3880
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3881
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3882
|
+
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3883
|
+
SSL_set_options(ssl, kOptions) &&
|
|
3884
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3885
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3888
|
+
} // namespace cnsa1_202603
|
|
3889
|
+
|
|
3890
|
+
namespace cnsa2_202603 {
|
|
3891
|
+
|
|
3892
|
+
// Approximates CNSA 2.0 (draft-becker-cnsa2-tls-profile).
|
|
3893
|
+
|
|
3894
|
+
static const uint16_t kGroups[] = {SSL_GROUP_MLKEM1024};
|
|
3895
|
+
|
|
3896
|
+
static const uint16_t kSigAlgs[] = {
|
|
3897
|
+
SSL_SIGN_ECDSA_SECP384R1_SHA384,
|
|
3898
|
+
SSL_SIGN_RSA_PSS_RSAE_SHA384,
|
|
3899
|
+
SSL_SIGN_RSA_PKCS1_SHA384,
|
|
3900
|
+
};
|
|
3901
|
+
|
|
3902
|
+
static const uint16_t kTLS13Ciphers[] = {
|
|
3903
|
+
SSL_CIPHER_AES_256_GCM_SHA384,
|
|
3904
|
+
};
|
|
3905
|
+
static const bool kTLS13CiphersInGroup[] = {
|
|
3906
|
+
false,
|
|
3907
|
+
};
|
|
3908
|
+
|
|
3909
|
+
static int Configure(SSLContext *ctx) {
|
|
3910
|
+
ctx->compliance_policy = ssl_compliance_policy_cnsa2_202603;
|
|
3911
|
+
|
|
3912
|
+
return SSL_CTX_set_min_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3913
|
+
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3914
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3915
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3916
|
+
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3917
|
+
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3918
|
+
std::size(kSigAlgs)) &&
|
|
3919
|
+
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
static int Configure(SSLImpl *ssl) {
|
|
3923
|
+
ssl->config->compliance_policy = ssl_compliance_policy_cnsa2_202603;
|
|
3924
|
+
|
|
3925
|
+
return SSL_set_min_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3926
|
+
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3927
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3928
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3929
|
+
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3930
|
+
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3931
|
+
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
3932
|
+
}
|
|
3933
|
+
|
|
3934
|
+
} // namespace cnsa2_202603
|
|
3935
|
+
|
|
3364
3936
|
int SSL_CTX_set_compliance_policy(SSL_CTX *ctx,
|
|
3365
3937
|
enum ssl_compliance_policy_t policy) {
|
|
3938
|
+
auto *ctx_impl = FromOpaque(ctx);
|
|
3366
3939
|
switch (policy) {
|
|
3367
3940
|
case ssl_compliance_policy_fips_202205:
|
|
3368
|
-
return fips202205::Configure(
|
|
3941
|
+
return fips202205::Configure(ctx_impl);
|
|
3942
|
+
case ssl_compliance_policy_fips_202609:
|
|
3943
|
+
return fips202609::Configure(ctx_impl);
|
|
3369
3944
|
case ssl_compliance_policy_wpa3_192_202304:
|
|
3370
|
-
return wpa202304::Configure(
|
|
3945
|
+
return wpa202304::Configure(ctx_impl);
|
|
3371
3946
|
case ssl_compliance_policy_cnsa_202407:
|
|
3372
|
-
return cnsa202407::Configure(
|
|
3947
|
+
return cnsa202407::Configure(ctx_impl);
|
|
3948
|
+
case ssl_compliance_policy_cnsa1_202603:
|
|
3949
|
+
return cnsa1_202603::Configure(ctx_impl);
|
|
3950
|
+
case ssl_compliance_policy_cnsa2_202603:
|
|
3951
|
+
return cnsa2_202603::Configure(ctx_impl);
|
|
3373
3952
|
default:
|
|
3374
3953
|
return 0;
|
|
3375
3954
|
}
|
|
3376
3955
|
}
|
|
3377
3956
|
|
|
3378
3957
|
enum ssl_compliance_policy_t SSL_CTX_get_compliance_policy(const SSL_CTX *ctx) {
|
|
3379
|
-
return ctx->compliance_policy;
|
|
3958
|
+
return FromOpaque(ctx)->compliance_policy;
|
|
3380
3959
|
}
|
|
3381
3960
|
|
|
3382
3961
|
int SSL_set_compliance_policy(SSL *ssl, enum ssl_compliance_policy_t policy) {
|
|
3962
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3383
3963
|
switch (policy) {
|
|
3384
3964
|
case ssl_compliance_policy_fips_202205:
|
|
3385
|
-
return fips202205::Configure(
|
|
3965
|
+
return fips202205::Configure(ssl_impl);
|
|
3966
|
+
case ssl_compliance_policy_fips_202609:
|
|
3967
|
+
return fips202609::Configure(ssl_impl);
|
|
3386
3968
|
case ssl_compliance_policy_wpa3_192_202304:
|
|
3387
|
-
return wpa202304::Configure(
|
|
3969
|
+
return wpa202304::Configure(ssl_impl);
|
|
3388
3970
|
case ssl_compliance_policy_cnsa_202407:
|
|
3389
|
-
return cnsa202407::Configure(
|
|
3971
|
+
return cnsa202407::Configure(ssl_impl);
|
|
3972
|
+
case ssl_compliance_policy_cnsa1_202603:
|
|
3973
|
+
return cnsa1_202603::Configure(ssl_impl);
|
|
3974
|
+
case ssl_compliance_policy_cnsa2_202603:
|
|
3975
|
+
return cnsa2_202603::Configure(ssl_impl);
|
|
3390
3976
|
default:
|
|
3391
3977
|
return 0;
|
|
3392
3978
|
}
|
|
3393
3979
|
}
|
|
3394
3980
|
|
|
3395
3981
|
enum ssl_compliance_policy_t SSL_get_compliance_policy(const SSL *ssl) {
|
|
3396
|
-
return ssl->config->compliance_policy;
|
|
3982
|
+
return FromOpaque(ssl)->config->compliance_policy;
|
|
3397
3983
|
}
|
|
3398
3984
|
|
|
3399
3985
|
int SSL_peer_matched_trust_anchor(const SSL *ssl) {
|
|
3400
|
-
return ssl->s3->hs != nullptr &&
|
|
3986
|
+
return FromOpaque(ssl)->s3->hs != nullptr &&
|
|
3987
|
+
FromOpaque(ssl)->s3->hs->peer_matched_trust_anchor;
|
|
3401
3988
|
}
|
|
3402
3989
|
|
|
3403
3990
|
void SSL_get0_peer_available_trust_anchors(const SSL *ssl, const uint8_t **out,
|
|
3404
3991
|
size_t *out_len) {
|
|
3405
3992
|
Span<const uint8_t> ret;
|
|
3406
|
-
if (SSL_HANDSHAKE *hs = ssl->s3->hs.get(); hs != nullptr) {
|
|
3993
|
+
if (SSL_HANDSHAKE *hs = FromOpaque(ssl)->s3->hs.get(); hs != nullptr) {
|
|
3407
3994
|
ret = hs->peer_available_trust_anchors;
|
|
3408
3995
|
}
|
|
3409
3996
|
*out = ret.data();
|
|
3410
3997
|
*out_len = ret.size();
|
|
3411
3998
|
}
|
|
3412
3999
|
|
|
4000
|
+
int SSL_CTX_set1_available_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
4001
|
+
size_t ids_len) {
|
|
4002
|
+
auto span = Span(ids, ids_len);
|
|
4003
|
+
if (span.empty() || !ssl_is_valid_trust_anchor_list(span)) {
|
|
4004
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_TRUST_ANCHOR_LIST);
|
|
4005
|
+
return 0;
|
|
4006
|
+
}
|
|
4007
|
+
return FromOpaque(ctx)->cert->available_trust_anchors.CopyFrom(span);
|
|
4008
|
+
}
|
|
4009
|
+
|
|
4010
|
+
int SSL_set1_available_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
4011
|
+
size_t ids_len) {
|
|
4012
|
+
if (!FromOpaque(ssl)->config) {
|
|
4013
|
+
return 0;
|
|
4014
|
+
}
|
|
4015
|
+
auto span = Span(ids, ids_len);
|
|
4016
|
+
if (span.empty() || !ssl_is_valid_trust_anchor_list(span)) {
|
|
4017
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_TRUST_ANCHOR_LIST);
|
|
4018
|
+
return 0;
|
|
4019
|
+
}
|
|
4020
|
+
return FromOpaque(ssl)->config->cert->available_trust_anchors.CopyFrom(span);
|
|
4021
|
+
}
|
|
4022
|
+
|
|
3413
4023
|
int SSL_CTX_set1_requested_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
3414
4024
|
size_t ids_len) {
|
|
3415
4025
|
auto span = Span(ids, ids_len);
|
|
@@ -3421,13 +4031,13 @@ int SSL_CTX_set1_requested_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
|
3421
4031
|
if (!copy.CopyFrom(span)) {
|
|
3422
4032
|
return 0;
|
|
3423
4033
|
}
|
|
3424
|
-
ctx->requested_trust_anchors = std::move(copy);
|
|
4034
|
+
FromOpaque(ctx)->requested_trust_anchors = std::move(copy);
|
|
3425
4035
|
return 1;
|
|
3426
4036
|
}
|
|
3427
4037
|
|
|
3428
4038
|
int SSL_set1_requested_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
3429
4039
|
size_t ids_len) {
|
|
3430
|
-
if (!ssl->config) {
|
|
4040
|
+
if (!FromOpaque(ssl)->config) {
|
|
3431
4041
|
return 0;
|
|
3432
4042
|
}
|
|
3433
4043
|
auto span = Span(ids, ids_len);
|
|
@@ -3439,6 +4049,105 @@ int SSL_set1_requested_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
|
3439
4049
|
if (!copy.CopyFrom(span)) {
|
|
3440
4050
|
return 0;
|
|
3441
4051
|
}
|
|
3442
|
-
ssl->config->requested_trust_anchors = std::move(copy);
|
|
4052
|
+
FromOpaque(ssl)->config->requested_trust_anchors = std::move(copy);
|
|
3443
4053
|
return 1;
|
|
3444
4054
|
}
|
|
4055
|
+
|
|
4056
|
+
int SSL_CTX_get_security_level(const SSL_CTX *ctx) { return 0; }
|
|
4057
|
+
|
|
4058
|
+
static bool is_valid_cert_types_list(Span<const uint8_t> list) {
|
|
4059
|
+
if (list.empty() || list.size() > kNumCertTypes) {
|
|
4060
|
+
return false;
|
|
4061
|
+
}
|
|
4062
|
+
for (size_t i = 0u; i < list.size(); ++i) {
|
|
4063
|
+
// Check that each value is a recognized cert type.
|
|
4064
|
+
if (std::find(std::begin(kAllCertTypes), std::end(kAllCertTypes),
|
|
4065
|
+
list[i]) == std::end(kAllCertTypes)) {
|
|
4066
|
+
return false;
|
|
4067
|
+
}
|
|
4068
|
+
// Reject duplicates.
|
|
4069
|
+
for (size_t j = 0u; j < i; ++j) {
|
|
4070
|
+
if (list[i] == list[j]) {
|
|
4071
|
+
return false;
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
return true;
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4078
|
+
static bool set1_cert_types(InplaceVector<uint8_t, kNumCertTypes> *out,
|
|
4079
|
+
Span<const uint8_t> values) {
|
|
4080
|
+
if (!is_valid_cert_types_list(values)) {
|
|
4081
|
+
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_CERT_TYPES_LIST);
|
|
4082
|
+
return false;
|
|
4083
|
+
}
|
|
4084
|
+
out->CopyFrom(values);
|
|
4085
|
+
return true;
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
int SSL_CTX_set1_accepted_peer_cert_types(SSL_CTX *ctx, const uint8_t *values,
|
|
4089
|
+
size_t num_values) {
|
|
4090
|
+
return set1_cert_types(&FromOpaque(ctx)->accepted_peer_cert_types,
|
|
4091
|
+
Span(values, num_values));
|
|
4092
|
+
}
|
|
4093
|
+
|
|
4094
|
+
int SSL_set1_accepted_peer_cert_types(SSL *ssl, const uint8_t *values,
|
|
4095
|
+
size_t num_values) {
|
|
4096
|
+
if (!FromOpaque(ssl)->config) {
|
|
4097
|
+
return 0;
|
|
4098
|
+
}
|
|
4099
|
+
return set1_cert_types(&FromOpaque(ssl)->config->accepted_peer_cert_types,
|
|
4100
|
+
Span(values, num_values));
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
int SSL_CTX_set1_available_client_cert_types(SSL_CTX *ctx,
|
|
4104
|
+
const uint8_t *values,
|
|
4105
|
+
size_t num_values) {
|
|
4106
|
+
return set1_cert_types(&FromOpaque(ctx)->available_client_cert_types,
|
|
4107
|
+
Span(values, num_values));
|
|
4108
|
+
}
|
|
4109
|
+
|
|
4110
|
+
int SSL_set1_available_client_cert_types(SSL *ssl, const uint8_t *values,
|
|
4111
|
+
size_t num_values) {
|
|
4112
|
+
if (!FromOpaque(ssl)->config) {
|
|
4113
|
+
return 0;
|
|
4114
|
+
}
|
|
4115
|
+
return set1_cert_types(&FromOpaque(ssl)->config->available_client_cert_types,
|
|
4116
|
+
Span(values, num_values));
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
int SSL_get_peer_cert_type(const SSL *ssl) {
|
|
4120
|
+
if (const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
4121
|
+
session != nullptr) {
|
|
4122
|
+
return session->peer_cert_type;
|
|
4123
|
+
}
|
|
4124
|
+
return kDefaultCertType;
|
|
4125
|
+
}
|
|
4126
|
+
|
|
4127
|
+
EVP_PKEY *SSL_get0_peer_rpk(const SSL *ssl) {
|
|
4128
|
+
if (const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
4129
|
+
session != nullptr) {
|
|
4130
|
+
return session->peer_raw_public_key.get();
|
|
4131
|
+
}
|
|
4132
|
+
return nullptr;
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
void SSL_set_server_padding_request(SSL *ssl, uint16_t num_bytes) {
|
|
4136
|
+
if (!FromOpaque(ssl)->config) {
|
|
4137
|
+
return;
|
|
4138
|
+
}
|
|
4139
|
+
|
|
4140
|
+
FromOpaque(ssl)->config->server_padding_request = num_bytes;
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
void SSL_set_server_padding_enabled(SSL *ssl, int enabled) {
|
|
4144
|
+
if (!FromOpaque(ssl)->config) {
|
|
4145
|
+
return;
|
|
4146
|
+
}
|
|
4147
|
+
|
|
4148
|
+
FromOpaque(ssl)->config->server_padding_enabled = enabled;
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
int SSL_server_sent_requested_padding(const SSL *ssl) {
|
|
4152
|
+
return FromOpaque(ssl)->s3->server_sent_requested_padding;
|
|
4153
|
+
}
|