grpc 1.15.0 → 1.30.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +8591 -13387
- data/etc/roots.pem +455 -130
- data/include/grpc/grpc.h +39 -9
- data/include/grpc/grpc_posix.h +0 -8
- data/include/grpc/grpc_security.h +409 -14
- data/include/grpc/grpc_security_constants.h +55 -22
- data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
- data/include/grpc/impl/codegen/atm_windows.h +2 -0
- data/include/grpc/impl/codegen/byte_buffer.h +13 -0
- data/include/grpc/impl/codegen/compression_types.h +2 -1
- data/include/grpc/impl/codegen/gpr_types.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +111 -16
- data/include/grpc/impl/codegen/port_platform.h +171 -9
- data/include/grpc/impl/codegen/slice.h +2 -22
- data/include/grpc/impl/codegen/status.h +2 -1
- data/include/grpc/impl/codegen/sync.h +5 -3
- data/include/grpc/impl/codegen/sync_abseil.h +36 -0
- data/include/grpc/impl/codegen/sync_generic.h +1 -1
- data/include/grpc/impl/codegen/sync_posix.h +18 -0
- data/include/grpc/module.modulemap +25 -37
- data/include/grpc/slice.h +3 -3
- data/include/grpc/support/alloc.h +0 -16
- data/include/grpc/support/sync_abseil.h +26 -0
- data/src/core/ext/filters/client_channel/backend_metric.cc +81 -0
- data/src/core/ext/filters/client_channel/backend_metric.h +36 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +26 -19
- data/src/core/ext/filters/client_channel/backup_poller.h +8 -2
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +21 -5
- data/src/core/ext/filters/client_channel/client_channel.cc +2888 -2206
- data/src/core/ext/filters/client_channel/client_channel.h +26 -6
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +54 -72
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +33 -26
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +22 -34
- data/src/core/ext/filters/client_channel/client_channel_factory.h +12 -39
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +13 -14
- data/src/core/ext/filters/client_channel/connector.h +43 -37
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +179 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +68 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +606 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.h +175 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +177 -158
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +1 -1
- data/src/core/ext/filters/client_channel/http_proxy.cc +125 -121
- data/src/core/ext/filters/client_channel/http_proxy.h +5 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +105 -26
- data/src/core/ext/filters/client_channel/lb_policy.h +352 -152
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +83 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +99 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +297 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +83 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +64 -47
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1010 -1155
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +7 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +12 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +53 -40
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +10 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +19 -16
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +157 -271
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +43 -59
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +235 -384
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +871 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +174 -409
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +157 -285
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +734 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +417 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +938 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +528 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +32 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +834 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +7 -91
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +93 -8
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +13 -2
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +96 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +57 -0
- data/src/core/ext/filters/client_channel/parse_address.cc +76 -30
- data/src/core/ext/filters/client_channel/parse_address.h +4 -1
- data/src/core/ext/filters/client_channel/proxy_mapper.h +14 -34
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +46 -79
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +23 -17
- data/src/core/ext/filters/client_channel/resolver.cc +55 -5
- data/src/core/ext/filters/client_channel/resolver.h +61 -61
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +251 -226
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +200 -36
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +18 -20
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +177 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +8 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +491 -131
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +434 -233
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +20 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +15 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +38 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +7 -2
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc +28 -0
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h +29 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +92 -131
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +220 -134
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +27 -17
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +73 -99
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +184 -0
- data/src/core/ext/filters/client_channel/resolver_factory.h +13 -11
- data/src/core/ext/filters/client_channel/resolver_registry.cc +33 -14
- data/src/core/ext/filters/client_channel/resolver_registry.h +19 -13
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +443 -0
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +127 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +348 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +123 -0
- data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -5
- data/src/core/ext/filters/client_channel/retry_throttle.h +2 -6
- data/src/core/ext/filters/client_channel/server_address.cc +48 -0
- data/src/core/ext/filters/client_channel/server_address.h +90 -0
- data/src/core/ext/filters/client_channel/service_config.cc +221 -0
- data/src/core/ext/filters/client_channel/service_config.h +123 -0
- data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -0
- data/src/core/ext/filters/client_channel/service_config_parser.cc +87 -0
- data/src/core/ext/filters/client_channel/service_config_parser.h +89 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +903 -634
- data/src/core/ext/filters/client_channel/subchannel.h +364 -131
- data/src/core/ext/filters/client_channel/subchannel_interface.h +94 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +97 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +91 -0
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +1906 -0
- data/src/core/ext/filters/client_channel/xds/xds_api.h +280 -0
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +342 -0
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +88 -0
- data/src/core/ext/filters/client_channel/xds/xds_channel.h +46 -0
- data/src/core/ext/filters/client_channel/xds/xds_channel_args.h +26 -0
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +106 -0
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +2367 -0
- data/src/core/ext/filters/client_channel/xds/xds_client.h +309 -0
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +115 -0
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +211 -0
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +440 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +49 -52
- data/src/core/ext/filters/deadline/deadline_filter.h +11 -14
- data/src/core/ext/filters/http/client/http_client_filter.cc +122 -85
- data/src/core/ext/filters/http/client/http_client_filter.h +1 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +26 -24
- data/src/core/ext/filters/http/http_filters_plugin.cc +27 -12
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +342 -295
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +358 -0
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +29 -0
- data/src/core/ext/filters/http/server/http_server_filter.cc +156 -54
- data/src/core/ext/filters/max_age/max_age_filter.cc +76 -63
- data/src/core/ext/filters/message_size/message_size_filter.cc +218 -119
- data/src/core/ext/filters/message_size/message_size_filter.h +33 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +19 -17
- data/src/core/ext/transport/chttp2/alpn/alpn.h +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +141 -164
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +31 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +36 -34
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +133 -138
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +128 -30
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +2 -2
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +8 -11
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +11 -12
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +4 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +9 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +911 -716
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +8 -1
- data/src/core/ext/transport/chttp2/transport/context_list.cc +69 -0
- data/src/core/ext/transport/chttp2/transport/context_list.h +53 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/flow_control.h +22 -30
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +47 -54
- data/src/core/ext/transport/chttp2/transport/frame_data.h +11 -13
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +9 -8
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +5 -5
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +7 -5
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -4
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +17 -7
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +11 -4
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +11 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +3 -4
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +548 -351
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +26 -15
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +201 -120
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +14 -6
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +47 -169
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +70 -17
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +10 -17
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +19 -10
- data/src/core/ext/transport/chttp2/transport/internal.h +226 -161
- data/src/core/ext/transport/chttp2/transport/parsing.cc +166 -110
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +28 -18
- data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +95 -35
- data/src/core/ext/transport/inproc/inproc_transport.cc +406 -388
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +17 -0
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +30 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +27 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +54 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +21 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +114 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +418 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +197 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +105 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +378 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +28 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +403 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +1447 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +74 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +218 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +69 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +55 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +305 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +112 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +328 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +78 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +313 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +897 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +96 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +322 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +197 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +642 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +172 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +673 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +80 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +152 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +518 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +89 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +129 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +392 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +31 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +92 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +240 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +18 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +33 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +266 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +112 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +324 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +31 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +109 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +399 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +18 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +33 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +145 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +527 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +43 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +112 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +30 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +199 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +18 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +33 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +815 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +3032 -0
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +59 -0
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +134 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +28 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +228 -0
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +725 -0
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +316 -0
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +1132 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +33 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +51 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +125 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +24 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +50 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +54 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +134 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +17 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +144 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +53 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +133 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +258 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +39 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +87 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +50 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +112 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +29 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +62 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +89 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +249 -0
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +17 -0
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +30 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.c +18 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +30 -0
- data/src/core/ext/upb-generated/google/api/http.upb.c +66 -0
- data/src/core/ext/upb-generated/google/api/http.upb.h +190 -0
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +486 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1696 -0
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +22 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +50 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +79 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +215 -0
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +106 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +238 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +33 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +74 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +49 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +126 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +212 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +693 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +42 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +109 -0
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +36 -0
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +84 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +141 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +393 -0
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +48 -0
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +104 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +17 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +30 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +65 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +58 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +144 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +448 -0
- data/src/core/ext/upb-generated/validate/validate.upb.h +2073 -0
- data/src/core/lib/avl/avl.cc +1 -1
- data/src/core/lib/channel/channel_args.cc +54 -115
- data/src/core/lib/channel/channel_args.h +44 -40
- data/src/core/lib/channel/channel_stack.cc +6 -5
- data/src/core/lib/channel/channel_stack.h +52 -28
- data/src/core/lib/channel/channel_stack_builder.cc +14 -2
- data/src/core/lib/channel/channel_stack_builder.h +8 -0
- data/src/core/lib/channel/channel_trace.cc +75 -85
- data/src/core/lib/channel/channel_trace.h +37 -32
- data/src/core/lib/channel/channelz.cc +496 -106
- data/src/core/lib/channel/channelz.h +262 -61
- data/src/core/lib/channel/channelz_registry.cc +191 -69
- data/src/core/lib/channel/channelz_registry.h +30 -53
- data/src/core/lib/channel/connected_channel.cc +30 -27
- data/src/core/lib/channel/context.h +6 -6
- data/src/core/lib/channel/handshaker.cc +150 -218
- data/src/core/lib/channel/handshaker.h +111 -102
- data/src/core/lib/channel/handshaker_factory.h +9 -17
- data/src/core/lib/channel/handshaker_registry.cc +57 -49
- data/src/core/lib/channel/handshaker_registry.h +21 -15
- data/src/core/lib/channel/status_util.cc +2 -3
- data/src/core/lib/compression/algorithm_metadata.h +3 -3
- data/src/core/lib/compression/compression.cc +17 -12
- data/src/core/lib/compression/compression_args.cc +134 -0
- data/src/core/lib/compression/compression_args.h +56 -0
- data/src/core/lib/compression/compression_internal.cc +17 -13
- data/src/core/lib/compression/compression_internal.h +9 -1
- data/src/core/lib/compression/message_compress.cc +8 -3
- data/src/core/lib/compression/stream_compression.cc +3 -2
- data/src/core/lib/compression/stream_compression.h +2 -2
- data/src/core/lib/compression/stream_compression_gzip.cc +9 -9
- data/src/core/lib/compression/stream_compression_identity.cc +5 -7
- data/src/core/lib/debug/stats.cc +21 -27
- data/src/core/lib/debug/stats.h +3 -1
- data/src/core/lib/debug/trace.cc +16 -7
- data/src/core/lib/debug/trace.h +20 -4
- data/src/core/lib/gpr/alloc.cc +4 -29
- data/src/core/lib/gpr/arena.h +13 -7
- data/src/core/lib/gpr/cpu_linux.cc +1 -1
- data/src/core/lib/gpr/cpu_posix.cc +5 -3
- data/src/core/lib/gpr/env.h +3 -6
- data/src/core/lib/gpr/env_linux.cc +15 -21
- data/src/core/lib/gpr/env_posix.cc +5 -5
- data/src/core/lib/gpr/env_windows.cc +7 -5
- data/src/core/lib/gpr/log.cc +9 -13
- data/src/core/lib/gpr/log_linux.cc +2 -2
- data/src/core/lib/gpr/log_posix.cc +4 -3
- data/src/core/lib/gpr/spinlock.h +2 -3
- data/src/core/lib/gpr/string.cc +29 -35
- data/src/core/lib/gpr/string.h +11 -19
- data/src/core/lib/gpr/sync_abseil.cc +116 -0
- data/src/core/lib/gpr/sync_posix.cc +78 -9
- data/src/core/lib/gpr/sync_windows.cc +4 -2
- data/src/core/lib/gpr/time.cc +12 -0
- data/src/core/lib/gpr/time_posix.cc +22 -3
- data/src/core/lib/gpr/time_precise.cc +123 -36
- data/src/core/lib/gpr/time_precise.h +37 -0
- data/src/core/lib/gprpp/arena.cc +103 -0
- data/src/core/lib/gprpp/arena.h +120 -0
- data/src/core/lib/gprpp/atomic.h +79 -5
- data/src/core/lib/gprpp/debug_location.h +3 -2
- data/src/core/lib/gprpp/fork.cc +30 -56
- data/src/core/lib/gprpp/fork.h +18 -3
- data/src/core/lib/gprpp/global_config.h +96 -0
- data/src/core/lib/gprpp/global_config_custom.h +29 -0
- data/src/core/lib/gprpp/global_config_env.cc +135 -0
- data/src/core/lib/gprpp/global_config_env.h +131 -0
- data/src/core/lib/gprpp/global_config_generic.h +44 -0
- data/src/core/lib/gprpp/host_port.cc +112 -0
- data/src/core/lib/gprpp/host_port.h +56 -0
- data/src/core/lib/gprpp/map.h +53 -0
- data/src/core/lib/gprpp/memory.h +11 -83
- data/src/core/lib/gprpp/mpscq.cc +108 -0
- data/src/core/lib/gprpp/mpscq.h +98 -0
- data/src/core/lib/gprpp/orphanable.h +27 -95
- data/src/core/lib/gprpp/ref_counted.h +228 -83
- data/src/core/lib/gprpp/ref_counted_ptr.h +39 -16
- data/src/core/lib/gprpp/sync.h +135 -0
- data/src/core/lib/gprpp/thd.h +54 -12
- data/src/core/lib/gprpp/thd_posix.cc +57 -13
- data/src/core/lib/gprpp/thd_windows.cc +54 -33
- data/src/core/lib/http/format_request.cc +46 -65
- data/src/core/lib/http/httpcli.cc +11 -11
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +121 -107
- data/src/core/lib/http/parser.cc +4 -3
- data/src/core/lib/http/parser.h +9 -9
- data/src/core/lib/iomgr/buffer_list.cc +308 -0
- data/src/core/lib/iomgr/buffer_list.h +165 -0
- data/src/core/lib/iomgr/call_combiner.cc +113 -69
- data/src/core/lib/iomgr/call_combiner.h +96 -74
- data/src/core/lib/iomgr/cfstream_handle.cc +209 -0
- data/src/core/lib/iomgr/cfstream_handle.h +90 -0
- data/src/core/lib/iomgr/closure.h +44 -141
- data/src/core/lib/iomgr/combiner.cc +50 -86
- data/src/core/lib/iomgr/combiner.h +31 -9
- data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
- data/src/core/lib/iomgr/dynamic_annotations.h +67 -0
- data/src/core/lib/iomgr/endpoint.cc +8 -4
- data/src/core/lib/iomgr/endpoint.h +12 -4
- data/src/core/lib/iomgr/endpoint_cfstream.cc +376 -0
- data/src/core/lib/iomgr/endpoint_cfstream.h +49 -0
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +1 -1
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/error.cc +71 -64
- data/src/core/lib/iomgr/error.h +74 -10
- data/src/core/lib/iomgr/error_cfstream.cc +52 -0
- data/src/core/lib/iomgr/error_cfstream.h +31 -0
- data/src/core/lib/iomgr/error_internal.h +1 -3
- data/src/core/lib/iomgr/ev_apple.cc +356 -0
- data/src/core/lib/iomgr/ev_apple.h +43 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +99 -69
- data/src/core/lib/iomgr/ev_epollex_linux.cc +238 -259
- data/src/core/lib/iomgr/ev_poll_posix.cc +52 -504
- data/src/core/lib/iomgr/ev_posix.cc +54 -31
- data/src/core/lib/iomgr/ev_posix.h +29 -3
- data/src/core/lib/iomgr/ev_windows.cc +2 -2
- data/src/core/lib/iomgr/exec_ctx.cc +79 -8
- data/src/core/lib/iomgr/exec_ctx.h +163 -21
- data/src/core/lib/iomgr/executor.cc +137 -101
- data/src/core/lib/iomgr/executor.h +54 -48
- data/src/core/lib/iomgr/executor/mpmcqueue.cc +183 -0
- data/src/core/lib/iomgr/executor/mpmcqueue.h +175 -0
- data/src/core/lib/iomgr/executor/threadpool.cc +137 -0
- data/src/core/lib/iomgr/executor/threadpool.h +149 -0
- data/src/core/lib/iomgr/fork_posix.cc +15 -8
- data/src/core/lib/iomgr/grpc_if_nametoindex.h +30 -0
- data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +42 -0
- data/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc +38 -0
- data/src/core/lib/iomgr/internal_errqueue.cc +67 -0
- data/src/core/lib/iomgr/internal_errqueue.h +191 -0
- data/src/core/lib/iomgr/iocp_windows.cc +2 -2
- data/src/core/lib/iomgr/iomgr.cc +27 -13
- data/src/core/lib/iomgr/iomgr.h +19 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +18 -2
- data/src/core/lib/iomgr/iomgr_custom.h +2 -0
- data/src/core/lib/iomgr/iomgr_internal.cc +14 -0
- data/src/core/lib/iomgr/iomgr_internal.h +16 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +23 -1
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +171 -0
- data/src/core/lib/iomgr/iomgr_uv.cc +3 -0
- data/src/core/lib/iomgr/iomgr_windows.cc +20 -1
- data/src/core/lib/iomgr/load_file.cc +1 -0
- data/src/core/lib/iomgr/lockfree_event.cc +16 -15
- data/src/core/lib/iomgr/poller/eventmanager_libuv.cc +87 -0
- data/src/core/lib/iomgr/poller/eventmanager_libuv.h +88 -0
- data/src/core/lib/iomgr/polling_entity.h +4 -4
- data/src/core/lib/iomgr/pollset_custom.cc +5 -5
- data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
- data/src/core/lib/iomgr/pollset_uv.h +32 -0
- data/src/core/lib/iomgr/pollset_windows.cc +16 -2
- data/src/core/lib/iomgr/port.h +49 -2
- data/src/core/lib/iomgr/python_util.h +46 -0
- data/src/core/lib/iomgr/resolve_address.h +5 -7
- data/src/core/lib/iomgr/resolve_address_custom.cc +36 -50
- data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
- data/src/core/lib/iomgr/resolve_address_posix.cc +22 -25
- data/src/core/lib/iomgr/resolve_address_windows.cc +14 -26
- data/src/core/lib/iomgr/resource_quota.cc +175 -110
- data/src/core/lib/iomgr/resource_quota.h +30 -11
- data/src/core/lib/iomgr/sockaddr_utils.cc +26 -31
- data/src/core/lib/iomgr/sockaddr_utils.h +9 -14
- data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
- data/src/core/lib/iomgr/socket_mutator.h +2 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +145 -27
- data/src/core/lib/iomgr/socket_utils_posix.h +26 -0
- data/src/core/lib/iomgr/socket_windows.cc +21 -2
- data/src/core/lib/iomgr/socket_windows.h +9 -1
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +215 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +19 -7
- data/src/core/lib/iomgr/tcp_client_posix.cc +40 -38
- data/src/core/lib/iomgr/tcp_client_posix.h +6 -6
- data/src/core/lib/iomgr/tcp_client_windows.cc +11 -10
- data/src/core/lib/iomgr/tcp_custom.cc +37 -32
- data/src/core/lib/iomgr/tcp_custom.h +3 -0
- data/src/core/lib/iomgr/tcp_posix.cc +1196 -168
- data/src/core/lib/iomgr/tcp_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server.cc +5 -0
- data/src/core/lib/iomgr/tcp_server.h +21 -0
- data/src/core/lib/iomgr/tcp_server_custom.cc +43 -30
- data/src/core/lib/iomgr/tcp_server_posix.cc +97 -21
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +19 -16
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -11
- data/src/core/lib/iomgr/tcp_server_windows.cc +19 -15
- data/src/core/lib/iomgr/tcp_uv.cc +8 -9
- data/src/core/lib/iomgr/tcp_windows.cc +110 -48
- data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
- data/src/core/lib/iomgr/timer.h +2 -1
- data/src/core/lib/iomgr/timer_custom.cc +7 -5
- data/src/core/lib/iomgr/timer_generic.cc +42 -40
- data/src/core/lib/iomgr/timer_generic.h +39 -0
- data/src/core/lib/iomgr/timer_heap.cc +2 -2
- data/src/core/lib/iomgr/timer_heap.h +5 -6
- data/src/core/lib/iomgr/timer_manager.cc +34 -16
- data/src/core/lib/iomgr/timer_manager.h +4 -2
- data/src/core/lib/iomgr/udp_server.cc +31 -30
- data/src/core/lib/iomgr/udp_server.h +6 -12
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +3 -4
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +1 -19
- data/src/core/lib/iomgr/work_serializer.cc +155 -0
- data/src/core/lib/iomgr/work_serializer.h +65 -0
- data/src/core/lib/json/json.h +209 -68
- data/src/core/lib/json/json_reader.cc +511 -319
- data/src/core/lib/json/json_writer.cc +202 -110
- data/src/core/lib/profiling/basic_timers.cc +12 -6
- data/src/core/lib/security/context/security_context.cc +92 -119
- data/src/core/lib/security/context/security_context.h +79 -48
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +39 -48
- data/src/core/lib/security/credentials/alts/alts_credentials.h +37 -10
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +45 -57
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +2 -1
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +3 -2
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +119 -159
- data/src/core/lib/security/credentials/composite/composite_credentials.h +71 -24
- data/src/core/lib/security/credentials/credentials.cc +18 -142
- data/src/core/lib/security/credentials/credentials.h +141 -105
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +48 -72
- data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -5
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +186 -99
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +32 -6
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +33 -39
- data/src/core/lib/security/credentials/iam/iam_credentials.h +22 -4
- data/src/core/lib/security/credentials/jwt/json_token.cc +32 -58
- data/src/core/lib/security/credentials/jwt/json_token.h +5 -7
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +70 -88
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +41 -10
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +159 -170
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +4 -5
- data/src/core/lib/security/credentials/local/local_credentials.cc +21 -34
- data/src/core/lib/security/credentials/local/local_credentials.h +32 -11
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +438 -203
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +98 -33
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +89 -91
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +43 -17
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +84 -83
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +60 -15
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +245 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +313 -0
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +128 -0
- data/src/core/lib/security/credentials/tls/tls_credentials.h +62 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +301 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +76 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +324 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +45 -0
- data/src/core/lib/security/security_connector/load_system_roots_fallback.cc +2 -2
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +15 -9
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +281 -0
- data/src/core/lib/security/security_connector/local/local_security_connector.h +59 -0
- data/src/core/lib/security/security_connector/security_connector.cc +40 -1158
- data/src/core/lib/security/security_connector/security_connector.h +100 -209
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +439 -0
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +77 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +563 -0
- data/src/core/lib/security/security_connector/ssl_utils.h +184 -0
- data/src/core/lib/security/security_connector/ssl_utils_config.cc +32 -0
- data/src/core/lib/security/security_connector/ssl_utils_config.h +30 -0
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +603 -0
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +183 -0
- data/src/core/lib/security/transport/auth_filters.h +5 -2
- data/src/core/lib/security/transport/client_auth_filter.cc +164 -116
- data/src/core/lib/security/transport/secure_endpoint.cc +70 -53
- data/src/core/lib/security/transport/security_handshaker.cc +340 -297
- data/src/core/lib/security/transport/security_handshaker.h +14 -3
- data/src/core/lib/security/transport/server_auth_filter.cc +115 -55
- data/src/core/lib/security/transport/target_authority_table.h +1 -1
- data/src/core/lib/security/util/json_util.cc +34 -13
- data/src/core/lib/security/util/json_util.h +5 -3
- data/src/core/lib/slice/b64.cc +3 -4
- data/src/core/lib/slice/b64.h +3 -4
- data/src/core/lib/slice/percent_encoding.cc +3 -3
- data/src/core/lib/slice/percent_encoding.h +3 -3
- data/src/core/lib/slice/slice.cc +219 -153
- data/src/core/lib/slice/slice_buffer.cc +60 -26
- data/src/core/lib/slice/slice_hash_table.h +9 -15
- data/src/core/lib/slice/slice_intern.cc +186 -143
- data/src/core/lib/slice/slice_internal.h +318 -3
- data/src/core/lib/slice/slice_string_helpers.cc +10 -1
- data/src/core/lib/slice/slice_string_helpers.h +3 -1
- data/src/core/lib/slice/slice_utils.h +200 -0
- data/src/core/lib/slice/slice_weak_hash_table.h +10 -17
- data/src/core/lib/surface/api_trace.h +1 -1
- data/src/core/lib/surface/byte_buffer_reader.cc +15 -43
- data/src/core/lib/surface/call.cc +419 -438
- data/src/core/lib/surface/call.h +14 -5
- data/src/core/lib/surface/call_details.cc +0 -1
- data/src/core/lib/surface/call_log_batch.cc +51 -60
- data/src/core/lib/surface/channel.cc +205 -144
- data/src/core/lib/surface/channel.h +85 -14
- data/src/core/lib/surface/channel_init.h +5 -0
- data/src/core/lib/surface/channel_ping.cc +3 -4
- data/src/core/lib/surface/completion_queue.cc +322 -281
- data/src/core/lib/surface/completion_queue.h +7 -21
- data/src/core/lib/surface/completion_queue_factory.cc +4 -4
- data/src/core/lib/surface/event_string.cc +18 -25
- data/src/core/lib/surface/event_string.h +3 -1
- data/src/core/lib/surface/init.cc +86 -31
- data/src/core/lib/surface/init.h +1 -0
- data/src/core/lib/surface/init_secure.cc +4 -4
- data/src/core/lib/surface/lame_client.cc +46 -35
- data/src/core/lib/surface/server.cc +815 -476
- data/src/core/lib/surface/server.h +50 -9
- data/src/core/lib/surface/validate_metadata.cc +18 -8
- data/src/core/lib/surface/validate_metadata.h +13 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +3 -3
- data/src/core/lib/transport/bdp_estimator.h +2 -2
- data/src/core/lib/transport/byte_stream.cc +5 -7
- data/src/core/lib/transport/byte_stream.h +13 -12
- data/src/core/lib/transport/connectivity_state.cc +114 -129
- data/src/core/lib/transport/connectivity_state.h +102 -58
- data/src/core/lib/transport/error_utils.cc +25 -2
- data/src/core/lib/transport/metadata.cc +428 -288
- data/src/core/lib/transport/metadata.h +307 -26
- data/src/core/lib/transport/metadata_batch.cc +81 -18
- data/src/core/lib/transport/metadata_batch.h +47 -6
- data/src/core/lib/transport/static_metadata.cc +1150 -521
- data/src/core/lib/transport/static_metadata.h +311 -317
- data/src/core/lib/transport/status_conversion.cc +7 -15
- data/src/core/lib/transport/status_metadata.cc +11 -4
- data/src/core/lib/transport/status_metadata.h +18 -0
- data/src/core/lib/transport/timeout_encoding.cc +8 -1
- data/src/core/lib/transport/timeout_encoding.h +4 -3
- data/src/core/lib/transport/transport.cc +49 -80
- data/src/core/lib/transport/transport.h +132 -54
- data/src/core/lib/transport/transport_impl.h +1 -1
- data/src/core/lib/transport/transport_op_string.cc +67 -105
- data/src/core/lib/uri/uri_parser.cc +314 -0
- data/src/core/lib/uri/uri_parser.h +49 -0
- data/src/core/plugin_registry/grpc_plugin_registry.cc +32 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
- data/src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +715 -144
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +49 -35
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +83 -0
- data/src/core/tsi/alts/handshaker/alts_shared_resource.h +73 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +373 -217
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +45 -24
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +43 -10
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +13 -7
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +4 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +75 -48
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +35 -27
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +2 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +13 -3
- data/src/core/tsi/fake_transport_security.cc +26 -25
- data/src/core/tsi/fake_transport_security.h +2 -0
- data/src/core/tsi/local_transport_security.cc +8 -6
- data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -6
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +2 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +14 -11
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -13
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +2 -3
- data/src/core/tsi/ssl_transport_security.cc +289 -125
- data/src/core/tsi/ssl_transport_security.h +52 -13
- data/src/core/tsi/ssl_types.h +0 -2
- data/src/core/tsi/transport_security.cc +31 -1
- data/src/core/tsi/transport_security.h +8 -10
- data/src/core/tsi/transport_security_grpc.cc +7 -0
- data/src/core/tsi/transport_security_grpc.h +8 -3
- data/src/core/tsi/transport_security_interface.h +15 -3
- data/src/ruby/bin/math_pb.rb +23 -21
- data/src/ruby/ext/grpc/ext-export.clang +1 -0
- data/src/ruby/ext/grpc/ext-export.gcc +6 -0
- data/src/ruby/ext/grpc/extconf.rb +18 -4
- data/src/ruby/ext/grpc/rb_call.c +11 -2
- data/src/ruby/ext/grpc/rb_call_credentials.c +12 -6
- data/src/ruby/ext/grpc/rb_channel.c +18 -11
- data/src/ruby/ext/grpc/rb_channel_credentials.c +8 -4
- data/src/ruby/ext/grpc/rb_compression_options.c +9 -7
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc.c +48 -60
- data/src/ruby/ext/grpc/rb_grpc.h +5 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +42 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +67 -13
- data/src/ruby/ext/grpc/rb_server.c +10 -4
- data/src/ruby/lib/grpc.rb +2 -0
- data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
- data/src/ruby/lib/grpc/errors.rb +122 -46
- data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
- data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -2
- data/src/ruby/lib/grpc/generic/interceptors.rb +4 -4
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +3 -3
- data/src/ruby/lib/grpc/generic/rpc_server.rb +64 -4
- data/src/ruby/lib/grpc/generic/service.rb +6 -5
- data/src/ruby/lib/grpc/google_rpc_status_utils.rb +9 -4
- data/src/ruby/lib/grpc/grpc.rb +1 -1
- data/src/ruby/lib/grpc/structs.rb +15 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/README.md +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +5 -3
- data/src/ruby/pb/grpc/health/checker.rb +2 -3
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +16 -13
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +18 -0
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +4 -2
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +92 -69
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
- data/src/ruby/spec/channel_spec.rb +44 -0
- data/src/ruby/spec/client_auth_spec.rb +5 -5
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/errors_spec.rb +142 -0
- data/src/ruby/spec/generic/client_stub_spec.rb +13 -9
- data/src/ruby/spec/generic/rpc_server_spec.rb +25 -3
- data/src/ruby/spec/generic/service_spec.rb +2 -0
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +2 -2
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options.proto +28 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +39 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +78 -0
- data/src/ruby/spec/support/services.rb +29 -22
- data/src/ruby/spec/testdata/ca.pem +18 -13
- data/src/ruby/spec/testdata/client.key +26 -14
- data/src/ruby/spec/testdata/client.pem +18 -12
- data/src/ruby/spec/testdata/server1.key +26 -14
- data/src/ruby/spec/testdata/server1.pem +20 -14
- data/third_party/abseil-cpp/absl/algorithm/algorithm.h +159 -0
- data/third_party/abseil-cpp/absl/base/attributes.h +621 -0
- data/third_party/abseil-cpp/absl/base/call_once.h +226 -0
- data/third_party/abseil-cpp/absl/base/casts.h +184 -0
- data/third_party/abseil-cpp/absl/base/config.h +671 -0
- data/third_party/abseil-cpp/absl/base/const_init.h +76 -0
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.cc +129 -0
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +389 -0
- data/third_party/abseil-cpp/absl/base/internal/atomic_hook.h +200 -0
- data/third_party/abseil-cpp/absl/base/internal/bits.h +218 -0
- data/third_party/abseil-cpp/absl/base/internal/cycleclock.cc +107 -0
- data/third_party/abseil-cpp/absl/base/internal/cycleclock.h +94 -0
- data/third_party/abseil-cpp/absl/base/internal/endian.h +266 -0
- data/third_party/abseil-cpp/absl/base/internal/errno_saver.h +43 -0
- data/third_party/abseil-cpp/absl/base/internal/hide_ptr.h +51 -0
- data/third_party/abseil-cpp/absl/base/internal/identity.h +37 -0
- data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +107 -0
- data/third_party/abseil-cpp/absl/base/internal/invoke.h +187 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +107 -0
- data/third_party/abseil-cpp/absl/base/internal/per_thread_tls.h +52 -0
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +240 -0
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +183 -0
- data/third_party/abseil-cpp/absl/base/internal/scheduling_mode.h +58 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +233 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +243 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc +35 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +66 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +46 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc +81 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +93 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +37 -0
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +416 -0
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.h +66 -0
- data/third_party/abseil-cpp/absl/base/internal/thread_annotations.h +271 -0
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +152 -0
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +259 -0
- data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +108 -0
- data/third_party/abseil-cpp/absl/base/internal/throw_delegate.h +75 -0
- data/third_party/abseil-cpp/absl/base/internal/tsan_mutex_interface.h +66 -0
- data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +158 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +140 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +124 -0
- data/third_party/abseil-cpp/absl/base/log_severity.cc +27 -0
- data/third_party/abseil-cpp/absl/base/log_severity.h +121 -0
- data/third_party/abseil-cpp/absl/base/macros.h +220 -0
- data/third_party/abseil-cpp/absl/base/optimization.h +181 -0
- data/third_party/abseil-cpp/absl/base/options.h +211 -0
- data/third_party/abseil-cpp/absl/base/policy_checks.h +111 -0
- data/third_party/abseil-cpp/absl/base/port.h +26 -0
- data/third_party/abseil-cpp/absl/base/thread_annotations.h +280 -0
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +848 -0
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +265 -0
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +892 -0
- data/third_party/abseil-cpp/absl/memory/memory.h +695 -0
- data/third_party/abseil-cpp/absl/meta/type_traits.h +759 -0
- data/third_party/abseil-cpp/absl/numeric/int128.cc +404 -0
- data/third_party/abseil-cpp/absl/numeric/int128.h +1091 -0
- data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +302 -0
- data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +308 -0
- data/third_party/abseil-cpp/absl/strings/ascii.cc +200 -0
- data/third_party/abseil-cpp/absl/strings/ascii.h +242 -0
- data/third_party/abseil-cpp/absl/strings/charconv.cc +984 -0
- data/third_party/abseil-cpp/absl/strings/charconv.h +119 -0
- data/third_party/abseil-cpp/absl/strings/escaping.cc +949 -0
- data/third_party/abseil-cpp/absl/strings/escaping.h +164 -0
- data/third_party/abseil-cpp/absl/strings/internal/char_map.h +156 -0
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +359 -0
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +423 -0
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +504 -0
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.h +99 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +180 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.h +58 -0
- data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +112 -0
- data/third_party/abseil-cpp/absl/strings/internal/memutil.h +148 -0
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +36 -0
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.h +89 -0
- data/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h +73 -0
- data/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h +248 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +388 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +432 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +245 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +209 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +326 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +51 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +415 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +493 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +23 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.cc +72 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +104 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +334 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +333 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h +314 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +455 -0
- data/third_party/abseil-cpp/absl/strings/internal/utf8.cc +53 -0
- data/third_party/abseil-cpp/absl/strings/internal/utf8.h +50 -0
- data/third_party/abseil-cpp/absl/strings/match.cc +40 -0
- data/third_party/abseil-cpp/absl/strings/match.h +90 -0
- data/third_party/abseil-cpp/absl/strings/numbers.cc +965 -0
- data/third_party/abseil-cpp/absl/strings/numbers.h +266 -0
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +246 -0
- data/third_party/abseil-cpp/absl/strings/str_cat.h +408 -0
- data/third_party/abseil-cpp/absl/strings/str_format.h +537 -0
- data/third_party/abseil-cpp/absl/strings/str_join.h +293 -0
- data/third_party/abseil-cpp/absl/strings/str_replace.cc +82 -0
- data/third_party/abseil-cpp/absl/strings/str_replace.h +219 -0
- data/third_party/abseil-cpp/absl/strings/str_split.cc +139 -0
- data/third_party/abseil-cpp/absl/strings/str_split.h +513 -0
- data/third_party/abseil-cpp/absl/strings/string_view.cc +235 -0
- data/third_party/abseil-cpp/absl/strings/string_view.h +622 -0
- data/third_party/abseil-cpp/absl/strings/strip.h +91 -0
- data/third_party/abseil-cpp/absl/strings/substitute.cc +171 -0
- data/third_party/abseil-cpp/absl/strings/substitute.h +693 -0
- data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
- data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
- data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
- data/third_party/abseil-cpp/absl/time/clock.h +74 -0
- data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
- data/third_party/abseil-cpp/absl/time/format.cc +153 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
- data/third_party/abseil-cpp/absl/time/time.cc +499 -0
- data/third_party/abseil-cpp/absl/time/time.h +1584 -0
- data/third_party/abseil-cpp/absl/types/bad_optional_access.cc +48 -0
- data/third_party/abseil-cpp/absl/types/bad_optional_access.h +78 -0
- data/third_party/abseil-cpp/absl/types/internal/optional.h +396 -0
- data/third_party/abseil-cpp/absl/types/internal/span.h +128 -0
- data/third_party/abseil-cpp/absl/types/optional.h +776 -0
- data/third_party/abseil-cpp/absl/types/span.h +713 -0
- data/third_party/abseil-cpp/absl/utility/utility.h +350 -0
- data/third_party/boringssl-with-bazel/err_data.c +1439 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bitstr.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +123 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +93 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_dup.c +87 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +195 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_gentm.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_i2d_fp.c +88 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +420 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +305 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +286 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_octet.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_print.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +313 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +212 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_type.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utctm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utf8.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +446 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_locl.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_par.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn_pack.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_enum.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_int.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_string.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_dec.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +664 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_fre.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_new.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_typ.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_utl.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/time_support.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +466 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +700 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio_mem.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +545 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +279 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +317 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/hexdump.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/internal.h +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +488 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/printf.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +206 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +118 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/bn_asn1.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/bn_extra/convert.c +470 -0
- data/third_party/boringssl-with-bazel/src/crypto/buf/buf.c +172 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/asn1_compat.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +265 -0
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbb.c +719 -0
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +688 -0
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/internal.h +96 -0
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/unicode.c +155 -0
- data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +184 -0
- data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +45 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +143 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +152 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_aesccm.c +447 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_aesctrhmac.c +283 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_aesgcmsiv.c +891 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_chacha20poly1305.c +418 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_null.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc2.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc4.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +688 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/internal.h +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +491 -0
- data/third_party/boringssl-with-bazel/src/crypto/cmac/cmac.c +278 -0
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +810 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf_def.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-fuchsia.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-linux.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +220 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.h +201 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +291 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-ppc64le.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +226 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +2159 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +7872 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +146 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +539 -0
- data/third_party/boringssl-with-bazel/src/crypto/dh/check.c +217 -0
- data/third_party/boringssl-with-bazel/src/crypto/dh/dh.c +533 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/params.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/digest_extra/digest_extra.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +980 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa_asn1.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +574 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +95 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +425 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +78 -0
- data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +124 -0
- data/third_party/boringssl-with-bazel/src/crypto/ecdsa_extra/ecdsa_asn1.c +267 -0
- data/third_party/boringssl-with-bazel/src/crypto/engine/engine.c +99 -0
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +850 -0
- data/third_party/boringssl-with-bazel/src/crypto/err/internal.h +58 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/digestsign.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +443 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +388 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_ctx.c +484 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/internal.h +269 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.c +273 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +286 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +255 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ed25519.c +104 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ed25519_asn1.c +221 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa.c +648 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa_asn1.c +194 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_x25519.c +110 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_x25519_asn1.c +248 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/pbkdf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/print.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/evp/scrypt.c +213 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/sign.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ex_data.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.c +108 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1282 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +238 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/key_wrap.c +236 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +106 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +263 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/add.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/asm/x86_64-gcc.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/bn.c +445 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bytes.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/cmp.c +200 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/ctx.c +236 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +886 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div_extra.c +87 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +1288 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +378 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.c +325 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/generic.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +694 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/jacobi.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +502 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +186 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +749 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.c +1068 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/random.c +341 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +226 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.h +104 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/shift.c +364 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/sqrt.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/aead.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +620 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +1302 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_des.c +237 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/internal.h +128 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +89 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/des.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/internal.h +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +271 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +296 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/internal.h +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +268 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +1252 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +465 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +524 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +100 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +775 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +328 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +1178 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9497 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +632 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.h +153 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +736 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +175 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +357 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +270 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +255 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +270 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +122 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +328 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/fips_shared_support.c +32 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/hmac/hmac.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/is_fips.c +29 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +256 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/internal.h +37 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +301 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +167 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cfb.c +202 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +200 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +729 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +304 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +441 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +96 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/polyval.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/ctrdrbg.c +202 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +163 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +378 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +391 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +243 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +127 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/padding.c +695 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +898 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +1358 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +654 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/internal.h +53 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1-altivec.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +371 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +343 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +544 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/kdf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hkdf/hkdf.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c +2100 -0
- data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +61 -0
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +834 -0
- data/third_party/boringssl-with-bazel/src/crypto/lhash/lhash.c +348 -0
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +359 -0
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +549 -0
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +11585 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_xref.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +261 -0
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_info.c +360 -0
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +777 -0
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_oth.c +87 -0
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +257 -0
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +218 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_xaux.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/internal.h +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +159 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +385 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +131 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +316 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +530 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1305 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/internal.h +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +318 -0
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_arm.c +305 -0
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_vec.c +856 -0
- data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +45 -0
- data/third_party/boringssl-with-bazel/src/crypto/pool/pool.c +220 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +52 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/forkunsafe.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/fuchsia.c +30 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/rand_extra.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +69 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rc4/rc4.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_c11.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/refcount_lock.c +53 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_asn1.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_print.c +22 -0
- data/third_party/boringssl-with-bazel/src/crypto/siphash/siphash.c +82 -0
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +431 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +59 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +210 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +260 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +278 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1474 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +720 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_digest.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_sign.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +653 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.c +114 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/algorithm.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +842 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +458 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +275 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/charmap.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/i2d_pr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/rsa_pss.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +125 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_req.c +244 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +544 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509a.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/vpm_int.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_att.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +476 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_d2.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_def.c +103 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_ext.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +834 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +198 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_r2x.c +116 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +341 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +185 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +326 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_txt.c +204 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_v3.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +2487 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +671 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +210 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +389 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509rset.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509spki.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_algor.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +399 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_attrib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_crl.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_exten.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_info.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_name.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pkey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pubkey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_req.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_sig.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_spki.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_val.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +334 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509a.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/ext_dat.h +141 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +56 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +286 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_data.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_int.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_lib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_map.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_node.c +189 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +842 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +207 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akeya.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +629 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bcons.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bitst.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +463 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +503 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_crld.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +100 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_extku.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +246 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ia5.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +218 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_int.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +371 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ncons.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ocsp.c +68 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pci.c +288 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcia.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcons.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pku.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pmaps.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_prn.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +843 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +155 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_sxnet.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +1395 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +459 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +195 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/arm_arch.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +911 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1_mac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1t.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +575 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +190 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +933 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/blowfish.h +93 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +1057 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/buf.h +137 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buffer.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +561 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cast.h +96 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/chacha.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +638 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cmac.h +91 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +180 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +212 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +149 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/curve25519.h +201 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/des.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +319 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +331 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +457 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dtls1.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/e_os2.h +18 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +424 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +372 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdh.h +118 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +205 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/engine.h +109 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/err.h +465 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +1050 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ex_data.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hkdf.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/hmac.h +186 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +100 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/is_boringssl.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/lhash.h +282 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/md4.h +108 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/md5.h +109 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +175 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +4259 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +236 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj_mac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/objects.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslconf.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslv.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ossl_typ.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +435 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs12.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +215 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +269 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/poly1305.h +49 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +102 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +111 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rc4.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ripemd.h +108 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +818 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/safestack.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +294 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/siphash.h +37 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +199 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/srtp.h +0 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +5198 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl3.h +333 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +542 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +191 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +632 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +291 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/type_check.h +90 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +1207 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +681 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +831 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/bio_ssl.cc +0 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +837 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +268 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +273 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +232 -0
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +200 -0
- data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +353 -0
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +675 -0
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +703 -0
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +1890 -0
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1805 -0
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +3572 -0
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +724 -0
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +221 -0
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +458 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +432 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +856 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_buffer.cc +306 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +1019 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +1718 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_file.cc +585 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +397 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +3015 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +835 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +1333 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +230 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +277 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +394 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +1358 -0
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +365 -0
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +3870 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +689 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +1017 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +513 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +1096 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +317 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +703 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +981 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +619 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +3147 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +1226 -0
- data/third_party/cares/cares/ares.h +12 -0
- data/third_party/cares/cares/ares_create_query.c +5 -1
- data/third_party/cares/cares/ares_data.c +74 -73
- data/third_party/cares/cares/ares_destroy.c +6 -1
- data/third_party/cares/cares/ares_gethostbyaddr.c +5 -5
- data/third_party/cares/cares/ares_gethostbyname.c +15 -4
- data/third_party/cares/cares/ares_getnameinfo.c +11 -0
- data/third_party/cares/cares/ares_init.c +274 -173
- data/third_party/cares/cares/ares_library_init.c +21 -3
- data/third_party/cares/cares/ares_options.c +6 -2
- data/third_party/cares/cares/ares_parse_naptr_reply.c +7 -6
- data/third_party/cares/cares/ares_parse_ptr_reply.c +4 -2
- data/third_party/cares/cares/ares_platform.c +7 -0
- data/third_party/cares/cares/ares_private.h +19 -11
- data/third_party/cares/cares/ares_process.c +27 -2
- data/third_party/cares/cares/ares_rules.h +1 -1
- data/third_party/cares/cares/ares_search.c +7 -0
- data/third_party/cares/cares/ares_send.c +6 -0
- data/third_party/cares/cares/ares_strsplit.c +174 -0
- data/third_party/cares/cares/ares_strsplit.h +43 -0
- data/third_party/cares/cares/ares_version.h +4 -4
- data/third_party/cares/cares/config-win32.h +1 -1
- data/third_party/cares/cares/inet_ntop.c +2 -3
- data/third_party/cares/config_darwin/ares_config.h +3 -0
- data/third_party/cares/config_freebsd/ares_config.h +3 -0
- data/third_party/cares/config_linux/ares_config.h +3 -0
- data/third_party/cares/config_openbsd/ares_config.h +3 -0
- data/third_party/upb/upb/decode.c +609 -0
- data/third_party/upb/upb/decode.h +21 -0
- data/third_party/upb/upb/encode.c +378 -0
- data/third_party/upb/upb/encode.h +21 -0
- data/third_party/upb/upb/generated_util.h +105 -0
- data/third_party/upb/upb/msg.c +111 -0
- data/third_party/upb/upb/msg.h +69 -0
- data/third_party/upb/upb/port.c +26 -0
- data/third_party/upb/upb/port_def.inc +150 -0
- data/third_party/upb/upb/port_undef.inc +21 -0
- data/third_party/upb/upb/table.c +913 -0
- data/third_party/upb/upb/table.int.h +507 -0
- data/third_party/upb/upb/upb.c +261 -0
- data/third_party/upb/upb/upb.h +364 -0
- metadata +968 -542
- data/src/boringssl/err_data.c +0 -1362
- data/src/core/ext/filters/client_channel/connector.cc +0 -41
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +0 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +0 -54
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +0 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +0 -54
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +0 -89
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -164
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +0 -163
- data/src/core/ext/filters/client_channel/method_params.cc +0 -178
- data/src/core/ext/filters/client_channel/method_params.h +0 -78
- data/src/core/ext/filters/client_channel/proxy_mapper.cc +0 -48
- data/src/core/ext/filters/client_channel/subchannel_index.cc +0 -254
- data/src/core/ext/filters/client_channel/subchannel_index.h +0 -79
- data/src/core/ext/filters/client_channel/uri_parser.cc +0 -314
- data/src/core/ext/filters/client_channel/uri_parser.h +0 -50
- data/src/core/lib/channel/handshaker_factory.cc +0 -41
- data/src/core/lib/gpr/arena.cc +0 -145
- data/src/core/lib/gpr/host_port.cc +0 -98
- data/src/core/lib/gpr/host_port.h +0 -43
- data/src/core/lib/gpr/mpscq.cc +0 -117
- data/src/core/lib/gpr/mpscq.h +0 -86
- data/src/core/lib/gprpp/abstract.h +0 -37
- data/src/core/lib/gprpp/atomic_with_atm.h +0 -57
- data/src/core/lib/gprpp/atomic_with_std.h +0 -35
- data/src/core/lib/gprpp/inlined_vector.h +0 -186
- data/src/core/lib/gprpp/mutex_lock.h +0 -42
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +0 -1743
- data/src/core/lib/iomgr/ev_epollsig_linux.h +0 -35
- data/src/core/lib/iomgr/network_status_tracker.cc +0 -36
- data/src/core/lib/iomgr/network_status_tracker.h +0 -32
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +0 -107
- data/src/core/lib/iomgr/wakeup_fd_cv.h +0 -69
- data/src/core/lib/json/json.cc +0 -97
- data/src/core/lib/json/json_common.h +0 -34
- data/src/core/lib/json/json_reader.h +0 -146
- data/src/core/lib/json/json_string.cc +0 -367
- data/src/core/lib/json/json_writer.h +0 -84
- data/src/core/lib/security/security_connector/alts_security_connector.cc +0 -288
- data/src/core/lib/security/security_connector/alts_security_connector.h +0 -69
- data/src/core/lib/security/security_connector/local_security_connector.cc +0 -245
- data/src/core/lib/security/security_connector/local_security_connector.h +0 -58
- data/src/core/lib/transport/service_config.cc +0 -106
- data/src/core/lib/transport/service_config.h +0 -249
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +0 -520
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +0 -323
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +0 -143
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +0 -149
- data/src/core/tsi/alts/handshaker/alts_tsi_event.cc +0 -73
- data/src/core/tsi/alts/handshaker/alts_tsi_event.h +0 -93
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -47
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +0 -63
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -122
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +0 -254
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -49
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +0 -78
- data/src/core/tsi/alts_transport_security.cc +0 -63
- data/src/core/tsi/alts_transport_security.h +0 -47
- data/src/core/tsi/grpc_shadow_boringssl.h +0 -3006
- data/third_party/boringssl/crypto/asn1/a_bool.c +0 -110
- data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +0 -297
- data/third_party/boringssl/crypto/asn1/a_dup.c +0 -111
- data/third_party/boringssl/crypto/asn1/a_enum.c +0 -195
- data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +0 -150
- data/third_party/boringssl/crypto/asn1/a_int.c +0 -479
- data/third_party/boringssl/crypto/asn1/a_mbstr.c +0 -411
- data/third_party/boringssl/crypto/asn1/a_object.c +0 -275
- data/third_party/boringssl/crypto/asn1/a_strnid.c +0 -312
- data/third_party/boringssl/crypto/asn1/a_time.c +0 -213
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +0 -442
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +0 -662
- data/third_party/boringssl/crypto/base64/base64.c +0 -466
- data/third_party/boringssl/crypto/bio/bio.c +0 -636
- data/third_party/boringssl/crypto/bio/connect.c +0 -542
- data/third_party/boringssl/crypto/bio/fd.c +0 -276
- data/third_party/boringssl/crypto/bio/file.c +0 -315
- data/third_party/boringssl/crypto/bio/pair.c +0 -489
- data/third_party/boringssl/crypto/bio/socket.c +0 -202
- data/third_party/boringssl/crypto/bio/socket_helper.c +0 -114
- data/third_party/boringssl/crypto/bn_extra/convert.c +0 -466
- data/third_party/boringssl/crypto/buf/buf.c +0 -231
- data/third_party/boringssl/crypto/bytestring/ber.c +0 -261
- data/third_party/boringssl/crypto/bytestring/cbb.c +0 -668
- data/third_party/boringssl/crypto/bytestring/cbs.c +0 -618
- data/third_party/boringssl/crypto/bytestring/internal.h +0 -75
- data/third_party/boringssl/crypto/chacha/chacha.c +0 -167
- data/third_party/boringssl/crypto/cipher_extra/cipher_extra.c +0 -114
- data/third_party/boringssl/crypto/cipher_extra/derive_key.c +0 -152
- data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +0 -203
- data/third_party/boringssl/crypto/cipher_extra/e_aesctrhmac.c +0 -281
- data/third_party/boringssl/crypto/cipher_extra/e_aesgcmsiv.c +0 -867
- data/third_party/boringssl/crypto/cipher_extra/e_chacha20poly1305.c +0 -326
- data/third_party/boringssl/crypto/cipher_extra/e_ssl3.c +0 -460
- data/third_party/boringssl/crypto/cipher_extra/e_tls.c +0 -680
- data/third_party/boringssl/crypto/cipher_extra/tls_cbc.c +0 -482
- data/third_party/boringssl/crypto/cmac/cmac.c +0 -241
- data/third_party/boringssl/crypto/conf/conf.c +0 -803
- data/third_party/boringssl/crypto/cpu-arm-linux.c +0 -363
- data/third_party/boringssl/crypto/cpu-intel.c +0 -288
- data/third_party/boringssl/crypto/crypto.c +0 -198
- data/third_party/boringssl/crypto/curve25519/spake25519.c +0 -539
- data/third_party/boringssl/crypto/dh/check.c +0 -217
- data/third_party/boringssl/crypto/dh/dh.c +0 -519
- data/third_party/boringssl/crypto/dsa/dsa.c +0 -946
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +0 -562
- data/third_party/boringssl/crypto/ecdh/ecdh.c +0 -162
- data/third_party/boringssl/crypto/ecdsa_extra/ecdsa_asn1.c +0 -275
- data/third_party/boringssl/crypto/engine/engine.c +0 -98
- data/third_party/boringssl/crypto/err/err.c +0 -847
- data/third_party/boringssl/crypto/err/internal.h +0 -58
- data/third_party/boringssl/crypto/evp/evp.c +0 -362
- data/third_party/boringssl/crypto/evp/evp_asn1.c +0 -337
- data/third_party/boringssl/crypto/evp/evp_ctx.c +0 -446
- data/third_party/boringssl/crypto/evp/internal.h +0 -252
- data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +0 -268
- data/third_party/boringssl/crypto/evp/p_ec.c +0 -239
- data/third_party/boringssl/crypto/evp/p_ec_asn1.c +0 -256
- data/third_party/boringssl/crypto/evp/p_ed25519.c +0 -71
- data/third_party/boringssl/crypto/evp/p_ed25519_asn1.c +0 -190
- data/third_party/boringssl/crypto/evp/p_rsa.c +0 -634
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +0 -189
- data/third_party/boringssl/crypto/evp/scrypt.c +0 -209
- data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +0 -1100
- data/third_party/boringssl/crypto/fipsmodule/aes/internal.h +0 -100
- data/third_party/boringssl/crypto/fipsmodule/aes/key_wrap.c +0 -138
- data/third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.c +0 -112
- data/third_party/boringssl/crypto/fipsmodule/bcm.c +0 -148
- data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +0 -428
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +0 -200
- data/third_party/boringssl/crypto/fipsmodule/bn/ctx.c +0 -303
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +0 -895
- data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +0 -1356
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +0 -683
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +0 -573
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +0 -526
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +0 -185
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +0 -876
- data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +0 -1154
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +0 -351
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +0 -231
- data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +0 -33
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +0 -364
- data/third_party/boringssl/crypto/fipsmodule/cipher/cipher.c +0 -615
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +0 -1437
- data/third_party/boringssl/crypto/fipsmodule/cipher/e_des.c +0 -233
- data/third_party/boringssl/crypto/fipsmodule/cipher/internal.h +0 -129
- data/third_party/boringssl/crypto/fipsmodule/delocate.h +0 -88
- data/third_party/boringssl/crypto/fipsmodule/digest/digest.c +0 -256
- data/third_party/boringssl/crypto/fipsmodule/digest/digests.c +0 -280
- data/third_party/boringssl/crypto/fipsmodule/digest/md32_common.h +0 -268
- data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +0 -974
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +0 -453
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +0 -270
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +0 -337
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +0 -373
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +0 -1104
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +0 -9503
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +0 -447
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +0 -117
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +0 -1046
- data/third_party/boringssl/crypto/fipsmodule/ec/util.c +0 -104
- data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +0 -354
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +0 -458
- data/third_party/boringssl/crypto/fipsmodule/is_fips.c +0 -27
- data/third_party/boringssl/crypto/fipsmodule/md4/md4.c +0 -254
- data/third_party/boringssl/crypto/fipsmodule/md5/md5.c +0 -298
- data/third_party/boringssl/crypto/fipsmodule/modes/cbc.c +0 -211
- data/third_party/boringssl/crypto/fipsmodule/modes/ccm.c +0 -256
- data/third_party/boringssl/crypto/fipsmodule/modes/cfb.c +0 -234
- data/third_party/boringssl/crypto/fipsmodule/modes/ctr.c +0 -220
- data/third_party/boringssl/crypto/fipsmodule/modes/gcm.c +0 -1063
- data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +0 -388
- data/third_party/boringssl/crypto/fipsmodule/modes/ofb.c +0 -95
- data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +0 -202
- data/third_party/boringssl/crypto/fipsmodule/rand/internal.h +0 -92
- data/third_party/boringssl/crypto/fipsmodule/rand/rand.c +0 -358
- data/third_party/boringssl/crypto/fipsmodule/rand/urandom.c +0 -302
- data/third_party/boringssl/crypto/fipsmodule/rsa/blinding.c +0 -239
- data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +0 -126
- data/third_party/boringssl/crypto/fipsmodule/rsa/padding.c +0 -692
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +0 -875
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +0 -1218
- data/third_party/boringssl/crypto/fipsmodule/self_check/self_check.c +0 -581
- data/third_party/boringssl/crypto/fipsmodule/sha/sha1.c +0 -375
- data/third_party/boringssl/crypto/fipsmodule/sha/sha256.c +0 -337
- data/third_party/boringssl/crypto/fipsmodule/sha/sha512.c +0 -608
- data/third_party/boringssl/crypto/internal.h +0 -739
- data/third_party/boringssl/crypto/lhash/lhash.c +0 -336
- data/third_party/boringssl/crypto/mem.c +0 -235
- data/third_party/boringssl/crypto/obj/obj.c +0 -554
- data/third_party/boringssl/crypto/obj/obj_dat.h +0 -6244
- data/third_party/boringssl/crypto/pem/pem_all.c +0 -262
- data/third_party/boringssl/crypto/pem/pem_info.c +0 -379
- data/third_party/boringssl/crypto/pem/pem_lib.c +0 -776
- data/third_party/boringssl/crypto/pem/pem_oth.c +0 -88
- data/third_party/boringssl/crypto/pem/pem_pk8.c +0 -258
- data/third_party/boringssl/crypto/pem/pem_pkey.c +0 -227
- data/third_party/boringssl/crypto/pkcs7/pkcs7.c +0 -166
- data/third_party/boringssl/crypto/pkcs7/pkcs7_x509.c +0 -233
- data/third_party/boringssl/crypto/pkcs8/internal.h +0 -120
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +0 -307
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +0 -513
- data/third_party/boringssl/crypto/pkcs8/pkcs8_x509.c +0 -789
- data/third_party/boringssl/crypto/poly1305/poly1305.c +0 -318
- data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +0 -304
- data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +0 -839
- data/third_party/boringssl/crypto/pool/internal.h +0 -45
- data/third_party/boringssl/crypto/pool/pool.c +0 -200
- data/third_party/boringssl/crypto/rand_extra/deterministic.c +0 -48
- data/third_party/boringssl/crypto/rand_extra/fuchsia.c +0 -43
- data/third_party/boringssl/crypto/rand_extra/windows.c +0 -53
- data/third_party/boringssl/crypto/refcount_lock.c +0 -53
- data/third_party/boringssl/crypto/stack/stack.c +0 -380
- data/third_party/boringssl/crypto/thread_none.c +0 -59
- data/third_party/boringssl/crypto/thread_pthread.c +0 -206
- data/third_party/boringssl/crypto/thread_win.c +0 -237
- data/third_party/boringssl/crypto/x509/a_strex.c +0 -633
- data/third_party/boringssl/crypto/x509/a_verify.c +0 -115
- data/third_party/boringssl/crypto/x509/asn1_gen.c +0 -841
- data/third_party/boringssl/crypto/x509/by_dir.c +0 -451
- data/third_party/boringssl/crypto/x509/by_file.c +0 -274
- data/third_party/boringssl/crypto/x509/t_crl.c +0 -128
- data/third_party/boringssl/crypto/x509/t_req.c +0 -246
- data/third_party/boringssl/crypto/x509/t_x509.c +0 -547
- data/third_party/boringssl/crypto/x509/x509_cmp.c +0 -477
- data/third_party/boringssl/crypto/x509/x509_def.c +0 -103
- data/third_party/boringssl/crypto/x509/x509_lu.c +0 -725
- data/third_party/boringssl/crypto/x509/x509_obj.c +0 -198
- data/third_party/boringssl/crypto/x509/x509_r2x.c +0 -117
- data/third_party/boringssl/crypto/x509/x509_req.c +0 -322
- data/third_party/boringssl/crypto/x509/x509_set.c +0 -164
- data/third_party/boringssl/crypto/x509/x509_trs.c +0 -326
- data/third_party/boringssl/crypto/x509/x509_txt.c +0 -205
- data/third_party/boringssl/crypto/x509/x509_vfy.c +0 -2476
- data/third_party/boringssl/crypto/x509/x509_vpm.c +0 -670
- data/third_party/boringssl/crypto/x509/x509cset.c +0 -170
- data/third_party/boringssl/crypto/x509/x509name.c +0 -389
- data/third_party/boringssl/crypto/x509/x_all.c +0 -501
- data/third_party/boringssl/crypto/x509/x_x509.c +0 -328
- data/third_party/boringssl/crypto/x509v3/ext_dat.h +0 -143
- data/third_party/boringssl/crypto/x509v3/pcy_cache.c +0 -284
- data/third_party/boringssl/crypto/x509v3/pcy_node.c +0 -188
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +0 -840
- data/third_party/boringssl/crypto/x509v3/v3_akey.c +0 -204
- data/third_party/boringssl/crypto/x509v3/v3_alt.c +0 -623
- data/third_party/boringssl/crypto/x509v3/v3_conf.c +0 -462
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +0 -502
- data/third_party/boringssl/crypto/x509v3/v3_enum.c +0 -100
- data/third_party/boringssl/crypto/x509v3/v3_genn.c +0 -251
- data/third_party/boringssl/crypto/x509v3/v3_info.c +0 -219
- data/third_party/boringssl/crypto/x509v3/v3_lib.c +0 -370
- data/third_party/boringssl/crypto/x509v3/v3_pci.c +0 -287
- data/third_party/boringssl/crypto/x509v3/v3_purp.c +0 -866
- data/third_party/boringssl/crypto/x509v3/v3_skey.c +0 -152
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +0 -1352
- data/third_party/boringssl/include/openssl/aead.h +0 -433
- data/third_party/boringssl/include/openssl/aes.h +0 -170
- data/third_party/boringssl/include/openssl/asn1.h +0 -981
- data/third_party/boringssl/include/openssl/base.h +0 -457
- data/third_party/boringssl/include/openssl/base64.h +0 -187
- data/third_party/boringssl/include/openssl/bio.h +0 -902
- data/third_party/boringssl/include/openssl/blowfish.h +0 -93
- data/third_party/boringssl/include/openssl/bn.h +0 -1019
- data/third_party/boringssl/include/openssl/buf.h +0 -137
- data/third_party/boringssl/include/openssl/bytestring.h +0 -505
- data/third_party/boringssl/include/openssl/cast.h +0 -96
- data/third_party/boringssl/include/openssl/cipher.h +0 -608
- data/third_party/boringssl/include/openssl/cmac.h +0 -87
- data/third_party/boringssl/include/openssl/conf.h +0 -183
- data/third_party/boringssl/include/openssl/cpu.h +0 -196
- data/third_party/boringssl/include/openssl/crypto.h +0 -122
- data/third_party/boringssl/include/openssl/curve25519.h +0 -201
- data/third_party/boringssl/include/openssl/dh.h +0 -298
- data/third_party/boringssl/include/openssl/digest.h +0 -316
- data/third_party/boringssl/include/openssl/dsa.h +0 -435
- data/third_party/boringssl/include/openssl/ec.h +0 -413
- data/third_party/boringssl/include/openssl/ec_key.h +0 -342
- data/third_party/boringssl/include/openssl/ecdh.h +0 -101
- data/third_party/boringssl/include/openssl/ecdsa.h +0 -199
- data/third_party/boringssl/include/openssl/engine.h +0 -109
- data/third_party/boringssl/include/openssl/err.h +0 -458
- data/third_party/boringssl/include/openssl/evp.h +0 -873
- data/third_party/boringssl/include/openssl/hmac.h +0 -186
- data/third_party/boringssl/include/openssl/lhash.h +0 -174
- data/third_party/boringssl/include/openssl/lhash_macros.h +0 -174
- data/third_party/boringssl/include/openssl/md4.h +0 -106
- data/third_party/boringssl/include/openssl/md5.h +0 -107
- data/third_party/boringssl/include/openssl/mem.h +0 -156
- data/third_party/boringssl/include/openssl/nid.h +0 -4242
- data/third_party/boringssl/include/openssl/obj.h +0 -233
- data/third_party/boringssl/include/openssl/pem.h +0 -397
- data/third_party/boringssl/include/openssl/pkcs7.h +0 -82
- data/third_party/boringssl/include/openssl/pkcs8.h +0 -230
- data/third_party/boringssl/include/openssl/poly1305.h +0 -51
- data/third_party/boringssl/include/openssl/pool.h +0 -91
- data/third_party/boringssl/include/openssl/rand.h +0 -125
- data/third_party/boringssl/include/openssl/ripemd.h +0 -107
- data/third_party/boringssl/include/openssl/rsa.h +0 -756
- data/third_party/boringssl/include/openssl/sha.h +0 -256
- data/third_party/boringssl/include/openssl/span.h +0 -191
- data/third_party/boringssl/include/openssl/ssl.h +0 -4740
- data/third_party/boringssl/include/openssl/ssl3.h +0 -332
- data/third_party/boringssl/include/openssl/stack.h +0 -485
- data/third_party/boringssl/include/openssl/thread.h +0 -191
- data/third_party/boringssl/include/openssl/tls1.h +0 -618
- data/third_party/boringssl/include/openssl/type_check.h +0 -91
- data/third_party/boringssl/include/openssl/x509.h +0 -1180
- data/third_party/boringssl/include/openssl/x509_vfy.h +0 -614
- data/third_party/boringssl/include/openssl/x509v3.h +0 -827
- data/third_party/boringssl/ssl/custom_extensions.cc +0 -265
- data/third_party/boringssl/ssl/d1_both.cc +0 -851
- data/third_party/boringssl/ssl/d1_lib.cc +0 -267
- data/third_party/boringssl/ssl/d1_pkt.cc +0 -274
- data/third_party/boringssl/ssl/d1_srtp.cc +0 -232
- data/third_party/boringssl/ssl/dtls_method.cc +0 -193
- data/third_party/boringssl/ssl/dtls_record.cc +0 -353
- data/third_party/boringssl/ssl/handoff.cc +0 -285
- data/third_party/boringssl/ssl/handshake.cc +0 -630
- data/third_party/boringssl/ssl/handshake_client.cc +0 -1842
- data/third_party/boringssl/ssl/handshake_server.cc +0 -1674
- data/third_party/boringssl/ssl/internal.h +0 -3064
- data/third_party/boringssl/ssl/s3_both.cc +0 -585
- data/third_party/boringssl/ssl/s3_lib.cc +0 -226
- data/third_party/boringssl/ssl/s3_pkt.cc +0 -425
- data/third_party/boringssl/ssl/ssl_aead_ctx.cc +0 -412
- data/third_party/boringssl/ssl/ssl_asn1.cc +0 -844
- data/third_party/boringssl/ssl/ssl_buffer.cc +0 -286
- data/third_party/boringssl/ssl/ssl_cert.cc +0 -913
- data/third_party/boringssl/ssl/ssl_cipher.cc +0 -1781
- data/third_party/boringssl/ssl/ssl_file.cc +0 -583
- data/third_party/boringssl/ssl/ssl_key_share.cc +0 -252
- data/third_party/boringssl/ssl/ssl_lib.cc +0 -2719
- data/third_party/boringssl/ssl/ssl_privkey.cc +0 -494
- data/third_party/boringssl/ssl/ssl_session.cc +0 -1221
- data/third_party/boringssl/ssl/ssl_stat.cc +0 -224
- data/third_party/boringssl/ssl/ssl_transcript.cc +0 -398
- data/third_party/boringssl/ssl/ssl_versions.cc +0 -399
- data/third_party/boringssl/ssl/ssl_x509.cc +0 -1297
- data/third_party/boringssl/ssl/t1_enc.cc +0 -452
- data/third_party/boringssl/ssl/t1_lib.cc +0 -3783
- data/third_party/boringssl/ssl/tls13_both.cc +0 -559
- data/third_party/boringssl/ssl/tls13_client.cc +0 -891
- data/third_party/boringssl/ssl/tls13_enc.cc +0 -493
- data/third_party/boringssl/ssl/tls13_server.cc +0 -1022
- data/third_party/boringssl/ssl/tls_method.cc +0 -274
- data/third_party/boringssl/ssl/tls_record.cc +0 -703
- data/third_party/boringssl/third_party/fiat/curve25519.c +0 -3230
- data/third_party/boringssl/third_party/fiat/curve25519_tables.h +0 -7880
- data/third_party/boringssl/third_party/fiat/internal.h +0 -154
- data/third_party/boringssl/third_party/fiat/p256.c +0 -1824
- data/third_party/nanopb/pb.h +0 -579
- data/third_party/nanopb/pb_common.c +0 -97
- data/third_party/nanopb/pb_common.h +0 -42
- data/third_party/nanopb/pb_decode.c +0 -1347
- data/third_party/nanopb/pb_decode.h +0 -149
- data/third_party/nanopb/pb_encode.c +0 -696
- data/third_party/nanopb/pb_encode.h +0 -154
@@ -1,452 +0,0 @@
|
|
1
|
-
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
2
|
-
* All rights reserved.
|
3
|
-
*
|
4
|
-
* This package is an SSL implementation written
|
5
|
-
* by Eric Young (eay@cryptsoft.com).
|
6
|
-
* The implementation was written so as to conform with Netscapes SSL.
|
7
|
-
*
|
8
|
-
* This library is free for commercial and non-commercial use as long as
|
9
|
-
* the following conditions are aheared to. The following conditions
|
10
|
-
* apply to all code found in this distribution, be it the RC4, RSA,
|
11
|
-
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
12
|
-
* included with this distribution is covered by the same copyright terms
|
13
|
-
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
14
|
-
*
|
15
|
-
* Copyright remains Eric Young's, and as such any Copyright notices in
|
16
|
-
* the code are not to be removed.
|
17
|
-
* If this package is used in a product, Eric Young should be given attribution
|
18
|
-
* as the author of the parts of the library used.
|
19
|
-
* This can be in the form of a textual message at program startup or
|
20
|
-
* in documentation (online or textual) provided with the package.
|
21
|
-
*
|
22
|
-
* Redistribution and use in source and binary forms, with or without
|
23
|
-
* modification, are permitted provided that the following conditions
|
24
|
-
* are met:
|
25
|
-
* 1. Redistributions of source code must retain the copyright
|
26
|
-
* notice, this list of conditions and the following disclaimer.
|
27
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
28
|
-
* notice, this list of conditions and the following disclaimer in the
|
29
|
-
* documentation and/or other materials provided with the distribution.
|
30
|
-
* 3. All advertising materials mentioning features or use of this software
|
31
|
-
* must display the following acknowledgement:
|
32
|
-
* "This product includes cryptographic software written by
|
33
|
-
* Eric Young (eay@cryptsoft.com)"
|
34
|
-
* The word 'cryptographic' can be left out if the rouines from the library
|
35
|
-
* being used are not cryptographic related :-).
|
36
|
-
* 4. If you include any Windows specific code (or a derivative thereof) from
|
37
|
-
* the apps directory (application code) you must include an acknowledgement:
|
38
|
-
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
39
|
-
*
|
40
|
-
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
41
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
43
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
44
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
45
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
46
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
48
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
49
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
50
|
-
* SUCH DAMAGE.
|
51
|
-
*
|
52
|
-
* The licence and distribution terms for any publically available version or
|
53
|
-
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
54
|
-
* copied and put under another distribution licence
|
55
|
-
* [including the GNU Public Licence.]
|
56
|
-
*/
|
57
|
-
/* ====================================================================
|
58
|
-
* Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
|
59
|
-
*
|
60
|
-
* Redistribution and use in source and binary forms, with or without
|
61
|
-
* modification, are permitted provided that the following conditions
|
62
|
-
* are met:
|
63
|
-
*
|
64
|
-
* 1. Redistributions of source code must retain the above copyright
|
65
|
-
* notice, this list of conditions and the following disclaimer.
|
66
|
-
*
|
67
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
68
|
-
* notice, this list of conditions and the following disclaimer in
|
69
|
-
* the documentation and/or other materials provided with the
|
70
|
-
* distribution.
|
71
|
-
*
|
72
|
-
* 3. All advertising materials mentioning features or use of this
|
73
|
-
* software must display the following acknowledgment:
|
74
|
-
* "This product includes software developed by the OpenSSL Project
|
75
|
-
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
76
|
-
*
|
77
|
-
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
78
|
-
* endorse or promote products derived from this software without
|
79
|
-
* prior written permission. For written permission, please contact
|
80
|
-
* openssl-core@openssl.org.
|
81
|
-
*
|
82
|
-
* 5. Products derived from this software may not be called "OpenSSL"
|
83
|
-
* nor may "OpenSSL" appear in their names without prior written
|
84
|
-
* permission of the OpenSSL Project.
|
85
|
-
*
|
86
|
-
* 6. Redistributions of any form whatsoever must retain the following
|
87
|
-
* acknowledgment:
|
88
|
-
* "This product includes software developed by the OpenSSL Project
|
89
|
-
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
90
|
-
*
|
91
|
-
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
92
|
-
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
93
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
94
|
-
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
95
|
-
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
96
|
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
97
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
98
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
99
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
100
|
-
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
101
|
-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
102
|
-
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
103
|
-
* ====================================================================
|
104
|
-
*
|
105
|
-
* This product includes cryptographic software written by Eric Young
|
106
|
-
* (eay@cryptsoft.com). This product includes software written by Tim
|
107
|
-
* Hudson (tjh@cryptsoft.com).
|
108
|
-
*
|
109
|
-
*/
|
110
|
-
/* ====================================================================
|
111
|
-
* Copyright 2005 Nokia. All rights reserved.
|
112
|
-
*
|
113
|
-
* The portions of the attached software ("Contribution") is developed by
|
114
|
-
* Nokia Corporation and is licensed pursuant to the OpenSSL open source
|
115
|
-
* license.
|
116
|
-
*
|
117
|
-
* The Contribution, originally written by Mika Kousa and Pasi Eronen of
|
118
|
-
* Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
|
119
|
-
* support (see RFC 4279) to OpenSSL.
|
120
|
-
*
|
121
|
-
* No patent licenses or other rights except those expressly stated in
|
122
|
-
* the OpenSSL open source license shall be deemed granted or received
|
123
|
-
* expressly, by implication, estoppel, or otherwise.
|
124
|
-
*
|
125
|
-
* No assurances are provided by Nokia that the Contribution does not
|
126
|
-
* infringe the patent or other intellectual property rights of any third
|
127
|
-
* party or that the license provides you with all the necessary rights
|
128
|
-
* to make use of the Contribution.
|
129
|
-
*
|
130
|
-
* THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
|
131
|
-
* ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
|
132
|
-
* SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
|
133
|
-
* OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
|
134
|
-
* OTHERWISE. */
|
135
|
-
|
136
|
-
#include <openssl/ssl.h>
|
137
|
-
|
138
|
-
#include <assert.h>
|
139
|
-
#include <string.h>
|
140
|
-
|
141
|
-
#include <utility>
|
142
|
-
|
143
|
-
#include <openssl/err.h>
|
144
|
-
#include <openssl/evp.h>
|
145
|
-
#include <openssl/hmac.h>
|
146
|
-
#include <openssl/md5.h>
|
147
|
-
#include <openssl/mem.h>
|
148
|
-
#include <openssl/nid.h>
|
149
|
-
#include <openssl/rand.h>
|
150
|
-
|
151
|
-
#include "../crypto/fipsmodule/tls/internal.h"
|
152
|
-
#include "../crypto/internal.h"
|
153
|
-
#include "internal.h"
|
154
|
-
|
155
|
-
|
156
|
-
namespace bssl {
|
157
|
-
|
158
|
-
bool tls1_prf(const EVP_MD *digest, Span<uint8_t> out,
|
159
|
-
Span<const uint8_t> secret, Span<const char> label,
|
160
|
-
Span<const uint8_t> seed1, Span<const uint8_t> seed2) {
|
161
|
-
return 1 == CRYPTO_tls1_prf(digest, out.data(), out.size(), secret.data(),
|
162
|
-
secret.size(), label.data(), label.size(),
|
163
|
-
seed1.data(), seed1.size(), seed2.data(),
|
164
|
-
seed2.size());
|
165
|
-
}
|
166
|
-
|
167
|
-
static bool ssl3_prf(Span<uint8_t> out, Span<const uint8_t> secret,
|
168
|
-
Span<const char> label, Span<const uint8_t> seed1,
|
169
|
-
Span<const uint8_t> seed2) {
|
170
|
-
ScopedEVP_MD_CTX md5;
|
171
|
-
ScopedEVP_MD_CTX sha1;
|
172
|
-
uint8_t buf[16], smd[SHA_DIGEST_LENGTH];
|
173
|
-
uint8_t c = 'A';
|
174
|
-
size_t k = 0;
|
175
|
-
while (!out.empty()) {
|
176
|
-
k++;
|
177
|
-
if (k > sizeof(buf)) {
|
178
|
-
// bug: 'buf' is too small for this ciphersuite
|
179
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
180
|
-
return false;
|
181
|
-
}
|
182
|
-
|
183
|
-
for (size_t j = 0; j < k; j++) {
|
184
|
-
buf[j] = c;
|
185
|
-
}
|
186
|
-
c++;
|
187
|
-
if (!EVP_DigestInit_ex(sha1.get(), EVP_sha1(), NULL)) {
|
188
|
-
OPENSSL_PUT_ERROR(SSL, ERR_LIB_EVP);
|
189
|
-
return false;
|
190
|
-
}
|
191
|
-
EVP_DigestUpdate(sha1.get(), buf, k);
|
192
|
-
EVP_DigestUpdate(sha1.get(), secret.data(), secret.size());
|
193
|
-
// |label| is ignored for SSLv3.
|
194
|
-
EVP_DigestUpdate(sha1.get(), seed1.data(), seed1.size());
|
195
|
-
EVP_DigestUpdate(sha1.get(), seed2.data(), seed2.size());
|
196
|
-
EVP_DigestFinal_ex(sha1.get(), smd, NULL);
|
197
|
-
|
198
|
-
if (!EVP_DigestInit_ex(md5.get(), EVP_md5(), NULL)) {
|
199
|
-
OPENSSL_PUT_ERROR(SSL, ERR_LIB_EVP);
|
200
|
-
return false;
|
201
|
-
}
|
202
|
-
EVP_DigestUpdate(md5.get(), secret.data(), secret.size());
|
203
|
-
EVP_DigestUpdate(md5.get(), smd, SHA_DIGEST_LENGTH);
|
204
|
-
if (out.size() < MD5_DIGEST_LENGTH) {
|
205
|
-
EVP_DigestFinal_ex(md5.get(), smd, NULL);
|
206
|
-
OPENSSL_memcpy(out.data(), smd, out.size());
|
207
|
-
break;
|
208
|
-
}
|
209
|
-
EVP_DigestFinal_ex(md5.get(), out.data(), NULL);
|
210
|
-
out = out.subspan(MD5_DIGEST_LENGTH);
|
211
|
-
}
|
212
|
-
|
213
|
-
OPENSSL_cleanse(smd, SHA_DIGEST_LENGTH);
|
214
|
-
return true;
|
215
|
-
}
|
216
|
-
|
217
|
-
static bool get_key_block_lengths(const SSL *ssl, size_t *out_mac_secret_len,
|
218
|
-
size_t *out_key_len, size_t *out_iv_len,
|
219
|
-
const SSL_CIPHER *cipher) {
|
220
|
-
const EVP_AEAD *aead = NULL;
|
221
|
-
if (!ssl_cipher_get_evp_aead(&aead, out_mac_secret_len, out_iv_len, cipher,
|
222
|
-
ssl_protocol_version(ssl), SSL_is_dtls(ssl))) {
|
223
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_CIPHER_OR_HASH_UNAVAILABLE);
|
224
|
-
return false;
|
225
|
-
}
|
226
|
-
|
227
|
-
*out_key_len = EVP_AEAD_key_length(aead);
|
228
|
-
if (*out_mac_secret_len > 0) {
|
229
|
-
// For "stateful" AEADs (i.e. compatibility with pre-AEAD cipher suites) the
|
230
|
-
// key length reported by |EVP_AEAD_key_length| will include the MAC key
|
231
|
-
// bytes and initial implicit IV.
|
232
|
-
if (*out_key_len < *out_mac_secret_len + *out_iv_len) {
|
233
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
234
|
-
return false;
|
235
|
-
}
|
236
|
-
*out_key_len -= *out_mac_secret_len + *out_iv_len;
|
237
|
-
}
|
238
|
-
|
239
|
-
return true;
|
240
|
-
}
|
241
|
-
|
242
|
-
int tls1_configure_aead(SSL *ssl, evp_aead_direction_t direction,
|
243
|
-
Array<uint8_t> *key_block_cache,
|
244
|
-
const SSL_CIPHER *cipher,
|
245
|
-
Span<const uint8_t> iv_override) {
|
246
|
-
size_t mac_secret_len, key_len, iv_len;
|
247
|
-
if (!get_key_block_lengths(ssl, &mac_secret_len, &key_len, &iv_len, cipher)) {
|
248
|
-
return 0;
|
249
|
-
}
|
250
|
-
|
251
|
-
// Ensure that |key_block_cache| is set up.
|
252
|
-
const size_t key_block_size = 2 * (mac_secret_len + key_len + iv_len);
|
253
|
-
if (key_block_cache->empty()) {
|
254
|
-
if (!key_block_cache->Init(key_block_size) ||
|
255
|
-
!SSL_generate_key_block(ssl, key_block_cache->data(), key_block_size)) {
|
256
|
-
return 0;
|
257
|
-
}
|
258
|
-
}
|
259
|
-
assert(key_block_cache->size() == key_block_size);
|
260
|
-
|
261
|
-
Span<const uint8_t> key_block = *key_block_cache;
|
262
|
-
Span<const uint8_t> mac_secret, key, iv;
|
263
|
-
if (direction == (ssl->server ? evp_aead_open : evp_aead_seal)) {
|
264
|
-
// Use the client write (server read) keys.
|
265
|
-
mac_secret = key_block.subspan(0, mac_secret_len);
|
266
|
-
key = key_block.subspan(2 * mac_secret_len, key_len);
|
267
|
-
iv = key_block.subspan(2 * mac_secret_len + 2 * key_len, iv_len);
|
268
|
-
} else {
|
269
|
-
// Use the server write (client read) keys.
|
270
|
-
mac_secret = key_block.subspan(mac_secret_len, mac_secret_len);
|
271
|
-
key = key_block.subspan(2 * mac_secret_len + key_len, key_len);
|
272
|
-
iv = key_block.subspan(2 * mac_secret_len + 2 * key_len + iv_len, iv_len);
|
273
|
-
}
|
274
|
-
|
275
|
-
if (!iv_override.empty()) {
|
276
|
-
if (iv_override.size() != iv_len) {
|
277
|
-
return 0;
|
278
|
-
}
|
279
|
-
iv = iv_override;
|
280
|
-
}
|
281
|
-
|
282
|
-
UniquePtr<SSLAEADContext> aead_ctx = SSLAEADContext::Create(
|
283
|
-
direction, ssl->version, SSL_is_dtls(ssl), cipher, key, mac_secret, iv);
|
284
|
-
if (!aead_ctx) {
|
285
|
-
return 0;
|
286
|
-
}
|
287
|
-
|
288
|
-
if (direction == evp_aead_open) {
|
289
|
-
return ssl->method->set_read_state(ssl, std::move(aead_ctx));
|
290
|
-
}
|
291
|
-
|
292
|
-
return ssl->method->set_write_state(ssl, std::move(aead_ctx));
|
293
|
-
}
|
294
|
-
|
295
|
-
int tls1_change_cipher_state(SSL_HANDSHAKE *hs,
|
296
|
-
evp_aead_direction_t direction) {
|
297
|
-
return tls1_configure_aead(hs->ssl, direction, &hs->key_block,
|
298
|
-
hs->new_cipher, {});
|
299
|
-
}
|
300
|
-
|
301
|
-
int tls1_generate_master_secret(SSL_HANDSHAKE *hs, uint8_t *out,
|
302
|
-
Span<const uint8_t> premaster) {
|
303
|
-
static const char kMasterSecretLabel[] = "master secret";
|
304
|
-
static const char kExtendedMasterSecretLabel[] = "extended master secret";
|
305
|
-
|
306
|
-
const SSL *ssl = hs->ssl;
|
307
|
-
auto out_span = MakeSpan(out, SSL3_MASTER_SECRET_SIZE);
|
308
|
-
if (hs->extended_master_secret) {
|
309
|
-
auto label = MakeConstSpan(kExtendedMasterSecretLabel,
|
310
|
-
sizeof(kExtendedMasterSecretLabel) - 1);
|
311
|
-
uint8_t digests[EVP_MAX_MD_SIZE];
|
312
|
-
size_t digests_len;
|
313
|
-
if (!hs->transcript.GetHash(digests, &digests_len) ||
|
314
|
-
!tls1_prf(hs->transcript.Digest(), out_span, premaster, label,
|
315
|
-
MakeConstSpan(digests, digests_len), {})) {
|
316
|
-
return 0;
|
317
|
-
}
|
318
|
-
} else {
|
319
|
-
auto label =
|
320
|
-
MakeConstSpan(kMasterSecretLabel, sizeof(kMasterSecretLabel) - 1);
|
321
|
-
if (ssl_protocol_version(ssl) == SSL3_VERSION) {
|
322
|
-
if (!ssl3_prf(out_span, premaster, label, ssl->s3->client_random,
|
323
|
-
ssl->s3->server_random)) {
|
324
|
-
return 0;
|
325
|
-
}
|
326
|
-
} else {
|
327
|
-
if (!tls1_prf(hs->transcript.Digest(), out_span, premaster, label,
|
328
|
-
ssl->s3->client_random, ssl->s3->server_random)) {
|
329
|
-
return 0;
|
330
|
-
}
|
331
|
-
}
|
332
|
-
}
|
333
|
-
|
334
|
-
return SSL3_MASTER_SECRET_SIZE;
|
335
|
-
}
|
336
|
-
|
337
|
-
} // namespace bssl
|
338
|
-
|
339
|
-
using namespace bssl;
|
340
|
-
|
341
|
-
size_t SSL_get_key_block_len(const SSL *ssl) {
|
342
|
-
size_t mac_secret_len, key_len, fixed_iv_len;
|
343
|
-
if (!get_key_block_lengths(ssl, &mac_secret_len, &key_len, &fixed_iv_len,
|
344
|
-
SSL_get_current_cipher(ssl))) {
|
345
|
-
ERR_clear_error();
|
346
|
-
return 0;
|
347
|
-
}
|
348
|
-
|
349
|
-
return 2 * (mac_secret_len + key_len + fixed_iv_len);
|
350
|
-
}
|
351
|
-
|
352
|
-
int SSL_generate_key_block(const SSL *ssl, uint8_t *out, size_t out_len) {
|
353
|
-
const SSL_SESSION *session = SSL_get_session(ssl);
|
354
|
-
auto out_span = MakeSpan(out, out_len);
|
355
|
-
auto master_key =
|
356
|
-
MakeConstSpan(session->master_key, session->master_key_length);
|
357
|
-
static const char kLabel[] = "key expansion";
|
358
|
-
auto label = MakeConstSpan(kLabel, sizeof(kLabel) - 1);
|
359
|
-
|
360
|
-
if (ssl_protocol_version(ssl) == SSL3_VERSION) {
|
361
|
-
return ssl3_prf(out_span, master_key, label, ssl->s3->server_random,
|
362
|
-
ssl->s3->client_random);
|
363
|
-
}
|
364
|
-
|
365
|
-
const EVP_MD *digest = ssl_session_get_digest(session);
|
366
|
-
return tls1_prf(digest, out_span, master_key, label, ssl->s3->server_random,
|
367
|
-
ssl->s3->client_random);
|
368
|
-
}
|
369
|
-
|
370
|
-
int SSL_export_keying_material(SSL *ssl, uint8_t *out, size_t out_len,
|
371
|
-
const char *label, size_t label_len,
|
372
|
-
const uint8_t *context, size_t context_len,
|
373
|
-
int use_context) {
|
374
|
-
if (!ssl->s3->have_version || ssl->version == SSL3_VERSION) {
|
375
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_HANDSHAKE_NOT_COMPLETE);
|
376
|
-
return 0;
|
377
|
-
}
|
378
|
-
|
379
|
-
// Exporters may be used in False Start and server 0-RTT, where the handshake
|
380
|
-
// has progressed enough. Otherwise, they may not be used during a handshake.
|
381
|
-
if (SSL_in_init(ssl) &&
|
382
|
-
!SSL_in_false_start(ssl) &&
|
383
|
-
!(SSL_is_server(ssl) && SSL_in_early_data(ssl))) {
|
384
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_HANDSHAKE_NOT_COMPLETE);
|
385
|
-
return 0;
|
386
|
-
}
|
387
|
-
|
388
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
389
|
-
if (!use_context) {
|
390
|
-
context = nullptr;
|
391
|
-
context_len = 0;
|
392
|
-
}
|
393
|
-
return tls13_export_keying_material(
|
394
|
-
ssl, MakeSpan(out, out_len),
|
395
|
-
MakeConstSpan(ssl->s3->exporter_secret, ssl->s3->exporter_secret_len),
|
396
|
-
MakeConstSpan(label, label_len), MakeConstSpan(context, context_len));
|
397
|
-
}
|
398
|
-
|
399
|
-
size_t seed_len = 2 * SSL3_RANDOM_SIZE;
|
400
|
-
if (use_context) {
|
401
|
-
if (context_len >= 1u << 16) {
|
402
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
|
403
|
-
return 0;
|
404
|
-
}
|
405
|
-
seed_len += 2 + context_len;
|
406
|
-
}
|
407
|
-
Array<uint8_t> seed;
|
408
|
-
if (!seed.Init(seed_len)) {
|
409
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
410
|
-
return 0;
|
411
|
-
}
|
412
|
-
|
413
|
-
OPENSSL_memcpy(seed.data(), ssl->s3->client_random, SSL3_RANDOM_SIZE);
|
414
|
-
OPENSSL_memcpy(seed.data() + SSL3_RANDOM_SIZE, ssl->s3->server_random,
|
415
|
-
SSL3_RANDOM_SIZE);
|
416
|
-
if (use_context) {
|
417
|
-
seed[2 * SSL3_RANDOM_SIZE] = static_cast<uint8_t>(context_len >> 8);
|
418
|
-
seed[2 * SSL3_RANDOM_SIZE + 1] = static_cast<uint8_t>(context_len);
|
419
|
-
OPENSSL_memcpy(seed.data() + 2 * SSL3_RANDOM_SIZE + 2, context, context_len);
|
420
|
-
}
|
421
|
-
|
422
|
-
const SSL_SESSION *session = SSL_get_session(ssl);
|
423
|
-
const EVP_MD *digest = ssl_session_get_digest(session);
|
424
|
-
return tls1_prf(
|
425
|
-
digest, MakeSpan(out, out_len),
|
426
|
-
MakeConstSpan(session->master_key, session->master_key_length),
|
427
|
-
MakeConstSpan(label, label_len), seed, {});
|
428
|
-
}
|
429
|
-
|
430
|
-
int SSL_export_early_keying_material(
|
431
|
-
SSL *ssl, uint8_t *out, size_t out_len, const char *label, size_t label_len,
|
432
|
-
const uint8_t *context, size_t context_len) {
|
433
|
-
if (!SSL_in_early_data(ssl) &&
|
434
|
-
(!ssl->s3->have_version ||
|
435
|
-
ssl_protocol_version(ssl) < TLS1_3_VERSION)) {
|
436
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_SSL_VERSION);
|
437
|
-
return 0;
|
438
|
-
}
|
439
|
-
|
440
|
-
// The early exporter only exists if we accepted early data or offered it as
|
441
|
-
// a client.
|
442
|
-
if (!SSL_in_early_data(ssl) && !SSL_early_data_accepted(ssl)) {
|
443
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_EARLY_DATA_NOT_IN_USE);
|
444
|
-
return 0;
|
445
|
-
}
|
446
|
-
|
447
|
-
return tls13_export_keying_material(
|
448
|
-
ssl, MakeSpan(out, out_len),
|
449
|
-
MakeConstSpan(ssl->s3->early_exporter_secret,
|
450
|
-
ssl->s3->early_exporter_secret_len),
|
451
|
-
MakeConstSpan(label, label_len), MakeConstSpan(context, context_len));
|
452
|
-
}
|
@@ -1,3783 +0,0 @@
|
|
1
|
-
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
2
|
-
* All rights reserved.
|
3
|
-
*
|
4
|
-
* This package is an SSL implementation written
|
5
|
-
* by Eric Young (eay@cryptsoft.com).
|
6
|
-
* The implementation was written so as to conform with Netscapes SSL.
|
7
|
-
*
|
8
|
-
* This library is free for commercial and non-commercial use as long as
|
9
|
-
* the following conditions are aheared to. The following conditions
|
10
|
-
* apply to all code found in this distribution, be it the RC4, RSA,
|
11
|
-
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
12
|
-
* included with this distribution is covered by the same copyright terms
|
13
|
-
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
14
|
-
*
|
15
|
-
* Copyright remains Eric Young's, and as such any Copyright notices in
|
16
|
-
* the code are not to be removed.
|
17
|
-
* If this package is used in a product, Eric Young should be given attribution
|
18
|
-
* as the author of the parts of the library used.
|
19
|
-
* This can be in the form of a textual message at program startup or
|
20
|
-
* in documentation (online or textual) provided with the package.
|
21
|
-
*
|
22
|
-
* Redistribution and use in source and binary forms, with or without
|
23
|
-
* modification, are permitted provided that the following conditions
|
24
|
-
* are met:
|
25
|
-
* 1. Redistributions of source code must retain the copyright
|
26
|
-
* notice, this list of conditions and the following disclaimer.
|
27
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
28
|
-
* notice, this list of conditions and the following disclaimer in the
|
29
|
-
* documentation and/or other materials provided with the distribution.
|
30
|
-
* 3. All advertising materials mentioning features or use of this software
|
31
|
-
* must display the following acknowledgement:
|
32
|
-
* "This product includes cryptographic software written by
|
33
|
-
* Eric Young (eay@cryptsoft.com)"
|
34
|
-
* The word 'cryptographic' can be left out if the rouines from the library
|
35
|
-
* being used are not cryptographic related :-).
|
36
|
-
* 4. If you include any Windows specific code (or a derivative thereof) from
|
37
|
-
* the apps directory (application code) you must include an acknowledgement:
|
38
|
-
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
39
|
-
*
|
40
|
-
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
41
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
43
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
44
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
45
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
46
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
48
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
49
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
50
|
-
* SUCH DAMAGE.
|
51
|
-
*
|
52
|
-
* The licence and distribution terms for any publically available version or
|
53
|
-
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
54
|
-
* copied and put under another distribution licence
|
55
|
-
* [including the GNU Public Licence.]
|
56
|
-
*/
|
57
|
-
/* ====================================================================
|
58
|
-
* Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
|
59
|
-
*
|
60
|
-
* Redistribution and use in source and binary forms, with or without
|
61
|
-
* modification, are permitted provided that the following conditions
|
62
|
-
* are met:
|
63
|
-
*
|
64
|
-
* 1. Redistributions of source code must retain the above copyright
|
65
|
-
* notice, this list of conditions and the following disclaimer.
|
66
|
-
*
|
67
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
68
|
-
* notice, this list of conditions and the following disclaimer in
|
69
|
-
* the documentation and/or other materials provided with the
|
70
|
-
* distribution.
|
71
|
-
*
|
72
|
-
* 3. All advertising materials mentioning features or use of this
|
73
|
-
* software must display the following acknowledgment:
|
74
|
-
* "This product includes software developed by the OpenSSL Project
|
75
|
-
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
76
|
-
*
|
77
|
-
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
78
|
-
* endorse or promote products derived from this software without
|
79
|
-
* prior written permission. For written permission, please contact
|
80
|
-
* openssl-core@openssl.org.
|
81
|
-
*
|
82
|
-
* 5. Products derived from this software may not be called "OpenSSL"
|
83
|
-
* nor may "OpenSSL" appear in their names without prior written
|
84
|
-
* permission of the OpenSSL Project.
|
85
|
-
*
|
86
|
-
* 6. Redistributions of any form whatsoever must retain the following
|
87
|
-
* acknowledgment:
|
88
|
-
* "This product includes software developed by the OpenSSL Project
|
89
|
-
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
90
|
-
*
|
91
|
-
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
92
|
-
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
93
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
94
|
-
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
95
|
-
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
96
|
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
97
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
98
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
99
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
100
|
-
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
101
|
-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
102
|
-
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
103
|
-
* ====================================================================
|
104
|
-
*
|
105
|
-
* This product includes cryptographic software written by Eric Young
|
106
|
-
* (eay@cryptsoft.com). This product includes software written by Tim
|
107
|
-
* Hudson (tjh@cryptsoft.com). */
|
108
|
-
|
109
|
-
#include <openssl/ssl.h>
|
110
|
-
|
111
|
-
#include <assert.h>
|
112
|
-
#include <limits.h>
|
113
|
-
#include <stdlib.h>
|
114
|
-
#include <string.h>
|
115
|
-
|
116
|
-
#include <utility>
|
117
|
-
|
118
|
-
#include <openssl/bytestring.h>
|
119
|
-
#include <openssl/chacha.h>
|
120
|
-
#include <openssl/digest.h>
|
121
|
-
#include <openssl/err.h>
|
122
|
-
#include <openssl/evp.h>
|
123
|
-
#include <openssl/hmac.h>
|
124
|
-
#include <openssl/mem.h>
|
125
|
-
#include <openssl/nid.h>
|
126
|
-
#include <openssl/rand.h>
|
127
|
-
|
128
|
-
#include "internal.h"
|
129
|
-
#include "../crypto/internal.h"
|
130
|
-
|
131
|
-
|
132
|
-
namespace bssl {
|
133
|
-
|
134
|
-
static int ssl_check_clienthello_tlsext(SSL_HANDSHAKE *hs);
|
135
|
-
|
136
|
-
static int compare_uint16_t(const void *p1, const void *p2) {
|
137
|
-
uint16_t u1 = *((const uint16_t *)p1);
|
138
|
-
uint16_t u2 = *((const uint16_t *)p2);
|
139
|
-
if (u1 < u2) {
|
140
|
-
return -1;
|
141
|
-
} else if (u1 > u2) {
|
142
|
-
return 1;
|
143
|
-
} else {
|
144
|
-
return 0;
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
// Per http://tools.ietf.org/html/rfc5246#section-7.4.1.4, there may not be
|
149
|
-
// more than one extension of the same type in a ClientHello or ServerHello.
|
150
|
-
// This function does an initial scan over the extensions block to filter those
|
151
|
-
// out.
|
152
|
-
static int tls1_check_duplicate_extensions(const CBS *cbs) {
|
153
|
-
// First pass: count the extensions.
|
154
|
-
size_t num_extensions = 0;
|
155
|
-
CBS extensions = *cbs;
|
156
|
-
while (CBS_len(&extensions) > 0) {
|
157
|
-
uint16_t type;
|
158
|
-
CBS extension;
|
159
|
-
|
160
|
-
if (!CBS_get_u16(&extensions, &type) ||
|
161
|
-
!CBS_get_u16_length_prefixed(&extensions, &extension)) {
|
162
|
-
return 0;
|
163
|
-
}
|
164
|
-
|
165
|
-
num_extensions++;
|
166
|
-
}
|
167
|
-
|
168
|
-
if (num_extensions == 0) {
|
169
|
-
return 1;
|
170
|
-
}
|
171
|
-
|
172
|
-
Array<uint16_t> extension_types;
|
173
|
-
if (!extension_types.Init(num_extensions)) {
|
174
|
-
return 0;
|
175
|
-
}
|
176
|
-
|
177
|
-
// Second pass: gather the extension types.
|
178
|
-
extensions = *cbs;
|
179
|
-
for (size_t i = 0; i < extension_types.size(); i++) {
|
180
|
-
CBS extension;
|
181
|
-
|
182
|
-
if (!CBS_get_u16(&extensions, &extension_types[i]) ||
|
183
|
-
!CBS_get_u16_length_prefixed(&extensions, &extension)) {
|
184
|
-
// This should not happen.
|
185
|
-
return 0;
|
186
|
-
}
|
187
|
-
}
|
188
|
-
assert(CBS_len(&extensions) == 0);
|
189
|
-
|
190
|
-
// Sort the extensions and make sure there are no duplicates.
|
191
|
-
qsort(extension_types.data(), extension_types.size(), sizeof(uint16_t),
|
192
|
-
compare_uint16_t);
|
193
|
-
for (size_t i = 1; i < num_extensions; i++) {
|
194
|
-
if (extension_types[i - 1] == extension_types[i]) {
|
195
|
-
return 0;
|
196
|
-
}
|
197
|
-
}
|
198
|
-
|
199
|
-
return 1;
|
200
|
-
}
|
201
|
-
|
202
|
-
int ssl_client_hello_init(SSL *ssl, SSL_CLIENT_HELLO *out,
|
203
|
-
const SSLMessage &msg) {
|
204
|
-
OPENSSL_memset(out, 0, sizeof(*out));
|
205
|
-
out->ssl = ssl;
|
206
|
-
out->client_hello = CBS_data(&msg.body);
|
207
|
-
out->client_hello_len = CBS_len(&msg.body);
|
208
|
-
|
209
|
-
CBS client_hello, random, session_id;
|
210
|
-
CBS_init(&client_hello, out->client_hello, out->client_hello_len);
|
211
|
-
if (!CBS_get_u16(&client_hello, &out->version) ||
|
212
|
-
!CBS_get_bytes(&client_hello, &random, SSL3_RANDOM_SIZE) ||
|
213
|
-
!CBS_get_u8_length_prefixed(&client_hello, &session_id) ||
|
214
|
-
CBS_len(&session_id) > SSL_MAX_SSL_SESSION_ID_LENGTH) {
|
215
|
-
return 0;
|
216
|
-
}
|
217
|
-
|
218
|
-
out->random = CBS_data(&random);
|
219
|
-
out->random_len = CBS_len(&random);
|
220
|
-
out->session_id = CBS_data(&session_id);
|
221
|
-
out->session_id_len = CBS_len(&session_id);
|
222
|
-
|
223
|
-
// Skip past DTLS cookie
|
224
|
-
if (SSL_is_dtls(out->ssl)) {
|
225
|
-
CBS cookie;
|
226
|
-
if (!CBS_get_u8_length_prefixed(&client_hello, &cookie) ||
|
227
|
-
CBS_len(&cookie) > DTLS1_COOKIE_LENGTH) {
|
228
|
-
return 0;
|
229
|
-
}
|
230
|
-
}
|
231
|
-
|
232
|
-
CBS cipher_suites, compression_methods;
|
233
|
-
if (!CBS_get_u16_length_prefixed(&client_hello, &cipher_suites) ||
|
234
|
-
CBS_len(&cipher_suites) < 2 || (CBS_len(&cipher_suites) & 1) != 0 ||
|
235
|
-
!CBS_get_u8_length_prefixed(&client_hello, &compression_methods) ||
|
236
|
-
CBS_len(&compression_methods) < 1) {
|
237
|
-
return 0;
|
238
|
-
}
|
239
|
-
|
240
|
-
out->cipher_suites = CBS_data(&cipher_suites);
|
241
|
-
out->cipher_suites_len = CBS_len(&cipher_suites);
|
242
|
-
out->compression_methods = CBS_data(&compression_methods);
|
243
|
-
out->compression_methods_len = CBS_len(&compression_methods);
|
244
|
-
|
245
|
-
// If the ClientHello ends here then it's valid, but doesn't have any
|
246
|
-
// extensions. (E.g. SSLv3.)
|
247
|
-
if (CBS_len(&client_hello) == 0) {
|
248
|
-
out->extensions = NULL;
|
249
|
-
out->extensions_len = 0;
|
250
|
-
return 1;
|
251
|
-
}
|
252
|
-
|
253
|
-
// Extract extensions and check it is valid.
|
254
|
-
CBS extensions;
|
255
|
-
if (!CBS_get_u16_length_prefixed(&client_hello, &extensions) ||
|
256
|
-
!tls1_check_duplicate_extensions(&extensions) ||
|
257
|
-
CBS_len(&client_hello) != 0) {
|
258
|
-
return 0;
|
259
|
-
}
|
260
|
-
|
261
|
-
out->extensions = CBS_data(&extensions);
|
262
|
-
out->extensions_len = CBS_len(&extensions);
|
263
|
-
|
264
|
-
return 1;
|
265
|
-
}
|
266
|
-
|
267
|
-
int ssl_client_hello_get_extension(const SSL_CLIENT_HELLO *client_hello,
|
268
|
-
CBS *out, uint16_t extension_type) {
|
269
|
-
CBS extensions;
|
270
|
-
CBS_init(&extensions, client_hello->extensions, client_hello->extensions_len);
|
271
|
-
while (CBS_len(&extensions) != 0) {
|
272
|
-
// Decode the next extension.
|
273
|
-
uint16_t type;
|
274
|
-
CBS extension;
|
275
|
-
if (!CBS_get_u16(&extensions, &type) ||
|
276
|
-
!CBS_get_u16_length_prefixed(&extensions, &extension)) {
|
277
|
-
return 0;
|
278
|
-
}
|
279
|
-
|
280
|
-
if (type == extension_type) {
|
281
|
-
*out = extension;
|
282
|
-
return 1;
|
283
|
-
}
|
284
|
-
}
|
285
|
-
|
286
|
-
return 0;
|
287
|
-
}
|
288
|
-
|
289
|
-
static const uint16_t kDefaultGroups[] = {
|
290
|
-
SSL_CURVE_X25519,
|
291
|
-
SSL_CURVE_SECP256R1,
|
292
|
-
SSL_CURVE_SECP384R1,
|
293
|
-
};
|
294
|
-
|
295
|
-
Span<const uint16_t> tls1_get_grouplist(const SSL *ssl) {
|
296
|
-
if (ssl->supported_group_list != nullptr) {
|
297
|
-
return MakeConstSpan(ssl->supported_group_list,
|
298
|
-
ssl->supported_group_list_len);
|
299
|
-
}
|
300
|
-
return Span<const uint16_t>(kDefaultGroups);
|
301
|
-
}
|
302
|
-
|
303
|
-
int tls1_get_shared_group(SSL_HANDSHAKE *hs, uint16_t *out_group_id) {
|
304
|
-
SSL *const ssl = hs->ssl;
|
305
|
-
assert(ssl->server);
|
306
|
-
|
307
|
-
// Clients are not required to send a supported_groups extension. In this
|
308
|
-
// case, the server is free to pick any group it likes. See RFC 4492,
|
309
|
-
// section 4, paragraph 3.
|
310
|
-
//
|
311
|
-
// However, in the interests of compatibility, we will skip ECDH if the
|
312
|
-
// client didn't send an extension because we can't be sure that they'll
|
313
|
-
// support our favoured group. Thus we do not special-case an emtpy
|
314
|
-
// |peer_supported_group_list|.
|
315
|
-
|
316
|
-
Span<const uint16_t> groups = tls1_get_grouplist(ssl);
|
317
|
-
Span<const uint16_t> pref, supp;
|
318
|
-
if (ssl->options & SSL_OP_CIPHER_SERVER_PREFERENCE) {
|
319
|
-
pref = groups;
|
320
|
-
supp = hs->peer_supported_group_list;
|
321
|
-
} else {
|
322
|
-
pref = hs->peer_supported_group_list;
|
323
|
-
supp = groups;
|
324
|
-
}
|
325
|
-
|
326
|
-
for (uint16_t pref_group : pref) {
|
327
|
-
for (uint16_t supp_group : supp) {
|
328
|
-
if (pref_group == supp_group) {
|
329
|
-
*out_group_id = pref_group;
|
330
|
-
return 1;
|
331
|
-
}
|
332
|
-
}
|
333
|
-
}
|
334
|
-
|
335
|
-
return 0;
|
336
|
-
}
|
337
|
-
|
338
|
-
int tls1_set_curves(uint16_t **out_group_ids, size_t *out_group_ids_len,
|
339
|
-
const int *curves, size_t ncurves) {
|
340
|
-
uint16_t *group_ids = (uint16_t *)OPENSSL_malloc(ncurves * sizeof(uint16_t));
|
341
|
-
if (group_ids == NULL) {
|
342
|
-
return 0;
|
343
|
-
}
|
344
|
-
|
345
|
-
for (size_t i = 0; i < ncurves; i++) {
|
346
|
-
if (!ssl_nid_to_group_id(&group_ids[i], curves[i])) {
|
347
|
-
OPENSSL_free(group_ids);
|
348
|
-
return 0;
|
349
|
-
}
|
350
|
-
}
|
351
|
-
|
352
|
-
OPENSSL_free(*out_group_ids);
|
353
|
-
*out_group_ids = group_ids;
|
354
|
-
*out_group_ids_len = ncurves;
|
355
|
-
|
356
|
-
return 1;
|
357
|
-
}
|
358
|
-
|
359
|
-
int tls1_set_curves_list(uint16_t **out_group_ids, size_t *out_group_ids_len,
|
360
|
-
const char *curves) {
|
361
|
-
uint16_t *group_ids = NULL;
|
362
|
-
size_t ncurves = 0;
|
363
|
-
|
364
|
-
const char *col;
|
365
|
-
const char *ptr = curves;
|
366
|
-
|
367
|
-
do {
|
368
|
-
col = strchr(ptr, ':');
|
369
|
-
|
370
|
-
uint16_t group_id;
|
371
|
-
if (!ssl_name_to_group_id(&group_id, ptr,
|
372
|
-
col ? (size_t)(col - ptr) : strlen(ptr))) {
|
373
|
-
goto err;
|
374
|
-
}
|
375
|
-
|
376
|
-
uint16_t *new_group_ids = (uint16_t *)OPENSSL_realloc(
|
377
|
-
group_ids, (ncurves + 1) * sizeof(uint16_t));
|
378
|
-
if (new_group_ids == NULL) {
|
379
|
-
goto err;
|
380
|
-
}
|
381
|
-
group_ids = new_group_ids;
|
382
|
-
|
383
|
-
group_ids[ncurves] = group_id;
|
384
|
-
ncurves++;
|
385
|
-
|
386
|
-
if (col) {
|
387
|
-
ptr = col + 1;
|
388
|
-
}
|
389
|
-
} while (col);
|
390
|
-
|
391
|
-
OPENSSL_free(*out_group_ids);
|
392
|
-
*out_group_ids = group_ids;
|
393
|
-
*out_group_ids_len = ncurves;
|
394
|
-
|
395
|
-
return 1;
|
396
|
-
|
397
|
-
err:
|
398
|
-
OPENSSL_free(group_ids);
|
399
|
-
return 0;
|
400
|
-
}
|
401
|
-
|
402
|
-
int tls1_check_group_id(const SSL *ssl, uint16_t group_id) {
|
403
|
-
for (uint16_t supported : tls1_get_grouplist(ssl)) {
|
404
|
-
if (supported == group_id) {
|
405
|
-
return 1;
|
406
|
-
}
|
407
|
-
}
|
408
|
-
|
409
|
-
return 0;
|
410
|
-
}
|
411
|
-
|
412
|
-
// kVerifySignatureAlgorithms is the default list of accepted signature
|
413
|
-
// algorithms for verifying.
|
414
|
-
//
|
415
|
-
// For now, RSA-PSS signature algorithms are not enabled on Android's system
|
416
|
-
// BoringSSL. Once the change in Chrome has stuck and the values are finalized,
|
417
|
-
// restore them.
|
418
|
-
static const uint16_t kVerifySignatureAlgorithms[] = {
|
419
|
-
// List our preferred algorithms first.
|
420
|
-
SSL_SIGN_ED25519,
|
421
|
-
SSL_SIGN_ECDSA_SECP256R1_SHA256,
|
422
|
-
SSL_SIGN_RSA_PSS_SHA256,
|
423
|
-
SSL_SIGN_RSA_PKCS1_SHA256,
|
424
|
-
|
425
|
-
// Larger hashes are acceptable.
|
426
|
-
SSL_SIGN_ECDSA_SECP384R1_SHA384,
|
427
|
-
SSL_SIGN_RSA_PSS_SHA384,
|
428
|
-
SSL_SIGN_RSA_PKCS1_SHA384,
|
429
|
-
|
430
|
-
SSL_SIGN_RSA_PSS_SHA512,
|
431
|
-
SSL_SIGN_RSA_PKCS1_SHA512,
|
432
|
-
|
433
|
-
// For now, SHA-1 is still accepted but least preferable.
|
434
|
-
SSL_SIGN_RSA_PKCS1_SHA1,
|
435
|
-
|
436
|
-
};
|
437
|
-
|
438
|
-
// kSignSignatureAlgorithms is the default list of supported signature
|
439
|
-
// algorithms for signing.
|
440
|
-
//
|
441
|
-
// For now, RSA-PSS signature algorithms are not enabled on Android's system
|
442
|
-
// BoringSSL. Once the change in Chrome has stuck and the values are finalized,
|
443
|
-
// restore them.
|
444
|
-
static const uint16_t kSignSignatureAlgorithms[] = {
|
445
|
-
// List our preferred algorithms first.
|
446
|
-
SSL_SIGN_ED25519,
|
447
|
-
SSL_SIGN_ECDSA_SECP256R1_SHA256,
|
448
|
-
SSL_SIGN_RSA_PSS_SHA256,
|
449
|
-
SSL_SIGN_RSA_PKCS1_SHA256,
|
450
|
-
|
451
|
-
// If needed, sign larger hashes.
|
452
|
-
//
|
453
|
-
// TODO(davidben): Determine which of these may be pruned.
|
454
|
-
SSL_SIGN_ECDSA_SECP384R1_SHA384,
|
455
|
-
SSL_SIGN_RSA_PSS_SHA384,
|
456
|
-
SSL_SIGN_RSA_PKCS1_SHA384,
|
457
|
-
|
458
|
-
SSL_SIGN_ECDSA_SECP521R1_SHA512,
|
459
|
-
SSL_SIGN_RSA_PSS_SHA512,
|
460
|
-
SSL_SIGN_RSA_PKCS1_SHA512,
|
461
|
-
|
462
|
-
// If the peer supports nothing else, sign with SHA-1.
|
463
|
-
SSL_SIGN_ECDSA_SHA1,
|
464
|
-
SSL_SIGN_RSA_PKCS1_SHA1,
|
465
|
-
};
|
466
|
-
|
467
|
-
bool tls12_add_verify_sigalgs(const SSL *ssl, CBB *out) {
|
468
|
-
bool use_default = ssl->ctx->num_verify_sigalgs == 0;
|
469
|
-
Span<const uint16_t> sigalgs = kVerifySignatureAlgorithms;
|
470
|
-
if (!use_default) {
|
471
|
-
sigalgs = MakeConstSpan(ssl->ctx->verify_sigalgs,
|
472
|
-
ssl->ctx->num_verify_sigalgs);
|
473
|
-
}
|
474
|
-
|
475
|
-
for (uint16_t sigalg : sigalgs) {
|
476
|
-
if (use_default &&
|
477
|
-
sigalg == SSL_SIGN_ED25519 &&
|
478
|
-
!ssl->ctx->ed25519_enabled) {
|
479
|
-
continue;
|
480
|
-
}
|
481
|
-
if (!CBB_add_u16(out, sigalg)) {
|
482
|
-
return false;
|
483
|
-
}
|
484
|
-
}
|
485
|
-
|
486
|
-
return true;
|
487
|
-
}
|
488
|
-
|
489
|
-
bool tls12_check_peer_sigalg(const SSL *ssl, uint8_t *out_alert,
|
490
|
-
uint16_t sigalg) {
|
491
|
-
const uint16_t *sigalgs = kVerifySignatureAlgorithms;
|
492
|
-
size_t num_sigalgs = OPENSSL_ARRAY_SIZE(kVerifySignatureAlgorithms);
|
493
|
-
if (ssl->ctx->num_verify_sigalgs != 0) {
|
494
|
-
sigalgs = ssl->ctx->verify_sigalgs;
|
495
|
-
num_sigalgs = ssl->ctx->num_verify_sigalgs;
|
496
|
-
}
|
497
|
-
|
498
|
-
for (size_t i = 0; i < num_sigalgs; i++) {
|
499
|
-
if (sigalgs == kVerifySignatureAlgorithms &&
|
500
|
-
sigalgs[i] == SSL_SIGN_ED25519 &&
|
501
|
-
!ssl->ctx->ed25519_enabled) {
|
502
|
-
continue;
|
503
|
-
}
|
504
|
-
if (sigalg == sigalgs[i]) {
|
505
|
-
return true;
|
506
|
-
}
|
507
|
-
}
|
508
|
-
|
509
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_SIGNATURE_TYPE);
|
510
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
511
|
-
return false;
|
512
|
-
}
|
513
|
-
|
514
|
-
// tls_extension represents a TLS extension that is handled internally. The
|
515
|
-
// |init| function is called for each handshake, before any other functions of
|
516
|
-
// the extension. Then the add and parse callbacks are called as needed.
|
517
|
-
//
|
518
|
-
// The parse callbacks receive a |CBS| that contains the contents of the
|
519
|
-
// extension (i.e. not including the type and length bytes). If an extension is
|
520
|
-
// not received then the parse callbacks will be called with a NULL CBS so that
|
521
|
-
// they can do any processing needed to handle the absence of an extension.
|
522
|
-
//
|
523
|
-
// The add callbacks receive a |CBB| to which the extension can be appended but
|
524
|
-
// the function is responsible for appending the type and length bytes too.
|
525
|
-
//
|
526
|
-
// All callbacks return true for success and false for error. If a parse
|
527
|
-
// function returns zero then a fatal alert with value |*out_alert| will be
|
528
|
-
// sent. If |*out_alert| isn't set, then a |decode_error| alert will be sent.
|
529
|
-
struct tls_extension {
|
530
|
-
uint16_t value;
|
531
|
-
void (*init)(SSL_HANDSHAKE *hs);
|
532
|
-
|
533
|
-
bool (*add_clienthello)(SSL_HANDSHAKE *hs, CBB *out);
|
534
|
-
bool (*parse_serverhello)(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
535
|
-
CBS *contents);
|
536
|
-
|
537
|
-
bool (*parse_clienthello)(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
538
|
-
CBS *contents);
|
539
|
-
bool (*add_serverhello)(SSL_HANDSHAKE *hs, CBB *out);
|
540
|
-
};
|
541
|
-
|
542
|
-
static bool forbid_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
543
|
-
CBS *contents) {
|
544
|
-
if (contents != NULL) {
|
545
|
-
// Servers MUST NOT send this extension.
|
546
|
-
*out_alert = SSL_AD_UNSUPPORTED_EXTENSION;
|
547
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_EXTENSION);
|
548
|
-
return false;
|
549
|
-
}
|
550
|
-
|
551
|
-
return true;
|
552
|
-
}
|
553
|
-
|
554
|
-
static bool ignore_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
555
|
-
CBS *contents) {
|
556
|
-
// This extension from the client is handled elsewhere.
|
557
|
-
return true;
|
558
|
-
}
|
559
|
-
|
560
|
-
static bool dont_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
561
|
-
return true;
|
562
|
-
}
|
563
|
-
|
564
|
-
// Server name indication (SNI).
|
565
|
-
//
|
566
|
-
// https://tools.ietf.org/html/rfc6066#section-3.
|
567
|
-
|
568
|
-
static bool ext_sni_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
569
|
-
SSL *const ssl = hs->ssl;
|
570
|
-
if (ssl->tlsext_hostname == NULL) {
|
571
|
-
return true;
|
572
|
-
}
|
573
|
-
|
574
|
-
CBB contents, server_name_list, name;
|
575
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_server_name) ||
|
576
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
577
|
-
!CBB_add_u16_length_prefixed(&contents, &server_name_list) ||
|
578
|
-
!CBB_add_u8(&server_name_list, TLSEXT_NAMETYPE_host_name) ||
|
579
|
-
!CBB_add_u16_length_prefixed(&server_name_list, &name) ||
|
580
|
-
!CBB_add_bytes(&name, (const uint8_t *)ssl->tlsext_hostname,
|
581
|
-
strlen(ssl->tlsext_hostname)) ||
|
582
|
-
!CBB_flush(out)) {
|
583
|
-
return false;
|
584
|
-
}
|
585
|
-
|
586
|
-
return true;
|
587
|
-
}
|
588
|
-
|
589
|
-
static bool ext_sni_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
590
|
-
CBS *contents) {
|
591
|
-
// The server may acknowledge SNI with an empty extension. We check the syntax
|
592
|
-
// but otherwise ignore this signal.
|
593
|
-
return contents == NULL || CBS_len(contents) == 0;
|
594
|
-
}
|
595
|
-
|
596
|
-
static bool ext_sni_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
597
|
-
CBS *contents) {
|
598
|
-
SSL *const ssl = hs->ssl;
|
599
|
-
if (contents == NULL) {
|
600
|
-
return true;
|
601
|
-
}
|
602
|
-
|
603
|
-
CBS server_name_list, host_name;
|
604
|
-
uint8_t name_type;
|
605
|
-
if (!CBS_get_u16_length_prefixed(contents, &server_name_list) ||
|
606
|
-
!CBS_get_u8(&server_name_list, &name_type) ||
|
607
|
-
// Although the server_name extension was intended to be extensible to
|
608
|
-
// new name types and multiple names, OpenSSL 1.0.x had a bug which meant
|
609
|
-
// different name types will cause an error. Further, RFC 4366 originally
|
610
|
-
// defined syntax inextensibly. RFC 6066 corrected this mistake, but
|
611
|
-
// adding new name types is no longer feasible.
|
612
|
-
//
|
613
|
-
// Act as if the extensibility does not exist to simplify parsing.
|
614
|
-
!CBS_get_u16_length_prefixed(&server_name_list, &host_name) ||
|
615
|
-
CBS_len(&server_name_list) != 0 ||
|
616
|
-
CBS_len(contents) != 0) {
|
617
|
-
return false;
|
618
|
-
}
|
619
|
-
|
620
|
-
if (name_type != TLSEXT_NAMETYPE_host_name ||
|
621
|
-
CBS_len(&host_name) == 0 ||
|
622
|
-
CBS_len(&host_name) > TLSEXT_MAXLEN_host_name ||
|
623
|
-
CBS_contains_zero_byte(&host_name)) {
|
624
|
-
*out_alert = SSL_AD_UNRECOGNIZED_NAME;
|
625
|
-
return false;
|
626
|
-
}
|
627
|
-
|
628
|
-
// Copy the hostname as a string.
|
629
|
-
char *raw = nullptr;
|
630
|
-
if (!CBS_strdup(&host_name, &raw)) {
|
631
|
-
*out_alert = SSL_AD_INTERNAL_ERROR;
|
632
|
-
return false;
|
633
|
-
}
|
634
|
-
ssl->s3->hostname.reset(raw);
|
635
|
-
|
636
|
-
hs->should_ack_sni = true;
|
637
|
-
return true;
|
638
|
-
}
|
639
|
-
|
640
|
-
static bool ext_sni_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
641
|
-
if (hs->ssl->s3->session_reused ||
|
642
|
-
!hs->should_ack_sni) {
|
643
|
-
return true;
|
644
|
-
}
|
645
|
-
|
646
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_server_name) ||
|
647
|
-
!CBB_add_u16(out, 0 /* length */)) {
|
648
|
-
return false;
|
649
|
-
}
|
650
|
-
|
651
|
-
return true;
|
652
|
-
}
|
653
|
-
|
654
|
-
|
655
|
-
// Renegotiation indication.
|
656
|
-
//
|
657
|
-
// https://tools.ietf.org/html/rfc5746
|
658
|
-
|
659
|
-
static bool ext_ri_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
660
|
-
SSL *const ssl = hs->ssl;
|
661
|
-
// Renegotiation indication is not necessary in TLS 1.3.
|
662
|
-
if (hs->min_version >= TLS1_3_VERSION) {
|
663
|
-
return true;
|
664
|
-
}
|
665
|
-
|
666
|
-
assert(ssl->s3->initial_handshake_complete ==
|
667
|
-
(ssl->s3->previous_client_finished_len != 0));
|
668
|
-
|
669
|
-
CBB contents, prev_finished;
|
670
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_renegotiate) ||
|
671
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
672
|
-
!CBB_add_u8_length_prefixed(&contents, &prev_finished) ||
|
673
|
-
!CBB_add_bytes(&prev_finished, ssl->s3->previous_client_finished,
|
674
|
-
ssl->s3->previous_client_finished_len) ||
|
675
|
-
!CBB_flush(out)) {
|
676
|
-
return false;
|
677
|
-
}
|
678
|
-
|
679
|
-
return true;
|
680
|
-
}
|
681
|
-
|
682
|
-
static bool ext_ri_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
683
|
-
CBS *contents) {
|
684
|
-
SSL *const ssl = hs->ssl;
|
685
|
-
if (contents != NULL && ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
686
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
687
|
-
return false;
|
688
|
-
}
|
689
|
-
|
690
|
-
// Servers may not switch between omitting the extension and supporting it.
|
691
|
-
// See RFC 5746, sections 3.5 and 4.2.
|
692
|
-
if (ssl->s3->initial_handshake_complete &&
|
693
|
-
(contents != NULL) != ssl->s3->send_connection_binding) {
|
694
|
-
*out_alert = SSL_AD_HANDSHAKE_FAILURE;
|
695
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_MISMATCH);
|
696
|
-
return false;
|
697
|
-
}
|
698
|
-
|
699
|
-
if (contents == NULL) {
|
700
|
-
// Strictly speaking, if we want to avoid an attack we should *always* see
|
701
|
-
// RI even on initial ServerHello because the client doesn't see any
|
702
|
-
// renegotiation during an attack. However this would mean we could not
|
703
|
-
// connect to any server which doesn't support RI.
|
704
|
-
//
|
705
|
-
// OpenSSL has |SSL_OP_LEGACY_SERVER_CONNECT| to control this, but in
|
706
|
-
// practical terms every client sets it so it's just assumed here.
|
707
|
-
return true;
|
708
|
-
}
|
709
|
-
|
710
|
-
const size_t expected_len = ssl->s3->previous_client_finished_len +
|
711
|
-
ssl->s3->previous_server_finished_len;
|
712
|
-
|
713
|
-
// Check for logic errors
|
714
|
-
assert(!expected_len || ssl->s3->previous_client_finished_len);
|
715
|
-
assert(!expected_len || ssl->s3->previous_server_finished_len);
|
716
|
-
assert(ssl->s3->initial_handshake_complete ==
|
717
|
-
(ssl->s3->previous_client_finished_len != 0));
|
718
|
-
assert(ssl->s3->initial_handshake_complete ==
|
719
|
-
(ssl->s3->previous_server_finished_len != 0));
|
720
|
-
|
721
|
-
// Parse out the extension contents.
|
722
|
-
CBS renegotiated_connection;
|
723
|
-
if (!CBS_get_u8_length_prefixed(contents, &renegotiated_connection) ||
|
724
|
-
CBS_len(contents) != 0) {
|
725
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_ENCODING_ERR);
|
726
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
727
|
-
return false;
|
728
|
-
}
|
729
|
-
|
730
|
-
// Check that the extension matches.
|
731
|
-
if (CBS_len(&renegotiated_connection) != expected_len) {
|
732
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_MISMATCH);
|
733
|
-
*out_alert = SSL_AD_HANDSHAKE_FAILURE;
|
734
|
-
return false;
|
735
|
-
}
|
736
|
-
|
737
|
-
const uint8_t *d = CBS_data(&renegotiated_connection);
|
738
|
-
bool ok = CRYPTO_memcmp(d, ssl->s3->previous_client_finished,
|
739
|
-
ssl->s3->previous_client_finished_len) == 0;
|
740
|
-
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
741
|
-
ok = true;
|
742
|
-
#endif
|
743
|
-
if (!ok) {
|
744
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_MISMATCH);
|
745
|
-
*out_alert = SSL_AD_HANDSHAKE_FAILURE;
|
746
|
-
return false;
|
747
|
-
}
|
748
|
-
d += ssl->s3->previous_client_finished_len;
|
749
|
-
|
750
|
-
ok = CRYPTO_memcmp(d, ssl->s3->previous_server_finished,
|
751
|
-
ssl->s3->previous_server_finished_len) == 0;
|
752
|
-
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
753
|
-
ok = true;
|
754
|
-
#endif
|
755
|
-
if (!ok) {
|
756
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_MISMATCH);
|
757
|
-
*out_alert = SSL_AD_HANDSHAKE_FAILURE;
|
758
|
-
return false;
|
759
|
-
}
|
760
|
-
ssl->s3->send_connection_binding = true;
|
761
|
-
|
762
|
-
return true;
|
763
|
-
}
|
764
|
-
|
765
|
-
static bool ext_ri_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
766
|
-
CBS *contents) {
|
767
|
-
SSL *const ssl = hs->ssl;
|
768
|
-
// Renegotiation isn't supported as a server so this function should never be
|
769
|
-
// called after the initial handshake.
|
770
|
-
assert(!ssl->s3->initial_handshake_complete);
|
771
|
-
|
772
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
773
|
-
return true;
|
774
|
-
}
|
775
|
-
|
776
|
-
if (contents == NULL) {
|
777
|
-
return true;
|
778
|
-
}
|
779
|
-
|
780
|
-
CBS renegotiated_connection;
|
781
|
-
if (!CBS_get_u8_length_prefixed(contents, &renegotiated_connection) ||
|
782
|
-
CBS_len(contents) != 0) {
|
783
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_ENCODING_ERR);
|
784
|
-
return false;
|
785
|
-
}
|
786
|
-
|
787
|
-
// Check that the extension matches. We do not support renegotiation as a
|
788
|
-
// server, so this must be empty.
|
789
|
-
if (CBS_len(&renegotiated_connection) != 0) {
|
790
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_MISMATCH);
|
791
|
-
*out_alert = SSL_AD_HANDSHAKE_FAILURE;
|
792
|
-
return false;
|
793
|
-
}
|
794
|
-
|
795
|
-
ssl->s3->send_connection_binding = true;
|
796
|
-
|
797
|
-
return true;
|
798
|
-
}
|
799
|
-
|
800
|
-
static bool ext_ri_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
801
|
-
SSL *const ssl = hs->ssl;
|
802
|
-
// Renegotiation isn't supported as a server so this function should never be
|
803
|
-
// called after the initial handshake.
|
804
|
-
assert(!ssl->s3->initial_handshake_complete);
|
805
|
-
|
806
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
807
|
-
return true;
|
808
|
-
}
|
809
|
-
|
810
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_renegotiate) ||
|
811
|
-
!CBB_add_u16(out, 1 /* length */) ||
|
812
|
-
!CBB_add_u8(out, 0 /* empty renegotiation info */)) {
|
813
|
-
return false;
|
814
|
-
}
|
815
|
-
|
816
|
-
return true;
|
817
|
-
}
|
818
|
-
|
819
|
-
|
820
|
-
// Extended Master Secret.
|
821
|
-
//
|
822
|
-
// https://tools.ietf.org/html/rfc7627
|
823
|
-
|
824
|
-
static bool ext_ems_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
825
|
-
// Extended master secret is not necessary in TLS 1.3.
|
826
|
-
if (hs->min_version >= TLS1_3_VERSION || hs->max_version <= SSL3_VERSION) {
|
827
|
-
return true;
|
828
|
-
}
|
829
|
-
|
830
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_extended_master_secret) ||
|
831
|
-
!CBB_add_u16(out, 0 /* length */)) {
|
832
|
-
return false;
|
833
|
-
}
|
834
|
-
|
835
|
-
return true;
|
836
|
-
}
|
837
|
-
|
838
|
-
static bool ext_ems_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
839
|
-
CBS *contents) {
|
840
|
-
SSL *const ssl = hs->ssl;
|
841
|
-
|
842
|
-
if (contents != NULL) {
|
843
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION ||
|
844
|
-
ssl->version == SSL3_VERSION ||
|
845
|
-
CBS_len(contents) != 0) {
|
846
|
-
return false;
|
847
|
-
}
|
848
|
-
|
849
|
-
hs->extended_master_secret = true;
|
850
|
-
}
|
851
|
-
|
852
|
-
// Whether EMS is negotiated may not change on renegotiation.
|
853
|
-
if (ssl->s3->established_session != nullptr &&
|
854
|
-
hs->extended_master_secret !=
|
855
|
-
!!ssl->s3->established_session->extended_master_secret) {
|
856
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_EMS_MISMATCH);
|
857
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
858
|
-
return false;
|
859
|
-
}
|
860
|
-
|
861
|
-
return true;
|
862
|
-
}
|
863
|
-
|
864
|
-
static bool ext_ems_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
865
|
-
CBS *contents) {
|
866
|
-
uint16_t version = ssl_protocol_version(hs->ssl);
|
867
|
-
if (version >= TLS1_3_VERSION ||
|
868
|
-
version == SSL3_VERSION) {
|
869
|
-
return true;
|
870
|
-
}
|
871
|
-
|
872
|
-
if (contents == NULL) {
|
873
|
-
return true;
|
874
|
-
}
|
875
|
-
|
876
|
-
if (CBS_len(contents) != 0) {
|
877
|
-
return false;
|
878
|
-
}
|
879
|
-
|
880
|
-
hs->extended_master_secret = true;
|
881
|
-
return true;
|
882
|
-
}
|
883
|
-
|
884
|
-
static bool ext_ems_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
885
|
-
if (!hs->extended_master_secret) {
|
886
|
-
return true;
|
887
|
-
}
|
888
|
-
|
889
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_extended_master_secret) ||
|
890
|
-
!CBB_add_u16(out, 0 /* length */)) {
|
891
|
-
return false;
|
892
|
-
}
|
893
|
-
|
894
|
-
return true;
|
895
|
-
}
|
896
|
-
|
897
|
-
|
898
|
-
// Session tickets.
|
899
|
-
//
|
900
|
-
// https://tools.ietf.org/html/rfc5077
|
901
|
-
|
902
|
-
static bool ext_ticket_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
903
|
-
SSL *const ssl = hs->ssl;
|
904
|
-
// TLS 1.3 uses a different ticket extension.
|
905
|
-
if (hs->min_version >= TLS1_3_VERSION ||
|
906
|
-
SSL_get_options(ssl) & SSL_OP_NO_TICKET) {
|
907
|
-
return true;
|
908
|
-
}
|
909
|
-
|
910
|
-
const uint8_t *ticket_data = NULL;
|
911
|
-
int ticket_len = 0;
|
912
|
-
|
913
|
-
// Renegotiation does not participate in session resumption. However, still
|
914
|
-
// advertise the extension to avoid potentially breaking servers which carry
|
915
|
-
// over the state from the previous handshake, such as OpenSSL servers
|
916
|
-
// without upstream's 3c3f0259238594d77264a78944d409f2127642c4.
|
917
|
-
if (!ssl->s3->initial_handshake_complete &&
|
918
|
-
ssl->session != NULL &&
|
919
|
-
ssl->session->tlsext_tick != NULL &&
|
920
|
-
// Don't send TLS 1.3 session tickets in the ticket extension.
|
921
|
-
ssl_session_protocol_version(ssl->session) < TLS1_3_VERSION) {
|
922
|
-
ticket_data = ssl->session->tlsext_tick;
|
923
|
-
ticket_len = ssl->session->tlsext_ticklen;
|
924
|
-
}
|
925
|
-
|
926
|
-
CBB ticket;
|
927
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_session_ticket) ||
|
928
|
-
!CBB_add_u16_length_prefixed(out, &ticket) ||
|
929
|
-
!CBB_add_bytes(&ticket, ticket_data, ticket_len) ||
|
930
|
-
!CBB_flush(out)) {
|
931
|
-
return false;
|
932
|
-
}
|
933
|
-
|
934
|
-
return true;
|
935
|
-
}
|
936
|
-
|
937
|
-
static bool ext_ticket_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
938
|
-
CBS *contents) {
|
939
|
-
SSL *const ssl = hs->ssl;
|
940
|
-
if (contents == NULL) {
|
941
|
-
return true;
|
942
|
-
}
|
943
|
-
|
944
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
945
|
-
return false;
|
946
|
-
}
|
947
|
-
|
948
|
-
// If |SSL_OP_NO_TICKET| is set then no extension will have been sent and
|
949
|
-
// this function should never be called, even if the server tries to send the
|
950
|
-
// extension.
|
951
|
-
assert((SSL_get_options(ssl) & SSL_OP_NO_TICKET) == 0);
|
952
|
-
|
953
|
-
if (CBS_len(contents) != 0) {
|
954
|
-
return false;
|
955
|
-
}
|
956
|
-
|
957
|
-
hs->ticket_expected = true;
|
958
|
-
return true;
|
959
|
-
}
|
960
|
-
|
961
|
-
static bool ext_ticket_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
962
|
-
if (!hs->ticket_expected) {
|
963
|
-
return true;
|
964
|
-
}
|
965
|
-
|
966
|
-
// If |SSL_OP_NO_TICKET| is set, |ticket_expected| should never be true.
|
967
|
-
assert((SSL_get_options(hs->ssl) & SSL_OP_NO_TICKET) == 0);
|
968
|
-
|
969
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_session_ticket) ||
|
970
|
-
!CBB_add_u16(out, 0 /* length */)) {
|
971
|
-
return false;
|
972
|
-
}
|
973
|
-
|
974
|
-
return true;
|
975
|
-
}
|
976
|
-
|
977
|
-
|
978
|
-
// Signature Algorithms.
|
979
|
-
//
|
980
|
-
// https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1
|
981
|
-
|
982
|
-
static bool ext_sigalgs_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
983
|
-
SSL *const ssl = hs->ssl;
|
984
|
-
if (hs->max_version < TLS1_2_VERSION) {
|
985
|
-
return true;
|
986
|
-
}
|
987
|
-
|
988
|
-
CBB contents, sigalgs_cbb;
|
989
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_signature_algorithms) ||
|
990
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
991
|
-
!CBB_add_u16_length_prefixed(&contents, &sigalgs_cbb) ||
|
992
|
-
!tls12_add_verify_sigalgs(ssl, &sigalgs_cbb) ||
|
993
|
-
!CBB_flush(out)) {
|
994
|
-
return false;
|
995
|
-
}
|
996
|
-
|
997
|
-
return true;
|
998
|
-
}
|
999
|
-
|
1000
|
-
static bool ext_sigalgs_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1001
|
-
CBS *contents) {
|
1002
|
-
hs->peer_sigalgs.Reset();
|
1003
|
-
if (contents == NULL) {
|
1004
|
-
return true;
|
1005
|
-
}
|
1006
|
-
|
1007
|
-
CBS supported_signature_algorithms;
|
1008
|
-
if (!CBS_get_u16_length_prefixed(contents, &supported_signature_algorithms) ||
|
1009
|
-
CBS_len(contents) != 0 ||
|
1010
|
-
CBS_len(&supported_signature_algorithms) == 0 ||
|
1011
|
-
!tls1_parse_peer_sigalgs(hs, &supported_signature_algorithms)) {
|
1012
|
-
return false;
|
1013
|
-
}
|
1014
|
-
|
1015
|
-
return true;
|
1016
|
-
}
|
1017
|
-
|
1018
|
-
|
1019
|
-
// OCSP Stapling.
|
1020
|
-
//
|
1021
|
-
// https://tools.ietf.org/html/rfc6066#section-8
|
1022
|
-
|
1023
|
-
static bool ext_ocsp_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1024
|
-
SSL *const ssl = hs->ssl;
|
1025
|
-
if (!ssl->ocsp_stapling_enabled) {
|
1026
|
-
return true;
|
1027
|
-
}
|
1028
|
-
|
1029
|
-
CBB contents;
|
1030
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_status_request) ||
|
1031
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1032
|
-
!CBB_add_u8(&contents, TLSEXT_STATUSTYPE_ocsp) ||
|
1033
|
-
!CBB_add_u16(&contents, 0 /* empty responder ID list */) ||
|
1034
|
-
!CBB_add_u16(&contents, 0 /* empty request extensions */) ||
|
1035
|
-
!CBB_flush(out)) {
|
1036
|
-
return false;
|
1037
|
-
}
|
1038
|
-
|
1039
|
-
return true;
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
static bool ext_ocsp_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1043
|
-
CBS *contents) {
|
1044
|
-
SSL *const ssl = hs->ssl;
|
1045
|
-
if (contents == NULL) {
|
1046
|
-
return true;
|
1047
|
-
}
|
1048
|
-
|
1049
|
-
// TLS 1.3 OCSP responses are included in the Certificate extensions.
|
1050
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1051
|
-
return false;
|
1052
|
-
}
|
1053
|
-
|
1054
|
-
// OCSP stapling is forbidden on non-certificate ciphers.
|
1055
|
-
if (CBS_len(contents) != 0 ||
|
1056
|
-
!ssl_cipher_uses_certificate_auth(hs->new_cipher)) {
|
1057
|
-
return false;
|
1058
|
-
}
|
1059
|
-
|
1060
|
-
// Note this does not check for resumption in TLS 1.2. Sending
|
1061
|
-
// status_request here does not make sense, but OpenSSL does so and the
|
1062
|
-
// specification does not say anything. Tolerate it but ignore it.
|
1063
|
-
|
1064
|
-
hs->certificate_status_expected = true;
|
1065
|
-
return true;
|
1066
|
-
}
|
1067
|
-
|
1068
|
-
static bool ext_ocsp_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1069
|
-
CBS *contents) {
|
1070
|
-
if (contents == NULL) {
|
1071
|
-
return true;
|
1072
|
-
}
|
1073
|
-
|
1074
|
-
uint8_t status_type;
|
1075
|
-
if (!CBS_get_u8(contents, &status_type)) {
|
1076
|
-
return false;
|
1077
|
-
}
|
1078
|
-
|
1079
|
-
// We cannot decide whether OCSP stapling will occur yet because the correct
|
1080
|
-
// SSL_CTX might not have been selected.
|
1081
|
-
hs->ocsp_stapling_requested = status_type == TLSEXT_STATUSTYPE_ocsp;
|
1082
|
-
|
1083
|
-
return true;
|
1084
|
-
}
|
1085
|
-
|
1086
|
-
static bool ext_ocsp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
1087
|
-
SSL *const ssl = hs->ssl;
|
1088
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION ||
|
1089
|
-
!hs->ocsp_stapling_requested ||
|
1090
|
-
ssl->cert->ocsp_response == NULL ||
|
1091
|
-
ssl->s3->session_reused ||
|
1092
|
-
!ssl_cipher_uses_certificate_auth(hs->new_cipher)) {
|
1093
|
-
return true;
|
1094
|
-
}
|
1095
|
-
|
1096
|
-
hs->certificate_status_expected = true;
|
1097
|
-
|
1098
|
-
return CBB_add_u16(out, TLSEXT_TYPE_status_request) &&
|
1099
|
-
CBB_add_u16(out, 0 /* length */);
|
1100
|
-
}
|
1101
|
-
|
1102
|
-
|
1103
|
-
// Next protocol negotiation.
|
1104
|
-
//
|
1105
|
-
// https://htmlpreview.github.io/?https://github.com/agl/technotes/blob/master/nextprotoneg.html
|
1106
|
-
|
1107
|
-
static bool ext_npn_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1108
|
-
SSL *const ssl = hs->ssl;
|
1109
|
-
if (ssl->s3->initial_handshake_complete ||
|
1110
|
-
ssl->ctx->next_proto_select_cb == NULL ||
|
1111
|
-
SSL_is_dtls(ssl)) {
|
1112
|
-
return true;
|
1113
|
-
}
|
1114
|
-
|
1115
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_next_proto_neg) ||
|
1116
|
-
!CBB_add_u16(out, 0 /* length */)) {
|
1117
|
-
return false;
|
1118
|
-
}
|
1119
|
-
|
1120
|
-
return true;
|
1121
|
-
}
|
1122
|
-
|
1123
|
-
static bool ext_npn_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1124
|
-
CBS *contents) {
|
1125
|
-
SSL *const ssl = hs->ssl;
|
1126
|
-
if (contents == NULL) {
|
1127
|
-
return true;
|
1128
|
-
}
|
1129
|
-
|
1130
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1131
|
-
return false;
|
1132
|
-
}
|
1133
|
-
|
1134
|
-
// If any of these are false then we should never have sent the NPN
|
1135
|
-
// extension in the ClientHello and thus this function should never have been
|
1136
|
-
// called.
|
1137
|
-
assert(!ssl->s3->initial_handshake_complete);
|
1138
|
-
assert(!SSL_is_dtls(ssl));
|
1139
|
-
assert(ssl->ctx->next_proto_select_cb != NULL);
|
1140
|
-
|
1141
|
-
if (!ssl->s3->alpn_selected.empty()) {
|
1142
|
-
// NPN and ALPN may not be negotiated in the same connection.
|
1143
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
1144
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NEGOTIATED_BOTH_NPN_AND_ALPN);
|
1145
|
-
return false;
|
1146
|
-
}
|
1147
|
-
|
1148
|
-
const uint8_t *const orig_contents = CBS_data(contents);
|
1149
|
-
const size_t orig_len = CBS_len(contents);
|
1150
|
-
|
1151
|
-
while (CBS_len(contents) != 0) {
|
1152
|
-
CBS proto;
|
1153
|
-
if (!CBS_get_u8_length_prefixed(contents, &proto) ||
|
1154
|
-
CBS_len(&proto) == 0) {
|
1155
|
-
return false;
|
1156
|
-
}
|
1157
|
-
}
|
1158
|
-
|
1159
|
-
uint8_t *selected;
|
1160
|
-
uint8_t selected_len;
|
1161
|
-
if (ssl->ctx->next_proto_select_cb(
|
1162
|
-
ssl, &selected, &selected_len, orig_contents, orig_len,
|
1163
|
-
ssl->ctx->next_proto_select_cb_arg) != SSL_TLSEXT_ERR_OK ||
|
1164
|
-
!ssl->s3->next_proto_negotiated.CopyFrom(
|
1165
|
-
MakeConstSpan(selected, selected_len))) {
|
1166
|
-
*out_alert = SSL_AD_INTERNAL_ERROR;
|
1167
|
-
return false;
|
1168
|
-
}
|
1169
|
-
|
1170
|
-
hs->next_proto_neg_seen = true;
|
1171
|
-
return true;
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
static bool ext_npn_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1175
|
-
CBS *contents) {
|
1176
|
-
SSL *const ssl = hs->ssl;
|
1177
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1178
|
-
return true;
|
1179
|
-
}
|
1180
|
-
|
1181
|
-
if (contents != NULL && CBS_len(contents) != 0) {
|
1182
|
-
return false;
|
1183
|
-
}
|
1184
|
-
|
1185
|
-
if (contents == NULL ||
|
1186
|
-
ssl->s3->initial_handshake_complete ||
|
1187
|
-
ssl->ctx->next_protos_advertised_cb == NULL ||
|
1188
|
-
SSL_is_dtls(ssl)) {
|
1189
|
-
return true;
|
1190
|
-
}
|
1191
|
-
|
1192
|
-
hs->next_proto_neg_seen = true;
|
1193
|
-
return true;
|
1194
|
-
}
|
1195
|
-
|
1196
|
-
static bool ext_npn_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
1197
|
-
SSL *const ssl = hs->ssl;
|
1198
|
-
// |next_proto_neg_seen| might have been cleared when an ALPN extension was
|
1199
|
-
// parsed.
|
1200
|
-
if (!hs->next_proto_neg_seen) {
|
1201
|
-
return true;
|
1202
|
-
}
|
1203
|
-
|
1204
|
-
const uint8_t *npa;
|
1205
|
-
unsigned npa_len;
|
1206
|
-
|
1207
|
-
if (ssl->ctx->next_protos_advertised_cb(
|
1208
|
-
ssl, &npa, &npa_len, ssl->ctx->next_protos_advertised_cb_arg) !=
|
1209
|
-
SSL_TLSEXT_ERR_OK) {
|
1210
|
-
hs->next_proto_neg_seen = false;
|
1211
|
-
return true;
|
1212
|
-
}
|
1213
|
-
|
1214
|
-
CBB contents;
|
1215
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_next_proto_neg) ||
|
1216
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1217
|
-
!CBB_add_bytes(&contents, npa, npa_len) ||
|
1218
|
-
!CBB_flush(out)) {
|
1219
|
-
return false;
|
1220
|
-
}
|
1221
|
-
|
1222
|
-
return true;
|
1223
|
-
}
|
1224
|
-
|
1225
|
-
|
1226
|
-
// Signed certificate timestamps.
|
1227
|
-
//
|
1228
|
-
// https://tools.ietf.org/html/rfc6962#section-3.3.1
|
1229
|
-
|
1230
|
-
static bool ext_sct_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1231
|
-
SSL *const ssl = hs->ssl;
|
1232
|
-
if (!ssl->signed_cert_timestamps_enabled) {
|
1233
|
-
return true;
|
1234
|
-
}
|
1235
|
-
|
1236
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_certificate_timestamp) ||
|
1237
|
-
!CBB_add_u16(out, 0 /* length */)) {
|
1238
|
-
return false;
|
1239
|
-
}
|
1240
|
-
|
1241
|
-
return true;
|
1242
|
-
}
|
1243
|
-
|
1244
|
-
static bool ext_sct_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1245
|
-
CBS *contents) {
|
1246
|
-
SSL *const ssl = hs->ssl;
|
1247
|
-
if (contents == NULL) {
|
1248
|
-
return true;
|
1249
|
-
}
|
1250
|
-
|
1251
|
-
// TLS 1.3 SCTs are included in the Certificate extensions.
|
1252
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1253
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1254
|
-
return false;
|
1255
|
-
}
|
1256
|
-
|
1257
|
-
// If this is false then we should never have sent the SCT extension in the
|
1258
|
-
// ClientHello and thus this function should never have been called.
|
1259
|
-
assert(ssl->signed_cert_timestamps_enabled);
|
1260
|
-
|
1261
|
-
if (!ssl_is_sct_list_valid(contents)) {
|
1262
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1263
|
-
return false;
|
1264
|
-
}
|
1265
|
-
|
1266
|
-
// Session resumption uses the original session information. The extension
|
1267
|
-
// should not be sent on resumption, but RFC 6962 did not make it a
|
1268
|
-
// requirement, so tolerate this.
|
1269
|
-
//
|
1270
|
-
// TODO(davidben): Enforce this anyway.
|
1271
|
-
if (!ssl->s3->session_reused) {
|
1272
|
-
CRYPTO_BUFFER_free(hs->new_session->signed_cert_timestamp_list);
|
1273
|
-
hs->new_session->signed_cert_timestamp_list =
|
1274
|
-
CRYPTO_BUFFER_new_from_CBS(contents, ssl->ctx->pool);
|
1275
|
-
if (hs->new_session->signed_cert_timestamp_list == nullptr) {
|
1276
|
-
*out_alert = SSL_AD_INTERNAL_ERROR;
|
1277
|
-
return false;
|
1278
|
-
}
|
1279
|
-
}
|
1280
|
-
|
1281
|
-
return true;
|
1282
|
-
}
|
1283
|
-
|
1284
|
-
static bool ext_sct_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1285
|
-
CBS *contents) {
|
1286
|
-
if (contents == NULL) {
|
1287
|
-
return true;
|
1288
|
-
}
|
1289
|
-
|
1290
|
-
if (CBS_len(contents) != 0) {
|
1291
|
-
return false;
|
1292
|
-
}
|
1293
|
-
|
1294
|
-
hs->scts_requested = true;
|
1295
|
-
return true;
|
1296
|
-
}
|
1297
|
-
|
1298
|
-
static bool ext_sct_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
1299
|
-
SSL *const ssl = hs->ssl;
|
1300
|
-
// The extension shouldn't be sent when resuming sessions.
|
1301
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION ||
|
1302
|
-
ssl->s3->session_reused ||
|
1303
|
-
ssl->cert->signed_cert_timestamp_list == NULL) {
|
1304
|
-
return true;
|
1305
|
-
}
|
1306
|
-
|
1307
|
-
CBB contents;
|
1308
|
-
return CBB_add_u16(out, TLSEXT_TYPE_certificate_timestamp) &&
|
1309
|
-
CBB_add_u16_length_prefixed(out, &contents) &&
|
1310
|
-
CBB_add_bytes(
|
1311
|
-
&contents,
|
1312
|
-
CRYPTO_BUFFER_data(ssl->cert->signed_cert_timestamp_list),
|
1313
|
-
CRYPTO_BUFFER_len(ssl->cert->signed_cert_timestamp_list)) &&
|
1314
|
-
CBB_flush(out);
|
1315
|
-
}
|
1316
|
-
|
1317
|
-
|
1318
|
-
// Application-level Protocol Negotiation.
|
1319
|
-
//
|
1320
|
-
// https://tools.ietf.org/html/rfc7301
|
1321
|
-
|
1322
|
-
static bool ext_alpn_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1323
|
-
SSL *const ssl = hs->ssl;
|
1324
|
-
if (ssl->alpn_client_proto_list == NULL ||
|
1325
|
-
ssl->s3->initial_handshake_complete) {
|
1326
|
-
return true;
|
1327
|
-
}
|
1328
|
-
|
1329
|
-
CBB contents, proto_list;
|
1330
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_application_layer_protocol_negotiation) ||
|
1331
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1332
|
-
!CBB_add_u16_length_prefixed(&contents, &proto_list) ||
|
1333
|
-
!CBB_add_bytes(&proto_list, ssl->alpn_client_proto_list,
|
1334
|
-
ssl->alpn_client_proto_list_len) ||
|
1335
|
-
!CBB_flush(out)) {
|
1336
|
-
return false;
|
1337
|
-
}
|
1338
|
-
|
1339
|
-
return true;
|
1340
|
-
}
|
1341
|
-
|
1342
|
-
static bool ext_alpn_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1343
|
-
CBS *contents) {
|
1344
|
-
SSL *const ssl = hs->ssl;
|
1345
|
-
if (contents == NULL) {
|
1346
|
-
return true;
|
1347
|
-
}
|
1348
|
-
|
1349
|
-
assert(!ssl->s3->initial_handshake_complete);
|
1350
|
-
assert(ssl->alpn_client_proto_list != NULL);
|
1351
|
-
|
1352
|
-
if (hs->next_proto_neg_seen) {
|
1353
|
-
// NPN and ALPN may not be negotiated in the same connection.
|
1354
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
1355
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NEGOTIATED_BOTH_NPN_AND_ALPN);
|
1356
|
-
return false;
|
1357
|
-
}
|
1358
|
-
|
1359
|
-
// The extension data consists of a ProtocolNameList which must have
|
1360
|
-
// exactly one ProtocolName. Each of these is length-prefixed.
|
1361
|
-
CBS protocol_name_list, protocol_name;
|
1362
|
-
if (!CBS_get_u16_length_prefixed(contents, &protocol_name_list) ||
|
1363
|
-
CBS_len(contents) != 0 ||
|
1364
|
-
!CBS_get_u8_length_prefixed(&protocol_name_list, &protocol_name) ||
|
1365
|
-
// Empty protocol names are forbidden.
|
1366
|
-
CBS_len(&protocol_name) == 0 ||
|
1367
|
-
CBS_len(&protocol_name_list) != 0) {
|
1368
|
-
return false;
|
1369
|
-
}
|
1370
|
-
|
1371
|
-
if (!ssl_is_alpn_protocol_allowed(ssl, protocol_name)) {
|
1372
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_ALPN_PROTOCOL);
|
1373
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
1374
|
-
return false;
|
1375
|
-
}
|
1376
|
-
|
1377
|
-
if (!ssl->s3->alpn_selected.CopyFrom(protocol_name)) {
|
1378
|
-
*out_alert = SSL_AD_INTERNAL_ERROR;
|
1379
|
-
return false;
|
1380
|
-
}
|
1381
|
-
|
1382
|
-
return true;
|
1383
|
-
}
|
1384
|
-
|
1385
|
-
bool ssl_is_alpn_protocol_allowed(const SSL *ssl,
|
1386
|
-
Span<const uint8_t> protocol) {
|
1387
|
-
if (ssl->alpn_client_proto_list == nullptr) {
|
1388
|
-
return false;
|
1389
|
-
}
|
1390
|
-
|
1391
|
-
if (ssl->ctx->allow_unknown_alpn_protos) {
|
1392
|
-
return true;
|
1393
|
-
}
|
1394
|
-
|
1395
|
-
// Check that the protocol name is one of the ones we advertised.
|
1396
|
-
CBS client_protocol_name_list, client_protocol_name;
|
1397
|
-
CBS_init(&client_protocol_name_list, ssl->alpn_client_proto_list,
|
1398
|
-
ssl->alpn_client_proto_list_len);
|
1399
|
-
while (CBS_len(&client_protocol_name_list) > 0) {
|
1400
|
-
if (!CBS_get_u8_length_prefixed(&client_protocol_name_list,
|
1401
|
-
&client_protocol_name)) {
|
1402
|
-
return false;
|
1403
|
-
}
|
1404
|
-
|
1405
|
-
if (client_protocol_name == protocol) {
|
1406
|
-
return true;
|
1407
|
-
}
|
1408
|
-
}
|
1409
|
-
|
1410
|
-
return false;
|
1411
|
-
}
|
1412
|
-
|
1413
|
-
bool ssl_negotiate_alpn(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1414
|
-
const SSL_CLIENT_HELLO *client_hello) {
|
1415
|
-
SSL *const ssl = hs->ssl;
|
1416
|
-
CBS contents;
|
1417
|
-
if (ssl->ctx->alpn_select_cb == NULL ||
|
1418
|
-
!ssl_client_hello_get_extension(
|
1419
|
-
client_hello, &contents,
|
1420
|
-
TLSEXT_TYPE_application_layer_protocol_negotiation)) {
|
1421
|
-
// Ignore ALPN if not configured or no extension was supplied.
|
1422
|
-
return true;
|
1423
|
-
}
|
1424
|
-
|
1425
|
-
// ALPN takes precedence over NPN.
|
1426
|
-
hs->next_proto_neg_seen = false;
|
1427
|
-
|
1428
|
-
CBS protocol_name_list;
|
1429
|
-
if (!CBS_get_u16_length_prefixed(&contents, &protocol_name_list) ||
|
1430
|
-
CBS_len(&contents) != 0 ||
|
1431
|
-
CBS_len(&protocol_name_list) < 2) {
|
1432
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_PARSE_TLSEXT);
|
1433
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1434
|
-
return false;
|
1435
|
-
}
|
1436
|
-
|
1437
|
-
// Validate the protocol list.
|
1438
|
-
CBS protocol_name_list_copy = protocol_name_list;
|
1439
|
-
while (CBS_len(&protocol_name_list_copy) > 0) {
|
1440
|
-
CBS protocol_name;
|
1441
|
-
|
1442
|
-
if (!CBS_get_u8_length_prefixed(&protocol_name_list_copy, &protocol_name) ||
|
1443
|
-
// Empty protocol names are forbidden.
|
1444
|
-
CBS_len(&protocol_name) == 0) {
|
1445
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_PARSE_TLSEXT);
|
1446
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1447
|
-
return false;
|
1448
|
-
}
|
1449
|
-
}
|
1450
|
-
|
1451
|
-
const uint8_t *selected;
|
1452
|
-
uint8_t selected_len;
|
1453
|
-
if (ssl->ctx->alpn_select_cb(
|
1454
|
-
ssl, &selected, &selected_len, CBS_data(&protocol_name_list),
|
1455
|
-
CBS_len(&protocol_name_list),
|
1456
|
-
ssl->ctx->alpn_select_cb_arg) == SSL_TLSEXT_ERR_OK) {
|
1457
|
-
if (!ssl->s3->alpn_selected.CopyFrom(
|
1458
|
-
MakeConstSpan(selected, selected_len))) {
|
1459
|
-
*out_alert = SSL_AD_INTERNAL_ERROR;
|
1460
|
-
return false;
|
1461
|
-
}
|
1462
|
-
}
|
1463
|
-
|
1464
|
-
return true;
|
1465
|
-
}
|
1466
|
-
|
1467
|
-
static bool ext_alpn_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
1468
|
-
SSL *const ssl = hs->ssl;
|
1469
|
-
if (ssl->s3->alpn_selected.empty()) {
|
1470
|
-
return true;
|
1471
|
-
}
|
1472
|
-
|
1473
|
-
CBB contents, proto_list, proto;
|
1474
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_application_layer_protocol_negotiation) ||
|
1475
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1476
|
-
!CBB_add_u16_length_prefixed(&contents, &proto_list) ||
|
1477
|
-
!CBB_add_u8_length_prefixed(&proto_list, &proto) ||
|
1478
|
-
!CBB_add_bytes(&proto, ssl->s3->alpn_selected.data(),
|
1479
|
-
ssl->s3->alpn_selected.size()) ||
|
1480
|
-
!CBB_flush(out)) {
|
1481
|
-
return false;
|
1482
|
-
}
|
1483
|
-
|
1484
|
-
return true;
|
1485
|
-
}
|
1486
|
-
|
1487
|
-
|
1488
|
-
// Channel ID.
|
1489
|
-
//
|
1490
|
-
// https://tools.ietf.org/html/draft-balfanz-tls-channelid-01
|
1491
|
-
|
1492
|
-
static void ext_channel_id_init(SSL_HANDSHAKE *hs) {
|
1493
|
-
hs->ssl->s3->tlsext_channel_id_valid = false;
|
1494
|
-
}
|
1495
|
-
|
1496
|
-
static bool ext_channel_id_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1497
|
-
SSL *const ssl = hs->ssl;
|
1498
|
-
if (!ssl->tlsext_channel_id_enabled ||
|
1499
|
-
SSL_is_dtls(ssl)) {
|
1500
|
-
return true;
|
1501
|
-
}
|
1502
|
-
|
1503
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_channel_id) ||
|
1504
|
-
!CBB_add_u16(out, 0 /* length */)) {
|
1505
|
-
return false;
|
1506
|
-
}
|
1507
|
-
|
1508
|
-
return true;
|
1509
|
-
}
|
1510
|
-
|
1511
|
-
static bool ext_channel_id_parse_serverhello(SSL_HANDSHAKE *hs,
|
1512
|
-
uint8_t *out_alert,
|
1513
|
-
CBS *contents) {
|
1514
|
-
SSL *const ssl = hs->ssl;
|
1515
|
-
if (contents == NULL) {
|
1516
|
-
return true;
|
1517
|
-
}
|
1518
|
-
|
1519
|
-
assert(!SSL_is_dtls(ssl));
|
1520
|
-
assert(ssl->tlsext_channel_id_enabled);
|
1521
|
-
|
1522
|
-
if (CBS_len(contents) != 0) {
|
1523
|
-
return false;
|
1524
|
-
}
|
1525
|
-
|
1526
|
-
ssl->s3->tlsext_channel_id_valid = true;
|
1527
|
-
return true;
|
1528
|
-
}
|
1529
|
-
|
1530
|
-
static bool ext_channel_id_parse_clienthello(SSL_HANDSHAKE *hs,
|
1531
|
-
uint8_t *out_alert,
|
1532
|
-
CBS *contents) {
|
1533
|
-
SSL *const ssl = hs->ssl;
|
1534
|
-
if (contents == NULL ||
|
1535
|
-
!ssl->tlsext_channel_id_enabled ||
|
1536
|
-
SSL_is_dtls(ssl)) {
|
1537
|
-
return true;
|
1538
|
-
}
|
1539
|
-
|
1540
|
-
if (CBS_len(contents) != 0) {
|
1541
|
-
return false;
|
1542
|
-
}
|
1543
|
-
|
1544
|
-
ssl->s3->tlsext_channel_id_valid = true;
|
1545
|
-
return true;
|
1546
|
-
}
|
1547
|
-
|
1548
|
-
static bool ext_channel_id_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
1549
|
-
SSL *const ssl = hs->ssl;
|
1550
|
-
if (!ssl->s3->tlsext_channel_id_valid) {
|
1551
|
-
return true;
|
1552
|
-
}
|
1553
|
-
|
1554
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_channel_id) ||
|
1555
|
-
!CBB_add_u16(out, 0 /* length */)) {
|
1556
|
-
return false;
|
1557
|
-
}
|
1558
|
-
|
1559
|
-
return true;
|
1560
|
-
}
|
1561
|
-
|
1562
|
-
|
1563
|
-
// Secure Real-time Transport Protocol (SRTP) extension.
|
1564
|
-
//
|
1565
|
-
// https://tools.ietf.org/html/rfc5764
|
1566
|
-
|
1567
|
-
|
1568
|
-
static void ext_srtp_init(SSL_HANDSHAKE *hs) {
|
1569
|
-
hs->ssl->srtp_profile = NULL;
|
1570
|
-
}
|
1571
|
-
|
1572
|
-
static bool ext_srtp_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1573
|
-
SSL *const ssl = hs->ssl;
|
1574
|
-
STACK_OF(SRTP_PROTECTION_PROFILE) *profiles = SSL_get_srtp_profiles(ssl);
|
1575
|
-
if (profiles == NULL ||
|
1576
|
-
sk_SRTP_PROTECTION_PROFILE_num(profiles) == 0) {
|
1577
|
-
return true;
|
1578
|
-
}
|
1579
|
-
|
1580
|
-
CBB contents, profile_ids;
|
1581
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_srtp) ||
|
1582
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1583
|
-
!CBB_add_u16_length_prefixed(&contents, &profile_ids)) {
|
1584
|
-
return false;
|
1585
|
-
}
|
1586
|
-
|
1587
|
-
for (const SRTP_PROTECTION_PROFILE *profile : profiles) {
|
1588
|
-
if (!CBB_add_u16(&profile_ids, profile->id)) {
|
1589
|
-
return false;
|
1590
|
-
}
|
1591
|
-
}
|
1592
|
-
|
1593
|
-
if (!CBB_add_u8(&contents, 0 /* empty use_mki value */) ||
|
1594
|
-
!CBB_flush(out)) {
|
1595
|
-
return false;
|
1596
|
-
}
|
1597
|
-
|
1598
|
-
return true;
|
1599
|
-
}
|
1600
|
-
|
1601
|
-
static bool ext_srtp_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1602
|
-
CBS *contents) {
|
1603
|
-
SSL *const ssl = hs->ssl;
|
1604
|
-
if (contents == NULL) {
|
1605
|
-
return true;
|
1606
|
-
}
|
1607
|
-
|
1608
|
-
// The extension consists of a u16-prefixed profile ID list containing a
|
1609
|
-
// single uint16_t profile ID, then followed by a u8-prefixed srtp_mki field.
|
1610
|
-
//
|
1611
|
-
// See https://tools.ietf.org/html/rfc5764#section-4.1.1
|
1612
|
-
CBS profile_ids, srtp_mki;
|
1613
|
-
uint16_t profile_id;
|
1614
|
-
if (!CBS_get_u16_length_prefixed(contents, &profile_ids) ||
|
1615
|
-
!CBS_get_u16(&profile_ids, &profile_id) ||
|
1616
|
-
CBS_len(&profile_ids) != 0 ||
|
1617
|
-
!CBS_get_u8_length_prefixed(contents, &srtp_mki) ||
|
1618
|
-
CBS_len(contents) != 0) {
|
1619
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
|
1620
|
-
return false;
|
1621
|
-
}
|
1622
|
-
|
1623
|
-
if (CBS_len(&srtp_mki) != 0) {
|
1624
|
-
// Must be no MKI, since we never offer one.
|
1625
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_SRTP_MKI_VALUE);
|
1626
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
1627
|
-
return false;
|
1628
|
-
}
|
1629
|
-
|
1630
|
-
STACK_OF(SRTP_PROTECTION_PROFILE) *profiles = SSL_get_srtp_profiles(ssl);
|
1631
|
-
|
1632
|
-
// Check to see if the server gave us something we support (and presumably
|
1633
|
-
// offered).
|
1634
|
-
for (const SRTP_PROTECTION_PROFILE *profile : profiles) {
|
1635
|
-
if (profile->id == profile_id) {
|
1636
|
-
ssl->srtp_profile = profile;
|
1637
|
-
return true;
|
1638
|
-
}
|
1639
|
-
}
|
1640
|
-
|
1641
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
|
1642
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
1643
|
-
return false;
|
1644
|
-
}
|
1645
|
-
|
1646
|
-
static bool ext_srtp_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1647
|
-
CBS *contents) {
|
1648
|
-
SSL *const ssl = hs->ssl;
|
1649
|
-
if (contents == NULL) {
|
1650
|
-
return true;
|
1651
|
-
}
|
1652
|
-
|
1653
|
-
CBS profile_ids, srtp_mki;
|
1654
|
-
if (!CBS_get_u16_length_prefixed(contents, &profile_ids) ||
|
1655
|
-
CBS_len(&profile_ids) < 2 ||
|
1656
|
-
!CBS_get_u8_length_prefixed(contents, &srtp_mki) ||
|
1657
|
-
CBS_len(contents) != 0) {
|
1658
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
|
1659
|
-
return false;
|
1660
|
-
}
|
1661
|
-
// Discard the MKI value for now.
|
1662
|
-
|
1663
|
-
const STACK_OF(SRTP_PROTECTION_PROFILE) *server_profiles =
|
1664
|
-
SSL_get_srtp_profiles(ssl);
|
1665
|
-
|
1666
|
-
// Pick the server's most preferred profile.
|
1667
|
-
for (const SRTP_PROTECTION_PROFILE *server_profile : server_profiles) {
|
1668
|
-
CBS profile_ids_tmp;
|
1669
|
-
CBS_init(&profile_ids_tmp, CBS_data(&profile_ids), CBS_len(&profile_ids));
|
1670
|
-
|
1671
|
-
while (CBS_len(&profile_ids_tmp) > 0) {
|
1672
|
-
uint16_t profile_id;
|
1673
|
-
if (!CBS_get_u16(&profile_ids_tmp, &profile_id)) {
|
1674
|
-
return false;
|
1675
|
-
}
|
1676
|
-
|
1677
|
-
if (server_profile->id == profile_id) {
|
1678
|
-
ssl->srtp_profile = server_profile;
|
1679
|
-
return true;
|
1680
|
-
}
|
1681
|
-
}
|
1682
|
-
}
|
1683
|
-
|
1684
|
-
return true;
|
1685
|
-
}
|
1686
|
-
|
1687
|
-
static bool ext_srtp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
1688
|
-
SSL *const ssl = hs->ssl;
|
1689
|
-
if (ssl->srtp_profile == NULL) {
|
1690
|
-
return true;
|
1691
|
-
}
|
1692
|
-
|
1693
|
-
CBB contents, profile_ids;
|
1694
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_srtp) ||
|
1695
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1696
|
-
!CBB_add_u16_length_prefixed(&contents, &profile_ids) ||
|
1697
|
-
!CBB_add_u16(&profile_ids, ssl->srtp_profile->id) ||
|
1698
|
-
!CBB_add_u8(&contents, 0 /* empty MKI */) ||
|
1699
|
-
!CBB_flush(out)) {
|
1700
|
-
return false;
|
1701
|
-
}
|
1702
|
-
|
1703
|
-
return true;
|
1704
|
-
}
|
1705
|
-
|
1706
|
-
|
1707
|
-
// EC point formats.
|
1708
|
-
//
|
1709
|
-
// https://tools.ietf.org/html/rfc4492#section-5.1.2
|
1710
|
-
|
1711
|
-
static bool ext_ec_point_add_extension(SSL_HANDSHAKE *hs, CBB *out) {
|
1712
|
-
CBB contents, formats;
|
1713
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_ec_point_formats) ||
|
1714
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1715
|
-
!CBB_add_u8_length_prefixed(&contents, &formats) ||
|
1716
|
-
!CBB_add_u8(&formats, TLSEXT_ECPOINTFORMAT_uncompressed) ||
|
1717
|
-
!CBB_flush(out)) {
|
1718
|
-
return false;
|
1719
|
-
}
|
1720
|
-
|
1721
|
-
return true;
|
1722
|
-
}
|
1723
|
-
|
1724
|
-
static bool ext_ec_point_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1725
|
-
// The point format extension is unneccessary in TLS 1.3.
|
1726
|
-
if (hs->min_version >= TLS1_3_VERSION) {
|
1727
|
-
return true;
|
1728
|
-
}
|
1729
|
-
|
1730
|
-
return ext_ec_point_add_extension(hs, out);
|
1731
|
-
}
|
1732
|
-
|
1733
|
-
static bool ext_ec_point_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1734
|
-
CBS *contents) {
|
1735
|
-
if (contents == NULL) {
|
1736
|
-
return true;
|
1737
|
-
}
|
1738
|
-
|
1739
|
-
if (ssl_protocol_version(hs->ssl) >= TLS1_3_VERSION) {
|
1740
|
-
return false;
|
1741
|
-
}
|
1742
|
-
|
1743
|
-
CBS ec_point_format_list;
|
1744
|
-
if (!CBS_get_u8_length_prefixed(contents, &ec_point_format_list) ||
|
1745
|
-
CBS_len(contents) != 0) {
|
1746
|
-
return false;
|
1747
|
-
}
|
1748
|
-
|
1749
|
-
// Per RFC 4492, section 5.1.2, implementations MUST support the uncompressed
|
1750
|
-
// point format.
|
1751
|
-
if (OPENSSL_memchr(CBS_data(&ec_point_format_list),
|
1752
|
-
TLSEXT_ECPOINTFORMAT_uncompressed,
|
1753
|
-
CBS_len(&ec_point_format_list)) == NULL) {
|
1754
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
1755
|
-
return false;
|
1756
|
-
}
|
1757
|
-
|
1758
|
-
return true;
|
1759
|
-
}
|
1760
|
-
|
1761
|
-
static bool ext_ec_point_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
|
1762
|
-
CBS *contents) {
|
1763
|
-
if (ssl_protocol_version(hs->ssl) >= TLS1_3_VERSION) {
|
1764
|
-
return true;
|
1765
|
-
}
|
1766
|
-
|
1767
|
-
return ext_ec_point_parse_serverhello(hs, out_alert, contents);
|
1768
|
-
}
|
1769
|
-
|
1770
|
-
static bool ext_ec_point_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
1771
|
-
SSL *const ssl = hs->ssl;
|
1772
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
1773
|
-
return true;
|
1774
|
-
}
|
1775
|
-
|
1776
|
-
const uint32_t alg_k = hs->new_cipher->algorithm_mkey;
|
1777
|
-
const uint32_t alg_a = hs->new_cipher->algorithm_auth;
|
1778
|
-
const bool using_ecc = (alg_k & SSL_kECDHE) || (alg_a & SSL_aECDSA);
|
1779
|
-
|
1780
|
-
if (!using_ecc) {
|
1781
|
-
return true;
|
1782
|
-
}
|
1783
|
-
|
1784
|
-
return ext_ec_point_add_extension(hs, out);
|
1785
|
-
}
|
1786
|
-
|
1787
|
-
|
1788
|
-
// Pre Shared Key
|
1789
|
-
//
|
1790
|
-
// https://tools.ietf.org/html/draft-ietf-tls-tls13-18#section-4.2.6
|
1791
|
-
|
1792
|
-
static size_t ext_pre_shared_key_clienthello_length(SSL_HANDSHAKE *hs) {
|
1793
|
-
SSL *const ssl = hs->ssl;
|
1794
|
-
if (hs->max_version < TLS1_3_VERSION || ssl->session == NULL ||
|
1795
|
-
ssl_session_protocol_version(ssl->session) < TLS1_3_VERSION) {
|
1796
|
-
return 0;
|
1797
|
-
}
|
1798
|
-
|
1799
|
-
size_t binder_len = EVP_MD_size(ssl_session_get_digest(ssl->session));
|
1800
|
-
return 15 + ssl->session->tlsext_ticklen + binder_len;
|
1801
|
-
}
|
1802
|
-
|
1803
|
-
static bool ext_pre_shared_key_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1804
|
-
SSL *const ssl = hs->ssl;
|
1805
|
-
hs->needs_psk_binder = false;
|
1806
|
-
if (hs->max_version < TLS1_3_VERSION || ssl->session == NULL ||
|
1807
|
-
ssl_session_protocol_version(ssl->session) < TLS1_3_VERSION) {
|
1808
|
-
return true;
|
1809
|
-
}
|
1810
|
-
|
1811
|
-
// Per draft-ietf-tls-tls13-21 section 4.1.4, skip offering the session if the
|
1812
|
-
// selected cipher in HelloRetryRequest does not match. This avoids performing
|
1813
|
-
// the transcript hash transformation for multiple hashes.
|
1814
|
-
if (hs->received_hello_retry_request &&
|
1815
|
-
ssl->session->cipher->algorithm_prf != hs->new_cipher->algorithm_prf) {
|
1816
|
-
return true;
|
1817
|
-
}
|
1818
|
-
|
1819
|
-
struct OPENSSL_timeval now;
|
1820
|
-
ssl_get_current_time(ssl, &now);
|
1821
|
-
uint32_t ticket_age = 1000 * (now.tv_sec - ssl->session->time);
|
1822
|
-
uint32_t obfuscated_ticket_age = ticket_age + ssl->session->ticket_age_add;
|
1823
|
-
|
1824
|
-
// Fill in a placeholder zero binder of the appropriate length. It will be
|
1825
|
-
// computed and filled in later after length prefixes are computed.
|
1826
|
-
uint8_t zero_binder[EVP_MAX_MD_SIZE] = {0};
|
1827
|
-
size_t binder_len = EVP_MD_size(ssl_session_get_digest(ssl->session));
|
1828
|
-
|
1829
|
-
CBB contents, identity, ticket, binders, binder;
|
1830
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_pre_shared_key) ||
|
1831
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1832
|
-
!CBB_add_u16_length_prefixed(&contents, &identity) ||
|
1833
|
-
!CBB_add_u16_length_prefixed(&identity, &ticket) ||
|
1834
|
-
!CBB_add_bytes(&ticket, ssl->session->tlsext_tick,
|
1835
|
-
ssl->session->tlsext_ticklen) ||
|
1836
|
-
!CBB_add_u32(&identity, obfuscated_ticket_age) ||
|
1837
|
-
!CBB_add_u16_length_prefixed(&contents, &binders) ||
|
1838
|
-
!CBB_add_u8_length_prefixed(&binders, &binder) ||
|
1839
|
-
!CBB_add_bytes(&binder, zero_binder, binder_len)) {
|
1840
|
-
return false;
|
1841
|
-
}
|
1842
|
-
|
1843
|
-
hs->needs_psk_binder = true;
|
1844
|
-
return CBB_flush(out);
|
1845
|
-
}
|
1846
|
-
|
1847
|
-
bool ssl_ext_pre_shared_key_parse_serverhello(SSL_HANDSHAKE *hs,
|
1848
|
-
uint8_t *out_alert,
|
1849
|
-
CBS *contents) {
|
1850
|
-
uint16_t psk_id;
|
1851
|
-
if (!CBS_get_u16(contents, &psk_id) ||
|
1852
|
-
CBS_len(contents) != 0) {
|
1853
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
1854
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1855
|
-
return false;
|
1856
|
-
}
|
1857
|
-
|
1858
|
-
// We only advertise one PSK identity, so the only legal index is zero.
|
1859
|
-
if (psk_id != 0) {
|
1860
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_PSK_IDENTITY_NOT_FOUND);
|
1861
|
-
*out_alert = SSL_AD_UNKNOWN_PSK_IDENTITY;
|
1862
|
-
return false;
|
1863
|
-
}
|
1864
|
-
|
1865
|
-
return true;
|
1866
|
-
}
|
1867
|
-
|
1868
|
-
bool ssl_ext_pre_shared_key_parse_clienthello(
|
1869
|
-
SSL_HANDSHAKE *hs, CBS *out_ticket, CBS *out_binders,
|
1870
|
-
uint32_t *out_obfuscated_ticket_age, uint8_t *out_alert, CBS *contents) {
|
1871
|
-
// We only process the first PSK identity since we don't support pure PSK.
|
1872
|
-
CBS identities, binders;
|
1873
|
-
if (!CBS_get_u16_length_prefixed(contents, &identities) ||
|
1874
|
-
!CBS_get_u16_length_prefixed(&identities, out_ticket) ||
|
1875
|
-
!CBS_get_u32(&identities, out_obfuscated_ticket_age) ||
|
1876
|
-
!CBS_get_u16_length_prefixed(contents, &binders) ||
|
1877
|
-
CBS_len(&binders) == 0 ||
|
1878
|
-
CBS_len(contents) != 0) {
|
1879
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
1880
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1881
|
-
return false;
|
1882
|
-
}
|
1883
|
-
|
1884
|
-
*out_binders = binders;
|
1885
|
-
|
1886
|
-
// Check the syntax of the remaining identities, but do not process them.
|
1887
|
-
size_t num_identities = 1;
|
1888
|
-
while (CBS_len(&identities) != 0) {
|
1889
|
-
CBS unused_ticket;
|
1890
|
-
uint32_t unused_obfuscated_ticket_age;
|
1891
|
-
if (!CBS_get_u16_length_prefixed(&identities, &unused_ticket) ||
|
1892
|
-
!CBS_get_u32(&identities, &unused_obfuscated_ticket_age)) {
|
1893
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
1894
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1895
|
-
return false;
|
1896
|
-
}
|
1897
|
-
|
1898
|
-
num_identities++;
|
1899
|
-
}
|
1900
|
-
|
1901
|
-
// Check the syntax of the binders. The value will be checked later if
|
1902
|
-
// resuming.
|
1903
|
-
size_t num_binders = 0;
|
1904
|
-
while (CBS_len(&binders) != 0) {
|
1905
|
-
CBS binder;
|
1906
|
-
if (!CBS_get_u8_length_prefixed(&binders, &binder)) {
|
1907
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
1908
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1909
|
-
return false;
|
1910
|
-
}
|
1911
|
-
|
1912
|
-
num_binders++;
|
1913
|
-
}
|
1914
|
-
|
1915
|
-
if (num_identities != num_binders) {
|
1916
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_PSK_IDENTITY_BINDER_COUNT_MISMATCH);
|
1917
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
1918
|
-
return false;
|
1919
|
-
}
|
1920
|
-
|
1921
|
-
return true;
|
1922
|
-
}
|
1923
|
-
|
1924
|
-
bool ssl_ext_pre_shared_key_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
1925
|
-
if (!hs->ssl->s3->session_reused) {
|
1926
|
-
return true;
|
1927
|
-
}
|
1928
|
-
|
1929
|
-
CBB contents;
|
1930
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_pre_shared_key) ||
|
1931
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1932
|
-
// We only consider the first identity for resumption
|
1933
|
-
!CBB_add_u16(&contents, 0) ||
|
1934
|
-
!CBB_flush(out)) {
|
1935
|
-
return false;
|
1936
|
-
}
|
1937
|
-
|
1938
|
-
return true;
|
1939
|
-
}
|
1940
|
-
|
1941
|
-
|
1942
|
-
// Pre-Shared Key Exchange Modes
|
1943
|
-
//
|
1944
|
-
// https://tools.ietf.org/html/draft-ietf-tls-tls13-18#section-4.2.7
|
1945
|
-
|
1946
|
-
static bool ext_psk_key_exchange_modes_add_clienthello(SSL_HANDSHAKE *hs,
|
1947
|
-
CBB *out) {
|
1948
|
-
if (hs->max_version < TLS1_3_VERSION) {
|
1949
|
-
return true;
|
1950
|
-
}
|
1951
|
-
|
1952
|
-
CBB contents, ke_modes;
|
1953
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_psk_key_exchange_modes) ||
|
1954
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
1955
|
-
!CBB_add_u8_length_prefixed(&contents, &ke_modes) ||
|
1956
|
-
!CBB_add_u8(&ke_modes, SSL_PSK_DHE_KE)) {
|
1957
|
-
return false;
|
1958
|
-
}
|
1959
|
-
|
1960
|
-
return CBB_flush(out);
|
1961
|
-
}
|
1962
|
-
|
1963
|
-
static bool ext_psk_key_exchange_modes_parse_clienthello(SSL_HANDSHAKE *hs,
|
1964
|
-
uint8_t *out_alert,
|
1965
|
-
CBS *contents) {
|
1966
|
-
if (contents == NULL) {
|
1967
|
-
return true;
|
1968
|
-
}
|
1969
|
-
|
1970
|
-
CBS ke_modes;
|
1971
|
-
if (!CBS_get_u8_length_prefixed(contents, &ke_modes) ||
|
1972
|
-
CBS_len(&ke_modes) == 0 ||
|
1973
|
-
CBS_len(contents) != 0) {
|
1974
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
1975
|
-
return false;
|
1976
|
-
}
|
1977
|
-
|
1978
|
-
// We only support tickets with PSK_DHE_KE.
|
1979
|
-
hs->accept_psk_mode = OPENSSL_memchr(CBS_data(&ke_modes), SSL_PSK_DHE_KE,
|
1980
|
-
CBS_len(&ke_modes)) != NULL;
|
1981
|
-
|
1982
|
-
return true;
|
1983
|
-
}
|
1984
|
-
|
1985
|
-
|
1986
|
-
// Early Data Indication
|
1987
|
-
//
|
1988
|
-
// https://tools.ietf.org/html/draft-ietf-tls-tls13-18#section-4.2.8
|
1989
|
-
|
1990
|
-
static bool ext_early_data_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
1991
|
-
SSL *const ssl = hs->ssl;
|
1992
|
-
if (!ssl->cert->enable_early_data ||
|
1993
|
-
// Session must be 0-RTT capable.
|
1994
|
-
ssl->session == NULL ||
|
1995
|
-
ssl_session_protocol_version(ssl->session) < TLS1_3_VERSION ||
|
1996
|
-
ssl->session->ticket_max_early_data == 0 ||
|
1997
|
-
// The second ClientHello never offers early data.
|
1998
|
-
hs->received_hello_retry_request ||
|
1999
|
-
// In case ALPN preferences changed since this session was established,
|
2000
|
-
// avoid reporting a confusing value in |SSL_get0_alpn_selected|.
|
2001
|
-
(ssl->session->early_alpn_len != 0 &&
|
2002
|
-
!ssl_is_alpn_protocol_allowed(
|
2003
|
-
ssl, MakeConstSpan(ssl->session->early_alpn,
|
2004
|
-
ssl->session->early_alpn_len)))) {
|
2005
|
-
return true;
|
2006
|
-
}
|
2007
|
-
|
2008
|
-
hs->early_data_offered = true;
|
2009
|
-
|
2010
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_early_data) ||
|
2011
|
-
!CBB_add_u16(out, 0) ||
|
2012
|
-
!CBB_flush(out)) {
|
2013
|
-
return false;
|
2014
|
-
}
|
2015
|
-
|
2016
|
-
return true;
|
2017
|
-
}
|
2018
|
-
|
2019
|
-
static bool ext_early_data_parse_serverhello(SSL_HANDSHAKE *hs,
|
2020
|
-
uint8_t *out_alert, CBS *contents) {
|
2021
|
-
SSL *const ssl = hs->ssl;
|
2022
|
-
if (contents == NULL) {
|
2023
|
-
return true;
|
2024
|
-
}
|
2025
|
-
|
2026
|
-
if (CBS_len(contents) != 0) {
|
2027
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
2028
|
-
return false;
|
2029
|
-
}
|
2030
|
-
|
2031
|
-
if (!ssl->s3->session_reused) {
|
2032
|
-
*out_alert = SSL_AD_UNSUPPORTED_EXTENSION;
|
2033
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_EXTENSION);
|
2034
|
-
return false;
|
2035
|
-
}
|
2036
|
-
|
2037
|
-
ssl->s3->early_data_accepted = true;
|
2038
|
-
return true;
|
2039
|
-
}
|
2040
|
-
|
2041
|
-
static bool ext_early_data_parse_clienthello(SSL_HANDSHAKE *hs,
|
2042
|
-
uint8_t *out_alert, CBS *contents) {
|
2043
|
-
SSL *const ssl = hs->ssl;
|
2044
|
-
if (contents == NULL ||
|
2045
|
-
ssl_protocol_version(ssl) < TLS1_3_VERSION) {
|
2046
|
-
return true;
|
2047
|
-
}
|
2048
|
-
|
2049
|
-
if (CBS_len(contents) != 0) {
|
2050
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
2051
|
-
return false;
|
2052
|
-
}
|
2053
|
-
|
2054
|
-
hs->early_data_offered = true;
|
2055
|
-
return true;
|
2056
|
-
}
|
2057
|
-
|
2058
|
-
static bool ext_early_data_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
2059
|
-
if (!hs->ssl->s3->early_data_accepted) {
|
2060
|
-
return true;
|
2061
|
-
}
|
2062
|
-
|
2063
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_early_data) ||
|
2064
|
-
!CBB_add_u16(out, 0) ||
|
2065
|
-
!CBB_flush(out)) {
|
2066
|
-
return false;
|
2067
|
-
}
|
2068
|
-
|
2069
|
-
return true;
|
2070
|
-
}
|
2071
|
-
|
2072
|
-
|
2073
|
-
// Key Share
|
2074
|
-
//
|
2075
|
-
// https://tools.ietf.org/html/draft-ietf-tls-tls13-16#section-4.2.5
|
2076
|
-
|
2077
|
-
static bool ext_key_share_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
2078
|
-
SSL *const ssl = hs->ssl;
|
2079
|
-
if (hs->max_version < TLS1_3_VERSION) {
|
2080
|
-
return true;
|
2081
|
-
}
|
2082
|
-
|
2083
|
-
CBB contents, kse_bytes;
|
2084
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_key_share) ||
|
2085
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2086
|
-
!CBB_add_u16_length_prefixed(&contents, &kse_bytes)) {
|
2087
|
-
return false;
|
2088
|
-
}
|
2089
|
-
|
2090
|
-
uint16_t group_id = hs->retry_group;
|
2091
|
-
if (hs->received_hello_retry_request) {
|
2092
|
-
// We received a HelloRetryRequest without a new curve, so there is no new
|
2093
|
-
// share to append. Leave |hs->key_share| as-is.
|
2094
|
-
if (group_id == 0 &&
|
2095
|
-
!CBB_add_bytes(&kse_bytes, hs->key_share_bytes.data(),
|
2096
|
-
hs->key_share_bytes.size())) {
|
2097
|
-
return false;
|
2098
|
-
}
|
2099
|
-
hs->key_share_bytes.Reset();
|
2100
|
-
if (group_id == 0) {
|
2101
|
-
return CBB_flush(out);
|
2102
|
-
}
|
2103
|
-
} else {
|
2104
|
-
// Add a fake group. See draft-davidben-tls-grease-01.
|
2105
|
-
if (ssl->ctx->grease_enabled &&
|
2106
|
-
(!CBB_add_u16(&kse_bytes,
|
2107
|
-
ssl_get_grease_value(hs, ssl_grease_group)) ||
|
2108
|
-
!CBB_add_u16(&kse_bytes, 1 /* length */) ||
|
2109
|
-
!CBB_add_u8(&kse_bytes, 0 /* one byte key share */))) {
|
2110
|
-
return false;
|
2111
|
-
}
|
2112
|
-
|
2113
|
-
// Predict the most preferred group.
|
2114
|
-
Span<const uint16_t> groups = tls1_get_grouplist(ssl);
|
2115
|
-
if (groups.empty()) {
|
2116
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_GROUPS_SPECIFIED);
|
2117
|
-
return false;
|
2118
|
-
}
|
2119
|
-
|
2120
|
-
group_id = groups[0];
|
2121
|
-
}
|
2122
|
-
|
2123
|
-
hs->key_share = SSLKeyShare::Create(group_id);
|
2124
|
-
CBB key_exchange;
|
2125
|
-
if (!hs->key_share ||
|
2126
|
-
!CBB_add_u16(&kse_bytes, group_id) ||
|
2127
|
-
!CBB_add_u16_length_prefixed(&kse_bytes, &key_exchange) ||
|
2128
|
-
!hs->key_share->Offer(&key_exchange) ||
|
2129
|
-
!CBB_flush(&kse_bytes)) {
|
2130
|
-
return false;
|
2131
|
-
}
|
2132
|
-
|
2133
|
-
// Save the contents of the extension to repeat it in the second ClientHello.
|
2134
|
-
if (!hs->received_hello_retry_request &&
|
2135
|
-
!hs->key_share_bytes.CopyFrom(
|
2136
|
-
MakeConstSpan(CBB_data(&kse_bytes), CBB_len(&kse_bytes)))) {
|
2137
|
-
return false;
|
2138
|
-
}
|
2139
|
-
|
2140
|
-
return CBB_flush(out);
|
2141
|
-
}
|
2142
|
-
|
2143
|
-
bool ssl_ext_key_share_parse_serverhello(SSL_HANDSHAKE *hs,
|
2144
|
-
Array<uint8_t> *out_secret,
|
2145
|
-
uint8_t *out_alert, CBS *contents) {
|
2146
|
-
CBS peer_key;
|
2147
|
-
uint16_t group_id;
|
2148
|
-
if (!CBS_get_u16(contents, &group_id) ||
|
2149
|
-
!CBS_get_u16_length_prefixed(contents, &peer_key) ||
|
2150
|
-
CBS_len(contents) != 0) {
|
2151
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
2152
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
2153
|
-
return false;
|
2154
|
-
}
|
2155
|
-
|
2156
|
-
if (hs->key_share->GroupID() != group_id) {
|
2157
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
2158
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_CURVE);
|
2159
|
-
return false;
|
2160
|
-
}
|
2161
|
-
|
2162
|
-
if (!hs->key_share->Finish(out_secret, out_alert, peer_key)) {
|
2163
|
-
*out_alert = SSL_AD_INTERNAL_ERROR;
|
2164
|
-
return false;
|
2165
|
-
}
|
2166
|
-
|
2167
|
-
hs->new_session->group_id = group_id;
|
2168
|
-
hs->key_share.reset();
|
2169
|
-
return true;
|
2170
|
-
}
|
2171
|
-
|
2172
|
-
bool ssl_ext_key_share_parse_clienthello(SSL_HANDSHAKE *hs, bool *out_found,
|
2173
|
-
Array<uint8_t> *out_secret,
|
2174
|
-
uint8_t *out_alert, CBS *contents) {
|
2175
|
-
uint16_t group_id;
|
2176
|
-
CBS key_shares;
|
2177
|
-
if (!tls1_get_shared_group(hs, &group_id)) {
|
2178
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_SHARED_GROUP);
|
2179
|
-
*out_alert = SSL_AD_HANDSHAKE_FAILURE;
|
2180
|
-
return false;
|
2181
|
-
}
|
2182
|
-
|
2183
|
-
if (!CBS_get_u16_length_prefixed(contents, &key_shares) ||
|
2184
|
-
CBS_len(contents) != 0) {
|
2185
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
2186
|
-
return false;
|
2187
|
-
}
|
2188
|
-
|
2189
|
-
// Find the corresponding key share.
|
2190
|
-
CBS peer_key;
|
2191
|
-
CBS_init(&peer_key, NULL, 0);
|
2192
|
-
while (CBS_len(&key_shares) > 0) {
|
2193
|
-
uint16_t id;
|
2194
|
-
CBS peer_key_tmp;
|
2195
|
-
if (!CBS_get_u16(&key_shares, &id) ||
|
2196
|
-
!CBS_get_u16_length_prefixed(&key_shares, &peer_key_tmp) ||
|
2197
|
-
CBS_len(&peer_key_tmp) == 0) {
|
2198
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
2199
|
-
return false;
|
2200
|
-
}
|
2201
|
-
|
2202
|
-
if (id == group_id) {
|
2203
|
-
if (CBS_len(&peer_key) != 0) {
|
2204
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DUPLICATE_KEY_SHARE);
|
2205
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
2206
|
-
return false;
|
2207
|
-
}
|
2208
|
-
|
2209
|
-
peer_key = peer_key_tmp;
|
2210
|
-
// Continue parsing the structure to keep peers honest.
|
2211
|
-
}
|
2212
|
-
}
|
2213
|
-
|
2214
|
-
if (CBS_len(&peer_key) == 0) {
|
2215
|
-
*out_found = false;
|
2216
|
-
out_secret->Reset();
|
2217
|
-
return true;
|
2218
|
-
}
|
2219
|
-
|
2220
|
-
// Compute the DH secret.
|
2221
|
-
Array<uint8_t> secret;
|
2222
|
-
ScopedCBB public_key;
|
2223
|
-
UniquePtr<SSLKeyShare> key_share = SSLKeyShare::Create(group_id);
|
2224
|
-
if (!key_share ||
|
2225
|
-
!CBB_init(public_key.get(), 32) ||
|
2226
|
-
!key_share->Accept(public_key.get(), &secret, out_alert, peer_key) ||
|
2227
|
-
!CBBFinishArray(public_key.get(), &hs->ecdh_public_key)) {
|
2228
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
2229
|
-
return false;
|
2230
|
-
}
|
2231
|
-
|
2232
|
-
*out_secret = std::move(secret);
|
2233
|
-
*out_found = true;
|
2234
|
-
return true;
|
2235
|
-
}
|
2236
|
-
|
2237
|
-
bool ssl_ext_key_share_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
2238
|
-
uint16_t group_id;
|
2239
|
-
CBB kse_bytes, public_key;
|
2240
|
-
if (!tls1_get_shared_group(hs, &group_id) ||
|
2241
|
-
!CBB_add_u16(out, TLSEXT_TYPE_key_share) ||
|
2242
|
-
!CBB_add_u16_length_prefixed(out, &kse_bytes) ||
|
2243
|
-
!CBB_add_u16(&kse_bytes, group_id) ||
|
2244
|
-
!CBB_add_u16_length_prefixed(&kse_bytes, &public_key) ||
|
2245
|
-
!CBB_add_bytes(&public_key, hs->ecdh_public_key.data(),
|
2246
|
-
hs->ecdh_public_key.size()) ||
|
2247
|
-
!CBB_flush(out)) {
|
2248
|
-
return false;
|
2249
|
-
}
|
2250
|
-
|
2251
|
-
hs->ecdh_public_key.Reset();
|
2252
|
-
|
2253
|
-
hs->new_session->group_id = group_id;
|
2254
|
-
return true;
|
2255
|
-
}
|
2256
|
-
|
2257
|
-
|
2258
|
-
// Supported Versions
|
2259
|
-
//
|
2260
|
-
// https://tools.ietf.org/html/draft-ietf-tls-tls13-16#section-4.2.1
|
2261
|
-
|
2262
|
-
static bool ext_supported_versions_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
2263
|
-
SSL *const ssl = hs->ssl;
|
2264
|
-
if (hs->max_version <= TLS1_2_VERSION) {
|
2265
|
-
return true;
|
2266
|
-
}
|
2267
|
-
|
2268
|
-
CBB contents, versions;
|
2269
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_supported_versions) ||
|
2270
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2271
|
-
!CBB_add_u8_length_prefixed(&contents, &versions)) {
|
2272
|
-
return false;
|
2273
|
-
}
|
2274
|
-
|
2275
|
-
// Add a fake version. See draft-davidben-tls-grease-01.
|
2276
|
-
if (ssl->ctx->grease_enabled &&
|
2277
|
-
!CBB_add_u16(&versions, ssl_get_grease_value(hs, ssl_grease_version))) {
|
2278
|
-
return false;
|
2279
|
-
}
|
2280
|
-
|
2281
|
-
if (!ssl_add_supported_versions(hs, &versions) ||
|
2282
|
-
!CBB_flush(out)) {
|
2283
|
-
return false;
|
2284
|
-
}
|
2285
|
-
|
2286
|
-
return true;
|
2287
|
-
}
|
2288
|
-
|
2289
|
-
|
2290
|
-
// Cookie
|
2291
|
-
//
|
2292
|
-
// https://tools.ietf.org/html/draft-ietf-tls-tls13-16#section-4.2.2
|
2293
|
-
|
2294
|
-
static bool ext_cookie_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
2295
|
-
if (hs->cookie.empty()) {
|
2296
|
-
return true;
|
2297
|
-
}
|
2298
|
-
|
2299
|
-
CBB contents, cookie;
|
2300
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_cookie) ||
|
2301
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2302
|
-
!CBB_add_u16_length_prefixed(&contents, &cookie) ||
|
2303
|
-
!CBB_add_bytes(&cookie, hs->cookie.data(), hs->cookie.size()) ||
|
2304
|
-
!CBB_flush(out)) {
|
2305
|
-
return false;
|
2306
|
-
}
|
2307
|
-
|
2308
|
-
// The cookie is no longer needed in memory.
|
2309
|
-
hs->cookie.Reset();
|
2310
|
-
return true;
|
2311
|
-
}
|
2312
|
-
|
2313
|
-
|
2314
|
-
// Dummy PQ Padding extension
|
2315
|
-
//
|
2316
|
-
// Dummy post-quantum padding invovles the client (and later server) sending
|
2317
|
-
// useless, random-looking bytes in an extension in their ClientHello or
|
2318
|
-
// ServerHello. These extensions are sized to simulate a post-quantum
|
2319
|
-
// key-exchange and so enable measurement of the latency impact of the
|
2320
|
-
// additional bandwidth.
|
2321
|
-
|
2322
|
-
static bool ext_dummy_pq_padding_add(CBB *out, size_t len) {
|
2323
|
-
CBB contents;
|
2324
|
-
uint8_t *buffer;
|
2325
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_dummy_pq_padding) ||
|
2326
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2327
|
-
!CBB_add_space(&contents, &buffer, len)) {
|
2328
|
-
return false;
|
2329
|
-
}
|
2330
|
-
|
2331
|
-
// The length is used as the nonce so that different length extensions have
|
2332
|
-
// different contents. There's no reason this has to be the case, it just
|
2333
|
-
// makes things a little more obvious in a packet dump.
|
2334
|
-
uint8_t nonce[12] = {0};
|
2335
|
-
memcpy(nonce, &len, sizeof(len));
|
2336
|
-
|
2337
|
-
memset(buffer, 0, len);
|
2338
|
-
static const uint8_t kZeroKey[32] = {0};
|
2339
|
-
CRYPTO_chacha_20(buffer, buffer, len, kZeroKey, nonce, 0);
|
2340
|
-
|
2341
|
-
return CBB_flush(out);
|
2342
|
-
}
|
2343
|
-
|
2344
|
-
static bool ext_dummy_pq_padding_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
2345
|
-
const size_t len = hs->ssl->dummy_pq_padding_len;
|
2346
|
-
if (len == 0) {
|
2347
|
-
return true;
|
2348
|
-
}
|
2349
|
-
|
2350
|
-
return ext_dummy_pq_padding_add(out, len);
|
2351
|
-
}
|
2352
|
-
|
2353
|
-
static bool ext_dummy_pq_padding_parse_serverhello(SSL_HANDSHAKE *hs,
|
2354
|
-
uint8_t *out_alert,
|
2355
|
-
CBS *contents) {
|
2356
|
-
if (contents == nullptr) {
|
2357
|
-
return true;
|
2358
|
-
}
|
2359
|
-
|
2360
|
-
if (CBS_len(contents) != hs->ssl->dummy_pq_padding_len) {
|
2361
|
-
return false;
|
2362
|
-
}
|
2363
|
-
|
2364
|
-
hs->ssl->did_dummy_pq_padding = true;
|
2365
|
-
return true;
|
2366
|
-
}
|
2367
|
-
|
2368
|
-
static bool ext_dummy_pq_padding_parse_clienthello(SSL_HANDSHAKE *hs,
|
2369
|
-
uint8_t *out_alert,
|
2370
|
-
CBS *contents) {
|
2371
|
-
if (contents != nullptr &&
|
2372
|
-
0 < CBS_len(contents) && CBS_len(contents) < (1 << 12)) {
|
2373
|
-
hs->dummy_pq_padding_len = CBS_len(contents);
|
2374
|
-
}
|
2375
|
-
|
2376
|
-
return true;
|
2377
|
-
}
|
2378
|
-
|
2379
|
-
static bool ext_dummy_pq_padding_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
2380
|
-
if (!hs->dummy_pq_padding_len) {
|
2381
|
-
return true;
|
2382
|
-
}
|
2383
|
-
|
2384
|
-
return ext_dummy_pq_padding_add(out, hs->dummy_pq_padding_len);
|
2385
|
-
}
|
2386
|
-
|
2387
|
-
// Negotiated Groups
|
2388
|
-
//
|
2389
|
-
// https://tools.ietf.org/html/rfc4492#section-5.1.2
|
2390
|
-
// https://tools.ietf.org/html/draft-ietf-tls-tls13-16#section-4.2.4
|
2391
|
-
|
2392
|
-
static bool ext_supported_groups_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
2393
|
-
SSL *const ssl = hs->ssl;
|
2394
|
-
CBB contents, groups_bytes;
|
2395
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_supported_groups) ||
|
2396
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2397
|
-
!CBB_add_u16_length_prefixed(&contents, &groups_bytes)) {
|
2398
|
-
return false;
|
2399
|
-
}
|
2400
|
-
|
2401
|
-
// Add a fake group. See draft-davidben-tls-grease-01.
|
2402
|
-
if (ssl->ctx->grease_enabled &&
|
2403
|
-
!CBB_add_u16(&groups_bytes,
|
2404
|
-
ssl_get_grease_value(hs, ssl_grease_group))) {
|
2405
|
-
return false;
|
2406
|
-
}
|
2407
|
-
|
2408
|
-
for (uint16_t group : tls1_get_grouplist(ssl)) {
|
2409
|
-
if (!CBB_add_u16(&groups_bytes, group)) {
|
2410
|
-
return false;
|
2411
|
-
}
|
2412
|
-
}
|
2413
|
-
|
2414
|
-
return CBB_flush(out);
|
2415
|
-
}
|
2416
|
-
|
2417
|
-
static bool ext_supported_groups_parse_serverhello(SSL_HANDSHAKE *hs,
|
2418
|
-
uint8_t *out_alert,
|
2419
|
-
CBS *contents) {
|
2420
|
-
// This extension is not expected to be echoed by servers in TLS 1.2, but some
|
2421
|
-
// BigIP servers send it nonetheless, so do not enforce this.
|
2422
|
-
return true;
|
2423
|
-
}
|
2424
|
-
|
2425
|
-
static bool parse_u16_array(const CBS *cbs, Array<uint16_t> *out) {
|
2426
|
-
CBS copy = *cbs;
|
2427
|
-
if ((CBS_len(©) & 1) != 0) {
|
2428
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
2429
|
-
return false;
|
2430
|
-
}
|
2431
|
-
|
2432
|
-
Array<uint16_t> ret;
|
2433
|
-
if (!ret.Init(CBS_len(©) / 2)) {
|
2434
|
-
return false;
|
2435
|
-
}
|
2436
|
-
for (size_t i = 0; i < ret.size(); i++) {
|
2437
|
-
if (!CBS_get_u16(©, &ret[i])) {
|
2438
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
2439
|
-
return false;
|
2440
|
-
}
|
2441
|
-
}
|
2442
|
-
|
2443
|
-
assert(CBS_len(©) == 0);
|
2444
|
-
*out = std::move(ret);
|
2445
|
-
return 1;
|
2446
|
-
}
|
2447
|
-
|
2448
|
-
static bool ext_supported_groups_parse_clienthello(SSL_HANDSHAKE *hs,
|
2449
|
-
uint8_t *out_alert,
|
2450
|
-
CBS *contents) {
|
2451
|
-
if (contents == NULL) {
|
2452
|
-
return true;
|
2453
|
-
}
|
2454
|
-
|
2455
|
-
CBS supported_group_list;
|
2456
|
-
if (!CBS_get_u16_length_prefixed(contents, &supported_group_list) ||
|
2457
|
-
CBS_len(&supported_group_list) == 0 ||
|
2458
|
-
CBS_len(contents) != 0 ||
|
2459
|
-
!parse_u16_array(&supported_group_list, &hs->peer_supported_group_list)) {
|
2460
|
-
return false;
|
2461
|
-
}
|
2462
|
-
|
2463
|
-
return true;
|
2464
|
-
}
|
2465
|
-
|
2466
|
-
// Token Binding
|
2467
|
-
//
|
2468
|
-
// https://tools.ietf.org/html/draft-ietf-tokbind-negotiation-10
|
2469
|
-
|
2470
|
-
// The Token Binding version number currently matches the draft number of
|
2471
|
-
// draft-ietf-tokbind-protocol, and when published as an RFC it will be 0x0100.
|
2472
|
-
// Since there are no wire changes to the protocol from draft 13 through the
|
2473
|
-
// current draft (16), this implementation supports all versions in that range.
|
2474
|
-
static uint16_t kTokenBindingMaxVersion = 16;
|
2475
|
-
static uint16_t kTokenBindingMinVersion = 13;
|
2476
|
-
|
2477
|
-
static bool ext_token_binding_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
|
2478
|
-
SSL *const ssl = hs->ssl;
|
2479
|
-
if (ssl->token_binding_params == nullptr || SSL_is_dtls(ssl)) {
|
2480
|
-
return true;
|
2481
|
-
}
|
2482
|
-
|
2483
|
-
CBB contents, params;
|
2484
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_token_binding) ||
|
2485
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2486
|
-
!CBB_add_u16(&contents, kTokenBindingMaxVersion) ||
|
2487
|
-
!CBB_add_u8_length_prefixed(&contents, ¶ms) ||
|
2488
|
-
!CBB_add_bytes(¶ms, ssl->token_binding_params,
|
2489
|
-
ssl->token_binding_params_len) ||
|
2490
|
-
!CBB_flush(out)) {
|
2491
|
-
return false;
|
2492
|
-
}
|
2493
|
-
|
2494
|
-
return true;
|
2495
|
-
}
|
2496
|
-
|
2497
|
-
static bool ext_token_binding_parse_serverhello(SSL_HANDSHAKE *hs,
|
2498
|
-
uint8_t *out_alert,
|
2499
|
-
CBS *contents) {
|
2500
|
-
SSL *const ssl = hs->ssl;
|
2501
|
-
if (contents == nullptr) {
|
2502
|
-
return true;
|
2503
|
-
}
|
2504
|
-
|
2505
|
-
CBS params_list;
|
2506
|
-
uint16_t version;
|
2507
|
-
uint8_t param;
|
2508
|
-
if (!CBS_get_u16(contents, &version) ||
|
2509
|
-
!CBS_get_u8_length_prefixed(contents, ¶ms_list) ||
|
2510
|
-
!CBS_get_u8(¶ms_list, ¶m) ||
|
2511
|
-
CBS_len(¶ms_list) > 0 ||
|
2512
|
-
CBS_len(contents) > 0) {
|
2513
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
2514
|
-
return false;
|
2515
|
-
}
|
2516
|
-
|
2517
|
-
// The server-negotiated version must be less than or equal to our version.
|
2518
|
-
if (version > kTokenBindingMaxVersion) {
|
2519
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
2520
|
-
return false;
|
2521
|
-
}
|
2522
|
-
|
2523
|
-
// If the server-selected version is less than what we support, then Token
|
2524
|
-
// Binding wasn't negotiated (but the extension was parsed successfully).
|
2525
|
-
if (version < kTokenBindingMinVersion) {
|
2526
|
-
return true;
|
2527
|
-
}
|
2528
|
-
|
2529
|
-
for (size_t i = 0; i < ssl->token_binding_params_len; ++i) {
|
2530
|
-
if (param == ssl->token_binding_params[i]) {
|
2531
|
-
ssl->negotiated_token_binding_param = param;
|
2532
|
-
ssl->token_binding_negotiated = true;
|
2533
|
-
return true;
|
2534
|
-
}
|
2535
|
-
}
|
2536
|
-
|
2537
|
-
*out_alert = SSL_AD_ILLEGAL_PARAMETER;
|
2538
|
-
return false;
|
2539
|
-
}
|
2540
|
-
|
2541
|
-
// select_tb_param looks for the first token binding param in
|
2542
|
-
// |ssl->token_binding_params| that is also in |params| and puts it in
|
2543
|
-
// |ssl->negotiated_token_binding_param|. It returns true if a token binding
|
2544
|
-
// param is found, and false otherwise.
|
2545
|
-
static bool select_tb_param(SSL *ssl, Span<const uint8_t> peer_params) {
|
2546
|
-
for (size_t i = 0; i < ssl->token_binding_params_len; ++i) {
|
2547
|
-
uint8_t tb_param = ssl->token_binding_params[i];
|
2548
|
-
for (uint8_t peer_param : peer_params) {
|
2549
|
-
if (tb_param == peer_param) {
|
2550
|
-
ssl->negotiated_token_binding_param = tb_param;
|
2551
|
-
return true;
|
2552
|
-
}
|
2553
|
-
}
|
2554
|
-
}
|
2555
|
-
return false;
|
2556
|
-
}
|
2557
|
-
|
2558
|
-
static bool ext_token_binding_parse_clienthello(SSL_HANDSHAKE *hs,
|
2559
|
-
uint8_t *out_alert,
|
2560
|
-
CBS *contents) {
|
2561
|
-
SSL *const ssl = hs->ssl;
|
2562
|
-
if (contents == nullptr || ssl->token_binding_params == nullptr) {
|
2563
|
-
return true;
|
2564
|
-
}
|
2565
|
-
|
2566
|
-
CBS params;
|
2567
|
-
uint16_t version;
|
2568
|
-
if (!CBS_get_u16(contents, &version) ||
|
2569
|
-
!CBS_get_u8_length_prefixed(contents, ¶ms) ||
|
2570
|
-
CBS_len(¶ms) == 0 ||
|
2571
|
-
CBS_len(contents) > 0) {
|
2572
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
2573
|
-
return false;
|
2574
|
-
}
|
2575
|
-
|
2576
|
-
// If the client-selected version is less than what we support, then Token
|
2577
|
-
// Binding wasn't negotiated (but the extension was parsed successfully).
|
2578
|
-
if (version < kTokenBindingMinVersion) {
|
2579
|
-
return true;
|
2580
|
-
}
|
2581
|
-
|
2582
|
-
// If the client-selected version is higher than we support, use our max
|
2583
|
-
// version. Otherwise, use the client's version.
|
2584
|
-
hs->negotiated_token_binding_version =
|
2585
|
-
std::min(version, kTokenBindingMaxVersion);
|
2586
|
-
if (!select_tb_param(ssl, params)) {
|
2587
|
-
return true;
|
2588
|
-
}
|
2589
|
-
|
2590
|
-
ssl->token_binding_negotiated = true;
|
2591
|
-
return true;
|
2592
|
-
}
|
2593
|
-
|
2594
|
-
static bool ext_token_binding_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
|
2595
|
-
SSL *const ssl = hs->ssl;
|
2596
|
-
|
2597
|
-
if (!ssl->token_binding_negotiated) {
|
2598
|
-
return true;
|
2599
|
-
}
|
2600
|
-
|
2601
|
-
CBB contents, params;
|
2602
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_token_binding) ||
|
2603
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2604
|
-
!CBB_add_u16(&contents, hs->negotiated_token_binding_version) ||
|
2605
|
-
!CBB_add_u8_length_prefixed(&contents, ¶ms) ||
|
2606
|
-
!CBB_add_u8(¶ms, ssl->negotiated_token_binding_param) ||
|
2607
|
-
!CBB_flush(out)) {
|
2608
|
-
return false;
|
2609
|
-
}
|
2610
|
-
|
2611
|
-
return true;
|
2612
|
-
}
|
2613
|
-
|
2614
|
-
// QUIC Transport Parameters
|
2615
|
-
|
2616
|
-
static bool ext_quic_transport_params_add_clienthello(SSL_HANDSHAKE *hs,
|
2617
|
-
CBB *out) {
|
2618
|
-
SSL *const ssl = hs->ssl;
|
2619
|
-
if (!ssl->quic_transport_params || hs->max_version <= TLS1_2_VERSION) {
|
2620
|
-
return true;
|
2621
|
-
}
|
2622
|
-
|
2623
|
-
CBB contents;
|
2624
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_quic_transport_parameters) ||
|
2625
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2626
|
-
!CBB_add_bytes(&contents, ssl->quic_transport_params,
|
2627
|
-
ssl->quic_transport_params_len) ||
|
2628
|
-
!CBB_flush(out)) {
|
2629
|
-
return false;
|
2630
|
-
}
|
2631
|
-
return true;
|
2632
|
-
}
|
2633
|
-
|
2634
|
-
static bool ext_quic_transport_params_parse_serverhello(SSL_HANDSHAKE *hs,
|
2635
|
-
uint8_t *out_alert,
|
2636
|
-
CBS *contents) {
|
2637
|
-
SSL *const ssl = hs->ssl;
|
2638
|
-
if (contents == nullptr) {
|
2639
|
-
return true;
|
2640
|
-
}
|
2641
|
-
// QUIC requires TLS 1.3.
|
2642
|
-
if (ssl_protocol_version(ssl) < TLS1_3_VERSION) {
|
2643
|
-
*out_alert = SSL_AD_UNSUPPORTED_EXTENSION;
|
2644
|
-
return false;
|
2645
|
-
}
|
2646
|
-
|
2647
|
-
return ssl->s3->peer_quic_transport_params.CopyFrom(*contents);
|
2648
|
-
}
|
2649
|
-
|
2650
|
-
static bool ext_quic_transport_params_parse_clienthello(SSL_HANDSHAKE *hs,
|
2651
|
-
uint8_t *out_alert,
|
2652
|
-
CBS *contents) {
|
2653
|
-
SSL *const ssl = hs->ssl;
|
2654
|
-
if (!contents || !ssl->quic_transport_params) {
|
2655
|
-
return true;
|
2656
|
-
}
|
2657
|
-
// Ignore the extension before TLS 1.3.
|
2658
|
-
if (ssl_protocol_version(ssl) < TLS1_3_VERSION) {
|
2659
|
-
return true;
|
2660
|
-
}
|
2661
|
-
|
2662
|
-
return ssl->s3->peer_quic_transport_params.CopyFrom(*contents);
|
2663
|
-
}
|
2664
|
-
|
2665
|
-
static bool ext_quic_transport_params_add_serverhello(SSL_HANDSHAKE *hs,
|
2666
|
-
CBB *out) {
|
2667
|
-
SSL *const ssl = hs->ssl;
|
2668
|
-
if (!ssl->quic_transport_params) {
|
2669
|
-
return true;
|
2670
|
-
}
|
2671
|
-
|
2672
|
-
CBB contents;
|
2673
|
-
if (!CBB_add_u16(out, TLSEXT_TYPE_quic_transport_parameters) ||
|
2674
|
-
!CBB_add_u16_length_prefixed(out, &contents) ||
|
2675
|
-
!CBB_add_bytes(&contents, ssl->quic_transport_params,
|
2676
|
-
ssl->quic_transport_params_len) ||
|
2677
|
-
!CBB_flush(out)) {
|
2678
|
-
return false;
|
2679
|
-
}
|
2680
|
-
|
2681
|
-
return true;
|
2682
|
-
}
|
2683
|
-
|
2684
|
-
|
2685
|
-
// kExtensions contains all the supported extensions.
|
2686
|
-
static const struct tls_extension kExtensions[] = {
|
2687
|
-
{
|
2688
|
-
TLSEXT_TYPE_renegotiate,
|
2689
|
-
NULL,
|
2690
|
-
ext_ri_add_clienthello,
|
2691
|
-
ext_ri_parse_serverhello,
|
2692
|
-
ext_ri_parse_clienthello,
|
2693
|
-
ext_ri_add_serverhello,
|
2694
|
-
},
|
2695
|
-
{
|
2696
|
-
TLSEXT_TYPE_server_name,
|
2697
|
-
NULL,
|
2698
|
-
ext_sni_add_clienthello,
|
2699
|
-
ext_sni_parse_serverhello,
|
2700
|
-
ext_sni_parse_clienthello,
|
2701
|
-
ext_sni_add_serverhello,
|
2702
|
-
},
|
2703
|
-
{
|
2704
|
-
TLSEXT_TYPE_extended_master_secret,
|
2705
|
-
NULL,
|
2706
|
-
ext_ems_add_clienthello,
|
2707
|
-
ext_ems_parse_serverhello,
|
2708
|
-
ext_ems_parse_clienthello,
|
2709
|
-
ext_ems_add_serverhello,
|
2710
|
-
},
|
2711
|
-
{
|
2712
|
-
TLSEXT_TYPE_session_ticket,
|
2713
|
-
NULL,
|
2714
|
-
ext_ticket_add_clienthello,
|
2715
|
-
ext_ticket_parse_serverhello,
|
2716
|
-
// Ticket extension client parsing is handled in ssl_session.c
|
2717
|
-
ignore_parse_clienthello,
|
2718
|
-
ext_ticket_add_serverhello,
|
2719
|
-
},
|
2720
|
-
{
|
2721
|
-
TLSEXT_TYPE_signature_algorithms,
|
2722
|
-
NULL,
|
2723
|
-
ext_sigalgs_add_clienthello,
|
2724
|
-
forbid_parse_serverhello,
|
2725
|
-
ext_sigalgs_parse_clienthello,
|
2726
|
-
dont_add_serverhello,
|
2727
|
-
},
|
2728
|
-
{
|
2729
|
-
TLSEXT_TYPE_status_request,
|
2730
|
-
NULL,
|
2731
|
-
ext_ocsp_add_clienthello,
|
2732
|
-
ext_ocsp_parse_serverhello,
|
2733
|
-
ext_ocsp_parse_clienthello,
|
2734
|
-
ext_ocsp_add_serverhello,
|
2735
|
-
},
|
2736
|
-
{
|
2737
|
-
TLSEXT_TYPE_next_proto_neg,
|
2738
|
-
NULL,
|
2739
|
-
ext_npn_add_clienthello,
|
2740
|
-
ext_npn_parse_serverhello,
|
2741
|
-
ext_npn_parse_clienthello,
|
2742
|
-
ext_npn_add_serverhello,
|
2743
|
-
},
|
2744
|
-
{
|
2745
|
-
TLSEXT_TYPE_certificate_timestamp,
|
2746
|
-
NULL,
|
2747
|
-
ext_sct_add_clienthello,
|
2748
|
-
ext_sct_parse_serverhello,
|
2749
|
-
ext_sct_parse_clienthello,
|
2750
|
-
ext_sct_add_serverhello,
|
2751
|
-
},
|
2752
|
-
{
|
2753
|
-
TLSEXT_TYPE_application_layer_protocol_negotiation,
|
2754
|
-
NULL,
|
2755
|
-
ext_alpn_add_clienthello,
|
2756
|
-
ext_alpn_parse_serverhello,
|
2757
|
-
// ALPN is negotiated late in |ssl_negotiate_alpn|.
|
2758
|
-
ignore_parse_clienthello,
|
2759
|
-
ext_alpn_add_serverhello,
|
2760
|
-
},
|
2761
|
-
{
|
2762
|
-
TLSEXT_TYPE_channel_id,
|
2763
|
-
ext_channel_id_init,
|
2764
|
-
ext_channel_id_add_clienthello,
|
2765
|
-
ext_channel_id_parse_serverhello,
|
2766
|
-
ext_channel_id_parse_clienthello,
|
2767
|
-
ext_channel_id_add_serverhello,
|
2768
|
-
},
|
2769
|
-
{
|
2770
|
-
TLSEXT_TYPE_srtp,
|
2771
|
-
ext_srtp_init,
|
2772
|
-
ext_srtp_add_clienthello,
|
2773
|
-
ext_srtp_parse_serverhello,
|
2774
|
-
ext_srtp_parse_clienthello,
|
2775
|
-
ext_srtp_add_serverhello,
|
2776
|
-
},
|
2777
|
-
{
|
2778
|
-
TLSEXT_TYPE_ec_point_formats,
|
2779
|
-
NULL,
|
2780
|
-
ext_ec_point_add_clienthello,
|
2781
|
-
ext_ec_point_parse_serverhello,
|
2782
|
-
ext_ec_point_parse_clienthello,
|
2783
|
-
ext_ec_point_add_serverhello,
|
2784
|
-
},
|
2785
|
-
{
|
2786
|
-
TLSEXT_TYPE_key_share,
|
2787
|
-
NULL,
|
2788
|
-
ext_key_share_add_clienthello,
|
2789
|
-
forbid_parse_serverhello,
|
2790
|
-
ignore_parse_clienthello,
|
2791
|
-
dont_add_serverhello,
|
2792
|
-
},
|
2793
|
-
{
|
2794
|
-
TLSEXT_TYPE_psk_key_exchange_modes,
|
2795
|
-
NULL,
|
2796
|
-
ext_psk_key_exchange_modes_add_clienthello,
|
2797
|
-
forbid_parse_serverhello,
|
2798
|
-
ext_psk_key_exchange_modes_parse_clienthello,
|
2799
|
-
dont_add_serverhello,
|
2800
|
-
},
|
2801
|
-
{
|
2802
|
-
TLSEXT_TYPE_early_data,
|
2803
|
-
NULL,
|
2804
|
-
ext_early_data_add_clienthello,
|
2805
|
-
ext_early_data_parse_serverhello,
|
2806
|
-
ext_early_data_parse_clienthello,
|
2807
|
-
ext_early_data_add_serverhello,
|
2808
|
-
},
|
2809
|
-
{
|
2810
|
-
TLSEXT_TYPE_supported_versions,
|
2811
|
-
NULL,
|
2812
|
-
ext_supported_versions_add_clienthello,
|
2813
|
-
forbid_parse_serverhello,
|
2814
|
-
ignore_parse_clienthello,
|
2815
|
-
dont_add_serverhello,
|
2816
|
-
},
|
2817
|
-
{
|
2818
|
-
TLSEXT_TYPE_cookie,
|
2819
|
-
NULL,
|
2820
|
-
ext_cookie_add_clienthello,
|
2821
|
-
forbid_parse_serverhello,
|
2822
|
-
ignore_parse_clienthello,
|
2823
|
-
dont_add_serverhello,
|
2824
|
-
},
|
2825
|
-
{
|
2826
|
-
TLSEXT_TYPE_dummy_pq_padding,
|
2827
|
-
NULL,
|
2828
|
-
ext_dummy_pq_padding_add_clienthello,
|
2829
|
-
ext_dummy_pq_padding_parse_serverhello,
|
2830
|
-
ext_dummy_pq_padding_parse_clienthello,
|
2831
|
-
ext_dummy_pq_padding_add_serverhello,
|
2832
|
-
},
|
2833
|
-
{
|
2834
|
-
TLSEXT_TYPE_quic_transport_parameters,
|
2835
|
-
NULL,
|
2836
|
-
ext_quic_transport_params_add_clienthello,
|
2837
|
-
ext_quic_transport_params_parse_serverhello,
|
2838
|
-
ext_quic_transport_params_parse_clienthello,
|
2839
|
-
ext_quic_transport_params_add_serverhello,
|
2840
|
-
},
|
2841
|
-
// The final extension must be non-empty. WebSphere Application Server 7.0 is
|
2842
|
-
// intolerant to the last extension being zero-length. See
|
2843
|
-
// https://crbug.com/363583.
|
2844
|
-
{
|
2845
|
-
TLSEXT_TYPE_supported_groups,
|
2846
|
-
NULL,
|
2847
|
-
ext_supported_groups_add_clienthello,
|
2848
|
-
ext_supported_groups_parse_serverhello,
|
2849
|
-
ext_supported_groups_parse_clienthello,
|
2850
|
-
dont_add_serverhello,
|
2851
|
-
},
|
2852
|
-
{
|
2853
|
-
TLSEXT_TYPE_token_binding,
|
2854
|
-
NULL,
|
2855
|
-
ext_token_binding_add_clienthello,
|
2856
|
-
ext_token_binding_parse_serverhello,
|
2857
|
-
ext_token_binding_parse_clienthello,
|
2858
|
-
ext_token_binding_add_serverhello,
|
2859
|
-
},
|
2860
|
-
};
|
2861
|
-
|
2862
|
-
#define kNumExtensions (sizeof(kExtensions) / sizeof(struct tls_extension))
|
2863
|
-
|
2864
|
-
static_assert(kNumExtensions <=
|
2865
|
-
sizeof(((SSL_HANDSHAKE *)NULL)->extensions.sent) * 8,
|
2866
|
-
"too many extensions for sent bitset");
|
2867
|
-
static_assert(kNumExtensions <=
|
2868
|
-
sizeof(((SSL_HANDSHAKE *)NULL)->extensions.received) * 8,
|
2869
|
-
"too many extensions for received bitset");
|
2870
|
-
|
2871
|
-
static const struct tls_extension *tls_extension_find(uint32_t *out_index,
|
2872
|
-
uint16_t value) {
|
2873
|
-
unsigned i;
|
2874
|
-
for (i = 0; i < kNumExtensions; i++) {
|
2875
|
-
if (kExtensions[i].value == value) {
|
2876
|
-
*out_index = i;
|
2877
|
-
return &kExtensions[i];
|
2878
|
-
}
|
2879
|
-
}
|
2880
|
-
|
2881
|
-
return NULL;
|
2882
|
-
}
|
2883
|
-
|
2884
|
-
int ssl_add_clienthello_tlsext(SSL_HANDSHAKE *hs, CBB *out, size_t header_len) {
|
2885
|
-
SSL *const ssl = hs->ssl;
|
2886
|
-
// Don't add extensions for SSLv3 unless doing secure renegotiation.
|
2887
|
-
if (hs->client_version == SSL3_VERSION &&
|
2888
|
-
!ssl->s3->send_connection_binding) {
|
2889
|
-
return 1;
|
2890
|
-
}
|
2891
|
-
|
2892
|
-
CBB extensions;
|
2893
|
-
if (!CBB_add_u16_length_prefixed(out, &extensions)) {
|
2894
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
2895
|
-
return 0;
|
2896
|
-
}
|
2897
|
-
|
2898
|
-
hs->extensions.sent = 0;
|
2899
|
-
hs->custom_extensions.sent = 0;
|
2900
|
-
|
2901
|
-
for (size_t i = 0; i < kNumExtensions; i++) {
|
2902
|
-
if (kExtensions[i].init != NULL) {
|
2903
|
-
kExtensions[i].init(hs);
|
2904
|
-
}
|
2905
|
-
}
|
2906
|
-
|
2907
|
-
uint16_t grease_ext1 = 0;
|
2908
|
-
if (ssl->ctx->grease_enabled) {
|
2909
|
-
// Add a fake empty extension. See draft-davidben-tls-grease-01.
|
2910
|
-
grease_ext1 = ssl_get_grease_value(hs, ssl_grease_extension1);
|
2911
|
-
if (!CBB_add_u16(&extensions, grease_ext1) ||
|
2912
|
-
!CBB_add_u16(&extensions, 0 /* zero length */)) {
|
2913
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
2914
|
-
return 0;
|
2915
|
-
}
|
2916
|
-
}
|
2917
|
-
|
2918
|
-
for (size_t i = 0; i < kNumExtensions; i++) {
|
2919
|
-
const size_t len_before = CBB_len(&extensions);
|
2920
|
-
if (!kExtensions[i].add_clienthello(hs, &extensions)) {
|
2921
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_ERROR_ADDING_EXTENSION);
|
2922
|
-
ERR_add_error_dataf("extension %u", (unsigned)kExtensions[i].value);
|
2923
|
-
return 0;
|
2924
|
-
}
|
2925
|
-
|
2926
|
-
if (CBB_len(&extensions) != len_before) {
|
2927
|
-
hs->extensions.sent |= (1u << i);
|
2928
|
-
}
|
2929
|
-
}
|
2930
|
-
|
2931
|
-
if (!custom_ext_add_clienthello(hs, &extensions)) {
|
2932
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
2933
|
-
return 0;
|
2934
|
-
}
|
2935
|
-
|
2936
|
-
if (ssl->ctx->grease_enabled) {
|
2937
|
-
// Add a fake non-empty extension. See draft-davidben-tls-grease-01.
|
2938
|
-
uint16_t grease_ext2 = ssl_get_grease_value(hs, ssl_grease_extension2);
|
2939
|
-
|
2940
|
-
// The two fake extensions must not have the same value. GREASE values are
|
2941
|
-
// of the form 0x1a1a, 0x2a2a, 0x3a3a, etc., so XOR to generate a different
|
2942
|
-
// one.
|
2943
|
-
if (grease_ext1 == grease_ext2) {
|
2944
|
-
grease_ext2 ^= 0x1010;
|
2945
|
-
}
|
2946
|
-
|
2947
|
-
if (!CBB_add_u16(&extensions, grease_ext2) ||
|
2948
|
-
!CBB_add_u16(&extensions, 1 /* one byte length */) ||
|
2949
|
-
!CBB_add_u8(&extensions, 0 /* single zero byte as contents */)) {
|
2950
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
2951
|
-
return 0;
|
2952
|
-
}
|
2953
|
-
}
|
2954
|
-
|
2955
|
-
if (!SSL_is_dtls(ssl)) {
|
2956
|
-
size_t psk_extension_len = ext_pre_shared_key_clienthello_length(hs);
|
2957
|
-
header_len += 2 + CBB_len(&extensions) + psk_extension_len;
|
2958
|
-
if (header_len > 0xff && header_len < 0x200) {
|
2959
|
-
// Add padding to workaround bugs in F5 terminators. See RFC 7685.
|
2960
|
-
//
|
2961
|
-
// NB: because this code works out the length of all existing extensions
|
2962
|
-
// it MUST always appear last.
|
2963
|
-
size_t padding_len = 0x200 - header_len;
|
2964
|
-
// Extensions take at least four bytes to encode. Always include at least
|
2965
|
-
// one byte of data if including the extension. WebSphere Application
|
2966
|
-
// Server 7.0 is intolerant to the last extension being zero-length. See
|
2967
|
-
// https://crbug.com/363583.
|
2968
|
-
if (padding_len >= 4 + 1) {
|
2969
|
-
padding_len -= 4;
|
2970
|
-
} else {
|
2971
|
-
padding_len = 1;
|
2972
|
-
}
|
2973
|
-
|
2974
|
-
uint8_t *padding_bytes;
|
2975
|
-
if (!CBB_add_u16(&extensions, TLSEXT_TYPE_padding) ||
|
2976
|
-
!CBB_add_u16(&extensions, padding_len) ||
|
2977
|
-
!CBB_add_space(&extensions, &padding_bytes, padding_len)) {
|
2978
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
2979
|
-
return 0;
|
2980
|
-
}
|
2981
|
-
|
2982
|
-
OPENSSL_memset(padding_bytes, 0, padding_len);
|
2983
|
-
}
|
2984
|
-
}
|
2985
|
-
|
2986
|
-
// The PSK extension must be last, including after the padding.
|
2987
|
-
if (!ext_pre_shared_key_add_clienthello(hs, &extensions)) {
|
2988
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
2989
|
-
return 0;
|
2990
|
-
}
|
2991
|
-
|
2992
|
-
// Discard empty extensions blocks.
|
2993
|
-
if (CBB_len(&extensions) == 0) {
|
2994
|
-
CBB_discard_child(out);
|
2995
|
-
}
|
2996
|
-
|
2997
|
-
return CBB_flush(out);
|
2998
|
-
}
|
2999
|
-
|
3000
|
-
int ssl_add_serverhello_tlsext(SSL_HANDSHAKE *hs, CBB *out) {
|
3001
|
-
SSL *const ssl = hs->ssl;
|
3002
|
-
CBB extensions;
|
3003
|
-
if (!CBB_add_u16_length_prefixed(out, &extensions)) {
|
3004
|
-
goto err;
|
3005
|
-
}
|
3006
|
-
|
3007
|
-
for (unsigned i = 0; i < kNumExtensions; i++) {
|
3008
|
-
if (!(hs->extensions.received & (1u << i))) {
|
3009
|
-
// Don't send extensions that were not received.
|
3010
|
-
continue;
|
3011
|
-
}
|
3012
|
-
|
3013
|
-
if (!kExtensions[i].add_serverhello(hs, &extensions)) {
|
3014
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_ERROR_ADDING_EXTENSION);
|
3015
|
-
ERR_add_error_dataf("extension %u", (unsigned)kExtensions[i].value);
|
3016
|
-
goto err;
|
3017
|
-
}
|
3018
|
-
}
|
3019
|
-
|
3020
|
-
if (!custom_ext_add_serverhello(hs, &extensions)) {
|
3021
|
-
goto err;
|
3022
|
-
}
|
3023
|
-
|
3024
|
-
// Discard empty extensions blocks before TLS 1.3.
|
3025
|
-
if (ssl_protocol_version(ssl) < TLS1_3_VERSION &&
|
3026
|
-
CBB_len(&extensions) == 0) {
|
3027
|
-
CBB_discard_child(out);
|
3028
|
-
}
|
3029
|
-
|
3030
|
-
return CBB_flush(out);
|
3031
|
-
|
3032
|
-
err:
|
3033
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
3034
|
-
return 0;
|
3035
|
-
}
|
3036
|
-
|
3037
|
-
static int ssl_scan_clienthello_tlsext(SSL_HANDSHAKE *hs,
|
3038
|
-
const SSL_CLIENT_HELLO *client_hello,
|
3039
|
-
int *out_alert) {
|
3040
|
-
SSL *const ssl = hs->ssl;
|
3041
|
-
for (size_t i = 0; i < kNumExtensions; i++) {
|
3042
|
-
if (kExtensions[i].init != NULL) {
|
3043
|
-
kExtensions[i].init(hs);
|
3044
|
-
}
|
3045
|
-
}
|
3046
|
-
|
3047
|
-
hs->extensions.received = 0;
|
3048
|
-
hs->custom_extensions.received = 0;
|
3049
|
-
CBS extensions;
|
3050
|
-
CBS_init(&extensions, client_hello->extensions, client_hello->extensions_len);
|
3051
|
-
while (CBS_len(&extensions) != 0) {
|
3052
|
-
uint16_t type;
|
3053
|
-
CBS extension;
|
3054
|
-
|
3055
|
-
// Decode the next extension.
|
3056
|
-
if (!CBS_get_u16(&extensions, &type) ||
|
3057
|
-
!CBS_get_u16_length_prefixed(&extensions, &extension)) {
|
3058
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
3059
|
-
return 0;
|
3060
|
-
}
|
3061
|
-
|
3062
|
-
// RFC 5746 made the existence of extensions in SSL 3.0 somewhat
|
3063
|
-
// ambiguous. Ignore all but the renegotiation_info extension.
|
3064
|
-
if (ssl->version == SSL3_VERSION && type != TLSEXT_TYPE_renegotiate) {
|
3065
|
-
continue;
|
3066
|
-
}
|
3067
|
-
|
3068
|
-
unsigned ext_index;
|
3069
|
-
const struct tls_extension *const ext =
|
3070
|
-
tls_extension_find(&ext_index, type);
|
3071
|
-
|
3072
|
-
if (ext == NULL) {
|
3073
|
-
if (!custom_ext_parse_clienthello(hs, out_alert, type, &extension)) {
|
3074
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_ERROR_PARSING_EXTENSION);
|
3075
|
-
return 0;
|
3076
|
-
}
|
3077
|
-
continue;
|
3078
|
-
}
|
3079
|
-
|
3080
|
-
hs->extensions.received |= (1u << ext_index);
|
3081
|
-
uint8_t alert = SSL_AD_DECODE_ERROR;
|
3082
|
-
if (!ext->parse_clienthello(hs, &alert, &extension)) {
|
3083
|
-
*out_alert = alert;
|
3084
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_ERROR_PARSING_EXTENSION);
|
3085
|
-
ERR_add_error_dataf("extension %u", (unsigned)type);
|
3086
|
-
return 0;
|
3087
|
-
}
|
3088
|
-
}
|
3089
|
-
|
3090
|
-
for (size_t i = 0; i < kNumExtensions; i++) {
|
3091
|
-
if (hs->extensions.received & (1u << i)) {
|
3092
|
-
continue;
|
3093
|
-
}
|
3094
|
-
|
3095
|
-
CBS *contents = NULL, fake_contents;
|
3096
|
-
static const uint8_t kFakeRenegotiateExtension[] = {0};
|
3097
|
-
if (kExtensions[i].value == TLSEXT_TYPE_renegotiate &&
|
3098
|
-
ssl_client_cipher_list_contains_cipher(client_hello,
|
3099
|
-
SSL3_CK_SCSV & 0xffff)) {
|
3100
|
-
// The renegotiation SCSV was received so pretend that we received a
|
3101
|
-
// renegotiation extension.
|
3102
|
-
CBS_init(&fake_contents, kFakeRenegotiateExtension,
|
3103
|
-
sizeof(kFakeRenegotiateExtension));
|
3104
|
-
contents = &fake_contents;
|
3105
|
-
hs->extensions.received |= (1u << i);
|
3106
|
-
}
|
3107
|
-
|
3108
|
-
// Extension wasn't observed so call the callback with a NULL
|
3109
|
-
// parameter.
|
3110
|
-
uint8_t alert = SSL_AD_DECODE_ERROR;
|
3111
|
-
if (!kExtensions[i].parse_clienthello(hs, &alert, contents)) {
|
3112
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_MISSING_EXTENSION);
|
3113
|
-
ERR_add_error_dataf("extension %u", (unsigned)kExtensions[i].value);
|
3114
|
-
*out_alert = alert;
|
3115
|
-
return 0;
|
3116
|
-
}
|
3117
|
-
}
|
3118
|
-
|
3119
|
-
return 1;
|
3120
|
-
}
|
3121
|
-
|
3122
|
-
int ssl_parse_clienthello_tlsext(SSL_HANDSHAKE *hs,
|
3123
|
-
const SSL_CLIENT_HELLO *client_hello) {
|
3124
|
-
SSL *const ssl = hs->ssl;
|
3125
|
-
int alert = SSL_AD_DECODE_ERROR;
|
3126
|
-
if (ssl_scan_clienthello_tlsext(hs, client_hello, &alert) <= 0) {
|
3127
|
-
ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
|
3128
|
-
return 0;
|
3129
|
-
}
|
3130
|
-
|
3131
|
-
if (ssl_check_clienthello_tlsext(hs) <= 0) {
|
3132
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_CLIENTHELLO_TLSEXT);
|
3133
|
-
return 0;
|
3134
|
-
}
|
3135
|
-
|
3136
|
-
return 1;
|
3137
|
-
}
|
3138
|
-
|
3139
|
-
static int ssl_scan_serverhello_tlsext(SSL_HANDSHAKE *hs, CBS *cbs,
|
3140
|
-
int *out_alert) {
|
3141
|
-
SSL *const ssl = hs->ssl;
|
3142
|
-
// Before TLS 1.3, ServerHello extensions blocks may be omitted if empty.
|
3143
|
-
if (CBS_len(cbs) == 0 && ssl_protocol_version(ssl) < TLS1_3_VERSION) {
|
3144
|
-
return 1;
|
3145
|
-
}
|
3146
|
-
|
3147
|
-
// Decode the extensions block and check it is valid.
|
3148
|
-
CBS extensions;
|
3149
|
-
if (!CBS_get_u16_length_prefixed(cbs, &extensions) ||
|
3150
|
-
!tls1_check_duplicate_extensions(&extensions)) {
|
3151
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
3152
|
-
return 0;
|
3153
|
-
}
|
3154
|
-
|
3155
|
-
uint32_t received = 0;
|
3156
|
-
while (CBS_len(&extensions) != 0) {
|
3157
|
-
uint16_t type;
|
3158
|
-
CBS extension;
|
3159
|
-
|
3160
|
-
// Decode the next extension.
|
3161
|
-
if (!CBS_get_u16(&extensions, &type) ||
|
3162
|
-
!CBS_get_u16_length_prefixed(&extensions, &extension)) {
|
3163
|
-
*out_alert = SSL_AD_DECODE_ERROR;
|
3164
|
-
return 0;
|
3165
|
-
}
|
3166
|
-
|
3167
|
-
unsigned ext_index;
|
3168
|
-
const struct tls_extension *const ext =
|
3169
|
-
tls_extension_find(&ext_index, type);
|
3170
|
-
|
3171
|
-
if (ext == NULL) {
|
3172
|
-
hs->received_custom_extension = true;
|
3173
|
-
if (!custom_ext_parse_serverhello(hs, out_alert, type, &extension)) {
|
3174
|
-
return 0;
|
3175
|
-
}
|
3176
|
-
continue;
|
3177
|
-
}
|
3178
|
-
|
3179
|
-
static_assert(kNumExtensions <= sizeof(hs->extensions.sent) * 8,
|
3180
|
-
"too many bits");
|
3181
|
-
|
3182
|
-
if (!(hs->extensions.sent & (1u << ext_index)) &&
|
3183
|
-
type != TLSEXT_TYPE_renegotiate) {
|
3184
|
-
// If the extension was never sent then it is illegal, except for the
|
3185
|
-
// renegotiation extension which, in SSL 3.0, is signaled via SCSV.
|
3186
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_UNEXPECTED_EXTENSION);
|
3187
|
-
ERR_add_error_dataf("extension :%u", (unsigned)type);
|
3188
|
-
*out_alert = SSL_AD_UNSUPPORTED_EXTENSION;
|
3189
|
-
return 0;
|
3190
|
-
}
|
3191
|
-
|
3192
|
-
received |= (1u << ext_index);
|
3193
|
-
|
3194
|
-
uint8_t alert = SSL_AD_DECODE_ERROR;
|
3195
|
-
if (!ext->parse_serverhello(hs, &alert, &extension)) {
|
3196
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_ERROR_PARSING_EXTENSION);
|
3197
|
-
ERR_add_error_dataf("extension %u", (unsigned)type);
|
3198
|
-
*out_alert = alert;
|
3199
|
-
return 0;
|
3200
|
-
}
|
3201
|
-
}
|
3202
|
-
|
3203
|
-
for (size_t i = 0; i < kNumExtensions; i++) {
|
3204
|
-
if (!(received & (1u << i))) {
|
3205
|
-
// Extension wasn't observed so call the callback with a NULL
|
3206
|
-
// parameter.
|
3207
|
-
uint8_t alert = SSL_AD_DECODE_ERROR;
|
3208
|
-
if (!kExtensions[i].parse_serverhello(hs, &alert, NULL)) {
|
3209
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_MISSING_EXTENSION);
|
3210
|
-
ERR_add_error_dataf("extension %u", (unsigned)kExtensions[i].value);
|
3211
|
-
*out_alert = alert;
|
3212
|
-
return 0;
|
3213
|
-
}
|
3214
|
-
}
|
3215
|
-
}
|
3216
|
-
|
3217
|
-
return 1;
|
3218
|
-
}
|
3219
|
-
|
3220
|
-
static int ssl_check_clienthello_tlsext(SSL_HANDSHAKE *hs) {
|
3221
|
-
SSL *const ssl = hs->ssl;
|
3222
|
-
|
3223
|
-
if (ssl->token_binding_negotiated &&
|
3224
|
-
!(SSL_get_secure_renegotiation_support(ssl) &&
|
3225
|
-
SSL_get_extms_support(ssl))) {
|
3226
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NEGOTIATED_TB_WITHOUT_EMS_OR_RI);
|
3227
|
-
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_UNSUPPORTED_EXTENSION);
|
3228
|
-
return -1;
|
3229
|
-
}
|
3230
|
-
|
3231
|
-
int ret = SSL_TLSEXT_ERR_NOACK;
|
3232
|
-
int al = SSL_AD_UNRECOGNIZED_NAME;
|
3233
|
-
|
3234
|
-
if (ssl->ctx->tlsext_servername_callback != 0) {
|
3235
|
-
ret = ssl->ctx->tlsext_servername_callback(ssl, &al,
|
3236
|
-
ssl->ctx->tlsext_servername_arg);
|
3237
|
-
} else if (ssl->session_ctx->tlsext_servername_callback != 0) {
|
3238
|
-
ret = ssl->session_ctx->tlsext_servername_callback(
|
3239
|
-
ssl, &al, ssl->session_ctx->tlsext_servername_arg);
|
3240
|
-
}
|
3241
|
-
|
3242
|
-
switch (ret) {
|
3243
|
-
case SSL_TLSEXT_ERR_ALERT_FATAL:
|
3244
|
-
ssl_send_alert(ssl, SSL3_AL_FATAL, al);
|
3245
|
-
return -1;
|
3246
|
-
|
3247
|
-
case SSL_TLSEXT_ERR_NOACK:
|
3248
|
-
hs->should_ack_sni = false;
|
3249
|
-
return 1;
|
3250
|
-
|
3251
|
-
default:
|
3252
|
-
return 1;
|
3253
|
-
}
|
3254
|
-
}
|
3255
|
-
|
3256
|
-
int ssl_parse_serverhello_tlsext(SSL_HANDSHAKE *hs, CBS *cbs) {
|
3257
|
-
SSL *const ssl = hs->ssl;
|
3258
|
-
int alert = SSL_AD_DECODE_ERROR;
|
3259
|
-
if (ssl_scan_serverhello_tlsext(hs, cbs, &alert) <= 0) {
|
3260
|
-
ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
|
3261
|
-
return 0;
|
3262
|
-
}
|
3263
|
-
|
3264
|
-
return 1;
|
3265
|
-
}
|
3266
|
-
|
3267
|
-
static enum ssl_ticket_aead_result_t decrypt_ticket_with_cipher_ctx(
|
3268
|
-
uint8_t **out, size_t *out_len, EVP_CIPHER_CTX *cipher_ctx,
|
3269
|
-
HMAC_CTX *hmac_ctx, const uint8_t *ticket, size_t ticket_len) {
|
3270
|
-
size_t iv_len = EVP_CIPHER_CTX_iv_length(cipher_ctx);
|
3271
|
-
|
3272
|
-
// Check the MAC at the end of the ticket.
|
3273
|
-
uint8_t mac[EVP_MAX_MD_SIZE];
|
3274
|
-
size_t mac_len = HMAC_size(hmac_ctx);
|
3275
|
-
if (ticket_len < SSL_TICKET_KEY_NAME_LEN + iv_len + 1 + mac_len) {
|
3276
|
-
// The ticket must be large enough for key name, IV, data, and MAC.
|
3277
|
-
return ssl_ticket_aead_ignore_ticket;
|
3278
|
-
}
|
3279
|
-
HMAC_Update(hmac_ctx, ticket, ticket_len - mac_len);
|
3280
|
-
HMAC_Final(hmac_ctx, mac, NULL);
|
3281
|
-
int mac_ok =
|
3282
|
-
CRYPTO_memcmp(mac, ticket + (ticket_len - mac_len), mac_len) == 0;
|
3283
|
-
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
3284
|
-
mac_ok = 1;
|
3285
|
-
#endif
|
3286
|
-
if (!mac_ok) {
|
3287
|
-
return ssl_ticket_aead_ignore_ticket;
|
3288
|
-
}
|
3289
|
-
|
3290
|
-
// Decrypt the session data.
|
3291
|
-
const uint8_t *ciphertext = ticket + SSL_TICKET_KEY_NAME_LEN + iv_len;
|
3292
|
-
size_t ciphertext_len = ticket_len - SSL_TICKET_KEY_NAME_LEN - iv_len -
|
3293
|
-
mac_len;
|
3294
|
-
UniquePtr<uint8_t> plaintext((uint8_t *)OPENSSL_malloc(ciphertext_len));
|
3295
|
-
if (!plaintext) {
|
3296
|
-
return ssl_ticket_aead_error;
|
3297
|
-
}
|
3298
|
-
size_t plaintext_len;
|
3299
|
-
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
3300
|
-
OPENSSL_memcpy(plaintext.get(), ciphertext, ciphertext_len);
|
3301
|
-
plaintext_len = ciphertext_len;
|
3302
|
-
#else
|
3303
|
-
if (ciphertext_len >= INT_MAX) {
|
3304
|
-
return ssl_ticket_aead_ignore_ticket;
|
3305
|
-
}
|
3306
|
-
int len1, len2;
|
3307
|
-
if (!EVP_DecryptUpdate(cipher_ctx, plaintext.get(), &len1, ciphertext,
|
3308
|
-
(int)ciphertext_len) ||
|
3309
|
-
!EVP_DecryptFinal_ex(cipher_ctx, plaintext.get() + len1, &len2)) {
|
3310
|
-
ERR_clear_error();
|
3311
|
-
return ssl_ticket_aead_ignore_ticket;
|
3312
|
-
}
|
3313
|
-
plaintext_len = (size_t)(len1) + len2;
|
3314
|
-
#endif
|
3315
|
-
|
3316
|
-
*out = plaintext.release();
|
3317
|
-
*out_len = plaintext_len;
|
3318
|
-
return ssl_ticket_aead_success;
|
3319
|
-
}
|
3320
|
-
|
3321
|
-
static enum ssl_ticket_aead_result_t ssl_decrypt_ticket_with_cb(
|
3322
|
-
SSL *ssl, uint8_t **out, size_t *out_len, bool *out_renew_ticket,
|
3323
|
-
const uint8_t *ticket, size_t ticket_len) {
|
3324
|
-
assert(ticket_len >= SSL_TICKET_KEY_NAME_LEN + EVP_MAX_IV_LENGTH);
|
3325
|
-
ScopedEVP_CIPHER_CTX cipher_ctx;
|
3326
|
-
ScopedHMAC_CTX hmac_ctx;
|
3327
|
-
const uint8_t *iv = ticket + SSL_TICKET_KEY_NAME_LEN;
|
3328
|
-
int cb_ret = ssl->session_ctx->tlsext_ticket_key_cb(
|
3329
|
-
ssl, (uint8_t *)ticket /* name */, (uint8_t *)iv, cipher_ctx.get(),
|
3330
|
-
hmac_ctx.get(), 0 /* decrypt */);
|
3331
|
-
if (cb_ret < 0) {
|
3332
|
-
return ssl_ticket_aead_error;
|
3333
|
-
} else if (cb_ret == 0) {
|
3334
|
-
return ssl_ticket_aead_ignore_ticket;
|
3335
|
-
} else if (cb_ret == 2) {
|
3336
|
-
*out_renew_ticket = true;
|
3337
|
-
} else {
|
3338
|
-
assert(cb_ret == 1);
|
3339
|
-
}
|
3340
|
-
return decrypt_ticket_with_cipher_ctx(out, out_len, cipher_ctx.get(),
|
3341
|
-
hmac_ctx.get(), ticket, ticket_len);
|
3342
|
-
}
|
3343
|
-
|
3344
|
-
static enum ssl_ticket_aead_result_t ssl_decrypt_ticket_with_ticket_keys(
|
3345
|
-
SSL *ssl, uint8_t **out, size_t *out_len, const uint8_t *ticket,
|
3346
|
-
size_t ticket_len) {
|
3347
|
-
assert(ticket_len >= SSL_TICKET_KEY_NAME_LEN + EVP_MAX_IV_LENGTH);
|
3348
|
-
SSL_CTX *ctx = ssl->session_ctx;
|
3349
|
-
|
3350
|
-
// Rotate the ticket key if necessary.
|
3351
|
-
if (!ssl_ctx_rotate_ticket_encryption_key(ctx)) {
|
3352
|
-
return ssl_ticket_aead_error;
|
3353
|
-
}
|
3354
|
-
|
3355
|
-
// Pick the matching ticket key and decrypt.
|
3356
|
-
ScopedEVP_CIPHER_CTX cipher_ctx;
|
3357
|
-
ScopedHMAC_CTX hmac_ctx;
|
3358
|
-
{
|
3359
|
-
MutexReadLock lock(&ctx->lock);
|
3360
|
-
const tlsext_ticket_key *key;
|
3361
|
-
if (ctx->tlsext_ticket_key_current &&
|
3362
|
-
!OPENSSL_memcmp(ctx->tlsext_ticket_key_current->name, ticket,
|
3363
|
-
SSL_TICKET_KEY_NAME_LEN)) {
|
3364
|
-
key = ctx->tlsext_ticket_key_current;
|
3365
|
-
} else if (ctx->tlsext_ticket_key_prev &&
|
3366
|
-
!OPENSSL_memcmp(ctx->tlsext_ticket_key_prev->name, ticket,
|
3367
|
-
SSL_TICKET_KEY_NAME_LEN)) {
|
3368
|
-
key = ctx->tlsext_ticket_key_prev;
|
3369
|
-
} else {
|
3370
|
-
return ssl_ticket_aead_ignore_ticket;
|
3371
|
-
}
|
3372
|
-
const uint8_t *iv = ticket + SSL_TICKET_KEY_NAME_LEN;
|
3373
|
-
if (!HMAC_Init_ex(hmac_ctx.get(), key->hmac_key, sizeof(key->hmac_key),
|
3374
|
-
tlsext_tick_md(), NULL) ||
|
3375
|
-
!EVP_DecryptInit_ex(cipher_ctx.get(), EVP_aes_128_cbc(), NULL,
|
3376
|
-
key->aes_key, iv)) {
|
3377
|
-
return ssl_ticket_aead_error;
|
3378
|
-
}
|
3379
|
-
}
|
3380
|
-
return decrypt_ticket_with_cipher_ctx(out, out_len, cipher_ctx.get(),
|
3381
|
-
hmac_ctx.get(), ticket, ticket_len);
|
3382
|
-
}
|
3383
|
-
|
3384
|
-
static enum ssl_ticket_aead_result_t ssl_decrypt_ticket_with_method(
|
3385
|
-
SSL *ssl, uint8_t **out, size_t *out_len, bool *out_renew_ticket,
|
3386
|
-
const uint8_t *ticket, size_t ticket_len) {
|
3387
|
-
uint8_t *plaintext = (uint8_t *)OPENSSL_malloc(ticket_len);
|
3388
|
-
if (plaintext == NULL) {
|
3389
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
|
3390
|
-
return ssl_ticket_aead_error;
|
3391
|
-
}
|
3392
|
-
|
3393
|
-
size_t plaintext_len;
|
3394
|
-
const enum ssl_ticket_aead_result_t result =
|
3395
|
-
ssl->session_ctx->ticket_aead_method->open(
|
3396
|
-
ssl, plaintext, &plaintext_len, ticket_len, ticket, ticket_len);
|
3397
|
-
|
3398
|
-
if (result == ssl_ticket_aead_success) {
|
3399
|
-
*out = plaintext;
|
3400
|
-
plaintext = NULL;
|
3401
|
-
*out_len = plaintext_len;
|
3402
|
-
}
|
3403
|
-
|
3404
|
-
OPENSSL_free(plaintext);
|
3405
|
-
return result;
|
3406
|
-
}
|
3407
|
-
|
3408
|
-
enum ssl_ticket_aead_result_t ssl_process_ticket(
|
3409
|
-
SSL *ssl, UniquePtr<SSL_SESSION> *out_session, bool *out_renew_ticket,
|
3410
|
-
const uint8_t *ticket, size_t ticket_len, const uint8_t *session_id,
|
3411
|
-
size_t session_id_len) {
|
3412
|
-
*out_renew_ticket = false;
|
3413
|
-
out_session->reset();
|
3414
|
-
|
3415
|
-
if ((SSL_get_options(ssl) & SSL_OP_NO_TICKET) ||
|
3416
|
-
session_id_len > SSL_MAX_SSL_SESSION_ID_LENGTH) {
|
3417
|
-
return ssl_ticket_aead_ignore_ticket;
|
3418
|
-
}
|
3419
|
-
|
3420
|
-
uint8_t *plaintext = NULL;
|
3421
|
-
size_t plaintext_len;
|
3422
|
-
enum ssl_ticket_aead_result_t result;
|
3423
|
-
if (ssl->session_ctx->ticket_aead_method != NULL) {
|
3424
|
-
result = ssl_decrypt_ticket_with_method(
|
3425
|
-
ssl, &plaintext, &plaintext_len, out_renew_ticket, ticket, ticket_len);
|
3426
|
-
} else {
|
3427
|
-
// Ensure there is room for the key name and the largest IV
|
3428
|
-
// |tlsext_ticket_key_cb| may try to consume. The real limit may be lower,
|
3429
|
-
// but the maximum IV length should be well under the minimum size for the
|
3430
|
-
// session material and HMAC.
|
3431
|
-
if (ticket_len < SSL_TICKET_KEY_NAME_LEN + EVP_MAX_IV_LENGTH) {
|
3432
|
-
return ssl_ticket_aead_ignore_ticket;
|
3433
|
-
}
|
3434
|
-
if (ssl->session_ctx->tlsext_ticket_key_cb != NULL) {
|
3435
|
-
result = ssl_decrypt_ticket_with_cb(ssl, &plaintext, &plaintext_len,
|
3436
|
-
out_renew_ticket, ticket, ticket_len);
|
3437
|
-
} else {
|
3438
|
-
result = ssl_decrypt_ticket_with_ticket_keys(
|
3439
|
-
ssl, &plaintext, &plaintext_len, ticket, ticket_len);
|
3440
|
-
}
|
3441
|
-
}
|
3442
|
-
|
3443
|
-
if (result != ssl_ticket_aead_success) {
|
3444
|
-
return result;
|
3445
|
-
}
|
3446
|
-
|
3447
|
-
// Decode the session.
|
3448
|
-
UniquePtr<SSL_SESSION> session(
|
3449
|
-
SSL_SESSION_from_bytes(plaintext, plaintext_len, ssl->ctx));
|
3450
|
-
OPENSSL_free(plaintext);
|
3451
|
-
|
3452
|
-
if (!session) {
|
3453
|
-
ERR_clear_error(); // Don't leave an error on the queue.
|
3454
|
-
return ssl_ticket_aead_ignore_ticket;
|
3455
|
-
}
|
3456
|
-
|
3457
|
-
// Copy the client's session ID into the new session, to denote the ticket has
|
3458
|
-
// been accepted.
|
3459
|
-
OPENSSL_memcpy(session->session_id, session_id, session_id_len);
|
3460
|
-
session->session_id_length = session_id_len;
|
3461
|
-
|
3462
|
-
*out_session = std::move(session);
|
3463
|
-
return ssl_ticket_aead_success;
|
3464
|
-
}
|
3465
|
-
|
3466
|
-
bool tls1_parse_peer_sigalgs(SSL_HANDSHAKE *hs, const CBS *in_sigalgs) {
|
3467
|
-
// Extension ignored for inappropriate versions
|
3468
|
-
if (ssl_protocol_version(hs->ssl) < TLS1_2_VERSION) {
|
3469
|
-
return true;
|
3470
|
-
}
|
3471
|
-
|
3472
|
-
return parse_u16_array(in_sigalgs, &hs->peer_sigalgs);
|
3473
|
-
}
|
3474
|
-
|
3475
|
-
bool tls1_get_legacy_signature_algorithm(uint16_t *out, const EVP_PKEY *pkey) {
|
3476
|
-
switch (EVP_PKEY_id(pkey)) {
|
3477
|
-
case EVP_PKEY_RSA:
|
3478
|
-
*out = SSL_SIGN_RSA_PKCS1_MD5_SHA1;
|
3479
|
-
return true;
|
3480
|
-
case EVP_PKEY_EC:
|
3481
|
-
*out = SSL_SIGN_ECDSA_SHA1;
|
3482
|
-
return true;
|
3483
|
-
default:
|
3484
|
-
return false;
|
3485
|
-
}
|
3486
|
-
}
|
3487
|
-
|
3488
|
-
bool tls1_choose_signature_algorithm(SSL_HANDSHAKE *hs, uint16_t *out) {
|
3489
|
-
SSL *const ssl = hs->ssl;
|
3490
|
-
CERT *cert = ssl->cert;
|
3491
|
-
|
3492
|
-
// Before TLS 1.2, the signature algorithm isn't negotiated as part of the
|
3493
|
-
// handshake.
|
3494
|
-
if (ssl_protocol_version(ssl) < TLS1_2_VERSION) {
|
3495
|
-
if (!tls1_get_legacy_signature_algorithm(out, hs->local_pubkey.get())) {
|
3496
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_COMMON_SIGNATURE_ALGORITHMS);
|
3497
|
-
return false;
|
3498
|
-
}
|
3499
|
-
return true;
|
3500
|
-
}
|
3501
|
-
|
3502
|
-
Span<const uint16_t> sigalgs = kSignSignatureAlgorithms;
|
3503
|
-
if (cert->sigalgs != nullptr) {
|
3504
|
-
sigalgs = MakeConstSpan(cert->sigalgs, cert->num_sigalgs);
|
3505
|
-
}
|
3506
|
-
|
3507
|
-
Span<const uint16_t> peer_sigalgs = hs->peer_sigalgs;
|
3508
|
-
if (peer_sigalgs.empty() && ssl_protocol_version(ssl) < TLS1_3_VERSION) {
|
3509
|
-
// If the client didn't specify any signature_algorithms extension then
|
3510
|
-
// we can assume that it supports SHA1. See
|
3511
|
-
// http://tools.ietf.org/html/rfc5246#section-7.4.1.4.1
|
3512
|
-
static const uint16_t kDefaultPeerAlgorithms[] = {SSL_SIGN_RSA_PKCS1_SHA1,
|
3513
|
-
SSL_SIGN_ECDSA_SHA1};
|
3514
|
-
peer_sigalgs = kDefaultPeerAlgorithms;
|
3515
|
-
}
|
3516
|
-
|
3517
|
-
for (uint16_t sigalg : sigalgs) {
|
3518
|
-
// SSL_SIGN_RSA_PKCS1_MD5_SHA1 is an internal value and should never be
|
3519
|
-
// negotiated.
|
3520
|
-
if (sigalg == SSL_SIGN_RSA_PKCS1_MD5_SHA1 ||
|
3521
|
-
!ssl_private_key_supports_signature_algorithm(hs, sigalg)) {
|
3522
|
-
continue;
|
3523
|
-
}
|
3524
|
-
|
3525
|
-
for (uint16_t peer_sigalg : peer_sigalgs) {
|
3526
|
-
if (sigalg == peer_sigalg) {
|
3527
|
-
*out = sigalg;
|
3528
|
-
return true;
|
3529
|
-
}
|
3530
|
-
}
|
3531
|
-
}
|
3532
|
-
|
3533
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_COMMON_SIGNATURE_ALGORITHMS);
|
3534
|
-
return false;
|
3535
|
-
}
|
3536
|
-
|
3537
|
-
int tls1_verify_channel_id(SSL_HANDSHAKE *hs, const SSLMessage &msg) {
|
3538
|
-
SSL *const ssl = hs->ssl;
|
3539
|
-
// A Channel ID handshake message is structured to contain multiple
|
3540
|
-
// extensions, but the only one that can be present is Channel ID.
|
3541
|
-
uint16_t extension_type;
|
3542
|
-
CBS channel_id = msg.body, extension;
|
3543
|
-
if (!CBS_get_u16(&channel_id, &extension_type) ||
|
3544
|
-
!CBS_get_u16_length_prefixed(&channel_id, &extension) ||
|
3545
|
-
CBS_len(&channel_id) != 0 ||
|
3546
|
-
extension_type != TLSEXT_TYPE_channel_id ||
|
3547
|
-
CBS_len(&extension) != TLSEXT_CHANNEL_ID_SIZE) {
|
3548
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
|
3549
|
-
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
|
3550
|
-
return 0;
|
3551
|
-
}
|
3552
|
-
|
3553
|
-
UniquePtr<EC_GROUP> p256(EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1));
|
3554
|
-
if (!p256) {
|
3555
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_NO_P256_SUPPORT);
|
3556
|
-
return 0;
|
3557
|
-
}
|
3558
|
-
|
3559
|
-
UniquePtr<ECDSA_SIG> sig(ECDSA_SIG_new());
|
3560
|
-
UniquePtr<BIGNUM> x(BN_new()), y(BN_new());
|
3561
|
-
if (!sig || !x || !y) {
|
3562
|
-
return 0;
|
3563
|
-
}
|
3564
|
-
|
3565
|
-
const uint8_t *p = CBS_data(&extension);
|
3566
|
-
if (BN_bin2bn(p + 0, 32, x.get()) == NULL ||
|
3567
|
-
BN_bin2bn(p + 32, 32, y.get()) == NULL ||
|
3568
|
-
BN_bin2bn(p + 64, 32, sig->r) == NULL ||
|
3569
|
-
BN_bin2bn(p + 96, 32, sig->s) == NULL) {
|
3570
|
-
return 0;
|
3571
|
-
}
|
3572
|
-
|
3573
|
-
UniquePtr<EC_KEY> key(EC_KEY_new());
|
3574
|
-
UniquePtr<EC_POINT> point(EC_POINT_new(p256.get()));
|
3575
|
-
if (!key || !point ||
|
3576
|
-
!EC_POINT_set_affine_coordinates_GFp(p256.get(), point.get(), x.get(),
|
3577
|
-
y.get(), nullptr) ||
|
3578
|
-
!EC_KEY_set_group(key.get(), p256.get()) ||
|
3579
|
-
!EC_KEY_set_public_key(key.get(), point.get())) {
|
3580
|
-
return 0;
|
3581
|
-
}
|
3582
|
-
|
3583
|
-
uint8_t digest[EVP_MAX_MD_SIZE];
|
3584
|
-
size_t digest_len;
|
3585
|
-
if (!tls1_channel_id_hash(hs, digest, &digest_len)) {
|
3586
|
-
return 0;
|
3587
|
-
}
|
3588
|
-
|
3589
|
-
int sig_ok = ECDSA_do_verify(digest, digest_len, sig.get(), key.get());
|
3590
|
-
#if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
|
3591
|
-
sig_ok = 1;
|
3592
|
-
ERR_clear_error();
|
3593
|
-
#endif
|
3594
|
-
if (!sig_ok) {
|
3595
|
-
OPENSSL_PUT_ERROR(SSL, SSL_R_CHANNEL_ID_SIGNATURE_INVALID);
|
3596
|
-
ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_DECRYPT_ERROR);
|
3597
|
-
ssl->s3->tlsext_channel_id_valid = false;
|
3598
|
-
return 0;
|
3599
|
-
}
|
3600
|
-
|
3601
|
-
OPENSSL_memcpy(ssl->s3->tlsext_channel_id, p, 64);
|
3602
|
-
return 1;
|
3603
|
-
}
|
3604
|
-
|
3605
|
-
bool tls1_write_channel_id(SSL_HANDSHAKE *hs, CBB *cbb) {
|
3606
|
-
SSL *const ssl = hs->ssl;
|
3607
|
-
uint8_t digest[EVP_MAX_MD_SIZE];
|
3608
|
-
size_t digest_len;
|
3609
|
-
if (!tls1_channel_id_hash(hs, digest, &digest_len)) {
|
3610
|
-
return false;
|
3611
|
-
}
|
3612
|
-
|
3613
|
-
EC_KEY *ec_key = EVP_PKEY_get0_EC_KEY(ssl->tlsext_channel_id_private);
|
3614
|
-
if (ec_key == nullptr) {
|
3615
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
3616
|
-
return false;
|
3617
|
-
}
|
3618
|
-
|
3619
|
-
UniquePtr<BIGNUM> x(BN_new()), y(BN_new());
|
3620
|
-
if (!x || !y ||
|
3621
|
-
!EC_POINT_get_affine_coordinates_GFp(EC_KEY_get0_group(ec_key),
|
3622
|
-
EC_KEY_get0_public_key(ec_key),
|
3623
|
-
x.get(), y.get(), nullptr)) {
|
3624
|
-
return false;
|
3625
|
-
}
|
3626
|
-
|
3627
|
-
UniquePtr<ECDSA_SIG> sig(ECDSA_do_sign(digest, digest_len, ec_key));
|
3628
|
-
if (!sig) {
|
3629
|
-
return false;
|
3630
|
-
}
|
3631
|
-
|
3632
|
-
CBB child;
|
3633
|
-
if (!CBB_add_u16(cbb, TLSEXT_TYPE_channel_id) ||
|
3634
|
-
!CBB_add_u16_length_prefixed(cbb, &child) ||
|
3635
|
-
!BN_bn2cbb_padded(&child, 32, x.get()) ||
|
3636
|
-
!BN_bn2cbb_padded(&child, 32, y.get()) ||
|
3637
|
-
!BN_bn2cbb_padded(&child, 32, sig->r) ||
|
3638
|
-
!BN_bn2cbb_padded(&child, 32, sig->s) ||
|
3639
|
-
!CBB_flush(cbb)) {
|
3640
|
-
return false;
|
3641
|
-
}
|
3642
|
-
|
3643
|
-
return true;
|
3644
|
-
}
|
3645
|
-
|
3646
|
-
int tls1_channel_id_hash(SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len) {
|
3647
|
-
SSL *const ssl = hs->ssl;
|
3648
|
-
if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
|
3649
|
-
Array<uint8_t> msg;
|
3650
|
-
if (!tls13_get_cert_verify_signature_input(hs, &msg,
|
3651
|
-
ssl_cert_verify_channel_id)) {
|
3652
|
-
return 0;
|
3653
|
-
}
|
3654
|
-
SHA256(msg.data(), msg.size(), out);
|
3655
|
-
*out_len = SHA256_DIGEST_LENGTH;
|
3656
|
-
return 1;
|
3657
|
-
}
|
3658
|
-
|
3659
|
-
SHA256_CTX ctx;
|
3660
|
-
|
3661
|
-
SHA256_Init(&ctx);
|
3662
|
-
static const char kClientIDMagic[] = "TLS Channel ID signature";
|
3663
|
-
SHA256_Update(&ctx, kClientIDMagic, sizeof(kClientIDMagic));
|
3664
|
-
|
3665
|
-
if (ssl->session != NULL) {
|
3666
|
-
static const char kResumptionMagic[] = "Resumption";
|
3667
|
-
SHA256_Update(&ctx, kResumptionMagic, sizeof(kResumptionMagic));
|
3668
|
-
if (ssl->session->original_handshake_hash_len == 0) {
|
3669
|
-
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
|
3670
|
-
return 0;
|
3671
|
-
}
|
3672
|
-
SHA256_Update(&ctx, ssl->session->original_handshake_hash,
|
3673
|
-
ssl->session->original_handshake_hash_len);
|
3674
|
-
}
|
3675
|
-
|
3676
|
-
uint8_t hs_hash[EVP_MAX_MD_SIZE];
|
3677
|
-
size_t hs_hash_len;
|
3678
|
-
if (!hs->transcript.GetHash(hs_hash, &hs_hash_len)) {
|
3679
|
-
return 0;
|
3680
|
-
}
|
3681
|
-
SHA256_Update(&ctx, hs_hash, (size_t)hs_hash_len);
|
3682
|
-
SHA256_Final(out, &ctx);
|
3683
|
-
*out_len = SHA256_DIGEST_LENGTH;
|
3684
|
-
return 1;
|
3685
|
-
}
|
3686
|
-
|
3687
|
-
// tls1_record_handshake_hashes_for_channel_id records the current handshake
|
3688
|
-
// hashes in |hs->new_session| so that Channel ID resumptions can sign that
|
3689
|
-
// data.
|
3690
|
-
int tls1_record_handshake_hashes_for_channel_id(SSL_HANDSHAKE *hs) {
|
3691
|
-
SSL *const ssl = hs->ssl;
|
3692
|
-
// This function should never be called for a resumed session because the
|
3693
|
-
// handshake hashes that we wish to record are for the original, full
|
3694
|
-
// handshake.
|
3695
|
-
if (ssl->session != NULL) {
|
3696
|
-
return 0;
|
3697
|
-
}
|
3698
|
-
|
3699
|
-
static_assert(
|
3700
|
-
sizeof(hs->new_session->original_handshake_hash) == EVP_MAX_MD_SIZE,
|
3701
|
-
"original_handshake_hash is too small");
|
3702
|
-
|
3703
|
-
size_t digest_len;
|
3704
|
-
if (!hs->transcript.GetHash(hs->new_session->original_handshake_hash,
|
3705
|
-
&digest_len)) {
|
3706
|
-
return 0;
|
3707
|
-
}
|
3708
|
-
|
3709
|
-
static_assert(EVP_MAX_MD_SIZE <= 0xff,
|
3710
|
-
"EVP_MAX_MD_SIZE does not fit in uint8_t");
|
3711
|
-
hs->new_session->original_handshake_hash_len = (uint8_t)digest_len;
|
3712
|
-
|
3713
|
-
return 1;
|
3714
|
-
}
|
3715
|
-
|
3716
|
-
int ssl_do_channel_id_callback(SSL *ssl) {
|
3717
|
-
if (ssl->tlsext_channel_id_private != NULL ||
|
3718
|
-
ssl->ctx->channel_id_cb == NULL) {
|
3719
|
-
return 1;
|
3720
|
-
}
|
3721
|
-
|
3722
|
-
EVP_PKEY *key = NULL;
|
3723
|
-
ssl->ctx->channel_id_cb(ssl, &key);
|
3724
|
-
if (key == NULL) {
|
3725
|
-
// The caller should try again later.
|
3726
|
-
return 1;
|
3727
|
-
}
|
3728
|
-
|
3729
|
-
int ret = SSL_set1_tls_channel_id(ssl, key);
|
3730
|
-
EVP_PKEY_free(key);
|
3731
|
-
return ret;
|
3732
|
-
}
|
3733
|
-
|
3734
|
-
int ssl_is_sct_list_valid(const CBS *contents) {
|
3735
|
-
// Shallow parse the SCT list for sanity. By the RFC
|
3736
|
-
// (https://tools.ietf.org/html/rfc6962#section-3.3) neither the list nor any
|
3737
|
-
// of the SCTs may be empty.
|
3738
|
-
CBS copy = *contents;
|
3739
|
-
CBS sct_list;
|
3740
|
-
if (!CBS_get_u16_length_prefixed(©, &sct_list) ||
|
3741
|
-
CBS_len(©) != 0 ||
|
3742
|
-
CBS_len(&sct_list) == 0) {
|
3743
|
-
return 0;
|
3744
|
-
}
|
3745
|
-
|
3746
|
-
while (CBS_len(&sct_list) > 0) {
|
3747
|
-
CBS sct;
|
3748
|
-
if (!CBS_get_u16_length_prefixed(&sct_list, &sct) ||
|
3749
|
-
CBS_len(&sct) == 0) {
|
3750
|
-
return 0;
|
3751
|
-
}
|
3752
|
-
}
|
3753
|
-
|
3754
|
-
return 1;
|
3755
|
-
}
|
3756
|
-
|
3757
|
-
} // namespace bssl
|
3758
|
-
|
3759
|
-
using namespace bssl;
|
3760
|
-
|
3761
|
-
int SSL_early_callback_ctx_extension_get(const SSL_CLIENT_HELLO *client_hello,
|
3762
|
-
uint16_t extension_type,
|
3763
|
-
const uint8_t **out_data,
|
3764
|
-
size_t *out_len) {
|
3765
|
-
CBS cbs;
|
3766
|
-
if (!ssl_client_hello_get_extension(client_hello, &cbs, extension_type)) {
|
3767
|
-
return 0;
|
3768
|
-
}
|
3769
|
-
|
3770
|
-
*out_data = CBS_data(&cbs);
|
3771
|
-
*out_len = CBS_len(&cbs);
|
3772
|
-
return 1;
|
3773
|
-
}
|
3774
|
-
|
3775
|
-
void SSL_CTX_set_ed25519_enabled(SSL_CTX *ctx, int enabled) {
|
3776
|
-
ctx->ed25519_enabled = !!enabled;
|
3777
|
-
}
|
3778
|
-
|
3779
|
-
int SSL_extension_supported(unsigned extension_value) {
|
3780
|
-
uint32_t index;
|
3781
|
-
return extension_value == TLSEXT_TYPE_padding ||
|
3782
|
-
tls_extension_find(&index, extension_value) != NULL;
|
3783
|
-
}
|