grpc 1.85.4 → 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 +13 -9
- data/etc/roots.pem +0 -583
- data/include/grpc/channel_factory.h +78 -0
- data/include/grpc/credentials.h +21 -0
- data/include/grpc/grpc.h +7 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/module.modulemap +1 -0
- data/src/core/call/call_filters.cc +4 -1
- data/src/core/call/call_filters.h +3 -1
- 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/call/filter_fusion.h +2 -15
- data/src/core/call/interception_chain.h +2 -7
- data/src/core/call/metadata_batch.cc +5 -0
- data/src/core/call/metadata_batch.h +13 -3
- data/src/core/call/request_buffer.cc +1 -1
- data/src/core/call/server_call.cc +3 -3
- data/src/core/call/server_call.h +15 -0
- data/src/core/channelz/channelz_registry.cc +4 -4
- 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/global_subchannel_pool.cc +2 -2
- data/src/core/client_channel/lame_channel.cc +59 -0
- data/src/core/client_channel/lame_channel.h +86 -0
- data/src/core/credentials/call/external/aws_request_signer.cc +2 -1
- 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/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/ssl_utils.cc +20 -0
- data/src/core/credentials/transport/tls/ssl_utils.h +4 -0
- data/src/core/credentials/transport/tls/tls_security_connector.cc +6 -2
- data/src/core/ext/filters/rbac/rbac_filter.cc +3 -41
- data/src/core/ext/filters/rbac/rbac_filter.h +2 -11
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +31 -24
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +1 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +69 -102
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -1
- data/src/core/ext/transport/chttp2/transport/flow_control.h +2 -2
- 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 +1 -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/http2_client_transport.cc +34 -19
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +5 -2
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +134 -82
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +30 -15
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +4 -3
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +9 -33
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +1 -6
- data/src/core/ext/transport/chttp2/transport/http2_transport_stats.h +60 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -1
- data/src/core/ext/transport/chttp2/transport/keepalive.h +1 -4
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -8
- 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 +19 -5
- data/src/core/ext/transport/chttp2/transport/security_frame.h +7 -6
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +7 -5
- 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/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/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/filter/ext_proc/ext_proc_filter.cc +537 -259
- data/src/core/filter/ext_proc/ext_proc_filter.h +47 -14
- data/src/core/filter/ext_proc/ext_proc_messages.cc +38 -17
- data/src/core/filter/ext_proc/ext_proc_messages.h +19 -7
- data/src/core/filter/filter_args.h +5 -60
- data/src/core/handshaker/http_connect/http_connect_client_handshaker.cc +1 -1
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +23 -22
- data/src/core/handshaker/security/secure_endpoint.cc +16 -16
- 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 +57 -44
- data/src/core/lib/channel/promise_based_filter.h +29 -41
- data/src/core/lib/event_engine/ares_resolver.cc +10 -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/posix_engine/ev_epoll1_linux.cc +1 -5
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -12
- data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +3 -17
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +21 -1
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +10 -12
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
- data/src/core/lib/event_engine/posix_engine/timer.cc +2 -2
- 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/windows/windows_engine.cc +4 -4
- data/src/core/lib/event_engine/windows/windows_listener.cc +1 -1
- data/src/core/lib/experiments/experiments.cc +141 -246
- data/src/core/lib/experiments/experiments.h +42 -109
- data/src/core/lib/iomgr/iomgr_windows.cc +1 -6
- data/src/core/lib/iomgr/tcp_posix.cc +21 -21
- 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 +8 -8
- data/src/core/lib/promise/activity.h +5 -5
- data/src/core/lib/promise/inter_activity_pipe.h +3 -3
- data/src/core/lib/promise/party.cc +5 -5
- data/src/core/lib/promise/status_flag.h +7 -2
- data/src/core/lib/resource_quota/memory_quota.cc +2 -2
- data/src/core/lib/security/authorization/rbac_policy.h +2 -2
- data/src/core/lib/surface/call.cc +13 -3
- data/src/core/lib/surface/call.h +23 -6
- data/src/core/lib/surface/channel_create.cc +7 -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 +3 -3
- data/src/core/lib/surface/legacy_channel.cc +4 -1
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/transport.cc +15 -8
- data/src/core/lib/transport/transport_framing_endpoint_extension.h +8 -2
- data/src/core/load_balancing/autosharding/autosharding.cc +0 -8
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +99 -8
- 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 +2 -1
- data/src/core/load_balancing/rls/rls.cc +21 -1
- data/src/core/load_balancing/xds/cds.cc +4 -51
- data/src/core/plugin_registry/grpc_plugin_registry.cc +10 -13
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -7
- data/src/core/resolver/xds/xds_resolver.cc +1 -1
- data/src/core/server/server.cc +60 -4
- 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/transport/auth_context.cc +15 -5
- data/src/core/transport/auth_context.h +5 -0
- data/src/core/tsi/ssl_telemetry_utils.cc +9 -1
- data/src/core/tsi/ssl_transport_security.cc +158 -52
- data/src/core/tsi/ssl_transport_security.h +18 -2
- data/src/core/tsi/ssl_transport_security_utils.cc +123 -12
- data/src/core/tsi/ssl_transport_security_utils.h +19 -0
- data/src/core/util/latent_see.cc +65 -3
- data/src/core/util/latent_see.h +57 -12
- data/src/core/util/linux/cpu.cc +12 -6
- data/src/core/util/mpscq.cc +2 -2
- data/src/core/util/sync_abseil.cc +3 -3
- 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 +1 -1
- 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 +5 -2
- data/src/core/xds/grpc/streaming_call_promise_wrapper.h +2 -5
- 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 +2 -28
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +0 -20
- data/src/core/xds/grpc/xds_client_grpc.cc +4 -4
- 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_common_types_parser.cc +12 -0
- data/src/core/xds/grpc/xds_endpoint_parser.cc +3 -3
- 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 +1 -5
- 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 +2 -1
- data/src/core/xds/grpc/xds_matcher_context.cc +3 -0
- data/src/core/xds/grpc/xds_matcher_context.h +1 -1
- 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 +1 -112
- data/src/core/xds/grpc/xds_routing.h +0 -26
- 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 +78 -241
- data/src/core/xds/grpc/xds_transport_grpc.h +41 -51
- data/src/core/xds/xds_client/lrs_client.cc +3 -5
- data/src/core/xds/xds_client/lrs_client.h +2 -1
- data/src/core/xds/xds_client/xds_client.cc +36 -23
- data/src/core/xds/xds_client/xds_client.h +6 -5
- data/src/core/xds/xds_client/xds_transport.h +110 -108
- data/src/core/xds/xds_client/xds_transport_factory.h +43 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/crypto/asn1/a_type.cc +54 -19
- data/third_party/boringssl-with-bazel/crypto/asn1/asn1_lib.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/asn1/internal.h +58 -12
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_dec.cc +13 -13
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_enc.cc +13 -11
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_fre.cc +14 -18
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_new.cc +31 -35
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_typ.cc +0 -2
- data/third_party/boringssl-with-bazel/crypto/asn1/tasn_utl.cc +17 -24
- data/third_party/boringssl-with-bazel/crypto/bio/bio.cc +0 -1
- data/third_party/boringssl-with-bazel/crypto/bio/bio_mem.cc +9 -3
- data/third_party/boringssl-with-bazel/crypto/bio/connect.cc +3 -3
- data/third_party/boringssl-with-bazel/crypto/bio/fd.cc +0 -1
- data/third_party/boringssl-with-bazel/crypto/bio/file.cc +0 -1
- data/third_party/boringssl-with-bazel/crypto/bio/internal.h +2 -3
- data/third_party/boringssl-with-bazel/crypto/bio/pair.cc +0 -1
- data/third_party/boringssl-with-bazel/crypto/bio/socket.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbb.cc +70 -45
- data/third_party/boringssl-with-bazel/crypto/bytestring/cbs.cc +15 -34
- data/third_party/boringssl-with-bazel/crypto/bytestring/internal.h +5 -0
- data/third_party/boringssl-with-bazel/crypto/cipher/e_aesgcmsiv.cc +20 -165
- data/third_party/boringssl-with-bazel/crypto/cipher/e_tls.cc +7 -4
- data/third_party/boringssl-with-bazel/crypto/cipher/internal.h +159 -0
- data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519.cc +295 -16
- data/third_party/boringssl-with-bazel/crypto/curve25519/internal.h +25 -14
- data/third_party/boringssl-with-bazel/crypto/dh/params.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/ec/hash_to_curve.cc +208 -36
- data/third_party/boringssl-with-bazel/crypto/err/err.cc +3 -2
- data/third_party/boringssl-with-bazel/crypto/evp/evp.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/evp/evp_kem.cc +25 -6
- data/third_party/boringssl-with-bazel/crypto/evp/internal.h +15 -11
- data/third_party/boringssl-with-bazel/crypto/evp/p_ec.cc +121 -0
- data/third_party/boringssl-with-bazel/crypto/evp/p_mlkem.cc +34 -9
- data/third_party/boringssl-with-bazel/crypto/evp/p_rsa.cc +76 -8
- data/third_party/boringssl-with-bazel/crypto/evp/p_xwing.cc +47 -20
- data/third_party/boringssl-with-bazel/crypto/ex_data.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/aes_nohw.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/gcm.cc.inc +2 -2
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bcm.cc +1 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/add.cc.inc +9 -4
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +4 -4
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/exponentiation.cc.inc +2 -2
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/internal.h +12 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/jacobi.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/montgomery_inv.cc.inc +4 -4
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/prime.cc.inc +3 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/rsaz_exp.cc.inc +6 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/sqrt.cc.inc +21 -21
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/aead.cc.inc +4 -2
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/cipher.cc.inc +97 -132
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/internal.h +7 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/dh.cc.inc +3 -3
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/internal.h +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec.cc.inc +77 -17
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec_montgomery.cc.inc +13 -13
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/felem.cc.inc +117 -34
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/internal.h +67 -18
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/oct.cc.inc +29 -151
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.cc.inc +740 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.h +207 -0
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256.cc.inc +407 -519
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/simple.cc.inc +27 -28
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/jitter.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/fips_shared_support.cc +4 -4
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/internal.h +70 -1
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/keccak.cc.inc +292 -52
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mldsa/mldsa.cc.inc +226 -69
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/mlkem/mlkem.cc.inc +238 -83
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/rsa_impl.cc.inc +6 -6
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha1.cc.inc +2 -2
- data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/fors.cc.inc +1 -1
- data/third_party/boringssl-with-bazel/crypto/hpke/hpke.cc +327 -272
- data/third_party/boringssl-with-bazel/crypto/hrss/hrss.cc +14 -14
- data/third_party/boringssl-with-bazel/crypto/internal.h +63 -0
- data/third_party/boringssl-with-bazel/crypto/mem_internal.h +38 -3
- data/third_party/boringssl-with-bazel/crypto/obj/obj_dat.h +97 -1
- data/third_party/boringssl-with-bazel/crypto/pem/internal.h +86 -0
- data/third_party/boringssl-with-bazel/crypto/pem/pem_all.cc +8 -5
- data/third_party/boringssl-with-bazel/crypto/pem/pem_lib.cc +41 -73
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pk8.cc +3 -0
- data/third_party/boringssl-with-bazel/crypto/pem/pem_pkey.cc +10 -4
- 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/pkcs7.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7_x509.cc +2 -2
- data/third_party/boringssl-with-bazel/crypto/pkcs8/pkcs8_x509.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/poly1305/internal.h +17 -0
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_arm.cc +1 -13
- data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_vec.cc +3 -3
- data/third_party/boringssl-with-bazel/crypto/slhdsa/slhdsa.cc +23 -6
- data/third_party/boringssl-with-bazel/crypto/stack/stack.cc +7 -0
- data/third_party/boringssl-with-bazel/crypto/trust_token/internal.h +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/a_verify.cc +14 -7
- data/third_party/boringssl-with-bazel/crypto/x509/internal.h +110 -76
- data/third_party/boringssl-with-bazel/crypto/x509/name_print.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/rsa_pss.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/t_req.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/t_x509.cc +6 -5
- data/third_party/boringssl-with-bazel/crypto/x509/v3_crld.cc +11 -53
- data/third_party/boringssl-with-bazel/crypto/x509/v3_ncons.cc +5 -5
- data/third_party/boringssl-with-bazel/crypto/x509/v3_purp.cc +16 -39
- data/third_party/boringssl-with-bazel/crypto/x509/v3_skey.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/v3_utl.cc +12 -16
- data/third_party/boringssl-with-bazel/crypto/x509/x509_cmp.cc +9 -11
- data/third_party/boringssl-with-bazel/crypto/x509/x509_mtc.cc +598 -0
- data/third_party/boringssl-with-bazel/crypto/x509/x509_obj.cc +9 -8
- data/third_party/boringssl-with-bazel/crypto/x509/x509_set.cc +14 -18
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vfy.cc +315 -390
- data/third_party/boringssl-with-bazel/crypto/x509/x509_vpm.cc +1 -1
- data/third_party/boringssl-with-bazel/crypto/x509/x509name.cc +31 -29
- data/third_party/boringssl-with-bazel/crypto/x509/x_all.cc +10 -9
- data/third_party/boringssl-with-bazel/crypto/x509/x_crl.cc +3 -53
- data/third_party/boringssl-with-bazel/crypto/x509/x_name.cc +37 -59
- data/third_party/boringssl-with-bazel/crypto/x509/x_pubkey.cc +29 -47
- data/third_party/boringssl-with-bazel/crypto/x509/x_req.cc +2 -1
- data/third_party/boringssl-with-bazel/crypto/x509/x_x509.cc +53 -53
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +24 -0
- data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +24 -0
- data/third_party/boringssl-with-bazel/gen/crypto/err_data.cc +509 -497
- data/third_party/boringssl-with-bazel/include/openssl/aead.h +7 -19
- data/third_party/boringssl-with-bazel/include/openssl/asm_base.h +1 -1
- data/third_party/boringssl-with-bazel/include/openssl/asn1.h +6 -10
- data/third_party/boringssl-with-bazel/include/openssl/base.h +43 -16
- data/third_party/boringssl-with-bazel/include/openssl/bio.h +25 -10
- data/third_party/boringssl-with-bazel/include/openssl/bytestring.h +33 -1
- data/third_party/boringssl-with-bazel/include/openssl/cipher.h +11 -9
- data/third_party/boringssl-with-bazel/include/openssl/configuration.h +18 -0
- data/third_party/boringssl-with-bazel/include/openssl/curve25519.h +36 -0
- data/third_party/boringssl-with-bazel/include/openssl/digest.h +4 -4
- data/third_party/boringssl-with-bazel/include/openssl/ec.h +35 -1
- data/third_party/boringssl-with-bazel/include/openssl/ec_key.h +2 -2
- data/third_party/boringssl-with-bazel/include/openssl/evp.h +120 -3
- data/third_party/boringssl-with-bazel/include/openssl/evp_errors.h +1 -0
- data/third_party/boringssl-with-bazel/include/openssl/hmac.h +2 -2
- data/third_party/boringssl-with-bazel/include/openssl/hpke.h +38 -7
- data/third_party/boringssl-with-bazel/include/openssl/mem.h +5 -5
- data/third_party/boringssl-with-bazel/include/openssl/nid.h +42 -0
- data/third_party/boringssl-with-bazel/include/openssl/pem.h +650 -351
- data/third_party/boringssl-with-bazel/include/openssl/posix_time.h +4 -4
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols.h +130 -4
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_S.h +48 -0
- data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_c.h +24 -0
- data/third_party/boringssl-with-bazel/include/openssl/rsa.h +1 -1
- data/third_party/boringssl-with-bazel/include/openssl/slhdsa.h +25 -1
- data/third_party/boringssl-with-bazel/include/openssl/ssl.h +256 -87
- data/third_party/boringssl-with-bazel/include/openssl/stack.h +9 -0
- data/third_party/boringssl-with-bazel/include/openssl/types.h +18 -0
- data/third_party/boringssl-with-bazel/include/openssl/x509.h +40 -21
- data/third_party/boringssl-with-bazel/ssl/bio_ssl.cc +3 -5
- data/third_party/boringssl-with-bazel/ssl/d1_both.cc +146 -81
- data/third_party/boringssl-with-bazel/ssl/d1_lib.cc +39 -34
- data/third_party/boringssl-with-bazel/ssl/d1_pkt.cc +6 -6
- data/third_party/boringssl-with-bazel/ssl/d1_srtp.cc +10 -8
- data/third_party/boringssl-with-bazel/ssl/dtls_method.cc +4 -4
- data/third_party/boringssl-with-bazel/ssl/dtls_record.cc +15 -14
- data/third_party/boringssl-with-bazel/ssl/encrypted_client_hello.cc +41 -25
- data/third_party/boringssl-with-bazel/ssl/extensions.cc +153 -171
- data/third_party/boringssl-with-bazel/ssl/handoff.cc +79 -64
- data/third_party/boringssl-with-bazel/ssl/handshake.cc +15 -16
- data/third_party/boringssl-with-bazel/ssl/handshake_client.cc +35 -78
- data/third_party/boringssl-with-bazel/ssl/handshake_server.cc +75 -155
- data/third_party/boringssl-with-bazel/ssl/internal.h +419 -308
- data/third_party/boringssl-with-bazel/ssl/s3_both.cc +17 -150
- data/third_party/boringssl-with-bazel/ssl/s3_lib.cc +2 -3
- data/third_party/boringssl-with-bazel/ssl/s3_pkt.cc +10 -9
- data/third_party/boringssl-with-bazel/ssl/ssl_asn1.cc +13 -13
- data/third_party/boringssl-with-bazel/ssl/ssl_buffer.cc +8 -8
- data/third_party/boringssl-with-bazel/ssl/ssl_cert.cc +58 -24
- data/third_party/boringssl-with-bazel/ssl/ssl_cipher.cc +198 -26
- data/third_party/boringssl-with-bazel/ssl/ssl_credential.cc +164 -37
- data/third_party/boringssl-with-bazel/ssl/ssl_file.cc +10 -8
- data/third_party/boringssl-with-bazel/ssl/ssl_key_share.cc +2 -95
- data/third_party/boringssl-with-bazel/ssl/ssl_lib.cc +785 -472
- data/third_party/boringssl-with-bazel/ssl/ssl_privkey.cc +78 -67
- data/third_party/boringssl-with-bazel/ssl/ssl_session.cc +187 -150
- data/third_party/boringssl-with-bazel/ssl/ssl_stat.cc +6 -3
- data/third_party/boringssl-with-bazel/ssl/ssl_transcript.cc +1 -1
- data/third_party/boringssl-with-bazel/ssl/ssl_versions.cc +25 -19
- data/third_party/boringssl-with-bazel/ssl/ssl_x509.cc +148 -114
- data/third_party/boringssl-with-bazel/ssl/t1_enc.cc +28 -19
- data/third_party/boringssl-with-bazel/ssl/tls13_both.cc +24 -22
- data/third_party/boringssl-with-bazel/ssl/tls13_client.cc +30 -30
- data/third_party/boringssl-with-bazel/ssl/tls13_enc.cc +17 -16
- data/third_party/boringssl-with-bazel/ssl/tls13_server.cc +55 -63
- data/third_party/boringssl-with-bazel/ssl/tls_method.cc +12 -12
- data/third_party/boringssl-with-bazel/ssl/tls_record.cc +23 -20
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64.h +38 -0
- data/third_party/boringssl-with-bazel/third_party/fiat/p256_64_msvc.h +2 -0
- 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_point.br.c.inc +0 -54
- 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 +23 -9
- 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/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/boringssl-with-bazel/crypto/fipsmodule/ec/p256_internal.h +0 -193
- data/third_party/boringssl-with-bazel/crypto/kyber/internal.h +0 -165
- data/third_party/boringssl-with-bazel/crypto/kyber/kyber.cc +0 -870
|
@@ -72,7 +72,7 @@ static const size_t kMaxHandshakeSize = (1u << 24) - 1;
|
|
|
72
72
|
static ExDataClass g_ex_data_class_ssl(/*with_app_data=*/true);
|
|
73
73
|
static ExDataClass g_ex_data_class_ssl_ctx(/*with_app_data=*/true);
|
|
74
74
|
|
|
75
|
-
void ssl_reset_error_state(
|
|
75
|
+
void ssl_reset_error_state(SSLImpl *ssl) {
|
|
76
76
|
// Functions which use `SSL_get_error` must reset I/O and error state on
|
|
77
77
|
// entry.
|
|
78
78
|
ssl->s3->rwstate = SSL_ERROR_NONE;
|
|
@@ -80,12 +80,12 @@ void ssl_reset_error_state(SSL *ssl) {
|
|
|
80
80
|
ERR_clear_system_error();
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
void ssl_set_read_error(
|
|
83
|
+
void ssl_set_read_error(SSLImpl *ssl) {
|
|
84
84
|
ssl->s3->read_shutdown = ssl_shutdown_error;
|
|
85
85
|
ssl->s3->read_error.reset(ERR_save_state());
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
static bool check_read_error(const
|
|
88
|
+
static bool check_read_error(const SSLImpl *ssl) {
|
|
89
89
|
if (ssl->s3->read_shutdown == ssl_shutdown_error) {
|
|
90
90
|
ERR_restore_state(ssl->s3->read_error.get());
|
|
91
91
|
return false;
|
|
@@ -93,15 +93,15 @@ static bool check_read_error(const SSL *ssl) {
|
|
|
93
93
|
return true;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
bool ssl_can_write(const
|
|
96
|
+
bool ssl_can_write(const SSLImpl *ssl) {
|
|
97
97
|
return !SSL_in_init(ssl) || ssl->s3->hs->can_early_write;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
bool ssl_can_read(const
|
|
100
|
+
bool ssl_can_read(const SSLImpl *ssl) {
|
|
101
101
|
return !SSL_in_init(ssl) || ssl->s3->hs->can_early_read;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
ssl_open_record_t ssl_open_handshake(
|
|
104
|
+
ssl_open_record_t ssl_open_handshake(SSLImpl *ssl, size_t *out_consumed,
|
|
105
105
|
uint8_t *out_alert, Span<uint8_t> in) {
|
|
106
106
|
*out_consumed = 0;
|
|
107
107
|
if (!check_read_error(ssl)) {
|
|
@@ -115,7 +115,8 @@ ssl_open_record_t ssl_open_handshake(SSL *ssl, size_t *out_consumed,
|
|
|
115
115
|
return ret;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
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,
|
|
119
120
|
uint8_t *out_alert,
|
|
120
121
|
Span<uint8_t> in) {
|
|
121
122
|
*out_consumed = 0;
|
|
@@ -131,7 +132,7 @@ ssl_open_record_t ssl_open_change_cipher_spec(SSL *ssl, size_t *out_consumed,
|
|
|
131
132
|
return ret;
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
ssl_open_record_t ssl_open_app_data(
|
|
135
|
+
ssl_open_record_t ssl_open_app_data(SSLImpl *ssl, Span<uint8_t> *out,
|
|
135
136
|
size_t *out_consumed, uint8_t *out_alert,
|
|
136
137
|
Span<uint8_t> in) {
|
|
137
138
|
*out_consumed = 0;
|
|
@@ -166,7 +167,7 @@ static bool cbb_add_hex_consttime(CBB *cbb, Span<const uint8_t> in) {
|
|
|
166
167
|
return true;
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
bool ssl_log_secret(const
|
|
170
|
+
bool ssl_log_secret(const SSLImpl *ssl, const char *label,
|
|
170
171
|
Span<const uint8_t> secret) {
|
|
171
172
|
if (ssl->ctx->keylog_callback == nullptr) {
|
|
172
173
|
return true;
|
|
@@ -193,7 +194,7 @@ bool ssl_log_secret(const SSL *ssl, const char *label,
|
|
|
193
194
|
return true;
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
void ssl_do_info_callback(const
|
|
197
|
+
void ssl_do_info_callback(const SSLImpl *ssl, int type, int value) {
|
|
197
198
|
void (*cb)(const SSL *ssl, int type, int value) = nullptr;
|
|
198
199
|
if (ssl->info_callback != nullptr) {
|
|
199
200
|
cb = ssl->info_callback;
|
|
@@ -206,7 +207,7 @@ void ssl_do_info_callback(const SSL *ssl, int type, int value) {
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
void ssl_do_msg_callback(const
|
|
210
|
+
void ssl_do_msg_callback(const SSLImpl *ssl, int is_write, int content_type,
|
|
210
211
|
Span<const uint8_t> in) {
|
|
211
212
|
if (ssl->msg_callback == nullptr) {
|
|
212
213
|
return;
|
|
@@ -228,7 +229,7 @@ void ssl_do_msg_callback(const SSL *ssl, int is_write, int content_type,
|
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
ssl->msg_callback(is_write, version, content_type, in.data(), in.size(),
|
|
231
|
-
const_cast<
|
|
232
|
+
const_cast<SSLImpl *>(ssl), ssl->msg_callback_arg);
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
OPENSSL_timeval ssl_ctx_get_current_time(const SSLContext *ctx) {
|
|
@@ -273,7 +274,7 @@ void SSL_CTX_set_handoff_mode(SSL_CTX *ctx, bool on) {
|
|
|
273
274
|
FromOpaque(ctx)->handoff = on;
|
|
274
275
|
}
|
|
275
276
|
|
|
276
|
-
static bool ssl_can_renegotiate(const
|
|
277
|
+
static bool ssl_can_renegotiate(const SSLImpl *ssl) {
|
|
277
278
|
if (ssl->server || SSL_is_dtls(ssl)) {
|
|
278
279
|
return false;
|
|
279
280
|
}
|
|
@@ -304,7 +305,7 @@ static bool ssl_can_renegotiate(const SSL *ssl) {
|
|
|
304
305
|
return false;
|
|
305
306
|
}
|
|
306
307
|
|
|
307
|
-
static void ssl_maybe_shed_handshake_config(
|
|
308
|
+
static void ssl_maybe_shed_handshake_config(SSLImpl *ssl) {
|
|
308
309
|
if (ssl->s3->hs != nullptr || //
|
|
309
310
|
ssl->config == nullptr || //
|
|
310
311
|
!ssl->config->shed_handshake_config || //
|
|
@@ -316,50 +317,40 @@ static void ssl_maybe_shed_handshake_config(SSL *ssl) {
|
|
|
316
317
|
}
|
|
317
318
|
|
|
318
319
|
void SSL_set_handoff_mode(SSL *ssl, bool on) {
|
|
319
|
-
|
|
320
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
321
|
+
if (!ssl_impl->config) {
|
|
320
322
|
return;
|
|
321
323
|
}
|
|
322
|
-
|
|
324
|
+
ssl_impl->config->handoff = on;
|
|
323
325
|
}
|
|
324
326
|
|
|
325
327
|
bool SSL_get_traffic_secrets(const SSL *ssl,
|
|
326
328
|
Span<const uint8_t> *out_read_traffic_secret,
|
|
327
329
|
Span<const uint8_t> *out_write_traffic_secret) {
|
|
330
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
328
331
|
// This API is not well-defined for DTLS, where multiple epochs may be alive
|
|
329
332
|
// at once. Callers should use `SSL_get_dtls_*_traffic_secret` instead. In
|
|
330
333
|
// QUIC, the application is already handed the traffic secret.
|
|
331
|
-
if (SSL_is_dtls(
|
|
334
|
+
if (SSL_is_dtls(ssl_impl) || SSL_is_quic(ssl_impl)) {
|
|
332
335
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
333
336
|
return false;
|
|
334
337
|
}
|
|
335
338
|
|
|
336
|
-
if (!
|
|
339
|
+
if (!ssl_impl->s3->initial_handshake_complete) {
|
|
337
340
|
OPENSSL_PUT_ERROR(SSL, SSL_R_HANDSHAKE_NOT_COMPLETE);
|
|
338
341
|
return false;
|
|
339
342
|
}
|
|
340
343
|
|
|
341
|
-
if (SSL_version(
|
|
344
|
+
if (SSL_version(ssl_impl) < TLS1_3_VERSION) {
|
|
342
345
|
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_SSL_VERSION);
|
|
343
346
|
return false;
|
|
344
347
|
}
|
|
345
348
|
|
|
346
|
-
*out_read_traffic_secret =
|
|
347
|
-
*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;
|
|
348
351
|
return true;
|
|
349
352
|
}
|
|
350
353
|
|
|
351
|
-
void SSL_CTX_set_aes_hw_override_for_testing(SSL_CTX *ctx,
|
|
352
|
-
bool override_value) {
|
|
353
|
-
auto *ctx_impl = FromOpaque(ctx);
|
|
354
|
-
ctx_impl->aes_hw_override = true;
|
|
355
|
-
ctx_impl->aes_hw_override_value = override_value;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
void SSL_set_aes_hw_override_for_testing(SSL *ssl, bool override_value) {
|
|
359
|
-
ssl->config->aes_hw_override = true;
|
|
360
|
-
ssl->config->aes_hw_override_value = override_value;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
354
|
BSSL_NAMESPACE_END
|
|
364
355
|
|
|
365
356
|
using namespace bssl;
|
|
@@ -370,12 +361,14 @@ int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) {
|
|
|
370
361
|
return 1;
|
|
371
362
|
}
|
|
372
363
|
|
|
364
|
+
// TODO(crbug.com/565766495): Take `SSLSession` when the lhash does.
|
|
373
365
|
static uint32_t ssl_session_hash(const SSL_SESSION *sess) {
|
|
374
|
-
return ssl_hash_session_id(sess->session_id);
|
|
366
|
+
return ssl_hash_session_id(FromOpaque(sess)->session_id);
|
|
375
367
|
}
|
|
376
368
|
|
|
369
|
+
// TODO(crbug.com/565766495): Take `SSLSession` when the lhash does.
|
|
377
370
|
static int ssl_session_cmp(const SSL_SESSION *a, const SSL_SESSION *b) {
|
|
378
|
-
return Span(a->session_id) == b->session_id ? 0 : 1;
|
|
371
|
+
return Span(FromOpaque(a)->session_id) == FromOpaque(b)->session_id ? 0 : 1;
|
|
379
372
|
}
|
|
380
373
|
|
|
381
374
|
bssl::SSLContext::SSLContext(const SSL_METHOD *ssl_method)
|
|
@@ -388,13 +381,12 @@ bssl::SSLContext::SSLContext(const SSL_METHOD *ssl_method)
|
|
|
388
381
|
signed_cert_timestamps_enabled(false),
|
|
389
382
|
channel_id_enabled(false),
|
|
390
383
|
grease_enabled(false),
|
|
384
|
+
grease_sigalgs_enabled(false),
|
|
391
385
|
permute_extensions(false),
|
|
392
386
|
allow_unknown_alpn_protos(false),
|
|
393
387
|
false_start_allowed_without_alpn(false),
|
|
394
388
|
handoff(false),
|
|
395
389
|
enable_early_data(false),
|
|
396
|
-
aes_hw_override(false),
|
|
397
|
-
aes_hw_override_value(false),
|
|
398
390
|
resumption_across_names_enabled(false) {
|
|
399
391
|
CRYPTO_new_ex_data(&ex_data);
|
|
400
392
|
}
|
|
@@ -436,6 +428,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *method) {
|
|
|
436
428
|
}
|
|
437
429
|
|
|
438
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) ||
|
|
439
432
|
// Lock the SSL_CTX to the specified version, for compatibility with
|
|
440
433
|
// legacy uses of SSL_METHOD.
|
|
441
434
|
!SSL_CTX_set_max_proto_version(ret.get(), method->version) ||
|
|
@@ -466,7 +459,7 @@ void SSL_CTX_free(SSL_CTX *ctx) {
|
|
|
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,7 +476,7 @@ ssl_st::ssl_st(SSLContext *ctx_arg)
|
|
|
483
476
|
CRYPTO_new_ex_data(&ex_data);
|
|
484
477
|
}
|
|
485
478
|
|
|
486
|
-
|
|
479
|
+
bssl::SSLImpl::~SSLImpl() {
|
|
487
480
|
CRYPTO_free_ex_data(&g_ex_data_class_ssl, &ex_data);
|
|
488
481
|
// `config` refers to `this`, so we must release it earlier.
|
|
489
482
|
config.reset();
|
|
@@ -499,7 +492,7 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
|
499
492
|
return nullptr;
|
|
500
493
|
}
|
|
501
494
|
|
|
502
|
-
UniquePtr<
|
|
495
|
+
UniquePtr<SSLImpl> ssl = MakeUnique<SSLImpl>(ctx_impl);
|
|
503
496
|
if (ssl == nullptr) {
|
|
504
497
|
return nullptr;
|
|
505
498
|
}
|
|
@@ -522,10 +515,12 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
|
522
515
|
ssl->config->retain_only_sha256_of_client_certs =
|
|
523
516
|
ctx_impl->retain_only_sha256_of_client_certs;
|
|
524
517
|
ssl->config->permute_extensions = ctx_impl->permute_extensions;
|
|
525
|
-
ssl->config->aes_hw_override = ctx_impl->aes_hw_override;
|
|
526
|
-
ssl->config->aes_hw_override_value = ctx_impl->aes_hw_override_value;
|
|
527
518
|
ssl->config->compliance_policy = ctx_impl->compliance_policy;
|
|
528
519
|
|
|
520
|
+
if (!ssl->config->tls13_cipher_list.CopyFrom(ctx_impl->tls13_cipher_list)) {
|
|
521
|
+
return nullptr;
|
|
522
|
+
}
|
|
523
|
+
|
|
529
524
|
if (!ssl->config->supported_group_list.CopyFrom(
|
|
530
525
|
ctx_impl->supported_group_list) ||
|
|
531
526
|
!ssl->config->supported_group_list_flags.CopyFrom(
|
|
@@ -575,13 +570,13 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
|
|
575
570
|
return ssl.release();
|
|
576
571
|
}
|
|
577
572
|
|
|
578
|
-
SSL_CONFIG::SSL_CONFIG(
|
|
573
|
+
SSL_CONFIG::SSL_CONFIG(SSLImpl *ssl_arg)
|
|
579
574
|
: ssl(ssl_arg),
|
|
580
575
|
ech_grease_enabled(false),
|
|
576
|
+
reject_unusable_ech_config(false),
|
|
581
577
|
signed_cert_timestamps_enabled(false),
|
|
582
578
|
ocsp_stapling_enabled(false),
|
|
583
579
|
channel_id_enabled(false),
|
|
584
|
-
enforce_rsa_key_usage(true),
|
|
585
580
|
retain_only_sha256_of_client_certs(false),
|
|
586
581
|
handoff(false),
|
|
587
582
|
shed_handshake_config(false),
|
|
@@ -599,21 +594,23 @@ SSL_CONFIG::~SSL_CONFIG() {
|
|
|
599
594
|
}
|
|
600
595
|
}
|
|
601
596
|
|
|
602
|
-
void SSL_free(SSL *ssl) { Delete(ssl); }
|
|
597
|
+
void SSL_free(SSL *ssl) { Delete(FromOpaque(ssl)); }
|
|
603
598
|
|
|
604
599
|
void SSL_set_connect_state(SSL *ssl) {
|
|
605
|
-
|
|
606
|
-
|
|
600
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
601
|
+
ssl_impl->server = false;
|
|
602
|
+
ssl_impl->do_handshake = ssl_client_handshake;
|
|
607
603
|
}
|
|
608
604
|
|
|
609
605
|
void SSL_set_accept_state(SSL *ssl) {
|
|
610
|
-
|
|
611
|
-
|
|
606
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
607
|
+
ssl_impl->server = true;
|
|
608
|
+
ssl_impl->do_handshake = ssl_server_handshake;
|
|
612
609
|
}
|
|
613
610
|
|
|
614
|
-
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); }
|
|
615
612
|
|
|
616
|
-
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); }
|
|
617
614
|
|
|
618
615
|
void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
|
|
619
616
|
// For historical reasons, this function has many different cases in ownership
|
|
@@ -649,12 +646,13 @@ void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio) {
|
|
|
649
646
|
SSL_set0_wbio(ssl, wbio);
|
|
650
647
|
}
|
|
651
648
|
|
|
652
|
-
BIO *SSL_get_rbio(const SSL *ssl) { return ssl->rbio.get(); }
|
|
649
|
+
BIO *SSL_get_rbio(const SSL *ssl) { return FromOpaque(ssl)->rbio.get(); }
|
|
653
650
|
|
|
654
|
-
BIO *SSL_get_wbio(const SSL *ssl) { return ssl->wbio.get(); }
|
|
651
|
+
BIO *SSL_get_wbio(const SSL *ssl) { return FromOpaque(ssl)->wbio.get(); }
|
|
655
652
|
|
|
656
653
|
size_t SSL_quic_max_handshake_flight_len(const SSL *ssl,
|
|
657
654
|
enum ssl_encryption_level_t level) {
|
|
655
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
658
656
|
// Limits flights to 16K by default when there are no large
|
|
659
657
|
// (certificate-carrying) messages.
|
|
660
658
|
static const size_t kDefaultLimit = 16384;
|
|
@@ -666,18 +664,18 @@ size_t SSL_quic_max_handshake_flight_len(const SSL *ssl,
|
|
|
666
664
|
// QUIC does not send EndOfEarlyData.
|
|
667
665
|
return 0;
|
|
668
666
|
case ssl_encryption_handshake:
|
|
669
|
-
if (
|
|
667
|
+
if (ssl_impl->server) {
|
|
670
668
|
// Servers may receive Certificate message if configured to request
|
|
671
669
|
// client certificates.
|
|
672
|
-
if (!!(
|
|
673
|
-
|
|
674
|
-
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;
|
|
675
673
|
}
|
|
676
674
|
} else {
|
|
677
675
|
// Clients may receive both Certificate message and a CertificateRequest
|
|
678
676
|
// message.
|
|
679
|
-
if (2 *
|
|
680
|
-
return 2 *
|
|
677
|
+
if (2 * ssl_impl->max_cert_list > kDefaultLimit) {
|
|
678
|
+
return 2 * ssl_impl->max_cert_list;
|
|
681
679
|
}
|
|
682
680
|
}
|
|
683
681
|
return kDefaultLimit;
|
|
@@ -693,70 +691,74 @@ size_t SSL_quic_max_handshake_flight_len(const SSL *ssl,
|
|
|
693
691
|
|
|
694
692
|
enum ssl_encryption_level_t SSL_quic_read_level(const SSL *ssl) {
|
|
695
693
|
assert(SSL_is_quic(ssl));
|
|
696
|
-
return ssl->s3->quic_read_level;
|
|
694
|
+
return FromOpaque(ssl)->s3->quic_read_level;
|
|
697
695
|
}
|
|
698
696
|
|
|
699
697
|
enum ssl_encryption_level_t SSL_quic_write_level(const SSL *ssl) {
|
|
700
698
|
assert(SSL_is_quic(ssl));
|
|
701
|
-
return ssl->s3->quic_write_level;
|
|
699
|
+
return FromOpaque(ssl)->s3->quic_write_level;
|
|
702
700
|
}
|
|
703
701
|
|
|
704
702
|
int SSL_provide_quic_data(SSL *ssl, enum ssl_encryption_level_t level,
|
|
705
703
|
const uint8_t *data, size_t len) {
|
|
706
|
-
|
|
704
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
705
|
+
if (!SSL_is_quic(ssl_impl)) {
|
|
707
706
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
708
707
|
return 0;
|
|
709
708
|
}
|
|
710
709
|
|
|
711
|
-
if (level !=
|
|
710
|
+
if (level != ssl_impl->s3->quic_read_level) {
|
|
712
711
|
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_ENCRYPTION_LEVEL_RECEIVED);
|
|
713
712
|
return 0;
|
|
714
713
|
}
|
|
715
714
|
|
|
716
|
-
size_t new_len =
|
|
715
|
+
size_t new_len =
|
|
716
|
+
(ssl_impl->s3->hs_buf ? ssl_impl->s3->hs_buf->length : 0) + len;
|
|
717
717
|
if (new_len < len ||
|
|
718
|
-
new_len > SSL_quic_max_handshake_flight_len(
|
|
718
|
+
new_len > SSL_quic_max_handshake_flight_len(ssl_impl, level)) {
|
|
719
719
|
OPENSSL_PUT_ERROR(SSL, SSL_R_EXCESSIVE_MESSAGE_SIZE);
|
|
720
720
|
return 0;
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
-
return tls_append_handshake_data(
|
|
723
|
+
return tls_append_handshake_data(ssl_impl, Span(data, len));
|
|
724
724
|
}
|
|
725
725
|
|
|
726
726
|
int SSL_do_handshake(SSL *ssl) {
|
|
727
|
-
|
|
727
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
728
|
+
ssl_reset_error_state(ssl_impl);
|
|
728
729
|
|
|
729
|
-
if (
|
|
730
|
+
if (ssl_impl->do_handshake == nullptr) {
|
|
730
731
|
OPENSSL_PUT_ERROR(SSL, SSL_R_CONNECTION_TYPE_NOT_SET);
|
|
731
732
|
return -1;
|
|
732
733
|
}
|
|
733
734
|
|
|
734
|
-
if (!SSL_in_init(
|
|
735
|
+
if (!SSL_in_init(ssl_impl)) {
|
|
735
736
|
return 1;
|
|
736
737
|
}
|
|
737
738
|
|
|
738
739
|
// Run the handshake.
|
|
739
|
-
SSL_HANDSHAKE *hs =
|
|
740
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
740
741
|
|
|
741
742
|
bool early_return = false;
|
|
742
743
|
int ret = ssl_run_handshake(hs, &early_return);
|
|
743
744
|
ssl_do_info_callback(
|
|
744
|
-
|
|
745
|
+
ssl_impl, ssl_impl->server ? SSL_CB_ACCEPT_EXIT : SSL_CB_CONNECT_EXIT,
|
|
746
|
+
ret);
|
|
745
747
|
if (ret <= 0) {
|
|
746
748
|
return ret;
|
|
747
749
|
}
|
|
748
750
|
|
|
749
751
|
// Destroy the handshake object if the handshake has completely finished.
|
|
750
752
|
if (!early_return) {
|
|
751
|
-
|
|
752
|
-
ssl_maybe_shed_handshake_config(
|
|
753
|
+
ssl_impl->s3->hs.reset();
|
|
754
|
+
ssl_maybe_shed_handshake_config(ssl_impl);
|
|
753
755
|
}
|
|
754
756
|
|
|
755
757
|
return 1;
|
|
756
758
|
}
|
|
757
759
|
|
|
758
760
|
int SSL_connect(SSL *ssl) {
|
|
759
|
-
if (ssl->do_handshake == nullptr) {
|
|
761
|
+
if (FromOpaque(ssl)->do_handshake == nullptr) {
|
|
760
762
|
// Not properly initialized yet
|
|
761
763
|
SSL_set_connect_state(ssl);
|
|
762
764
|
}
|
|
@@ -765,7 +767,7 @@ int SSL_connect(SSL *ssl) {
|
|
|
765
767
|
}
|
|
766
768
|
|
|
767
769
|
int SSL_accept(SSL *ssl) {
|
|
768
|
-
if (ssl->do_handshake == nullptr) {
|
|
770
|
+
if (FromOpaque(ssl)->do_handshake == nullptr) {
|
|
769
771
|
// Not properly initialized yet
|
|
770
772
|
SSL_set_accept_state(ssl);
|
|
771
773
|
}
|
|
@@ -773,7 +775,7 @@ int SSL_accept(SSL *ssl) {
|
|
|
773
775
|
return SSL_do_handshake(ssl);
|
|
774
776
|
}
|
|
775
777
|
|
|
776
|
-
static int ssl_do_post_handshake(
|
|
778
|
+
static int ssl_do_post_handshake(SSLImpl *ssl, const SSLMessage &msg) {
|
|
777
779
|
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
|
778
780
|
return tls13_post_handshake(ssl, msg);
|
|
779
781
|
}
|
|
@@ -810,33 +812,34 @@ static int ssl_do_post_handshake(SSL *ssl, const SSLMessage &msg) {
|
|
|
810
812
|
}
|
|
811
813
|
|
|
812
814
|
int SSL_process_quic_post_handshake(SSL *ssl) {
|
|
813
|
-
|
|
815
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
816
|
+
ssl_reset_error_state(ssl_impl);
|
|
814
817
|
|
|
815
|
-
if (!SSL_is_quic(
|
|
818
|
+
if (!SSL_is_quic(ssl_impl) || SSL_in_init(ssl_impl)) {
|
|
816
819
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
817
820
|
return 0;
|
|
818
821
|
}
|
|
819
822
|
|
|
820
823
|
// Replay post-handshake message errors.
|
|
821
|
-
if (!check_read_error(
|
|
824
|
+
if (!check_read_error(ssl_impl)) {
|
|
822
825
|
return 0;
|
|
823
826
|
}
|
|
824
827
|
|
|
825
828
|
// Process any buffered post-handshake messages.
|
|
826
829
|
SSLMessage msg;
|
|
827
|
-
while (
|
|
830
|
+
while (ssl_impl->method->get_message(ssl_impl, &msg)) {
|
|
828
831
|
// Handle the post-handshake message and try again.
|
|
829
|
-
if (!ssl_do_post_handshake(
|
|
830
|
-
ssl_set_read_error(
|
|
832
|
+
if (!ssl_do_post_handshake(ssl_impl, msg)) {
|
|
833
|
+
ssl_set_read_error(ssl_impl);
|
|
831
834
|
return 0;
|
|
832
835
|
}
|
|
833
|
-
|
|
836
|
+
ssl_impl->method->next_message(ssl_impl);
|
|
834
837
|
}
|
|
835
838
|
|
|
836
839
|
return 1;
|
|
837
840
|
}
|
|
838
841
|
|
|
839
|
-
static int ssl_read_impl(
|
|
842
|
+
static int ssl_read_impl(SSLImpl *ssl) {
|
|
840
843
|
ssl_reset_error_state(ssl);
|
|
841
844
|
|
|
842
845
|
if (ssl->do_handshake == nullptr) {
|
|
@@ -916,27 +919,29 @@ static int ssl_read_impl(SSL *ssl) {
|
|
|
916
919
|
}
|
|
917
920
|
|
|
918
921
|
int SSL_read(SSL *ssl, void *buf, int num) {
|
|
919
|
-
|
|
922
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
923
|
+
int ret = SSL_peek(ssl_impl, buf, num);
|
|
920
924
|
if (ret <= 0) {
|
|
921
925
|
return ret;
|
|
922
926
|
}
|
|
923
927
|
// TODO(davidben): In DTLS, should the rest of the record be discarded? DTLS
|
|
924
928
|
// is not a stream. See https://crbug.com/boringssl/65.
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
if (
|
|
928
|
-
|
|
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();
|
|
929
933
|
}
|
|
930
934
|
return ret;
|
|
931
935
|
}
|
|
932
936
|
|
|
933
937
|
int SSL_peek(SSL *ssl, void *buf, int num) {
|
|
934
|
-
|
|
938
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
939
|
+
if (SSL_is_quic(ssl_impl)) {
|
|
935
940
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
936
941
|
return -1;
|
|
937
942
|
}
|
|
938
943
|
|
|
939
|
-
int ret = ssl_read_impl(
|
|
944
|
+
int ret = ssl_read_impl(ssl_impl);
|
|
940
945
|
if (ret <= 0) {
|
|
941
946
|
return ret;
|
|
942
947
|
}
|
|
@@ -944,20 +949,21 @@ int SSL_peek(SSL *ssl, void *buf, int num) {
|
|
|
944
949
|
return num;
|
|
945
950
|
}
|
|
946
951
|
size_t todo =
|
|
947
|
-
std::min(
|
|
948
|
-
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);
|
|
949
954
|
return static_cast<int>(todo);
|
|
950
955
|
}
|
|
951
956
|
|
|
952
957
|
int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
953
|
-
|
|
958
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
959
|
+
ssl_reset_error_state(ssl_impl);
|
|
954
960
|
|
|
955
|
-
if (SSL_is_quic(
|
|
961
|
+
if (SSL_is_quic(ssl_impl)) {
|
|
956
962
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
957
963
|
return -1;
|
|
958
964
|
}
|
|
959
965
|
|
|
960
|
-
if (
|
|
966
|
+
if (ssl_impl->do_handshake == nullptr) {
|
|
961
967
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
962
968
|
return -1;
|
|
963
969
|
}
|
|
@@ -967,8 +973,8 @@ int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
|
967
973
|
bool needs_handshake = false;
|
|
968
974
|
do {
|
|
969
975
|
// If necessary, complete the handshake implicitly.
|
|
970
|
-
if (!ssl_can_write(
|
|
971
|
-
ret = SSL_do_handshake(
|
|
976
|
+
if (!ssl_can_write(ssl_impl)) {
|
|
977
|
+
ret = SSL_do_handshake(ssl_impl);
|
|
972
978
|
if (ret < 0) {
|
|
973
979
|
return ret;
|
|
974
980
|
}
|
|
@@ -982,43 +988,45 @@ int SSL_write(SSL *ssl, const void *buf, int num) {
|
|
|
982
988
|
OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_LENGTH);
|
|
983
989
|
return -1;
|
|
984
990
|
}
|
|
985
|
-
ret =
|
|
986
|
-
|
|
991
|
+
ret = ssl_impl->method->write_app_data(
|
|
992
|
+
ssl_impl, &needs_handshake, &bytes_written,
|
|
987
993
|
Span(static_cast<const uint8_t *>(buf), static_cast<size_t>(num)));
|
|
988
994
|
} while (needs_handshake);
|
|
989
995
|
return ret <= 0 ? ret : static_cast<int>(bytes_written);
|
|
990
996
|
}
|
|
991
997
|
|
|
992
998
|
int SSL_key_update(SSL *ssl, int request_type) {
|
|
993
|
-
|
|
999
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1000
|
+
ssl_reset_error_state(ssl_impl);
|
|
994
1001
|
|
|
995
|
-
if (
|
|
1002
|
+
if (ssl_impl->do_handshake == nullptr) {
|
|
996
1003
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
997
1004
|
return 0;
|
|
998
1005
|
}
|
|
999
1006
|
|
|
1000
|
-
if (SSL_is_quic(
|
|
1007
|
+
if (SSL_is_quic(ssl_impl)) {
|
|
1001
1008
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
1002
1009
|
return 0;
|
|
1003
1010
|
}
|
|
1004
1011
|
|
|
1005
|
-
if (!
|
|
1012
|
+
if (!ssl_impl->s3->initial_handshake_complete) {
|
|
1006
1013
|
OPENSSL_PUT_ERROR(SSL, SSL_R_HANDSHAKE_NOT_COMPLETE);
|
|
1007
1014
|
return 0;
|
|
1008
1015
|
}
|
|
1009
1016
|
|
|
1010
|
-
if (ssl_protocol_version(
|
|
1017
|
+
if (ssl_protocol_version(ssl_impl) < TLS1_3_VERSION) {
|
|
1011
1018
|
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_SSL_VERSION);
|
|
1012
1019
|
return 0;
|
|
1013
1020
|
}
|
|
1014
1021
|
|
|
1015
|
-
return tls13_add_key_update(
|
|
1022
|
+
return tls13_add_key_update(ssl_impl, request_type);
|
|
1016
1023
|
}
|
|
1017
1024
|
|
|
1018
1025
|
int SSL_shutdown(SSL *ssl) {
|
|
1019
|
-
|
|
1026
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1027
|
+
ssl_reset_error_state(ssl_impl);
|
|
1020
1028
|
|
|
1021
|
-
if (
|
|
1029
|
+
if (ssl_impl->do_handshake == nullptr) {
|
|
1022
1030
|
OPENSSL_PUT_ERROR(SSL, SSL_R_UNINITIALIZED);
|
|
1023
1031
|
return -1;
|
|
1024
1032
|
}
|
|
@@ -1026,14 +1034,14 @@ int SSL_shutdown(SSL *ssl) {
|
|
|
1026
1034
|
// If we are in the middle of a handshake, silently succeed. Consumers often
|
|
1027
1035
|
// call this function before `SSL_free`, whether the handshake succeeded or
|
|
1028
1036
|
// not. We assume the caller has already handled failed handshakes.
|
|
1029
|
-
if (SSL_in_init(
|
|
1037
|
+
if (SSL_in_init(ssl_impl)) {
|
|
1030
1038
|
return 1;
|
|
1031
1039
|
}
|
|
1032
1040
|
|
|
1033
|
-
if (
|
|
1041
|
+
if (ssl_impl->quiet_shutdown) {
|
|
1034
1042
|
// Do nothing if configured not to send a close_notify.
|
|
1035
|
-
|
|
1036
|
-
|
|
1043
|
+
ssl_impl->s3->write_shutdown = ssl_shutdown_close_notify;
|
|
1044
|
+
ssl_impl->s3->read_shutdown = ssl_shutdown_close_notify;
|
|
1037
1045
|
return 1;
|
|
1038
1046
|
}
|
|
1039
1047
|
|
|
@@ -1041,75 +1049,80 @@ int SSL_shutdown(SSL *ssl) {
|
|
|
1041
1049
|
// waits for a close_notify to come in. Perform exactly one action and return
|
|
1042
1050
|
// whether or not it succeeds.
|
|
1043
1051
|
|
|
1044
|
-
if (
|
|
1052
|
+
if (ssl_impl->s3->write_shutdown != ssl_shutdown_close_notify) {
|
|
1045
1053
|
// Send a close_notify.
|
|
1046
|
-
if (ssl_send_alert_impl(
|
|
1054
|
+
if (ssl_send_alert_impl(ssl_impl, SSL3_AL_WARNING, SSL_AD_CLOSE_NOTIFY) <=
|
|
1055
|
+
0) {
|
|
1047
1056
|
return -1;
|
|
1048
1057
|
}
|
|
1049
|
-
} else if (
|
|
1058
|
+
} else if (ssl_impl->s3->alert_dispatch) {
|
|
1050
1059
|
// Finish sending the close_notify.
|
|
1051
|
-
if (
|
|
1060
|
+
if (ssl_impl->method->dispatch_alert(ssl_impl) <= 0) {
|
|
1052
1061
|
return -1;
|
|
1053
1062
|
}
|
|
1054
|
-
} else if (
|
|
1055
|
-
if (SSL_is_dtls(
|
|
1063
|
+
} else if (ssl_impl->s3->read_shutdown != ssl_shutdown_close_notify) {
|
|
1064
|
+
if (SSL_is_dtls(ssl_impl)) {
|
|
1056
1065
|
// Bidirectional shutdown doesn't make sense for an unordered
|
|
1057
1066
|
// transport. DTLS alerts also aren't delivered reliably, so we may even
|
|
1058
1067
|
// time out because the peer never received our close_notify. Report to
|
|
1059
1068
|
// the caller that the channel has fully shut down.
|
|
1060
|
-
if (
|
|
1061
|
-
ERR_restore_state(
|
|
1069
|
+
if (ssl_impl->s3->read_shutdown == ssl_shutdown_error) {
|
|
1070
|
+
ERR_restore_state(ssl_impl->s3->read_error.get());
|
|
1062
1071
|
return -1;
|
|
1063
1072
|
}
|
|
1064
|
-
|
|
1073
|
+
ssl_impl->s3->read_shutdown = ssl_shutdown_close_notify;
|
|
1065
1074
|
} else {
|
|
1066
1075
|
// Process records until an error, close_notify, or application data.
|
|
1067
|
-
if (ssl_read_impl(
|
|
1076
|
+
if (ssl_read_impl(ssl_impl) > 0) {
|
|
1068
1077
|
// We received some unexpected application data.
|
|
1069
1078
|
OPENSSL_PUT_ERROR(SSL, SSL_R_APPLICATION_DATA_ON_SHUTDOWN);
|
|
1070
1079
|
return -1;
|
|
1071
1080
|
}
|
|
1072
|
-
if (
|
|
1081
|
+
if (ssl_impl->s3->read_shutdown != ssl_shutdown_close_notify) {
|
|
1073
1082
|
return -1;
|
|
1074
1083
|
}
|
|
1075
1084
|
}
|
|
1076
1085
|
}
|
|
1077
1086
|
|
|
1078
1087
|
// Return 0 for unidirectional shutdown and 1 for bidirectional shutdown.
|
|
1079
|
-
return
|
|
1088
|
+
return ssl_impl->s3->read_shutdown == ssl_shutdown_close_notify;
|
|
1080
1089
|
}
|
|
1081
1090
|
|
|
1082
1091
|
int SSL_send_fatal_alert(SSL *ssl, uint8_t alert) {
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
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) {
|
|
1086
1096
|
// We are already attempting to write a different alert.
|
|
1087
1097
|
OPENSSL_PUT_ERROR(SSL, SSL_R_PROTOCOL_IS_SHUTDOWN);
|
|
1088
1098
|
return -1;
|
|
1089
1099
|
}
|
|
1090
|
-
return
|
|
1100
|
+
return ssl_impl->method->dispatch_alert(ssl_impl);
|
|
1091
1101
|
}
|
|
1092
1102
|
|
|
1093
|
-
return ssl_send_alert_impl(
|
|
1103
|
+
return ssl_send_alert_impl(ssl_impl, SSL3_AL_FATAL, alert);
|
|
1094
1104
|
}
|
|
1095
1105
|
|
|
1096
1106
|
int SSL_set_quic_transport_params(SSL *ssl, const uint8_t *params,
|
|
1097
1107
|
size_t params_len) {
|
|
1098
|
-
|
|
1099
|
-
|
|
1108
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1109
|
+
return ssl_impl->config && ssl_impl->config->quic_transport_params.CopyFrom(
|
|
1110
|
+
Span(params, params_len));
|
|
1100
1111
|
}
|
|
1101
1112
|
|
|
1102
1113
|
void SSL_get_peer_quic_transport_params(const SSL *ssl,
|
|
1103
1114
|
const uint8_t **out_params,
|
|
1104
1115
|
size_t *out_params_len) {
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
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();
|
|
1107
1119
|
}
|
|
1108
1120
|
|
|
1109
1121
|
int SSL_set_quic_early_data_context(SSL *ssl, const uint8_t *context,
|
|
1110
1122
|
size_t context_len) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1123
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1124
|
+
return ssl_impl->config && ssl_impl->config->quic_early_data_context.CopyFrom(
|
|
1125
|
+
Span(context, context_len));
|
|
1113
1126
|
}
|
|
1114
1127
|
|
|
1115
1128
|
void SSL_CTX_set_early_data_enabled(SSL_CTX *ctx, int enabled) {
|
|
@@ -1117,22 +1130,24 @@ void SSL_CTX_set_early_data_enabled(SSL_CTX *ctx, int enabled) {
|
|
|
1117
1130
|
}
|
|
1118
1131
|
|
|
1119
1132
|
void SSL_set_early_data_enabled(SSL *ssl, int enabled) {
|
|
1120
|
-
ssl->enable_early_data = !!enabled;
|
|
1133
|
+
FromOpaque(ssl)->enable_early_data = !!enabled;
|
|
1121
1134
|
}
|
|
1122
1135
|
|
|
1123
1136
|
int SSL_in_early_data(const SSL *ssl) {
|
|
1124
|
-
|
|
1137
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1138
|
+
if (ssl_impl->s3->hs == nullptr) {
|
|
1125
1139
|
return 0;
|
|
1126
1140
|
}
|
|
1127
|
-
return
|
|
1141
|
+
return ssl_impl->s3->hs->in_early_data;
|
|
1128
1142
|
}
|
|
1129
1143
|
|
|
1130
1144
|
int SSL_early_data_accepted(const SSL *ssl) {
|
|
1131
|
-
return ssl->s3->early_data_accepted;
|
|
1145
|
+
return FromOpaque(ssl)->s3->early_data_accepted;
|
|
1132
1146
|
}
|
|
1133
1147
|
|
|
1134
1148
|
void SSL_reset_early_data_reject(SSL *ssl) {
|
|
1135
|
-
|
|
1149
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1150
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
1136
1151
|
if (hs == nullptr || //
|
|
1137
1152
|
hs->wait != ssl_hs_early_data_rejected) {
|
|
1138
1153
|
abort();
|
|
@@ -1145,12 +1160,12 @@ void SSL_reset_early_data_reject(SSL *ssl) {
|
|
|
1145
1160
|
// Discard any unfinished writes from the perspective of `SSL_write`'s
|
|
1146
1161
|
// retry. The handshake will transparently flush out the pending record
|
|
1147
1162
|
// (discarded by the server) to keep the framing correct.
|
|
1148
|
-
|
|
1149
|
-
|
|
1163
|
+
ssl_impl->s3->pending_write = {};
|
|
1164
|
+
ssl_impl->s3->unreported_bytes_written = 0;
|
|
1150
1165
|
}
|
|
1151
1166
|
|
|
1152
1167
|
enum ssl_early_data_reason_t SSL_get_early_data_reason(const SSL *ssl) {
|
|
1153
|
-
return ssl->s3->early_data_reason;
|
|
1168
|
+
return FromOpaque(ssl)->s3->early_data_reason;
|
|
1154
1169
|
}
|
|
1155
1170
|
|
|
1156
1171
|
const char *SSL_early_data_reason_string(enum ssl_early_data_reason_t reason) {
|
|
@@ -1200,6 +1215,7 @@ static int bio_retry_reason_to_error(int reason) {
|
|
|
1200
1215
|
}
|
|
1201
1216
|
|
|
1202
1217
|
int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
1218
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1203
1219
|
if (ret_code > 0) {
|
|
1204
1220
|
return SSL_ERROR_NONE;
|
|
1205
1221
|
}
|
|
@@ -1215,7 +1231,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
|
1215
1231
|
}
|
|
1216
1232
|
|
|
1217
1233
|
if (ret_code == 0) {
|
|
1218
|
-
if (
|
|
1234
|
+
if (ssl_impl->s3->rwstate == SSL_ERROR_ZERO_RETURN) {
|
|
1219
1235
|
return SSL_ERROR_ZERO_RETURN;
|
|
1220
1236
|
}
|
|
1221
1237
|
// An EOF was observed which violates the protocol, and the underlying
|
|
@@ -1224,7 +1240,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
|
1224
1240
|
return SSL_ERROR_SYSCALL;
|
|
1225
1241
|
}
|
|
1226
1242
|
|
|
1227
|
-
switch (
|
|
1243
|
+
switch (ssl_impl->s3->rwstate) {
|
|
1228
1244
|
case SSL_ERROR_PENDING_SESSION:
|
|
1229
1245
|
case SSL_ERROR_PENDING_CERTIFICATE:
|
|
1230
1246
|
case SSL_ERROR_HANDOFF:
|
|
@@ -1236,13 +1252,13 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
|
1236
1252
|
case SSL_ERROR_WANT_CERTIFICATE_VERIFY:
|
|
1237
1253
|
case SSL_ERROR_WANT_RENEGOTIATE:
|
|
1238
1254
|
case SSL_ERROR_HANDSHAKE_HINTS_READY:
|
|
1239
|
-
return
|
|
1255
|
+
return ssl_impl->s3->rwstate;
|
|
1240
1256
|
|
|
1241
1257
|
case SSL_ERROR_WANT_READ: {
|
|
1242
|
-
if (SSL_is_quic(
|
|
1258
|
+
if (SSL_is_quic(ssl_impl)) {
|
|
1243
1259
|
return SSL_ERROR_WANT_READ;
|
|
1244
1260
|
}
|
|
1245
|
-
BIO *bio = SSL_get_rbio(
|
|
1261
|
+
BIO *bio = SSL_get_rbio(ssl_impl);
|
|
1246
1262
|
if (BIO_should_read(bio)) {
|
|
1247
1263
|
return SSL_ERROR_WANT_READ;
|
|
1248
1264
|
}
|
|
@@ -1261,7 +1277,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
|
|
|
1261
1277
|
}
|
|
1262
1278
|
|
|
1263
1279
|
case SSL_ERROR_WANT_WRITE: {
|
|
1264
|
-
BIO *bio = SSL_get_wbio(
|
|
1280
|
+
BIO *bio = SSL_get_wbio(ssl_impl);
|
|
1265
1281
|
if (BIO_should_write(bio)) {
|
|
1266
1282
|
return SSL_ERROR_WANT_WRITE;
|
|
1267
1283
|
}
|
|
@@ -1345,16 +1361,18 @@ uint32_t SSL_CTX_get_options(const SSL_CTX *ctx) {
|
|
|
1345
1361
|
}
|
|
1346
1362
|
|
|
1347
1363
|
uint32_t SSL_set_options(SSL *ssl, uint32_t options) {
|
|
1348
|
-
|
|
1349
|
-
|
|
1364
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1365
|
+
ssl_impl->options |= options;
|
|
1366
|
+
return ssl_impl->options;
|
|
1350
1367
|
}
|
|
1351
1368
|
|
|
1352
1369
|
uint32_t SSL_clear_options(SSL *ssl, uint32_t options) {
|
|
1353
|
-
|
|
1354
|
-
|
|
1370
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1371
|
+
ssl_impl->options &= ~options;
|
|
1372
|
+
return ssl_impl->options;
|
|
1355
1373
|
}
|
|
1356
1374
|
|
|
1357
|
-
uint32_t SSL_get_options(const SSL *ssl) { return ssl->options; }
|
|
1375
|
+
uint32_t SSL_get_options(const SSL *ssl) { return FromOpaque(ssl)->options; }
|
|
1358
1376
|
|
|
1359
1377
|
uint32_t SSL_CTX_set_mode(SSL_CTX *ctx, uint32_t mode) {
|
|
1360
1378
|
auto *ctx_impl = FromOpaque(ctx);
|
|
@@ -1371,16 +1389,18 @@ uint32_t SSL_CTX_clear_mode(SSL_CTX *ctx, uint32_t mode) {
|
|
|
1371
1389
|
uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx) { return FromOpaque(ctx)->mode; }
|
|
1372
1390
|
|
|
1373
1391
|
uint32_t SSL_set_mode(SSL *ssl, uint32_t mode) {
|
|
1374
|
-
|
|
1375
|
-
|
|
1392
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1393
|
+
ssl_impl->mode |= mode;
|
|
1394
|
+
return ssl_impl->mode;
|
|
1376
1395
|
}
|
|
1377
1396
|
|
|
1378
1397
|
uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode) {
|
|
1379
|
-
|
|
1380
|
-
|
|
1398
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1399
|
+
ssl_impl->mode &= ~mode;
|
|
1400
|
+
return ssl_impl->mode;
|
|
1381
1401
|
}
|
|
1382
1402
|
|
|
1383
|
-
uint32_t SSL_get_mode(const SSL *ssl) { return ssl->mode; }
|
|
1403
|
+
uint32_t SSL_get_mode(const SSL *ssl) { return FromOpaque(ssl)->mode; }
|
|
1384
1404
|
|
|
1385
1405
|
void SSL_CTX_set1_buffer_pool(SSL_CTX *ctx, CRYPTO_BUFFER_POOL *pool) {
|
|
1386
1406
|
FromOpaque(ctx)->pool = UpRef(pool);
|
|
@@ -1397,25 +1417,26 @@ void SSL_CTX_set0_buffer_pool(SSL_CTX *ctx, CRYPTO_BUFFER_POOL *pool) {
|
|
|
1397
1417
|
|
|
1398
1418
|
int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, size_t *out_len,
|
|
1399
1419
|
size_t max_out) {
|
|
1420
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1400
1421
|
*out_len = 0;
|
|
1401
1422
|
OPENSSL_memset(out, 0, max_out);
|
|
1402
1423
|
|
|
1403
1424
|
// tls-unique is not defined for TLS 1.3.
|
|
1404
|
-
if (!
|
|
1405
|
-
ssl_protocol_version(
|
|
1425
|
+
if (!ssl_impl->s3->initial_handshake_complete ||
|
|
1426
|
+
ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION) {
|
|
1406
1427
|
return 0;
|
|
1407
1428
|
}
|
|
1408
1429
|
|
|
1409
1430
|
// The tls-unique value is the first Finished message in the handshake, which
|
|
1410
1431
|
// is the client's in a full handshake and the server's for a resumption. See
|
|
1411
1432
|
// https://tools.ietf.org/html/rfc5929#section-3.1.
|
|
1412
|
-
Span<const uint8_t> finished =
|
|
1413
|
-
if (
|
|
1433
|
+
Span<const uint8_t> finished = ssl_impl->s3->previous_client_finished;
|
|
1434
|
+
if (ssl_impl->session != nullptr) {
|
|
1414
1435
|
// tls-unique is broken for resumed sessions unless EMS is used.
|
|
1415
|
-
if (!
|
|
1436
|
+
if (!ssl_impl->session->extended_master_secret) {
|
|
1416
1437
|
return 0;
|
|
1417
1438
|
}
|
|
1418
|
-
finished =
|
|
1439
|
+
finished = ssl_impl->s3->previous_server_finished;
|
|
1419
1440
|
}
|
|
1420
1441
|
|
|
1421
1442
|
*out_len = finished.size();
|
|
@@ -1445,20 +1466,23 @@ int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const uint8_t *sid_ctx,
|
|
|
1445
1466
|
|
|
1446
1467
|
int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
|
|
1447
1468
|
size_t sid_ctx_len) {
|
|
1448
|
-
|
|
1469
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1470
|
+
if (!ssl_impl->config) {
|
|
1449
1471
|
return 0;
|
|
1450
1472
|
}
|
|
1451
|
-
return set_session_id_context(
|
|
1473
|
+
return set_session_id_context(ssl_impl->config->cert.get(), sid_ctx,
|
|
1474
|
+
sid_ctx_len);
|
|
1452
1475
|
}
|
|
1453
1476
|
|
|
1454
1477
|
const uint8_t *SSL_get0_session_id_context(const SSL *ssl, size_t *out_len) {
|
|
1455
|
-
|
|
1456
|
-
|
|
1478
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1479
|
+
if (!ssl_impl->config) {
|
|
1480
|
+
assert(ssl_impl->config);
|
|
1457
1481
|
*out_len = 0;
|
|
1458
1482
|
return nullptr;
|
|
1459
1483
|
}
|
|
1460
|
-
*out_len =
|
|
1461
|
-
return
|
|
1484
|
+
*out_len = ssl_impl->config->cert->sid_ctx.size();
|
|
1485
|
+
return ssl_impl->config->cert->sid_ctx.data();
|
|
1462
1486
|
}
|
|
1463
1487
|
|
|
1464
1488
|
int SSL_get_fd(const SSL *ssl) { return SSL_get_rfd(ssl); }
|
|
@@ -1542,57 +1566,61 @@ static size_t copy_finished(void *out, size_t out_len, Span<const uint8_t> in) {
|
|
|
1542
1566
|
}
|
|
1543
1567
|
|
|
1544
1568
|
size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count) {
|
|
1545
|
-
|
|
1546
|
-
|
|
1569
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1570
|
+
if (!ssl_impl->s3->initial_handshake_complete ||
|
|
1571
|
+
ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION) {
|
|
1547
1572
|
return 0;
|
|
1548
1573
|
}
|
|
1549
1574
|
|
|
1550
|
-
if (
|
|
1551
|
-
return copy_finished(buf, count,
|
|
1575
|
+
if (ssl_impl->server) {
|
|
1576
|
+
return copy_finished(buf, count, ssl_impl->s3->previous_server_finished);
|
|
1552
1577
|
}
|
|
1553
1578
|
|
|
1554
|
-
return copy_finished(buf, count,
|
|
1579
|
+
return copy_finished(buf, count, ssl_impl->s3->previous_client_finished);
|
|
1555
1580
|
}
|
|
1556
1581
|
|
|
1557
1582
|
size_t SSL_get_peer_finished(const SSL *ssl, void *buf, size_t count) {
|
|
1558
|
-
|
|
1559
|
-
|
|
1583
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1584
|
+
if (!ssl_impl->s3->initial_handshake_complete ||
|
|
1585
|
+
ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION) {
|
|
1560
1586
|
return 0;
|
|
1561
1587
|
}
|
|
1562
1588
|
|
|
1563
|
-
if (
|
|
1564
|
-
return copy_finished(buf, count,
|
|
1589
|
+
if (ssl_impl->server) {
|
|
1590
|
+
return copy_finished(buf, count, ssl_impl->s3->previous_client_finished);
|
|
1565
1591
|
}
|
|
1566
1592
|
|
|
1567
|
-
return copy_finished(buf, count,
|
|
1593
|
+
return copy_finished(buf, count, ssl_impl->s3->previous_server_finished);
|
|
1568
1594
|
}
|
|
1569
1595
|
|
|
1570
1596
|
int SSL_get_verify_mode(const SSL *ssl) {
|
|
1571
|
-
|
|
1572
|
-
|
|
1597
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1598
|
+
if (!ssl_impl->config) {
|
|
1599
|
+
assert(ssl_impl->config);
|
|
1573
1600
|
return -1;
|
|
1574
1601
|
}
|
|
1575
|
-
return
|
|
1602
|
+
return ssl_impl->config->verify_mode;
|
|
1576
1603
|
}
|
|
1577
1604
|
|
|
1578
1605
|
int SSL_get_extms_support(const SSL *ssl) {
|
|
1606
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1579
1607
|
// TLS 1.3 does not require extended master secret and always reports as
|
|
1580
1608
|
// supporting it.
|
|
1581
|
-
if (
|
|
1609
|
+
if (ssl_impl->s3->version == 0) {
|
|
1582
1610
|
return 0;
|
|
1583
1611
|
}
|
|
1584
|
-
if (ssl_protocol_version(
|
|
1612
|
+
if (ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION) {
|
|
1585
1613
|
return 1;
|
|
1586
1614
|
}
|
|
1587
1615
|
|
|
1588
1616
|
// If the initial handshake completed, query the established session.
|
|
1589
|
-
if (
|
|
1590
|
-
return
|
|
1617
|
+
if (ssl_impl->s3->established_session != nullptr) {
|
|
1618
|
+
return ssl_impl->s3->established_session->extended_master_secret;
|
|
1591
1619
|
}
|
|
1592
1620
|
|
|
1593
1621
|
// Otherwise, query the in-progress handshake.
|
|
1594
|
-
if (
|
|
1595
|
-
return
|
|
1622
|
+
if (ssl_impl->s3->hs != nullptr) {
|
|
1623
|
+
return ssl_impl->s3->hs->extended_master_secret;
|
|
1596
1624
|
}
|
|
1597
1625
|
assert(0);
|
|
1598
1626
|
return 0;
|
|
@@ -1607,11 +1635,11 @@ int SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes) { return 1; }
|
|
|
1607
1635
|
int SSL_set_read_ahead(SSL *ssl, int yes) { return 1; }
|
|
1608
1636
|
|
|
1609
1637
|
int SSL_pending(const SSL *ssl) {
|
|
1610
|
-
return static_cast<int>(ssl->s3->pending_app_data.size());
|
|
1638
|
+
return static_cast<int>(FromOpaque(ssl)->s3->pending_app_data.size());
|
|
1611
1639
|
}
|
|
1612
1640
|
|
|
1613
1641
|
int SSL_has_pending(const SSL *ssl) {
|
|
1614
|
-
return SSL_pending(ssl) != 0 || !ssl->s3->read_buffer.empty();
|
|
1642
|
+
return SSL_pending(ssl) != 0 || !FromOpaque(ssl)->s3->read_buffer.empty();
|
|
1615
1643
|
}
|
|
1616
1644
|
|
|
1617
1645
|
static bool has_cert_and_key(const SSLCredential *cred) {
|
|
@@ -1637,13 +1665,14 @@ int SSL_CTX_check_private_key(const SSL_CTX *ctx) {
|
|
|
1637
1665
|
}
|
|
1638
1666
|
|
|
1639
1667
|
int SSL_check_private_key(const SSL *ssl) {
|
|
1640
|
-
|
|
1668
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1669
|
+
if (!ssl_impl->config) {
|
|
1641
1670
|
return 0;
|
|
1642
1671
|
}
|
|
1643
1672
|
|
|
1644
1673
|
// There is no need to actually check consistency because inconsistent values
|
|
1645
1674
|
// can never be configured.
|
|
1646
|
-
return has_cert_and_key(
|
|
1675
|
+
return has_cert_and_key(ssl_impl->config->cert->legacy_credential.get());
|
|
1647
1676
|
}
|
|
1648
1677
|
|
|
1649
1678
|
long SSL_get_default_timeout(const SSL *ssl) {
|
|
@@ -1651,51 +1680,52 @@ long SSL_get_default_timeout(const SSL *ssl) {
|
|
|
1651
1680
|
}
|
|
1652
1681
|
|
|
1653
1682
|
int SSL_renegotiate(SSL *ssl) {
|
|
1683
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1654
1684
|
// Caller-initiated renegotiation is not supported.
|
|
1655
|
-
if (!
|
|
1685
|
+
if (!ssl_impl->s3->renegotiate_pending) {
|
|
1656
1686
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
1657
1687
|
return 0;
|
|
1658
1688
|
}
|
|
1659
1689
|
|
|
1660
|
-
if (!ssl_can_renegotiate(
|
|
1690
|
+
if (!ssl_can_renegotiate(ssl_impl)) {
|
|
1661
1691
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_RENEGOTIATION);
|
|
1662
1692
|
return 0;
|
|
1663
1693
|
}
|
|
1664
1694
|
|
|
1665
1695
|
// We should not have told the caller to release the private key.
|
|
1666
|
-
assert(!SSL_can_release_private_key(
|
|
1696
|
+
assert(!SSL_can_release_private_key(ssl_impl));
|
|
1667
1697
|
|
|
1668
1698
|
// Renegotiation is only supported at quiescent points in the application
|
|
1669
1699
|
// protocol, namely in HTTPS, just before reading the HTTP response.
|
|
1670
1700
|
// Require the record-layer be idle and avoid complexities of sending a
|
|
1671
1701
|
// handshake record while an application_data record is being written.
|
|
1672
|
-
if (!
|
|
1673
|
-
|
|
1702
|
+
if (!ssl_impl->s3->write_buffer.empty() ||
|
|
1703
|
+
ssl_impl->s3->write_shutdown != ssl_shutdown_none) {
|
|
1674
1704
|
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_RENEGOTIATION);
|
|
1675
1705
|
return 0;
|
|
1676
1706
|
}
|
|
1677
1707
|
|
|
1678
1708
|
// Begin a new handshake.
|
|
1679
|
-
if (
|
|
1709
|
+
if (ssl_impl->s3->hs != nullptr) {
|
|
1680
1710
|
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
|
1681
1711
|
return 0;
|
|
1682
1712
|
}
|
|
1683
|
-
|
|
1684
|
-
if (
|
|
1713
|
+
ssl_impl->s3->hs = ssl_handshake_new(ssl_impl);
|
|
1714
|
+
if (ssl_impl->s3->hs == nullptr) {
|
|
1685
1715
|
return 0;
|
|
1686
1716
|
}
|
|
1687
1717
|
|
|
1688
|
-
|
|
1689
|
-
|
|
1718
|
+
ssl_impl->s3->renegotiate_pending = false;
|
|
1719
|
+
ssl_impl->s3->total_renegotiations++;
|
|
1690
1720
|
return 1;
|
|
1691
1721
|
}
|
|
1692
1722
|
|
|
1693
1723
|
int SSL_renegotiate_pending(SSL *ssl) {
|
|
1694
|
-
return SSL_in_init(ssl) && ssl->s3->initial_handshake_complete;
|
|
1724
|
+
return SSL_in_init(ssl) && FromOpaque(ssl)->s3->initial_handshake_complete;
|
|
1695
1725
|
}
|
|
1696
1726
|
|
|
1697
1727
|
int SSL_total_renegotiations(const SSL *ssl) {
|
|
1698
|
-
return ssl->s3->total_renegotiations;
|
|
1728
|
+
return FromOpaque(ssl)->s3->total_renegotiations;
|
|
1699
1729
|
}
|
|
1700
1730
|
|
|
1701
1731
|
size_t SSL_CTX_get_max_cert_list(const SSL_CTX *ctx) {
|
|
@@ -1709,13 +1739,15 @@ void SSL_CTX_set_max_cert_list(SSL_CTX *ctx, size_t max_cert_list) {
|
|
|
1709
1739
|
FromOpaque(ctx)->max_cert_list = (uint32_t)max_cert_list;
|
|
1710
1740
|
}
|
|
1711
1741
|
|
|
1712
|
-
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
|
+
}
|
|
1713
1745
|
|
|
1714
1746
|
void SSL_set_max_cert_list(SSL *ssl, size_t max_cert_list) {
|
|
1715
1747
|
if (max_cert_list > kMaxHandshakeSize) {
|
|
1716
1748
|
max_cert_list = kMaxHandshakeSize;
|
|
1717
1749
|
}
|
|
1718
|
-
ssl->max_cert_list = (uint32_t)max_cert_list;
|
|
1750
|
+
FromOpaque(ssl)->max_cert_list = (uint32_t)max_cert_list;
|
|
1719
1751
|
}
|
|
1720
1752
|
|
|
1721
1753
|
int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, size_t max_send_fragment) {
|
|
@@ -1737,7 +1769,7 @@ int SSL_set_max_send_fragment(SSL *ssl, size_t max_send_fragment) {
|
|
|
1737
1769
|
if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
|
|
1738
1770
|
max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH;
|
|
1739
1771
|
}
|
|
1740
|
-
ssl->max_send_fragment = (uint16_t)max_send_fragment;
|
|
1772
|
+
FromOpaque(ssl)->max_send_fragment = (uint16_t)max_send_fragment;
|
|
1741
1773
|
|
|
1742
1774
|
return 1;
|
|
1743
1775
|
}
|
|
@@ -1746,16 +1778,17 @@ int SSL_set_mtu(SSL *ssl, unsigned mtu) {
|
|
|
1746
1778
|
if (!SSL_is_dtls(ssl) || mtu < dtls1_min_mtu()) {
|
|
1747
1779
|
return 0;
|
|
1748
1780
|
}
|
|
1749
|
-
ssl->d1->mtu = mtu;
|
|
1781
|
+
FromOpaque(ssl)->d1->mtu = mtu;
|
|
1750
1782
|
return 1;
|
|
1751
1783
|
}
|
|
1752
1784
|
|
|
1753
1785
|
int SSL_get_secure_renegotiation_support(const SSL *ssl) {
|
|
1754
|
-
|
|
1786
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
1787
|
+
if (ssl_impl->s3->version == 0) {
|
|
1755
1788
|
return 0;
|
|
1756
1789
|
}
|
|
1757
|
-
return ssl_protocol_version(
|
|
1758
|
-
|
|
1790
|
+
return ssl_protocol_version(ssl_impl) >= TLS1_3_VERSION ||
|
|
1791
|
+
ssl_impl->s3->send_connection_binding;
|
|
1759
1792
|
}
|
|
1760
1793
|
|
|
1761
1794
|
size_t SSL_CTX_sess_number(const SSL_CTX *ctx) {
|
|
@@ -1838,14 +1871,14 @@ int SSL_CTX_set_tlsext_ticket_key_cb(
|
|
|
1838
1871
|
return 1;
|
|
1839
1872
|
}
|
|
1840
1873
|
|
|
1841
|
-
static bool check_no_duplicates(Span<const uint16_t> list) {
|
|
1874
|
+
static bool check_no_duplicates(Span<const uint16_t> list, int reason) {
|
|
1842
1875
|
if (list.size() < 2) {
|
|
1843
1876
|
return true;
|
|
1844
1877
|
}
|
|
1845
1878
|
for (size_t i = 0; i < list.size() - 1; ++i) {
|
|
1846
1879
|
for (size_t j = i + 1; j < list.size(); ++j) {
|
|
1847
1880
|
if (list[i] == list[j]) {
|
|
1848
|
-
OPENSSL_PUT_ERROR(SSL,
|
|
1881
|
+
OPENSSL_PUT_ERROR(SSL, reason);
|
|
1849
1882
|
return false;
|
|
1850
1883
|
}
|
|
1851
1884
|
}
|
|
@@ -1860,7 +1893,7 @@ static bool check_group_ids(Span<const uint16_t> group_ids) {
|
|
|
1860
1893
|
return false;
|
|
1861
1894
|
}
|
|
1862
1895
|
}
|
|
1863
|
-
return check_no_duplicates(group_ids);
|
|
1896
|
+
return check_no_duplicates(group_ids, SSL_R_DUPLICATE_GROUP);
|
|
1864
1897
|
}
|
|
1865
1898
|
|
|
1866
1899
|
// validate_key_shares returns whether the `requested_key_shares` are free of
|
|
@@ -1868,7 +1901,7 @@ static bool check_group_ids(Span<const uint16_t> group_ids) {
|
|
|
1868
1901
|
// `groups`.
|
|
1869
1902
|
static bool validate_key_shares(Span<const uint16_t> requested_key_shares,
|
|
1870
1903
|
Span<const uint16_t> groups) {
|
|
1871
|
-
if (!check_no_duplicates(requested_key_shares)) {
|
|
1904
|
+
if (!check_no_duplicates(requested_key_shares, SSL_R_DUPLICATE_GROUP)) {
|
|
1872
1905
|
return false;
|
|
1873
1906
|
}
|
|
1874
1907
|
if (requested_key_shares.size() > groups.size()) {
|
|
@@ -1948,18 +1981,89 @@ int SSL_set1_group_ids(SSL *ssl, const uint16_t *group_ids,
|
|
|
1948
1981
|
|
|
1949
1982
|
int SSL_set1_group_ids_with_flags(SSL *ssl, const uint16_t *group_ids,
|
|
1950
1983
|
const uint32_t *flags, size_t num_group_ids) {
|
|
1951
|
-
|
|
1984
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
1985
|
+
if (!ssl_impl->config) {
|
|
1952
1986
|
return 0;
|
|
1953
1987
|
}
|
|
1954
1988
|
if (set_group_ids_and_flags(group_ids, flags, num_group_ids,
|
|
1955
|
-
&
|
|
1956
|
-
&
|
|
1957
|
-
clear_key_shares_if_invalid(
|
|
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());
|
|
1958
1992
|
return 1;
|
|
1959
1993
|
}
|
|
1960
1994
|
return 0;
|
|
1961
1995
|
}
|
|
1962
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) {
|
|
2061
|
+
return 0;
|
|
2062
|
+
}
|
|
2063
|
+
return set_tls13_ciphers(cipher_ids, flags, num_cipher_ids,
|
|
2064
|
+
&ssl_impl->config->tls13_cipher_list);
|
|
2065
|
+
}
|
|
2066
|
+
|
|
1963
2067
|
static bool ssl_nids_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
1964
2068
|
Span<const int> nids) {
|
|
1965
2069
|
if (nids.empty()) {
|
|
@@ -1976,7 +2080,7 @@ static bool ssl_nids_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
|
1976
2080
|
return false;
|
|
1977
2081
|
}
|
|
1978
2082
|
}
|
|
1979
|
-
if (!check_no_duplicates(group_ids)) {
|
|
2083
|
+
if (!check_no_duplicates(group_ids, SSL_R_DUPLICATE_GROUP)) {
|
|
1980
2084
|
return false;
|
|
1981
2085
|
}
|
|
1982
2086
|
|
|
@@ -1993,14 +2097,15 @@ int SSL_CTX_set1_groups(SSL_CTX *ctx, const int *groups, size_t num_groups) {
|
|
|
1993
2097
|
}
|
|
1994
2098
|
|
|
1995
2099
|
int SSL_set1_groups(SSL *ssl, const int *groups, size_t num_groups) {
|
|
1996
|
-
|
|
2100
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2101
|
+
if (!ssl_impl->config) {
|
|
1997
2102
|
return 0;
|
|
1998
2103
|
}
|
|
1999
|
-
if (ssl_nids_to_group_ids(&
|
|
2104
|
+
if (ssl_nids_to_group_ids(&ssl_impl->config->supported_group_list,
|
|
2000
2105
|
Span(groups, num_groups)) &&
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
clear_key_shares_if_invalid(
|
|
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());
|
|
2004
2109
|
return 1;
|
|
2005
2110
|
}
|
|
2006
2111
|
return 0;
|
|
@@ -2039,7 +2144,7 @@ static bool ssl_str_to_group_ids(Array<uint16_t> *out_group_ids,
|
|
|
2039
2144
|
} while (col);
|
|
2040
2145
|
|
|
2041
2146
|
assert(i == count);
|
|
2042
|
-
if (!check_no_duplicates(group_ids)) {
|
|
2147
|
+
if (!check_no_duplicates(group_ids, SSL_R_DUPLICATE_GROUP)) {
|
|
2043
2148
|
return false;
|
|
2044
2149
|
}
|
|
2045
2150
|
*out_group_ids = std::move(group_ids);
|
|
@@ -2054,20 +2159,21 @@ int SSL_CTX_set1_groups_list(SSL_CTX *ctx, const char *groups) {
|
|
|
2054
2159
|
}
|
|
2055
2160
|
|
|
2056
2161
|
int SSL_set1_groups_list(SSL *ssl, const char *groups) {
|
|
2057
|
-
|
|
2162
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2163
|
+
if (!ssl_impl->config) {
|
|
2058
2164
|
return 0;
|
|
2059
2165
|
}
|
|
2060
|
-
if (ssl_str_to_group_ids(&
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
clear_key_shares_if_invalid(
|
|
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());
|
|
2064
2170
|
return 1;
|
|
2065
2171
|
}
|
|
2066
2172
|
return 0;
|
|
2067
2173
|
}
|
|
2068
2174
|
|
|
2069
2175
|
uint16_t SSL_get_group_id(const SSL *ssl) {
|
|
2070
|
-
|
|
2176
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2071
2177
|
if (session == nullptr) {
|
|
2072
2178
|
return 0;
|
|
2073
2179
|
}
|
|
@@ -2085,29 +2191,31 @@ int SSL_get_negotiated_group(const SSL *ssl) {
|
|
|
2085
2191
|
|
|
2086
2192
|
int SSL_set1_client_key_shares(SSL *ssl, const uint16_t *group_ids,
|
|
2087
2193
|
size_t num_group_ids) {
|
|
2088
|
-
|
|
2194
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2195
|
+
if (!ssl_impl->config) {
|
|
2089
2196
|
return 0;
|
|
2090
2197
|
}
|
|
2091
2198
|
auto requested_key_shares = Span(group_ids, num_group_ids);
|
|
2092
2199
|
if (!validate_key_shares(requested_key_shares,
|
|
2093
|
-
|
|
2200
|
+
ssl_impl->config->supported_group_list)) {
|
|
2094
2201
|
return 0;
|
|
2095
2202
|
}
|
|
2096
2203
|
|
|
2097
2204
|
assert(requested_key_shares.size() <= kNumNamedGroups);
|
|
2098
|
-
|
|
2099
|
-
|
|
2205
|
+
ssl_impl->config->client_key_share_selections.emplace();
|
|
2206
|
+
ssl_impl->config->client_key_share_selections->CopyFrom(requested_key_shares);
|
|
2100
2207
|
return 1;
|
|
2101
2208
|
}
|
|
2102
2209
|
|
|
2103
2210
|
int SSL_set1_server_supported_groups_hint(SSL *ssl,
|
|
2104
2211
|
const uint16_t *server_groups,
|
|
2105
2212
|
size_t num_server_groups) {
|
|
2106
|
-
|
|
2213
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2214
|
+
if (!ssl_impl->config) {
|
|
2107
2215
|
return 0;
|
|
2108
2216
|
}
|
|
2109
2217
|
auto span = Span(server_groups, num_server_groups);
|
|
2110
|
-
return
|
|
2218
|
+
return ssl_impl->config->server_supported_groups_hint.CopyFrom(span);
|
|
2111
2219
|
}
|
|
2112
2220
|
|
|
2113
2221
|
int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh) { return 1; }
|
|
@@ -2115,28 +2223,30 @@ int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh) { return 1; }
|
|
|
2115
2223
|
int SSL_set_tmp_dh(SSL *ssl, const DH *dh) { return 1; }
|
|
2116
2224
|
|
|
2117
2225
|
STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx) {
|
|
2118
|
-
return FromOpaque(ctx)->cipher_list->ciphers
|
|
2226
|
+
return FromOpaque(ctx)->cipher_list->ciphers();
|
|
2119
2227
|
}
|
|
2120
2228
|
|
|
2121
2229
|
int SSL_CTX_cipher_in_group(const SSL_CTX *ctx, size_t i) {
|
|
2122
2230
|
auto *ctx_impl = FromOpaque(ctx);
|
|
2123
|
-
if (i >= sk_SSL_CIPHER_num(ctx_impl->cipher_list->ciphers
|
|
2231
|
+
if (i >= sk_SSL_CIPHER_num(ctx_impl->cipher_list->ciphers())) {
|
|
2124
2232
|
return 0;
|
|
2125
2233
|
}
|
|
2126
|
-
return ctx_impl->cipher_list->in_group_flags[i];
|
|
2234
|
+
return ctx_impl->cipher_list->in_group_flags()[i];
|
|
2127
2235
|
}
|
|
2128
2236
|
|
|
2129
2237
|
STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl) {
|
|
2130
2238
|
if (ssl == nullptr) {
|
|
2131
2239
|
return nullptr;
|
|
2132
2240
|
}
|
|
2133
|
-
|
|
2134
|
-
|
|
2241
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2242
|
+
if (ssl_impl->config == nullptr) {
|
|
2243
|
+
assert(ssl_impl->config);
|
|
2135
2244
|
return nullptr;
|
|
2136
2245
|
}
|
|
2137
2246
|
|
|
2138
|
-
return
|
|
2139
|
-
|
|
2247
|
+
return ssl_impl->config->cipher_list
|
|
2248
|
+
? ssl_impl->config->cipher_list->ciphers()
|
|
2249
|
+
: ssl_impl->ctx->cipher_list->ciphers();
|
|
2140
2250
|
}
|
|
2141
2251
|
|
|
2142
2252
|
const char *SSL_get_cipher_list(const SSL *ssl, int n) {
|
|
@@ -2144,8 +2254,9 @@ const char *SSL_get_cipher_list(const SSL *ssl, int n) {
|
|
|
2144
2254
|
return nullptr;
|
|
2145
2255
|
}
|
|
2146
2256
|
|
|
2147
|
-
STACK_OF(SSL_CIPHER) *sk = SSL_get_ciphers(ssl);
|
|
2148
|
-
if (sk == nullptr || n < 0 ||
|
|
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)) {
|
|
2149
2260
|
return nullptr;
|
|
2150
2261
|
}
|
|
2151
2262
|
|
|
@@ -2159,41 +2270,30 @@ const char *SSL_get_cipher_list(const SSL *ssl, int n) {
|
|
|
2159
2270
|
|
|
2160
2271
|
int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
|
|
2161
2272
|
auto *ctx_impl = FromOpaque(ctx);
|
|
2162
|
-
|
|
2163
|
-
? ctx_impl->aes_hw_override_value
|
|
2164
|
-
: EVP_has_aes_hardware();
|
|
2165
|
-
return ssl_create_cipher_list(&ctx_impl->cipher_list, has_aes_hw, str,
|
|
2273
|
+
return ssl_create_cipher_list(&ctx_impl->cipher_list, str,
|
|
2166
2274
|
false /* not strict */);
|
|
2167
2275
|
}
|
|
2168
2276
|
|
|
2169
2277
|
int SSL_CTX_set_strict_cipher_list(SSL_CTX *ctx, const char *str) {
|
|
2170
2278
|
auto *ctx_impl = FromOpaque(ctx);
|
|
2171
|
-
|
|
2172
|
-
? ctx_impl->aes_hw_override_value
|
|
2173
|
-
: EVP_has_aes_hardware();
|
|
2174
|
-
return ssl_create_cipher_list(&ctx_impl->cipher_list, has_aes_hw, str,
|
|
2175
|
-
true /* strict */);
|
|
2279
|
+
return ssl_create_cipher_list(&ctx_impl->cipher_list, str, true /* strict */);
|
|
2176
2280
|
}
|
|
2177
2281
|
|
|
2178
2282
|
int SSL_set_cipher_list(SSL *ssl, const char *str) {
|
|
2179
|
-
|
|
2283
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2284
|
+
if (!ssl_impl->config) {
|
|
2180
2285
|
return 0;
|
|
2181
2286
|
}
|
|
2182
|
-
|
|
2183
|
-
? ssl->config->aes_hw_override_value
|
|
2184
|
-
: EVP_has_aes_hardware();
|
|
2185
|
-
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,
|
|
2186
2288
|
false /* not strict */);
|
|
2187
2289
|
}
|
|
2188
2290
|
|
|
2189
2291
|
int SSL_set_strict_cipher_list(SSL *ssl, const char *str) {
|
|
2190
|
-
|
|
2292
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2293
|
+
if (!ssl_impl->config) {
|
|
2191
2294
|
return 0;
|
|
2192
2295
|
}
|
|
2193
|
-
|
|
2194
|
-
? ssl->config->aes_hw_override_value
|
|
2195
|
-
: EVP_has_aes_hardware();
|
|
2196
|
-
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,
|
|
2197
2297
|
true /* strict */);
|
|
2198
2298
|
}
|
|
2199
2299
|
|
|
@@ -2202,13 +2302,14 @@ const char *SSL_get_servername(const SSL *ssl, const int type) {
|
|
|
2202
2302
|
return nullptr;
|
|
2203
2303
|
}
|
|
2204
2304
|
|
|
2305
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2205
2306
|
// Historically, `SSL_get_servername` was also the configuration getter
|
|
2206
2307
|
// corresponding to `SSL_set_tlsext_host_name`.
|
|
2207
|
-
if (
|
|
2208
|
-
return
|
|
2308
|
+
if (ssl_impl->hostname != nullptr) {
|
|
2309
|
+
return ssl_impl->hostname.get();
|
|
2209
2310
|
}
|
|
2210
2311
|
|
|
2211
|
-
return
|
|
2312
|
+
return ssl_impl->s3->hostname.get();
|
|
2212
2313
|
}
|
|
2213
2314
|
|
|
2214
2315
|
int SSL_get_servername_type(const SSL *ssl) {
|
|
@@ -2229,11 +2330,12 @@ void SSL_CTX_set_custom_verify(
|
|
|
2229
2330
|
void SSL_set_custom_verify(
|
|
2230
2331
|
SSL *ssl, int mode,
|
|
2231
2332
|
enum ssl_verify_result_t (*callback)(SSL *ssl, uint8_t *out_alert)) {
|
|
2232
|
-
|
|
2333
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2334
|
+
if (!ssl_impl->config) {
|
|
2233
2335
|
return;
|
|
2234
2336
|
}
|
|
2235
|
-
|
|
2236
|
-
|
|
2337
|
+
ssl_impl->config->verify_mode = mode;
|
|
2338
|
+
ssl_impl->config->custom_verify_callback = callback;
|
|
2237
2339
|
}
|
|
2238
2340
|
|
|
2239
2341
|
void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx) {
|
|
@@ -2241,10 +2343,11 @@ void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx) {
|
|
|
2241
2343
|
}
|
|
2242
2344
|
|
|
2243
2345
|
void SSL_enable_signed_cert_timestamps(SSL *ssl) {
|
|
2244
|
-
|
|
2346
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2347
|
+
if (!ssl_impl->config) {
|
|
2245
2348
|
return;
|
|
2246
2349
|
}
|
|
2247
|
-
|
|
2350
|
+
ssl_impl->config->signed_cert_timestamps_enabled = true;
|
|
2248
2351
|
}
|
|
2249
2352
|
|
|
2250
2353
|
void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx) {
|
|
@@ -2252,16 +2355,18 @@ void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx) {
|
|
|
2252
2355
|
}
|
|
2253
2356
|
|
|
2254
2357
|
void SSL_enable_ocsp_stapling(SSL *ssl) {
|
|
2255
|
-
|
|
2358
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2359
|
+
if (!ssl_impl->config) {
|
|
2256
2360
|
return;
|
|
2257
2361
|
}
|
|
2258
|
-
|
|
2362
|
+
ssl_impl->config->ocsp_stapling_enabled = true;
|
|
2259
2363
|
}
|
|
2260
2364
|
|
|
2261
2365
|
void SSL_get0_signed_cert_timestamp_list(const SSL *ssl, const uint8_t **out,
|
|
2262
2366
|
size_t *out_len) {
|
|
2263
|
-
|
|
2264
|
-
if (ssl->server || !session ||
|
|
2367
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2368
|
+
if (FromOpaque(ssl)->server || !session ||
|
|
2369
|
+
!session->signed_cert_timestamp_list) {
|
|
2265
2370
|
*out_len = 0;
|
|
2266
2371
|
*out = nullptr;
|
|
2267
2372
|
return;
|
|
@@ -2273,8 +2378,8 @@ void SSL_get0_signed_cert_timestamp_list(const SSL *ssl, const uint8_t **out,
|
|
|
2273
2378
|
|
|
2274
2379
|
void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
|
|
2275
2380
|
size_t *out_len) {
|
|
2276
|
-
|
|
2277
|
-
if (ssl->server || !session || !session->ocsp_response) {
|
|
2381
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2382
|
+
if (FromOpaque(ssl)->server || !session || !session->ocsp_response) {
|
|
2278
2383
|
*out_len = 0;
|
|
2279
2384
|
*out = nullptr;
|
|
2280
2385
|
return;
|
|
@@ -2285,7 +2390,8 @@ void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
|
|
|
2285
2390
|
}
|
|
2286
2391
|
|
|
2287
2392
|
int SSL_set_tlsext_host_name(SSL *ssl, const char *name) {
|
|
2288
|
-
ssl
|
|
2393
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2394
|
+
ssl_impl->hostname.reset();
|
|
2289
2395
|
if (name == nullptr) {
|
|
2290
2396
|
return 1;
|
|
2291
2397
|
}
|
|
@@ -2295,8 +2401,8 @@ int SSL_set_tlsext_host_name(SSL *ssl, const char *name) {
|
|
|
2295
2401
|
OPENSSL_PUT_ERROR(SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME);
|
|
2296
2402
|
return 0;
|
|
2297
2403
|
}
|
|
2298
|
-
|
|
2299
|
-
if (
|
|
2404
|
+
ssl_impl->hostname.reset(OPENSSL_strdup(name));
|
|
2405
|
+
if (ssl_impl->hostname == nullptr) {
|
|
2300
2406
|
return 0;
|
|
2301
2407
|
}
|
|
2302
2408
|
return 1;
|
|
@@ -2363,10 +2469,11 @@ int SSL_select_next_proto(uint8_t **out, uint8_t *out_len, const uint8_t *peer,
|
|
|
2363
2469
|
|
|
2364
2470
|
void SSL_get0_next_proto_negotiated(const SSL *ssl, const uint8_t **out_data,
|
|
2365
2471
|
unsigned *out_len) {
|
|
2472
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2366
2473
|
// NPN protocols have one-byte lengths, so they must fit in `unsigned`.
|
|
2367
|
-
assert(
|
|
2368
|
-
*out_data =
|
|
2369
|
-
*out_len = static_cast<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());
|
|
2370
2477
|
}
|
|
2371
2478
|
|
|
2372
2479
|
void SSL_CTX_set_next_protos_advertised_cb(
|
|
@@ -2402,7 +2509,8 @@ int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const uint8_t *protos,
|
|
|
2402
2509
|
|
|
2403
2510
|
int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos, size_t protos_len) {
|
|
2404
2511
|
// Note this function's return value is backwards.
|
|
2405
|
-
|
|
2512
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2513
|
+
if (!ssl_impl->config) {
|
|
2406
2514
|
return 1;
|
|
2407
2515
|
}
|
|
2408
2516
|
auto span = Span(protos, protos_len);
|
|
@@ -2410,7 +2518,7 @@ int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos, size_t protos_len) {
|
|
|
2410
2518
|
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_ALPN_PROTOCOL_LIST);
|
|
2411
2519
|
return 1;
|
|
2412
2520
|
}
|
|
2413
|
-
return
|
|
2521
|
+
return ssl_impl->config->alpn_client_proto_list.CopyFrom(span) ? 0 : 1;
|
|
2414
2522
|
}
|
|
2415
2523
|
|
|
2416
2524
|
void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
|
|
@@ -2425,11 +2533,12 @@ void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
|
|
|
2425
2533
|
|
|
2426
2534
|
void SSL_get0_alpn_selected(const SSL *ssl, const uint8_t **out_data,
|
|
2427
2535
|
unsigned *out_len) {
|
|
2536
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2428
2537
|
Span<const uint8_t> protocol;
|
|
2429
|
-
if (SSL_in_early_data(
|
|
2430
|
-
protocol =
|
|
2538
|
+
if (SSL_in_early_data(ssl_impl) && !ssl_impl->server) {
|
|
2539
|
+
protocol = ssl_impl->s3->hs->early_session->early_alpn;
|
|
2431
2540
|
} else {
|
|
2432
|
-
protocol =
|
|
2541
|
+
protocol = ssl_impl->s3->alpn_selected;
|
|
2433
2542
|
}
|
|
2434
2543
|
// ALPN protocols have one-byte lengths, so they must fit in `unsigned`.
|
|
2435
2544
|
assert(protocol.size() < UINT_MAX);
|
|
@@ -2444,13 +2553,14 @@ void SSL_CTX_set_allow_unknown_alpn_protos(SSL_CTX *ctx, int enabled) {
|
|
|
2444
2553
|
int SSL_add_application_settings(SSL *ssl, const uint8_t *proto,
|
|
2445
2554
|
size_t proto_len, const uint8_t *settings,
|
|
2446
2555
|
size_t settings_len) {
|
|
2447
|
-
|
|
2556
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2557
|
+
if (!ssl_impl->config) {
|
|
2448
2558
|
return 0;
|
|
2449
2559
|
}
|
|
2450
2560
|
ALPSConfig config;
|
|
2451
2561
|
if (!config.protocol.CopyFrom(Span(proto, proto_len)) ||
|
|
2452
2562
|
!config.settings.CopyFrom(Span(settings, settings_len)) ||
|
|
2453
|
-
!
|
|
2563
|
+
!ssl_impl->config->alps_configs.Push(std::move(config))) {
|
|
2454
2564
|
return 0;
|
|
2455
2565
|
}
|
|
2456
2566
|
return 1;
|
|
@@ -2459,7 +2569,7 @@ int SSL_add_application_settings(SSL *ssl, const uint8_t *proto,
|
|
|
2459
2569
|
void SSL_get0_peer_application_settings(const SSL *ssl,
|
|
2460
2570
|
const uint8_t **out_data,
|
|
2461
2571
|
size_t *out_len) {
|
|
2462
|
-
const
|
|
2572
|
+
const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2463
2573
|
Span<const uint8_t> settings =
|
|
2464
2574
|
session ? session->peer_application_settings : Span<const uint8_t>();
|
|
2465
2575
|
*out_data = settings.data();
|
|
@@ -2467,15 +2577,16 @@ void SSL_get0_peer_application_settings(const SSL *ssl,
|
|
|
2467
2577
|
}
|
|
2468
2578
|
|
|
2469
2579
|
int SSL_has_application_settings(const SSL *ssl) {
|
|
2470
|
-
const
|
|
2580
|
+
const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2471
2581
|
return session && session->has_application_settings;
|
|
2472
2582
|
}
|
|
2473
2583
|
|
|
2474
2584
|
void SSL_set_alps_use_new_codepoint(SSL *ssl, int use_new) {
|
|
2475
|
-
|
|
2585
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2586
|
+
if (!ssl_impl->config) {
|
|
2476
2587
|
return;
|
|
2477
2588
|
}
|
|
2478
|
-
|
|
2589
|
+
ssl_impl->config->alps_use_new_codepoint = !!use_new;
|
|
2479
2590
|
}
|
|
2480
2591
|
|
|
2481
2592
|
int SSL_CTX_add_cert_compression_alg(SSL_CTX *ctx, uint16_t alg_id,
|
|
@@ -2507,10 +2618,11 @@ int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx) {
|
|
|
2507
2618
|
}
|
|
2508
2619
|
|
|
2509
2620
|
void SSL_set_tls_channel_id_enabled(SSL *ssl, int enabled) {
|
|
2510
|
-
|
|
2621
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2622
|
+
if (!ssl_impl->config) {
|
|
2511
2623
|
return;
|
|
2512
2624
|
}
|
|
2513
|
-
|
|
2625
|
+
ssl_impl->config->channel_id_enabled = !!enabled;
|
|
2514
2626
|
}
|
|
2515
2627
|
|
|
2516
2628
|
int SSL_enable_tls_channel_id(SSL *ssl) {
|
|
@@ -2529,7 +2641,8 @@ int SSL_CTX_set1_tls_channel_id(SSL_CTX *ctx, EVP_PKEY *private_key) {
|
|
|
2529
2641
|
}
|
|
2530
2642
|
|
|
2531
2643
|
int SSL_set1_tls_channel_id(SSL *ssl, EVP_PKEY *private_key) {
|
|
2532
|
-
|
|
2644
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2645
|
+
if (!ssl_impl->config) {
|
|
2533
2646
|
return 0;
|
|
2534
2647
|
}
|
|
2535
2648
|
if (EVP_PKEY_get_ec_curve_nid(private_key) != NID_X9_62_prime256v1) {
|
|
@@ -2537,22 +2650,24 @@ int SSL_set1_tls_channel_id(SSL *ssl, EVP_PKEY *private_key) {
|
|
|
2537
2650
|
return 0;
|
|
2538
2651
|
}
|
|
2539
2652
|
|
|
2540
|
-
|
|
2653
|
+
ssl_impl->config->channel_id_private = UpRef(private_key);
|
|
2541
2654
|
return 1;
|
|
2542
2655
|
}
|
|
2543
2656
|
|
|
2544
2657
|
size_t SSL_get_tls_channel_id(SSL *ssl, uint8_t *out, size_t max_out) {
|
|
2545
|
-
|
|
2658
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2659
|
+
if (!ssl_impl->s3->channel_id_valid) {
|
|
2546
2660
|
return 0;
|
|
2547
2661
|
}
|
|
2548
|
-
OPENSSL_memcpy(out,
|
|
2662
|
+
OPENSSL_memcpy(out, ssl_impl->s3->channel_id, (max_out < 64) ? max_out : 64);
|
|
2549
2663
|
return 64;
|
|
2550
2664
|
}
|
|
2551
2665
|
|
|
2552
2666
|
size_t SSL_get0_certificate_types(const SSL *ssl, const uint8_t **out_types) {
|
|
2667
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2553
2668
|
Span<const uint8_t> types;
|
|
2554
|
-
if (!
|
|
2555
|
-
types =
|
|
2669
|
+
if (!ssl_impl->server && ssl_impl->s3->hs != nullptr) {
|
|
2670
|
+
types = ssl_impl->s3->hs->certificate_types;
|
|
2556
2671
|
}
|
|
2557
2672
|
*out_types = types.data();
|
|
2558
2673
|
return types.size();
|
|
@@ -2560,9 +2675,10 @@ size_t SSL_get0_certificate_types(const SSL *ssl, const uint8_t **out_types) {
|
|
|
2560
2675
|
|
|
2561
2676
|
size_t SSL_get0_peer_verify_algorithms(const SSL *ssl,
|
|
2562
2677
|
const uint16_t **out_sigalgs) {
|
|
2678
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2563
2679
|
Span<const uint16_t> sigalgs;
|
|
2564
|
-
if (
|
|
2565
|
-
sigalgs =
|
|
2680
|
+
if (ssl_impl->s3->hs != nullptr) {
|
|
2681
|
+
sigalgs = ssl_impl->s3->hs->peer_sigalgs;
|
|
2566
2682
|
}
|
|
2567
2683
|
*out_sigalgs = sigalgs.data();
|
|
2568
2684
|
return sigalgs.size();
|
|
@@ -2570,20 +2686,22 @@ size_t SSL_get0_peer_verify_algorithms(const SSL *ssl,
|
|
|
2570
2686
|
|
|
2571
2687
|
size_t SSL_get0_peer_delegation_algorithms(const SSL *ssl,
|
|
2572
2688
|
const uint16_t **out_sigalgs) {
|
|
2689
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2573
2690
|
Span<const uint16_t> sigalgs;
|
|
2574
|
-
if (
|
|
2575
|
-
sigalgs =
|
|
2691
|
+
if (ssl_impl->s3->hs != nullptr) {
|
|
2692
|
+
sigalgs = ssl_impl->s3->hs->peer_delegated_credential_sigalgs;
|
|
2576
2693
|
}
|
|
2577
2694
|
*out_sigalgs = sigalgs.data();
|
|
2578
2695
|
return sigalgs.size();
|
|
2579
2696
|
}
|
|
2580
2697
|
|
|
2581
2698
|
EVP_PKEY *SSL_get_privatekey(const SSL *ssl) {
|
|
2582
|
-
|
|
2583
|
-
|
|
2699
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2700
|
+
if (!ssl_impl->config) {
|
|
2701
|
+
assert(ssl_impl->config);
|
|
2584
2702
|
return nullptr;
|
|
2585
2703
|
}
|
|
2586
|
-
return
|
|
2704
|
+
return ssl_impl->config->cert->legacy_credential->privkey.get();
|
|
2587
2705
|
}
|
|
2588
2706
|
|
|
2589
2707
|
EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx) {
|
|
@@ -2591,12 +2709,12 @@ EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx) {
|
|
|
2591
2709
|
}
|
|
2592
2710
|
|
|
2593
2711
|
const SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl) {
|
|
2594
|
-
const
|
|
2712
|
+
const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2595
2713
|
return session == nullptr ? nullptr : session->cipher;
|
|
2596
2714
|
}
|
|
2597
2715
|
|
|
2598
2716
|
int SSL_session_reused(const SSL *ssl) {
|
|
2599
|
-
return ssl->s3->session_reused || SSL_in_early_data(ssl);
|
|
2717
|
+
return FromOpaque(ssl)->s3->session_reused || SSL_in_early_data(ssl);
|
|
2600
2718
|
}
|
|
2601
2719
|
|
|
2602
2720
|
const COMP_METHOD *SSL_get_current_compression(SSL *ssl) { return nullptr; }
|
|
@@ -2605,6 +2723,8 @@ const COMP_METHOD *SSL_get_current_expansion(SSL *ssl) { return nullptr; }
|
|
|
2605
2723
|
|
|
2606
2724
|
int SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key) { return 0; }
|
|
2607
2725
|
|
|
2726
|
+
int SSL_get_peer_tmp_key(SSL *ssl, EVP_PKEY **out_key) { return 0; }
|
|
2727
|
+
|
|
2608
2728
|
void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode) {
|
|
2609
2729
|
FromOpaque(ctx)->quiet_shutdown = (mode != 0);
|
|
2610
2730
|
}
|
|
@@ -2614,54 +2734,59 @@ int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx) {
|
|
|
2614
2734
|
}
|
|
2615
2735
|
|
|
2616
2736
|
void SSL_set_quiet_shutdown(SSL *ssl, int mode) {
|
|
2617
|
-
ssl->quiet_shutdown = (mode != 0);
|
|
2737
|
+
FromOpaque(ssl)->quiet_shutdown = (mode != 0);
|
|
2618
2738
|
}
|
|
2619
2739
|
|
|
2620
|
-
int SSL_get_quiet_shutdown(const SSL *ssl) {
|
|
2740
|
+
int SSL_get_quiet_shutdown(const SSL *ssl) {
|
|
2741
|
+
return FromOpaque(ssl)->quiet_shutdown;
|
|
2742
|
+
}
|
|
2621
2743
|
|
|
2622
2744
|
void SSL_set_shutdown(SSL *ssl, int mode) {
|
|
2745
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2623
2746
|
// It is an error to clear any bits that have already been set. (We can't try
|
|
2624
2747
|
// to get a second close_notify or send two.)
|
|
2625
2748
|
assert((SSL_get_shutdown(ssl) & mode) == SSL_get_shutdown(ssl));
|
|
2626
2749
|
|
|
2627
2750
|
if (mode & SSL_RECEIVED_SHUTDOWN &&
|
|
2628
|
-
|
|
2629
|
-
|
|
2751
|
+
ssl_impl->s3->read_shutdown == ssl_shutdown_none) {
|
|
2752
|
+
ssl_impl->s3->read_shutdown = ssl_shutdown_close_notify;
|
|
2630
2753
|
}
|
|
2631
2754
|
|
|
2632
2755
|
if (mode & SSL_SENT_SHUTDOWN &&
|
|
2633
|
-
|
|
2634
|
-
|
|
2756
|
+
ssl_impl->s3->write_shutdown == ssl_shutdown_none) {
|
|
2757
|
+
ssl_impl->s3->write_shutdown = ssl_shutdown_close_notify;
|
|
2635
2758
|
}
|
|
2636
2759
|
}
|
|
2637
2760
|
|
|
2638
2761
|
int SSL_get_shutdown(const SSL *ssl) {
|
|
2762
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2639
2763
|
int ret = 0;
|
|
2640
|
-
if (
|
|
2764
|
+
if (ssl_impl->s3->read_shutdown != ssl_shutdown_none) {
|
|
2641
2765
|
// Historically, OpenSSL set `SSL_RECEIVED_SHUTDOWN` on both close_notify
|
|
2642
2766
|
// and fatal alert.
|
|
2643
2767
|
ret |= SSL_RECEIVED_SHUTDOWN;
|
|
2644
2768
|
}
|
|
2645
|
-
if (
|
|
2769
|
+
if (ssl_impl->s3->write_shutdown == ssl_shutdown_close_notify) {
|
|
2646
2770
|
// Historically, OpenSSL set `SSL_SENT_SHUTDOWN` on only close_notify.
|
|
2647
2771
|
ret |= SSL_SENT_SHUTDOWN;
|
|
2648
2772
|
}
|
|
2649
2773
|
return ret;
|
|
2650
2774
|
}
|
|
2651
2775
|
|
|
2652
|
-
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(); }
|
|
2653
2777
|
|
|
2654
2778
|
SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) {
|
|
2655
|
-
|
|
2779
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2780
|
+
if (!ssl_impl->config) {
|
|
2656
2781
|
return nullptr;
|
|
2657
2782
|
}
|
|
2658
|
-
if (
|
|
2659
|
-
return
|
|
2783
|
+
if (ssl_impl->ctx.get() == ctx) {
|
|
2784
|
+
return ssl_impl->ctx.get();
|
|
2660
2785
|
}
|
|
2661
2786
|
|
|
2662
2787
|
// One cannot change the X.509 callbacks during a connection.
|
|
2663
2788
|
auto *ctx_impl = FromOpaque(ctx);
|
|
2664
|
-
if (
|
|
2789
|
+
if (ssl_impl->ctx->x509_method != ctx_impl->x509_method) {
|
|
2665
2790
|
assert(0);
|
|
2666
2791
|
return nullptr;
|
|
2667
2792
|
}
|
|
@@ -2671,21 +2796,21 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) {
|
|
|
2671
2796
|
return nullptr;
|
|
2672
2797
|
}
|
|
2673
2798
|
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
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;
|
|
2677
2802
|
|
|
2678
|
-
return
|
|
2803
|
+
return ssl_impl->ctx.get();
|
|
2679
2804
|
}
|
|
2680
2805
|
|
|
2681
2806
|
void SSL_set_info_callback(SSL *ssl,
|
|
2682
2807
|
void (*cb)(const SSL *ssl, int type, int value)) {
|
|
2683
|
-
ssl->info_callback = cb;
|
|
2808
|
+
FromOpaque(ssl)->info_callback = cb;
|
|
2684
2809
|
}
|
|
2685
2810
|
|
|
2686
2811
|
void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type,
|
|
2687
2812
|
int value) {
|
|
2688
|
-
return ssl->info_callback;
|
|
2813
|
+
return FromOpaque(ssl)->info_callback;
|
|
2689
2814
|
}
|
|
2690
2815
|
|
|
2691
2816
|
int SSL_state(const SSL *ssl) {
|
|
@@ -2717,10 +2842,11 @@ int SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method) {
|
|
|
2717
2842
|
}
|
|
2718
2843
|
|
|
2719
2844
|
int SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method) {
|
|
2720
|
-
|
|
2845
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2846
|
+
if (ssl_impl->method->is_dtls) {
|
|
2721
2847
|
return 0;
|
|
2722
2848
|
}
|
|
2723
|
-
|
|
2849
|
+
ssl_impl->quic_method = quic_method;
|
|
2724
2850
|
return 1;
|
|
2725
2851
|
}
|
|
2726
2852
|
|
|
@@ -2731,11 +2857,11 @@ int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
|
|
|
2731
2857
|
}
|
|
2732
2858
|
|
|
2733
2859
|
int SSL_set_ex_data(SSL *ssl, int idx, void *data) {
|
|
2734
|
-
return CRYPTO_set_ex_data(&ssl->ex_data, idx, data);
|
|
2860
|
+
return CRYPTO_set_ex_data(&FromOpaque(ssl)->ex_data, idx, data);
|
|
2735
2861
|
}
|
|
2736
2862
|
|
|
2737
2863
|
void *SSL_get_ex_data(const SSL *ssl, int idx) {
|
|
2738
|
-
return CRYPTO_get_ex_data(&ssl->ex_data, idx);
|
|
2864
|
+
return CRYPTO_get_ex_data(&FromOpaque(ssl)->ex_data, idx);
|
|
2739
2865
|
}
|
|
2740
2866
|
|
|
2741
2867
|
int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused,
|
|
@@ -2754,11 +2880,12 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
|
|
|
2754
2880
|
}
|
|
2755
2881
|
|
|
2756
2882
|
int SSL_want(const SSL *ssl) {
|
|
2883
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2757
2884
|
// Historically, OpenSSL did not track `SSL_ERROR_ZERO_RETURN` as an `rwstate`
|
|
2758
2885
|
// value. We do, but map it back to `SSL_ERROR_NONE` to preserve the original
|
|
2759
2886
|
// behavior.
|
|
2760
|
-
return
|
|
2761
|
-
|
|
2887
|
+
return ssl_impl->s3->rwstate == SSL_ERROR_ZERO_RETURN ? SSL_ERROR_NONE
|
|
2888
|
+
: ssl_impl->s3->rwstate;
|
|
2762
2889
|
}
|
|
2763
2890
|
|
|
2764
2891
|
void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
|
|
@@ -2806,28 +2933,31 @@ int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) {
|
|
|
2806
2933
|
}
|
|
2807
2934
|
|
|
2808
2935
|
int SSL_use_psk_identity_hint(SSL *ssl, const char *identity_hint) {
|
|
2809
|
-
|
|
2936
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2937
|
+
if (!ssl_impl->config) {
|
|
2810
2938
|
return 0;
|
|
2811
2939
|
}
|
|
2812
|
-
return use_psk_identity_hint(&
|
|
2940
|
+
return use_psk_identity_hint(&ssl_impl->config->psk_identity_hint,
|
|
2941
|
+
identity_hint);
|
|
2813
2942
|
}
|
|
2814
2943
|
|
|
2815
2944
|
const char *SSL_get_psk_identity_hint(const SSL *ssl) {
|
|
2816
2945
|
if (ssl == nullptr) {
|
|
2817
2946
|
return nullptr;
|
|
2818
2947
|
}
|
|
2819
|
-
|
|
2820
|
-
|
|
2948
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2949
|
+
if (ssl_impl->config == nullptr) {
|
|
2950
|
+
assert(ssl_impl->config);
|
|
2821
2951
|
return nullptr;
|
|
2822
2952
|
}
|
|
2823
|
-
return
|
|
2953
|
+
return ssl_impl->config->psk_identity_hint.get();
|
|
2824
2954
|
}
|
|
2825
2955
|
|
|
2826
2956
|
const char *SSL_get_psk_identity(const SSL *ssl) {
|
|
2827
2957
|
if (ssl == nullptr) {
|
|
2828
2958
|
return nullptr;
|
|
2829
2959
|
}
|
|
2830
|
-
|
|
2960
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
2831
2961
|
if (session == nullptr) {
|
|
2832
2962
|
return nullptr;
|
|
2833
2963
|
}
|
|
@@ -2838,10 +2968,11 @@ void SSL_set_psk_client_callback(
|
|
|
2838
2968
|
SSL *ssl, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
|
|
2839
2969
|
unsigned max_identity_len, uint8_t *psk,
|
|
2840
2970
|
unsigned max_psk_len)) {
|
|
2841
|
-
|
|
2971
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2972
|
+
if (!ssl_impl->config) {
|
|
2842
2973
|
return;
|
|
2843
2974
|
}
|
|
2844
|
-
|
|
2975
|
+
ssl_impl->config->psk_client_callback = cb;
|
|
2845
2976
|
}
|
|
2846
2977
|
|
|
2847
2978
|
void SSL_CTX_set_psk_client_callback(
|
|
@@ -2855,10 +2986,11 @@ void SSL_set_psk_server_callback(SSL *ssl,
|
|
|
2855
2986
|
unsigned (*cb)(SSL *ssl, const char *identity,
|
|
2856
2987
|
uint8_t *psk,
|
|
2857
2988
|
unsigned max_psk_len)) {
|
|
2858
|
-
|
|
2989
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
2990
|
+
if (!ssl_impl->config) {
|
|
2859
2991
|
return;
|
|
2860
2992
|
}
|
|
2861
|
-
|
|
2993
|
+
ssl_impl->config->psk_server_callback = cb;
|
|
2862
2994
|
}
|
|
2863
2995
|
|
|
2864
2996
|
void SSL_CTX_set_psk_server_callback(
|
|
@@ -2882,11 +3014,11 @@ void SSL_set_msg_callback(SSL *ssl,
|
|
|
2882
3014
|
void (*cb)(int write_p, int version, int content_type,
|
|
2883
3015
|
const void *buf, size_t len, SSL *ssl,
|
|
2884
3016
|
void *arg)) {
|
|
2885
|
-
ssl->msg_callback = cb;
|
|
3017
|
+
FromOpaque(ssl)->msg_callback = cb;
|
|
2886
3018
|
}
|
|
2887
3019
|
|
|
2888
3020
|
void SSL_set_msg_callback_arg(SSL *ssl, void *arg) {
|
|
2889
|
-
ssl->msg_callback_arg = arg;
|
|
3021
|
+
FromOpaque(ssl)->msg_callback_arg = arg;
|
|
2890
3022
|
}
|
|
2891
3023
|
|
|
2892
3024
|
void SSL_CTX_set_keylog_callback(SSL_CTX *ctx,
|
|
@@ -2906,14 +3038,15 @@ void SSL_CTX_set_current_time_cb(SSL_CTX *ctx,
|
|
|
2906
3038
|
}
|
|
2907
3039
|
|
|
2908
3040
|
int SSL_can_release_private_key(const SSL *ssl) {
|
|
2909
|
-
|
|
3041
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3042
|
+
if (ssl_can_renegotiate(ssl_impl)) {
|
|
2910
3043
|
// If the connection can renegotiate (client only), the private key may be
|
|
2911
3044
|
// used in a future handshake.
|
|
2912
3045
|
return 0;
|
|
2913
3046
|
}
|
|
2914
3047
|
|
|
2915
3048
|
// Otherwise, this is determined by the current handshake.
|
|
2916
|
-
return !
|
|
3049
|
+
return !ssl_impl->s3->hs || ssl_impl->s3->hs->can_release_private_key;
|
|
2917
3050
|
}
|
|
2918
3051
|
|
|
2919
3052
|
int SSL_is_init_finished(const SSL *ssl) { return !SSL_in_init(ssl); }
|
|
@@ -2922,24 +3055,28 @@ int SSL_in_init(const SSL *ssl) {
|
|
|
2922
3055
|
// This returns false once all the handshake state has been finalized, to
|
|
2923
3056
|
// allow callbacks and getters based on SSL_in_init to return the correct
|
|
2924
3057
|
// values.
|
|
2925
|
-
|
|
3058
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3059
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
2926
3060
|
return hs != nullptr && !hs->handshake_finalized;
|
|
2927
3061
|
}
|
|
2928
3062
|
|
|
2929
3063
|
int SSL_in_false_start(const SSL *ssl) {
|
|
2930
|
-
|
|
3064
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3065
|
+
if (ssl_impl->s3->hs == nullptr) {
|
|
2931
3066
|
return 0;
|
|
2932
3067
|
}
|
|
2933
|
-
return
|
|
3068
|
+
return ssl_impl->s3->hs->in_false_start;
|
|
2934
3069
|
}
|
|
2935
3070
|
|
|
2936
3071
|
int SSL_cutthrough_complete(const SSL *ssl) { return SSL_in_false_start(ssl); }
|
|
2937
3072
|
|
|
2938
|
-
int SSL_is_server(const SSL *ssl) { return ssl->server; }
|
|
3073
|
+
int SSL_is_server(const SSL *ssl) { return FromOpaque(ssl)->server; }
|
|
2939
3074
|
|
|
2940
|
-
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; }
|
|
2941
3076
|
|
|
2942
|
-
int SSL_is_quic(const SSL *ssl) {
|
|
3077
|
+
int SSL_is_quic(const SSL *ssl) {
|
|
3078
|
+
return FromOpaque(ssl)->quic_method != nullptr;
|
|
3079
|
+
}
|
|
2943
3080
|
|
|
2944
3081
|
void SSL_CTX_set_select_certificate_cb(
|
|
2945
3082
|
SSL_CTX *ctx,
|
|
@@ -2956,24 +3093,14 @@ void SSL_CTX_set_reverify_on_resume(SSL_CTX *ctx, int enabled) {
|
|
|
2956
3093
|
FromOpaque(ctx)->reverify_on_resume = !!enabled;
|
|
2957
3094
|
}
|
|
2958
3095
|
|
|
2959
|
-
void SSL_set_enforce_rsa_key_usage(SSL *ssl, int enabled) {
|
|
2960
|
-
if (!ssl->config) {
|
|
2961
|
-
return;
|
|
2962
|
-
}
|
|
2963
|
-
ssl->config->enforce_rsa_key_usage = !!enabled;
|
|
2964
|
-
}
|
|
2965
|
-
|
|
2966
|
-
int SSL_was_key_usage_invalid(const SSL *ssl) {
|
|
2967
|
-
return ssl->s3->was_key_usage_invalid;
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
3096
|
void SSL_set_renegotiate_mode(SSL *ssl, enum ssl_renegotiate_mode_t mode) {
|
|
2971
|
-
|
|
3097
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3098
|
+
ssl_impl->renegotiate_mode = mode;
|
|
2972
3099
|
|
|
2973
3100
|
// Check if `ssl_can_renegotiate` has changed and the configuration may now be
|
|
2974
3101
|
// shed. HTTP clients may initially allow renegotiation for HTTP/1.1, and then
|
|
2975
3102
|
// disable after the handshake once the ALPN protocol is known to be HTTP/2.
|
|
2976
|
-
ssl_maybe_shed_handshake_config(
|
|
3103
|
+
ssl_maybe_shed_handshake_config(ssl_impl);
|
|
2977
3104
|
}
|
|
2978
3105
|
|
|
2979
3106
|
int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
|
|
@@ -2985,9 +3112,10 @@ int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
|
|
|
2985
3112
|
return 0;
|
|
2986
3113
|
}
|
|
2987
3114
|
|
|
3115
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2988
3116
|
size_t write_iv_len;
|
|
2989
|
-
if (!
|
|
2990
|
-
!
|
|
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) ||
|
|
2991
3119
|
*out_iv_len != write_iv_len) {
|
|
2992
3120
|
return 0;
|
|
2993
3121
|
}
|
|
@@ -2996,14 +3124,15 @@ int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
|
|
|
2996
3124
|
}
|
|
2997
3125
|
|
|
2998
3126
|
uint64_t SSL_get_read_sequence(const SSL *ssl) {
|
|
3127
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
2999
3128
|
if (SSL_is_dtls(ssl)) {
|
|
3000
3129
|
// TODO(crbug.com/42290608): This API should not be implemented for DTLS or
|
|
3001
3130
|
// QUIC. In QUIC we do not maintain a sequence number.
|
|
3002
|
-
const DTLSReadEpoch *read_epoch = &
|
|
3131
|
+
const DTLSReadEpoch *read_epoch = &ssl_impl->d1->read_epoch;
|
|
3003
3132
|
return DTLSRecordNumber(read_epoch->epoch, read_epoch->bitmap.max_seq_num())
|
|
3004
3133
|
.combined();
|
|
3005
3134
|
}
|
|
3006
|
-
return
|
|
3135
|
+
return ssl_impl->s3->read_sequence;
|
|
3007
3136
|
}
|
|
3008
3137
|
|
|
3009
3138
|
uint64_t SSL_get_write_sequence(const SSL *ssl) {
|
|
@@ -3011,60 +3140,66 @@ uint64_t SSL_get_write_sequence(const SSL *ssl) {
|
|
|
3011
3140
|
// QUIC. In QUIC we do not maintain a sequence number. In DTLS, this API isn't
|
|
3012
3141
|
// harmful per se, but the caller already needs to use a DTLS-specific API on
|
|
3013
3142
|
// the read side.
|
|
3143
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3014
3144
|
if (SSL_is_dtls(ssl)) {
|
|
3015
|
-
return
|
|
3145
|
+
return ssl_impl->d1->write_epoch.next_record.combined();
|
|
3016
3146
|
}
|
|
3017
3147
|
|
|
3018
|
-
return
|
|
3148
|
+
return ssl_impl->s3->write_sequence;
|
|
3019
3149
|
}
|
|
3020
3150
|
|
|
3021
3151
|
int SSL_is_dtls_handshake_idle(const SSL *ssl) {
|
|
3022
3152
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3153
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3023
3154
|
|
|
3024
3155
|
return !SSL_in_init(ssl) &&
|
|
3025
3156
|
// No unacknowledged messages in DTLS 1.3. In DTLS 1.2, there no ACKs
|
|
3026
3157
|
// and we currently never clear `outgoing_messages` on the side that
|
|
3027
3158
|
// speaks last.
|
|
3028
|
-
(ssl_protocol_version(
|
|
3029
|
-
|
|
3159
|
+
(ssl_protocol_version(ssl_impl) < TLS1_3_VERSION ||
|
|
3160
|
+
ssl_impl->d1->outgoing_messages.empty()) &&
|
|
3030
3161
|
// No partial or out-of-order messages.
|
|
3031
|
-
std::all_of(std::begin(
|
|
3032
|
-
std::end(
|
|
3162
|
+
std::all_of(std::begin(ssl_impl->d1->incoming_messages),
|
|
3163
|
+
std::end(ssl_impl->d1->incoming_messages),
|
|
3033
3164
|
[](const auto &msg) { return msg == nullptr; }) &&
|
|
3034
3165
|
// Not trying to send a KeyUpdate.
|
|
3035
|
-
!
|
|
3036
|
-
|
|
3166
|
+
!ssl_impl->s3->key_update_pending &&
|
|
3167
|
+
ssl_impl->d1->queued_key_update == bssl::QueuedKeyUpdate::kNone;
|
|
3037
3168
|
}
|
|
3038
3169
|
|
|
3039
3170
|
uint32_t SSL_get_dtls_handshake_read_seq(const SSL *ssl) {
|
|
3040
3171
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3041
|
-
|
|
3172
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3173
|
+
return ssl_impl->d1->handshake_read_overflow
|
|
3042
3174
|
? uint32_t{0x10000}
|
|
3043
|
-
: uint32_t{
|
|
3175
|
+
: uint32_t{ssl_impl->d1->handshake_read_seq};
|
|
3044
3176
|
}
|
|
3045
3177
|
|
|
3046
3178
|
uint32_t SSL_get_dtls_handshake_write_seq(const SSL *ssl) {
|
|
3047
3179
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3048
|
-
|
|
3180
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3181
|
+
return ssl_impl->d1->handshake_write_overflow
|
|
3049
3182
|
? uint32_t{0x10000}
|
|
3050
|
-
: uint32_t{
|
|
3183
|
+
: uint32_t{ssl_impl->d1->handshake_write_seq};
|
|
3051
3184
|
}
|
|
3052
3185
|
|
|
3053
3186
|
uint16_t SSL_get_dtls_read_epoch(const SSL *ssl) {
|
|
3054
3187
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3188
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3055
3189
|
// Return the highest available epoch.
|
|
3056
|
-
return
|
|
3057
|
-
|
|
3190
|
+
return ssl_impl->d1->next_read_epoch ? ssl_impl->d1->next_read_epoch->epoch
|
|
3191
|
+
: ssl_impl->d1->read_epoch.epoch;
|
|
3058
3192
|
}
|
|
3059
3193
|
|
|
3060
3194
|
uint16_t SSL_get_dtls_write_epoch(const SSL *ssl) {
|
|
3061
3195
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3062
|
-
return ssl->d1->write_epoch.epoch();
|
|
3196
|
+
return FromOpaque(ssl)->d1->write_epoch.epoch();
|
|
3063
3197
|
}
|
|
3064
3198
|
|
|
3065
3199
|
uint64_t SSL_get_dtls_read_sequence(const SSL *ssl, uint16_t epoch) {
|
|
3066
3200
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3067
|
-
const
|
|
3201
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3202
|
+
const DTLSReadEpoch *read_epoch = dtls_get_read_epoch(ssl_impl, epoch);
|
|
3068
3203
|
if (read_epoch == nullptr) {
|
|
3069
3204
|
return UINT64_MAX;
|
|
3070
3205
|
}
|
|
@@ -3082,7 +3217,8 @@ uint64_t SSL_get_dtls_read_sequence(const SSL *ssl, uint16_t epoch) {
|
|
|
3082
3217
|
|
|
3083
3218
|
uint64_t SSL_get_dtls_write_sequence(const SSL *ssl, uint16_t epoch) {
|
|
3084
3219
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3085
|
-
const
|
|
3220
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3221
|
+
const DTLSWriteEpoch *write_epoch = dtls_get_write_epoch(ssl_impl, epoch);
|
|
3086
3222
|
if (write_epoch == nullptr) {
|
|
3087
3223
|
return UINT64_MAX;
|
|
3088
3224
|
}
|
|
@@ -3091,7 +3227,7 @@ uint64_t SSL_get_dtls_write_sequence(const SSL *ssl, uint16_t epoch) {
|
|
|
3091
3227
|
|
|
3092
3228
|
template <typename EpochState>
|
|
3093
3229
|
static int get_dtls_traffic_secret(
|
|
3094
|
-
const
|
|
3230
|
+
const SSLImpl *ssl, EpochState *(*get_epoch)(const SSLImpl *, uint16_t),
|
|
3095
3231
|
const uint8_t **out_data, size_t *out_len, uint16_t epoch) {
|
|
3096
3232
|
BSSL_CHECK(SSL_is_dtls(ssl));
|
|
3097
3233
|
// This function only applies to encrypted DTLS 1.3 epochs.
|
|
@@ -3111,18 +3247,18 @@ static int get_dtls_traffic_secret(
|
|
|
3111
3247
|
|
|
3112
3248
|
int SSL_get_dtls_read_traffic_secret(const SSL *ssl, const uint8_t **out_data,
|
|
3113
3249
|
size_t *out_len, uint16_t epoch) {
|
|
3114
|
-
return get_dtls_traffic_secret(ssl, dtls_get_read_epoch, out_data,
|
|
3115
|
-
epoch);
|
|
3250
|
+
return get_dtls_traffic_secret(FromOpaque(ssl), dtls_get_read_epoch, out_data,
|
|
3251
|
+
out_len, epoch);
|
|
3116
3252
|
}
|
|
3117
3253
|
|
|
3118
3254
|
int SSL_get_dtls_write_traffic_secret(const SSL *ssl, const uint8_t **out_data,
|
|
3119
3255
|
size_t *out_len, uint16_t epoch) {
|
|
3120
|
-
return get_dtls_traffic_secret(ssl, dtls_get_write_epoch,
|
|
3121
|
-
epoch);
|
|
3256
|
+
return get_dtls_traffic_secret(FromOpaque(ssl), dtls_get_write_epoch,
|
|
3257
|
+
out_data, out_len, epoch);
|
|
3122
3258
|
}
|
|
3123
3259
|
|
|
3124
3260
|
uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl) {
|
|
3125
|
-
|
|
3261
|
+
SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
3126
3262
|
if (session == nullptr) {
|
|
3127
3263
|
return 0;
|
|
3128
3264
|
}
|
|
@@ -3131,29 +3267,32 @@ uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl) {
|
|
|
3131
3267
|
}
|
|
3132
3268
|
|
|
3133
3269
|
size_t SSL_get_client_random(const SSL *ssl, uint8_t *out, size_t max_out) {
|
|
3270
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3134
3271
|
if (max_out == 0) {
|
|
3135
|
-
return sizeof(
|
|
3272
|
+
return sizeof(ssl_impl->s3->client_random);
|
|
3136
3273
|
}
|
|
3137
|
-
if (max_out > sizeof(
|
|
3138
|
-
max_out = sizeof(
|
|
3274
|
+
if (max_out > sizeof(ssl_impl->s3->client_random)) {
|
|
3275
|
+
max_out = sizeof(ssl_impl->s3->client_random);
|
|
3139
3276
|
}
|
|
3140
|
-
OPENSSL_memcpy(out,
|
|
3277
|
+
OPENSSL_memcpy(out, ssl_impl->s3->client_random, max_out);
|
|
3141
3278
|
return max_out;
|
|
3142
3279
|
}
|
|
3143
3280
|
|
|
3144
3281
|
size_t SSL_get_server_random(const SSL *ssl, uint8_t *out, size_t max_out) {
|
|
3282
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3145
3283
|
if (max_out == 0) {
|
|
3146
|
-
return sizeof(
|
|
3284
|
+
return sizeof(ssl_impl->s3->server_random);
|
|
3147
3285
|
}
|
|
3148
|
-
if (max_out > sizeof(
|
|
3149
|
-
max_out = sizeof(
|
|
3286
|
+
if (max_out > sizeof(ssl_impl->s3->server_random)) {
|
|
3287
|
+
max_out = sizeof(ssl_impl->s3->server_random);
|
|
3150
3288
|
}
|
|
3151
|
-
OPENSSL_memcpy(out,
|
|
3289
|
+
OPENSSL_memcpy(out, ssl_impl->s3->server_random, max_out);
|
|
3152
3290
|
return max_out;
|
|
3153
3291
|
}
|
|
3154
3292
|
|
|
3155
3293
|
uint16_t SSL_get_signature_algorithm_used(const SSL *ssl) {
|
|
3156
|
-
|
|
3294
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3295
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
3157
3296
|
if (hs == nullptr) {
|
|
3158
3297
|
return 0;
|
|
3159
3298
|
}
|
|
@@ -3161,7 +3300,8 @@ uint16_t SSL_get_signature_algorithm_used(const SSL *ssl) {
|
|
|
3161
3300
|
}
|
|
3162
3301
|
|
|
3163
3302
|
const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl) {
|
|
3164
|
-
|
|
3303
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3304
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
3165
3305
|
if (hs == nullptr) {
|
|
3166
3306
|
return nullptr;
|
|
3167
3307
|
}
|
|
@@ -3169,10 +3309,11 @@ const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl) {
|
|
|
3169
3309
|
}
|
|
3170
3310
|
|
|
3171
3311
|
void SSL_set_retain_only_sha256_of_client_certs(SSL *ssl, int enabled) {
|
|
3172
|
-
|
|
3312
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3313
|
+
if (!ssl_impl->config) {
|
|
3173
3314
|
return;
|
|
3174
3315
|
}
|
|
3175
|
-
|
|
3316
|
+
ssl_impl->config->retain_only_sha256_of_client_certs = !!enabled;
|
|
3176
3317
|
}
|
|
3177
3318
|
|
|
3178
3319
|
void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx, int enabled) {
|
|
@@ -3183,19 +3324,24 @@ void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled) {
|
|
|
3183
3324
|
FromOpaque(ctx)->grease_enabled = !!enabled;
|
|
3184
3325
|
}
|
|
3185
3326
|
|
|
3327
|
+
void SSL_CTX_set_grease_sigalgs_enabled(SSL_CTX *ctx, int enabled) {
|
|
3328
|
+
FromOpaque(ctx)->grease_sigalgs_enabled = !!enabled;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3186
3331
|
void SSL_CTX_set_permute_extensions(SSL_CTX *ctx, int enabled) {
|
|
3187
3332
|
FromOpaque(ctx)->permute_extensions = !!enabled;
|
|
3188
3333
|
}
|
|
3189
3334
|
|
|
3190
3335
|
void SSL_set_permute_extensions(SSL *ssl, int enabled) {
|
|
3191
|
-
|
|
3336
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3337
|
+
if (!ssl_impl->config) {
|
|
3192
3338
|
return;
|
|
3193
3339
|
}
|
|
3194
|
-
|
|
3340
|
+
ssl_impl->config->permute_extensions = !!enabled;
|
|
3195
3341
|
}
|
|
3196
3342
|
|
|
3197
3343
|
int32_t SSL_get_ticket_age_skew(const SSL *ssl) {
|
|
3198
|
-
return ssl->s3->ticket_age_skew;
|
|
3344
|
+
return FromOpaque(ssl)->s3->ticket_age_skew;
|
|
3199
3345
|
}
|
|
3200
3346
|
|
|
3201
3347
|
void SSL_CTX_set_false_start_allowed_without_alpn(SSL_CTX *ctx, int allowed) {
|
|
@@ -3203,41 +3349,45 @@ void SSL_CTX_set_false_start_allowed_without_alpn(SSL_CTX *ctx, int allowed) {
|
|
|
3203
3349
|
}
|
|
3204
3350
|
|
|
3205
3351
|
int SSL_used_hello_retry_request(const SSL *ssl) {
|
|
3206
|
-
return ssl->s3->used_hello_retry_request;
|
|
3352
|
+
return FromOpaque(ssl)->s3->used_hello_retry_request;
|
|
3207
3353
|
}
|
|
3208
3354
|
|
|
3209
3355
|
void SSL_set_shed_handshake_config(SSL *ssl, int enable) {
|
|
3210
|
-
|
|
3356
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3357
|
+
if (!ssl_impl->config) {
|
|
3211
3358
|
return;
|
|
3212
3359
|
}
|
|
3213
|
-
|
|
3360
|
+
ssl_impl->config->shed_handshake_config = !!enable;
|
|
3214
3361
|
}
|
|
3215
3362
|
|
|
3216
3363
|
void SSL_set_jdk11_workaround(SSL *ssl, int enable) {
|
|
3217
|
-
|
|
3364
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3365
|
+
if (!ssl_impl->config) {
|
|
3218
3366
|
return;
|
|
3219
3367
|
}
|
|
3220
|
-
|
|
3368
|
+
ssl_impl->config->jdk11_workaround = !!enable;
|
|
3221
3369
|
}
|
|
3222
3370
|
|
|
3223
3371
|
void SSL_set_quic_use_legacy_codepoint(SSL *ssl, int use_legacy) {
|
|
3224
|
-
|
|
3372
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3373
|
+
if (!ssl_impl->config) {
|
|
3225
3374
|
return;
|
|
3226
3375
|
}
|
|
3227
|
-
|
|
3376
|
+
ssl_impl->config->quic_use_legacy_codepoint = !!use_legacy;
|
|
3228
3377
|
}
|
|
3229
3378
|
|
|
3230
3379
|
int SSL_clear(SSL *ssl) {
|
|
3231
|
-
|
|
3380
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3381
|
+
if (!ssl_impl->config) {
|
|
3232
3382
|
return 0; // SSL_clear may not be used after shedding config.
|
|
3233
3383
|
}
|
|
3234
3384
|
|
|
3235
3385
|
// In OpenSSL, reusing a client `SSL` with `SSL_clear` causes the previously
|
|
3236
3386
|
// established session to be offered the next time around. wpa_supplicant
|
|
3237
3387
|
// depends on this behavior, so emulate it.
|
|
3238
|
-
UniquePtr<
|
|
3239
|
-
if (!
|
|
3240
|
-
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);
|
|
3241
3391
|
}
|
|
3242
3392
|
|
|
3243
3393
|
// The ssl->d1->mtu is simultaneously configuration (preserved across
|
|
@@ -3245,17 +3395,17 @@ int SSL_clear(SSL *ssl) {
|
|
|
3245
3395
|
//
|
|
3246
3396
|
// TODO(davidben): Avoid this.
|
|
3247
3397
|
unsigned mtu = 0;
|
|
3248
|
-
if (
|
|
3249
|
-
mtu =
|
|
3398
|
+
if (ssl_impl->d1 != nullptr) {
|
|
3399
|
+
mtu = ssl_impl->d1->mtu;
|
|
3250
3400
|
}
|
|
3251
3401
|
|
|
3252
|
-
|
|
3253
|
-
if (!
|
|
3402
|
+
ssl_impl->method->ssl_free(ssl_impl);
|
|
3403
|
+
if (!ssl_impl->method->ssl_new(ssl_impl)) {
|
|
3254
3404
|
return 0;
|
|
3255
3405
|
}
|
|
3256
3406
|
|
|
3257
3407
|
if (SSL_is_dtls(ssl) && (SSL_get_options(ssl) & SSL_OP_NO_QUERY_MTU)) {
|
|
3258
|
-
|
|
3408
|
+
ssl_impl->d1->mtu = mtu;
|
|
3259
3409
|
}
|
|
3260
3410
|
|
|
3261
3411
|
if (session != nullptr) {
|
|
@@ -3314,9 +3464,10 @@ void SSL_CTX_set_ticket_aead_method(SSL_CTX *ctx,
|
|
|
3314
3464
|
|
|
3315
3465
|
SSL_SESSION *SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf,
|
|
3316
3466
|
size_t buf_len) {
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
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) {
|
|
3320
3471
|
// Only TLS 1.3 clients are supported.
|
|
3321
3472
|
OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
|
3322
3473
|
return nullptr;
|
|
@@ -3332,7 +3483,8 @@ SSL_SESSION *SSL_process_tls13_new_session_ticket(SSL *ssl, const uint8_t *buf,
|
|
|
3332
3483
|
return nullptr;
|
|
3333
3484
|
}
|
|
3334
3485
|
|
|
3335
|
-
UniquePtr<
|
|
3486
|
+
UniquePtr<SSLSession> session =
|
|
3487
|
+
tls13_create_session_with_ticket(ssl_impl, &body);
|
|
3336
3488
|
if (!session) {
|
|
3337
3489
|
// `tls13_create_session_with_ticket` puts the correct error.
|
|
3338
3490
|
return nullptr;
|
|
@@ -3352,22 +3504,24 @@ size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx) {
|
|
|
3352
3504
|
}
|
|
3353
3505
|
|
|
3354
3506
|
int SSL_set_tlsext_status_type(SSL *ssl, int type) {
|
|
3355
|
-
|
|
3507
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3508
|
+
if (!ssl_impl->config) {
|
|
3356
3509
|
return 0;
|
|
3357
3510
|
}
|
|
3358
|
-
|
|
3511
|
+
ssl_impl->config->ocsp_stapling_enabled = type == TLSEXT_STATUSTYPE_ocsp;
|
|
3359
3512
|
return 1;
|
|
3360
3513
|
}
|
|
3361
3514
|
|
|
3362
3515
|
int SSL_get_tlsext_status_type(const SSL *ssl) {
|
|
3363
|
-
|
|
3364
|
-
|
|
3516
|
+
const auto *ssl_impl = FromOpaque(ssl);
|
|
3517
|
+
if (ssl_impl->server) {
|
|
3518
|
+
SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
|
|
3365
3519
|
return hs != nullptr && hs->ocsp_stapling_requested
|
|
3366
3520
|
? TLSEXT_STATUSTYPE_ocsp
|
|
3367
3521
|
: TLSEXT_STATUSTYPE_nothing;
|
|
3368
3522
|
}
|
|
3369
3523
|
|
|
3370
|
-
return
|
|
3524
|
+
return ssl_impl->config != nullptr && ssl_impl->config->ocsp_stapling_enabled
|
|
3371
3525
|
? TLSEXT_STATUSTYPE_ocsp
|
|
3372
3526
|
: TLSEXT_STATUSTYPE_nothing;
|
|
3373
3527
|
}
|
|
@@ -3455,6 +3609,15 @@ static const char kTLS12Ciphers[] =
|
|
|
3455
3609
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3456
3610
|
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
|
|
3457
3611
|
|
|
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
|
+
|
|
3458
3621
|
static int Configure(SSLContext *ctx) {
|
|
3459
3622
|
ctx->compliance_policy = ssl_compliance_policy_fips_202205;
|
|
3460
3623
|
|
|
@@ -3471,18 +3634,22 @@ static int Configure(SSLContext *ctx) {
|
|
|
3471
3634
|
// Encrypt-then-MAC extension is required for all CBC cipher suites and so
|
|
3472
3635
|
// it's easier to drop them.
|
|
3473
3636
|
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3637
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3638
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3474
3639
|
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3475
3640
|
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3476
3641
|
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3477
3642
|
}
|
|
3478
3643
|
|
|
3479
|
-
static int Configure(
|
|
3644
|
+
static int Configure(SSLImpl *ssl) {
|
|
3480
3645
|
ssl->config->compliance_policy = ssl_compliance_policy_fips_202205;
|
|
3481
3646
|
|
|
3482
3647
|
// See `Configure(SSL_CTX)`, above, for reasoning.
|
|
3483
3648
|
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3484
3649
|
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3485
3650
|
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3651
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3652
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3486
3653
|
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3487
3654
|
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3488
3655
|
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
@@ -3490,6 +3657,97 @@ static int Configure(SSL *ssl) {
|
|
|
3490
3657
|
|
|
3491
3658
|
} // namespace fips202205
|
|
3492
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
|
+
|
|
3493
3751
|
namespace wpa202304 {
|
|
3494
3752
|
|
|
3495
3753
|
// See WPA version 3.1, section 3.5.
|
|
@@ -3508,6 +3766,13 @@ static const char kTLS12Ciphers[] =
|
|
|
3508
3766
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3509
3767
|
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384";
|
|
3510
3768
|
|
|
3769
|
+
static const uint16_t kTLS13Ciphers[] = {
|
|
3770
|
+
SSL_CIPHER_AES_256_GCM_SHA384,
|
|
3771
|
+
};
|
|
3772
|
+
static const bool kTLS13CiphersInGroup[] = {
|
|
3773
|
+
false,
|
|
3774
|
+
};
|
|
3775
|
+
|
|
3511
3776
|
static int Configure(SSLContext *ctx) {
|
|
3512
3777
|
ctx->compliance_policy = ssl_compliance_policy_wpa3_192_202304;
|
|
3513
3778
|
|
|
@@ -3515,17 +3780,21 @@ static int Configure(SSLContext *ctx) {
|
|
|
3515
3780
|
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3516
3781
|
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3517
3782
|
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3783
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3784
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3518
3785
|
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3519
3786
|
std::size(kSigAlgs)) &&
|
|
3520
3787
|
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3521
3788
|
}
|
|
3522
3789
|
|
|
3523
|
-
static int Configure(
|
|
3790
|
+
static int Configure(SSLImpl *ssl) {
|
|
3524
3791
|
ssl->config->compliance_policy = ssl_compliance_policy_wpa3_192_202304;
|
|
3525
3792
|
|
|
3526
3793
|
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3527
3794
|
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3528
3795
|
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3796
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3797
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3529
3798
|
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3530
3799
|
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3531
3800
|
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
@@ -3535,14 +3804,27 @@ static int Configure(SSL *ssl) {
|
|
|
3535
3804
|
|
|
3536
3805
|
namespace cnsa202407 {
|
|
3537
3806
|
|
|
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
|
+
|
|
3538
3818
|
static int Configure(SSLContext *ctx) {
|
|
3539
3819
|
ctx->compliance_policy = ssl_compliance_policy_cnsa_202407;
|
|
3540
|
-
return
|
|
3820
|
+
return ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3821
|
+
Span(kTLS13CiphersInGroup));
|
|
3541
3822
|
}
|
|
3542
3823
|
|
|
3543
|
-
static int Configure(
|
|
3824
|
+
static int Configure(SSLImpl *ssl) {
|
|
3544
3825
|
ssl->config->compliance_policy = ssl_compliance_policy_cnsa_202407;
|
|
3545
|
-
return
|
|
3826
|
+
return ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3827
|
+
Span(kTLS13CiphersInGroup));
|
|
3546
3828
|
}
|
|
3547
3829
|
|
|
3548
3830
|
} // namespace cnsa202407
|
|
@@ -3564,7 +3846,15 @@ static const uint16_t kSigAlgs[] = {
|
|
|
3564
3846
|
|
|
3565
3847
|
static const char kTLS12Ciphers[] =
|
|
3566
3848
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:"
|
|
3567
|
-
"TLS_ECDHE_RSA_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
|
+
};
|
|
3568
3858
|
|
|
3569
3859
|
static int Configure(SSLContext *ctx) {
|
|
3570
3860
|
ctx->compliance_policy = ssl_compliance_policy_cnsa1_202603;
|
|
@@ -3572,6 +3862,8 @@ static int Configure(SSLContext *ctx) {
|
|
|
3572
3862
|
return SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION) &&
|
|
3573
3863
|
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3574
3864
|
SSL_CTX_set_strict_cipher_list(ctx, kTLS12Ciphers) &&
|
|
3865
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3866
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3575
3867
|
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3576
3868
|
SSL_CTX_set_options(ctx, kOptions) &&
|
|
3577
3869
|
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
@@ -3579,12 +3871,14 @@ static int Configure(SSLContext *ctx) {
|
|
|
3579
3871
|
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3580
3872
|
}
|
|
3581
3873
|
|
|
3582
|
-
static int Configure(
|
|
3874
|
+
static int Configure(SSLImpl *ssl) {
|
|
3583
3875
|
ssl->config->compliance_policy = ssl_compliance_policy_cnsa1_202603;
|
|
3584
3876
|
|
|
3585
3877
|
return SSL_set_min_proto_version(ssl, TLS1_2_VERSION) &&
|
|
3586
3878
|
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3587
3879
|
SSL_set_strict_cipher_list(ssl, kTLS12Ciphers) &&
|
|
3880
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3881
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3588
3882
|
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3589
3883
|
SSL_set_options(ssl, kOptions) &&
|
|
3590
3884
|
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
@@ -3605,22 +3899,33 @@ static const uint16_t kSigAlgs[] = {
|
|
|
3605
3899
|
SSL_SIGN_RSA_PKCS1_SHA384,
|
|
3606
3900
|
};
|
|
3607
3901
|
|
|
3902
|
+
static const uint16_t kTLS13Ciphers[] = {
|
|
3903
|
+
SSL_CIPHER_AES_256_GCM_SHA384,
|
|
3904
|
+
};
|
|
3905
|
+
static const bool kTLS13CiphersInGroup[] = {
|
|
3906
|
+
false,
|
|
3907
|
+
};
|
|
3908
|
+
|
|
3608
3909
|
static int Configure(SSLContext *ctx) {
|
|
3609
3910
|
ctx->compliance_policy = ssl_compliance_policy_cnsa2_202603;
|
|
3610
3911
|
|
|
3611
3912
|
return SSL_CTX_set_min_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3612
3913
|
SSL_CTX_set_max_proto_version(ctx, TLS1_3_VERSION) &&
|
|
3914
|
+
ctx->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3915
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3613
3916
|
SSL_CTX_set1_group_ids(ctx, kGroups, std::size(kGroups)) &&
|
|
3614
3917
|
SSL_CTX_set_signing_algorithm_prefs(ctx, kSigAlgs,
|
|
3615
3918
|
std::size(kSigAlgs)) &&
|
|
3616
3919
|
SSL_CTX_set_verify_algorithm_prefs(ctx, kSigAlgs, std::size(kSigAlgs));
|
|
3617
3920
|
}
|
|
3618
3921
|
|
|
3619
|
-
static int Configure(
|
|
3922
|
+
static int Configure(SSLImpl *ssl) {
|
|
3620
3923
|
ssl->config->compliance_policy = ssl_compliance_policy_cnsa2_202603;
|
|
3621
3924
|
|
|
3622
3925
|
return SSL_set_min_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3623
3926
|
SSL_set_max_proto_version(ssl, TLS1_3_VERSION) &&
|
|
3927
|
+
ssl->config->tls13_cipher_list.Init(Span(kTLS13Ciphers),
|
|
3928
|
+
Span(kTLS13CiphersInGroup)) &&
|
|
3624
3929
|
SSL_set1_group_ids(ssl, kGroups, std::size(kGroups)) &&
|
|
3625
3930
|
SSL_set_signing_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs)) &&
|
|
3626
3931
|
SSL_set_verify_algorithm_prefs(ssl, kSigAlgs, std::size(kSigAlgs));
|
|
@@ -3634,6 +3939,8 @@ int SSL_CTX_set_compliance_policy(SSL_CTX *ctx,
|
|
|
3634
3939
|
switch (policy) {
|
|
3635
3940
|
case ssl_compliance_policy_fips_202205:
|
|
3636
3941
|
return fips202205::Configure(ctx_impl);
|
|
3942
|
+
case ssl_compliance_policy_fips_202609:
|
|
3943
|
+
return fips202609::Configure(ctx_impl);
|
|
3637
3944
|
case ssl_compliance_policy_wpa3_192_202304:
|
|
3638
3945
|
return wpa202304::Configure(ctx_impl);
|
|
3639
3946
|
case ssl_compliance_policy_cnsa_202407:
|
|
@@ -3652,34 +3959,38 @@ enum ssl_compliance_policy_t SSL_CTX_get_compliance_policy(const SSL_CTX *ctx) {
|
|
|
3652
3959
|
}
|
|
3653
3960
|
|
|
3654
3961
|
int SSL_set_compliance_policy(SSL *ssl, enum ssl_compliance_policy_t policy) {
|
|
3962
|
+
auto *ssl_impl = FromOpaque(ssl);
|
|
3655
3963
|
switch (policy) {
|
|
3656
3964
|
case ssl_compliance_policy_fips_202205:
|
|
3657
|
-
return fips202205::Configure(
|
|
3965
|
+
return fips202205::Configure(ssl_impl);
|
|
3966
|
+
case ssl_compliance_policy_fips_202609:
|
|
3967
|
+
return fips202609::Configure(ssl_impl);
|
|
3658
3968
|
case ssl_compliance_policy_wpa3_192_202304:
|
|
3659
|
-
return wpa202304::Configure(
|
|
3969
|
+
return wpa202304::Configure(ssl_impl);
|
|
3660
3970
|
case ssl_compliance_policy_cnsa_202407:
|
|
3661
|
-
return cnsa202407::Configure(
|
|
3971
|
+
return cnsa202407::Configure(ssl_impl);
|
|
3662
3972
|
case ssl_compliance_policy_cnsa1_202603:
|
|
3663
|
-
return cnsa1_202603::Configure(
|
|
3973
|
+
return cnsa1_202603::Configure(ssl_impl);
|
|
3664
3974
|
case ssl_compliance_policy_cnsa2_202603:
|
|
3665
|
-
return cnsa2_202603::Configure(
|
|
3975
|
+
return cnsa2_202603::Configure(ssl_impl);
|
|
3666
3976
|
default:
|
|
3667
3977
|
return 0;
|
|
3668
3978
|
}
|
|
3669
3979
|
}
|
|
3670
3980
|
|
|
3671
3981
|
enum ssl_compliance_policy_t SSL_get_compliance_policy(const SSL *ssl) {
|
|
3672
|
-
return ssl->config->compliance_policy;
|
|
3982
|
+
return FromOpaque(ssl)->config->compliance_policy;
|
|
3673
3983
|
}
|
|
3674
3984
|
|
|
3675
3985
|
int SSL_peer_matched_trust_anchor(const SSL *ssl) {
|
|
3676
|
-
return ssl->s3->hs != nullptr &&
|
|
3986
|
+
return FromOpaque(ssl)->s3->hs != nullptr &&
|
|
3987
|
+
FromOpaque(ssl)->s3->hs->peer_matched_trust_anchor;
|
|
3677
3988
|
}
|
|
3678
3989
|
|
|
3679
3990
|
void SSL_get0_peer_available_trust_anchors(const SSL *ssl, const uint8_t **out,
|
|
3680
3991
|
size_t *out_len) {
|
|
3681
3992
|
Span<const uint8_t> ret;
|
|
3682
|
-
if (SSL_HANDSHAKE *hs = ssl->s3->hs.get(); hs != nullptr) {
|
|
3993
|
+
if (SSL_HANDSHAKE *hs = FromOpaque(ssl)->s3->hs.get(); hs != nullptr) {
|
|
3683
3994
|
ret = hs->peer_available_trust_anchors;
|
|
3684
3995
|
}
|
|
3685
3996
|
*out = ret.data();
|
|
@@ -3698,7 +4009,7 @@ int SSL_CTX_set1_available_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
|
3698
4009
|
|
|
3699
4010
|
int SSL_set1_available_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
3700
4011
|
size_t ids_len) {
|
|
3701
|
-
if (!ssl->config) {
|
|
4012
|
+
if (!FromOpaque(ssl)->config) {
|
|
3702
4013
|
return 0;
|
|
3703
4014
|
}
|
|
3704
4015
|
auto span = Span(ids, ids_len);
|
|
@@ -3706,7 +4017,7 @@ int SSL_set1_available_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
|
3706
4017
|
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_TRUST_ANCHOR_LIST);
|
|
3707
4018
|
return 0;
|
|
3708
4019
|
}
|
|
3709
|
-
return ssl->config->cert->available_trust_anchors.CopyFrom(span);
|
|
4020
|
+
return FromOpaque(ssl)->config->cert->available_trust_anchors.CopyFrom(span);
|
|
3710
4021
|
}
|
|
3711
4022
|
|
|
3712
4023
|
int SSL_CTX_set1_requested_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
@@ -3726,7 +4037,7 @@ int SSL_CTX_set1_requested_trust_anchors(SSL_CTX *ctx, const uint8_t *ids,
|
|
|
3726
4037
|
|
|
3727
4038
|
int SSL_set1_requested_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
3728
4039
|
size_t ids_len) {
|
|
3729
|
-
if (!ssl->config) {
|
|
4040
|
+
if (!FromOpaque(ssl)->config) {
|
|
3730
4041
|
return 0;
|
|
3731
4042
|
}
|
|
3732
4043
|
auto span = Span(ids, ids_len);
|
|
@@ -3738,7 +4049,7 @@ int SSL_set1_requested_trust_anchors(SSL *ssl, const uint8_t *ids,
|
|
|
3738
4049
|
if (!copy.CopyFrom(span)) {
|
|
3739
4050
|
return 0;
|
|
3740
4051
|
}
|
|
3741
|
-
ssl->config->requested_trust_anchors = std::move(copy);
|
|
4052
|
+
FromOpaque(ssl)->config->requested_trust_anchors = std::move(copy);
|
|
3742
4053
|
return 1;
|
|
3743
4054
|
}
|
|
3744
4055
|
|
|
@@ -3782,10 +4093,10 @@ int SSL_CTX_set1_accepted_peer_cert_types(SSL_CTX *ctx, const uint8_t *values,
|
|
|
3782
4093
|
|
|
3783
4094
|
int SSL_set1_accepted_peer_cert_types(SSL *ssl, const uint8_t *values,
|
|
3784
4095
|
size_t num_values) {
|
|
3785
|
-
if (!ssl->config) {
|
|
4096
|
+
if (!FromOpaque(ssl)->config) {
|
|
3786
4097
|
return 0;
|
|
3787
4098
|
}
|
|
3788
|
-
return set1_cert_types(&ssl->config->accepted_peer_cert_types,
|
|
4099
|
+
return set1_cert_types(&FromOpaque(ssl)->config->accepted_peer_cert_types,
|
|
3789
4100
|
Span(values, num_values));
|
|
3790
4101
|
}
|
|
3791
4102
|
|
|
@@ -3798,43 +4109,45 @@ int SSL_CTX_set1_available_client_cert_types(SSL_CTX *ctx,
|
|
|
3798
4109
|
|
|
3799
4110
|
int SSL_set1_available_client_cert_types(SSL *ssl, const uint8_t *values,
|
|
3800
4111
|
size_t num_values) {
|
|
3801
|
-
if (!ssl->config) {
|
|
4112
|
+
if (!FromOpaque(ssl)->config) {
|
|
3802
4113
|
return 0;
|
|
3803
4114
|
}
|
|
3804
|
-
return set1_cert_types(&ssl->config->available_client_cert_types,
|
|
4115
|
+
return set1_cert_types(&FromOpaque(ssl)->config->available_client_cert_types,
|
|
3805
4116
|
Span(values, num_values));
|
|
3806
4117
|
}
|
|
3807
4118
|
|
|
3808
4119
|
int SSL_get_peer_cert_type(const SSL *ssl) {
|
|
3809
|
-
if (const
|
|
4120
|
+
if (const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
4121
|
+
session != nullptr) {
|
|
3810
4122
|
return session->peer_cert_type;
|
|
3811
4123
|
}
|
|
3812
4124
|
return kDefaultCertType;
|
|
3813
4125
|
}
|
|
3814
4126
|
|
|
3815
4127
|
EVP_PKEY *SSL_get0_peer_rpk(const SSL *ssl) {
|
|
3816
|
-
if (const
|
|
4128
|
+
if (const SSLSession *session = ssl_get_session(FromOpaque(ssl));
|
|
4129
|
+
session != nullptr) {
|
|
3817
4130
|
return session->peer_raw_public_key.get();
|
|
3818
4131
|
}
|
|
3819
4132
|
return nullptr;
|
|
3820
4133
|
}
|
|
3821
4134
|
|
|
3822
4135
|
void SSL_set_server_padding_request(SSL *ssl, uint16_t num_bytes) {
|
|
3823
|
-
if (!ssl->config) {
|
|
4136
|
+
if (!FromOpaque(ssl)->config) {
|
|
3824
4137
|
return;
|
|
3825
4138
|
}
|
|
3826
4139
|
|
|
3827
|
-
ssl->config->server_padding_request = num_bytes;
|
|
4140
|
+
FromOpaque(ssl)->config->server_padding_request = num_bytes;
|
|
3828
4141
|
}
|
|
3829
4142
|
|
|
3830
4143
|
void SSL_set_server_padding_enabled(SSL *ssl, int enabled) {
|
|
3831
|
-
if (!ssl->config) {
|
|
4144
|
+
if (!FromOpaque(ssl)->config) {
|
|
3832
4145
|
return;
|
|
3833
4146
|
}
|
|
3834
4147
|
|
|
3835
|
-
ssl->config->server_padding_enabled = enabled;
|
|
4148
|
+
FromOpaque(ssl)->config->server_padding_enabled = enabled;
|
|
3836
4149
|
}
|
|
3837
4150
|
|
|
3838
4151
|
int SSL_server_sent_requested_padding(const SSL *ssl) {
|
|
3839
|
-
return ssl->s3->server_sent_requested_padding;
|
|
4152
|
+
return FromOpaque(ssl)->s3->server_sent_requested_padding;
|
|
3840
4153
|
}
|