grpc 1.85.0 → 1.86.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (634) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +13 -9
  3. data/etc/roots.pem +0 -583
  4. data/include/grpc/channel_factory.h +78 -0
  5. data/include/grpc/credentials.h +21 -0
  6. data/include/grpc/grpc.h +7 -0
  7. data/include/grpc/grpc_security_constants.h +2 -0
  8. data/include/grpc/module.modulemap +1 -0
  9. data/src/core/call/call_filters.cc +4 -1
  10. data/src/core/call/call_filters.h +3 -1
  11. data/src/core/call/call_spine.h +12 -6
  12. data/src/core/call/call_state.h +3 -3
  13. data/src/core/call/client_call.cc +4 -1
  14. data/src/core/call/client_call.h +1 -0
  15. data/src/core/call/evaluate_args.cc +15 -14
  16. data/src/core/call/filter_fusion.h +2 -15
  17. data/src/core/call/interception_chain.h +2 -7
  18. data/src/core/call/metadata_batch.cc +5 -0
  19. data/src/core/call/metadata_batch.h +34 -3
  20. data/src/core/call/request_buffer.cc +1 -1
  21. data/src/core/call/server_call.cc +3 -3
  22. data/src/core/call/server_call.h +15 -0
  23. data/src/core/channelz/channelz_registry.cc +4 -4
  24. data/src/core/channelz/ztrace_collector.h +11 -2
  25. data/src/core/client_channel/backup_poller.cc +1 -2
  26. data/src/core/client_channel/channel_factory.cc +110 -0
  27. data/src/core/client_channel/channel_factory.h +45 -0
  28. data/src/core/client_channel/global_subchannel_pool.cc +2 -2
  29. data/src/core/client_channel/lame_channel.cc +59 -0
  30. data/src/core/client_channel/lame_channel.h +86 -0
  31. data/src/core/credentials/call/external/aws_request_signer.cc +2 -1
  32. data/src/core/credentials/call/external/url_external_account_credentials.cc +6 -17
  33. data/src/core/credentials/call/external/url_external_account_credentials.h +0 -1
  34. data/src/core/credentials/call/jwt/jwt_verifier.cc +25 -13
  35. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +6 -4
  36. data/src/core/credentials/call/regional_access_boundary_fetcher.cc +16 -0
  37. data/src/core/credentials/call/regional_access_boundary_fetcher.h +6 -2
  38. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +14 -0
  39. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +12 -2
  40. data/src/core/credentials/transport/tls/ssl_utils.cc +20 -0
  41. data/src/core/credentials/transport/tls/ssl_utils.h +4 -0
  42. data/src/core/credentials/transport/tls/tls_security_connector.cc +6 -2
  43. data/src/core/ext/filters/http/server/http_server_filter.cc +6 -1
  44. data/src/core/ext/filters/rbac/rbac_filter.cc +3 -41
  45. data/src/core/ext/filters/rbac/rbac_filter.h +2 -11
  46. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
  47. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +31 -24
  48. data/src/core/ext/transport/chttp2/server/chttp2_server.h +1 -2
  49. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +69 -102
  50. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -1
  51. data/src/core/ext/transport/chttp2/transport/flow_control.h +2 -2
  52. data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +1 -1
  53. data/src/core/ext/transport/chttp2/transport/frame.cc +15 -19
  54. data/src/core/ext/transport/chttp2/transport/frame.h +1 -1
  55. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +18 -61
  56. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +0 -4
  57. data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -2
  58. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +9 -0
  59. data/src/core/ext/transport/chttp2/transport/goaway.cc +1 -1
  60. data/src/core/ext/transport/chttp2/transport/goaway.h +0 -5
  61. data/src/core/ext/transport/chttp2/transport/header_assembler.h +1 -5
  62. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +3 -0
  63. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +8 -0
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +33 -0
  65. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +34 -19
  66. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +5 -2
  67. data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +134 -82
  68. data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +30 -15
  69. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +4 -3
  70. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +9 -33
  71. data/src/core/ext/transport/chttp2/transport/http2_transport.h +1 -6
  72. data/src/core/ext/transport/chttp2/transport/http2_transport_stats.h +60 -0
  73. data/src/core/ext/transport/chttp2/transport/internal.h +6 -1
  74. data/src/core/ext/transport/chttp2/transport/keepalive.h +1 -4
  75. data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -8
  76. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +35 -11
  77. data/src/core/ext/transport/chttp2/transport/ping_promise.h +52 -47
  78. data/src/core/ext/transport/chttp2/transport/read_context.h +19 -5
  79. data/src/core/ext/transport/chttp2/transport/security_frame.h +7 -6
  80. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +7 -5
  81. data/src/core/ext/transport/chttp2/transport/transport_common.cc +47 -0
  82. data/src/core/ext/transport/chttp2/transport/transport_common.h +29 -0
  83. data/src/core/ext/transport/chttp2/transport/writable_streams.h +1 -1
  84. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +1 -7
  85. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb.h +16 -0
  86. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb_minitable.c +4 -3
  87. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +129 -81
  88. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +50 -39
  89. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +411 -163
  90. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +95 -44
  91. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.h +3 -0
  92. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb.h +41 -8
  93. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb_minitable.c +8 -5
  94. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +427 -222
  95. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +97 -66
  96. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.h +1 -0
  97. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb.h +130 -99
  98. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb_minitable.c +29 -27
  99. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +49 -33
  100. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +19 -8
  101. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +95 -3
  102. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +33 -6
  103. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +1 -0
  104. data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb.h +93 -11
  105. data/src/core/ext/upb-gen/envoy/config/core/v3/http_service.upb_minitable.c +8 -5
  106. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +656 -134
  107. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +117 -51
  108. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.h +2 -0
  109. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +45 -23
  110. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +19 -10
  111. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +99 -34
  112. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +12 -7
  113. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +344 -273
  114. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +62 -69
  115. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +1 -3
  116. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +53 -22
  117. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +9 -7
  118. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +108 -0
  119. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.c +26 -2
  120. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb_minitable.h +1 -0
  121. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +809 -231
  122. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +183 -77
  123. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +3 -0
  124. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +151 -26
  125. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +17 -9
  126. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +24 -8
  127. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +6 -5
  128. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb.h +2 -1
  129. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb.h +224 -16
  130. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.c +83 -10
  131. data/src/core/ext/upb-gen/envoy/extensions/filters/http/composite/v3/composite.upb_minitable.h +2 -0
  132. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +95 -79
  133. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +23 -22
  134. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb.h +34 -18
  135. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.c +10 -9
  136. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +243 -2
  137. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +53 -5
  138. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h +3 -0
  139. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb.h +53 -22
  140. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb_minitable.c +9 -7
  141. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +23 -7
  142. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +9 -4
  143. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +516 -215
  144. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +99 -60
  145. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +1 -0
  146. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +60 -28
  147. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +12 -10
  148. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +109 -0
  149. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +32 -2
  150. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +1 -0
  151. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +37 -4
  152. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +7 -4
  153. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +65 -47
  154. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +29 -12
  155. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +20 -4
  156. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb_minitable.c +6 -3
  157. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +776 -88
  158. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +195 -35
  159. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +5 -0
  160. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb.h +23 -7
  161. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.c +10 -3
  162. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb.h +44 -0
  163. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.c +11 -2
  164. data/src/core/ext/upb-gen/envoy/type/matcher/v3/status_code_input.upb_minitable.h +1 -0
  165. data/src/core/ext/upb-gen/envoy/type/v3/scope.upb.h +218 -0
  166. data/src/core/ext/upb-gen/envoy/type/v3/scope.upb_minitable.c +70 -0
  167. data/src/core/ext/upb-gen/envoy/type/v3/scope.upb_minitable.h +31 -0
  168. data/src/core/ext/upbdefs-gen/envoy/admin/v3/clusters.upbdefs.c +30 -24
  169. data/src/core/ext/upbdefs-gen/envoy/admin/v3/server_info.upbdefs.c +166 -152
  170. data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +467 -422
  171. data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +15 -0
  172. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +120 -110
  173. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +912 -857
  174. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.h +5 -0
  175. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/outlier_detection.upbdefs.c +26 -19
  176. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +59 -54
  177. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +356 -346
  178. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
  179. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/http_service.upbdefs.c +49 -37
  180. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +599 -483
  181. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.h +10 -0
  182. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +65 -49
  183. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +165 -161
  184. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +369 -327
  185. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -15
  186. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +129 -121
  187. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +224 -204
  188. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.h +5 -0
  189. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +2046 -1932
  190. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +15 -0
  191. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +70 -37
  192. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +7 -3
  193. data/src/core/ext/upbdefs-gen/envoy/data/accesslog/v3/accesslog.upbdefs.c +5 -3
  194. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.c +121 -78
  195. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/composite/v3/composite.upbdefs.h +10 -0
  196. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +165 -160
  197. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +121 -118
  198. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.c +68 -37
  199. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h +15 -0
  200. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/router/v3/router.upbdefs.c +48 -40
  201. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +44 -37
  202. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +919 -870
  203. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  204. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +26 -14
  205. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +44 -36
  206. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +372 -371
  207. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +32 -28
  208. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.c +17 -15
  209. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.c +4 -1
  210. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.h +5 -0
  211. data/src/core/ext/upbdefs-gen/envoy/type/v3/scope.upbdefs.c +76 -0
  212. data/src/core/ext/upbdefs-gen/envoy/type/v3/scope.upbdefs.h +37 -0
  213. data/src/core/ext/upbdefs-gen/envoy/type/v3/token_bucket.upbdefs.c +1 -1
  214. data/src/core/filter/ext_proc/ext_proc_filter.cc +537 -259
  215. data/src/core/filter/ext_proc/ext_proc_filter.h +47 -14
  216. data/src/core/filter/ext_proc/ext_proc_messages.cc +38 -17
  217. data/src/core/filter/ext_proc/ext_proc_messages.h +19 -7
  218. data/src/core/filter/filter_args.h +5 -60
  219. data/src/core/handshaker/http_connect/http_connect_client_handshaker.cc +1 -1
  220. data/src/core/handshaker/security/pipelined_secure_endpoint.cc +23 -22
  221. data/src/core/handshaker/security/secure_endpoint.cc +16 -16
  222. data/src/core/lib/channel/channel_stack.cc +0 -12
  223. data/src/core/lib/channel/channel_stack.h +0 -8
  224. data/src/core/lib/channel/promise_based_filter.cc +57 -44
  225. data/src/core/lib/channel/promise_based_filter.h +29 -41
  226. data/src/core/lib/event_engine/ares_resolver.cc +10 -4
  227. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +1 -1
  228. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +3 -3
  229. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -5
  230. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -12
  231. data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +3 -17
  232. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +21 -1
  233. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +5 -5
  234. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +10 -12
  235. data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
  236. data/src/core/lib/event_engine/posix_engine/timer.cc +2 -2
  237. data/src/core/lib/event_engine/shim.cc +1 -6
  238. data/src/core/lib/event_engine/shim.h +0 -5
  239. data/src/core/lib/event_engine/windows/windows_engine.cc +4 -4
  240. data/src/core/lib/event_engine/windows/windows_listener.cc +1 -1
  241. data/src/core/lib/experiments/experiments.cc +144 -261
  242. data/src/core/lib/experiments/experiments.h +48 -120
  243. data/src/core/lib/iomgr/iomgr_windows.cc +1 -6
  244. data/src/core/lib/iomgr/tcp_posix.cc +21 -21
  245. data/src/core/lib/iomgr/tcp_server_posix.cc +64 -242
  246. data/src/core/lib/iomgr/tcp_server_windows.cc +0 -469
  247. data/src/core/lib/promise/activity.cc +8 -8
  248. data/src/core/lib/promise/activity.h +5 -5
  249. data/src/core/lib/promise/inter_activity_pipe.h +3 -3
  250. data/src/core/lib/promise/party.cc +5 -5
  251. data/src/core/lib/promise/status_flag.h +7 -2
  252. data/src/core/lib/resource_quota/memory_quota.cc +2 -2
  253. data/src/core/lib/security/authorization/rbac_policy.h +2 -2
  254. data/src/core/lib/surface/call.cc +13 -3
  255. data/src/core/lib/surface/call.h +23 -6
  256. data/src/core/lib/surface/channel_create.cc +7 -1
  257. data/src/core/lib/surface/channel_init.h +1 -8
  258. data/src/core/lib/surface/filter_stack_call.cc +16 -0
  259. data/src/core/lib/surface/filter_stack_call.h +1 -0
  260. data/src/core/lib/surface/init.cc +3 -3
  261. data/src/core/lib/surface/legacy_channel.cc +4 -1
  262. data/src/core/lib/surface/version.cc +2 -2
  263. data/src/core/lib/transport/transport.cc +15 -8
  264. data/src/core/lib/transport/transport_framing_endpoint_extension.h +8 -2
  265. data/src/core/load_balancing/outlier_detection/outlier_detection.cc +99 -8
  266. data/src/core/load_balancing/outlier_detection/outlier_detection_metrics.cc +38 -0
  267. data/src/core/load_balancing/outlier_detection/outlier_detection_metrics.h +55 -0
  268. data/src/core/load_balancing/ring_hash/ring_hash.cc +2 -1
  269. data/src/core/load_balancing/rls/rls.cc +21 -1
  270. data/src/core/load_balancing/xds/cds.cc +4 -51
  271. data/src/core/plugin_registry/grpc_plugin_registry.cc +10 -13
  272. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -7
  273. data/src/core/resolver/xds/xds_resolver.cc +1 -1
  274. data/src/core/server/server.cc +60 -4
  275. data/src/core/server/server_config_selector.h +4 -18
  276. data/src/core/server/server_config_selector_filter.cc +20 -146
  277. data/src/core/server/server_config_selector_filter.h +2 -2
  278. data/src/core/server/xds_server_config_fetcher.cc +5 -20
  279. data/src/core/transport/auth_context.cc +15 -5
  280. data/src/core/transport/auth_context.h +5 -0
  281. data/src/core/tsi/ssl_telemetry_utils.cc +9 -1
  282. data/src/core/tsi/ssl_transport_security.cc +158 -52
  283. data/src/core/tsi/ssl_transport_security.h +18 -2
  284. data/src/core/tsi/ssl_transport_security_utils.cc +123 -12
  285. data/src/core/tsi/ssl_transport_security_utils.h +19 -0
  286. data/src/core/util/latent_see.cc +65 -3
  287. data/src/core/util/latent_see.h +57 -12
  288. data/src/core/util/linux/cpu.cc +12 -6
  289. data/src/core/util/mpscq.cc +2 -2
  290. data/src/core/util/sync_abseil.cc +3 -3
  291. data/src/core/util/trie_lookup.h +5 -1
  292. data/src/core/util/windows/env.cc +1 -0
  293. data/src/core/util/work_serializer.cc +1 -1
  294. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +10 -9
  295. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +3 -3
  296. data/src/core/xds/grpc/streaming_call_promise_wrapper.cc +5 -2
  297. data/src/core/xds/grpc/streaming_call_promise_wrapper.h +2 -5
  298. data/src/core/xds/grpc/xds_audit_logger_registry.cc +0 -54
  299. data/src/core/xds/grpc/xds_audit_logger_registry.h +0 -8
  300. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +2 -28
  301. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +0 -20
  302. data/src/core/xds/grpc/xds_client_grpc.cc +4 -4
  303. data/src/core/xds/grpc/xds_client_grpc.h +1 -1
  304. data/src/core/xds/grpc/xds_cluster_parser.cc +5 -1
  305. data/src/core/xds/grpc/xds_common_types_parser.cc +12 -0
  306. data/src/core/xds/grpc/xds_endpoint_parser.cc +3 -3
  307. data/src/core/xds/grpc/xds_http_composite_filter.cc +0 -5
  308. data/src/core/xds/grpc/xds_http_composite_filter.h +1 -27
  309. data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +1 -5
  310. data/src/core/xds/grpc/xds_http_ext_proc_filter.h +3 -29
  311. data/src/core/xds/grpc/xds_http_fault_filter.cc +0 -4
  312. data/src/core/xds/grpc/xds_http_fault_filter.h +0 -26
  313. data/src/core/xds/grpc/xds_http_filter.h +1 -63
  314. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +0 -5
  315. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +1 -27
  316. data/src/core/xds/grpc/xds_http_rbac_filter.cc +0 -527
  317. data/src/core/xds/grpc/xds_http_rbac_filter.h +0 -15
  318. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +0 -5
  319. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +0 -26
  320. data/src/core/xds/grpc/xds_listener.cc +0 -2
  321. data/src/core/xds/grpc/xds_listener.h +0 -2
  322. data/src/core/xds/grpc/xds_listener_parser.cc +0 -7
  323. data/src/core/xds/grpc/xds_matcher.cc +17 -11
  324. data/src/core/xds/grpc/xds_matcher.h +2 -1
  325. data/src/core/xds/grpc/xds_matcher_context.cc +11 -0
  326. data/src/core/xds/grpc/xds_matcher_context.h +3 -2
  327. data/src/core/xds/grpc/xds_matcher_input.cc +19 -1
  328. data/src/core/xds/grpc/xds_matcher_parse.cc +3 -2
  329. data/src/core/xds/grpc/xds_route_config.cc +0 -2
  330. data/src/core/xds/grpc/xds_route_config.h +0 -2
  331. data/src/core/xds/grpc/xds_route_config_parser.cc +0 -5
  332. data/src/core/xds/grpc/xds_routing.cc +22 -112
  333. data/src/core/xds/grpc/xds_routing.h +2 -27
  334. data/src/core/xds/grpc/xds_transport_factory_grpc.cc +236 -0
  335. data/src/core/xds/grpc/xds_transport_factory_grpc.h +95 -0
  336. data/src/core/xds/grpc/xds_transport_grpc.cc +78 -241
  337. data/src/core/xds/grpc/xds_transport_grpc.h +41 -51
  338. data/src/core/xds/xds_client/lrs_client.cc +3 -5
  339. data/src/core/xds/xds_client/lrs_client.h +2 -1
  340. data/src/core/xds/xds_client/xds_client.cc +36 -23
  341. data/src/core/xds/xds_client/xds_client.h +6 -5
  342. data/src/core/xds/xds_client/xds_transport.h +110 -108
  343. data/src/core/xds/xds_client/xds_transport_factory.h +43 -0
  344. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  345. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  346. data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
  347. data/src/ruby/lib/grpc/version.rb +1 -1
  348. data/third_party/boringssl-with-bazel/crypto/asn1/a_type.cc +54 -19
  349. data/third_party/boringssl-with-bazel/crypto/asn1/asn1_lib.cc +1 -1
  350. data/third_party/boringssl-with-bazel/crypto/asn1/internal.h +58 -12
  351. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_dec.cc +13 -13
  352. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_enc.cc +13 -11
  353. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_fre.cc +14 -18
  354. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_new.cc +31 -35
  355. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_typ.cc +0 -2
  356. data/third_party/boringssl-with-bazel/crypto/asn1/tasn_utl.cc +17 -24
  357. data/third_party/boringssl-with-bazel/crypto/bio/bio.cc +0 -1
  358. data/third_party/boringssl-with-bazel/crypto/bio/bio_mem.cc +9 -3
  359. data/third_party/boringssl-with-bazel/crypto/bio/connect.cc +3 -3
  360. data/third_party/boringssl-with-bazel/crypto/bio/fd.cc +0 -1
  361. data/third_party/boringssl-with-bazel/crypto/bio/file.cc +0 -1
  362. data/third_party/boringssl-with-bazel/crypto/bio/internal.h +2 -3
  363. data/third_party/boringssl-with-bazel/crypto/bio/pair.cc +0 -1
  364. data/third_party/boringssl-with-bazel/crypto/bio/socket.cc +1 -1
  365. data/third_party/boringssl-with-bazel/crypto/bytestring/cbb.cc +70 -45
  366. data/third_party/boringssl-with-bazel/crypto/bytestring/cbs.cc +15 -34
  367. data/third_party/boringssl-with-bazel/crypto/bytestring/internal.h +5 -0
  368. data/third_party/boringssl-with-bazel/crypto/cipher/e_aesgcmsiv.cc +20 -165
  369. data/third_party/boringssl-with-bazel/crypto/cipher/e_tls.cc +7 -4
  370. data/third_party/boringssl-with-bazel/crypto/cipher/internal.h +159 -0
  371. data/third_party/boringssl-with-bazel/crypto/curve25519/curve25519.cc +295 -16
  372. data/third_party/boringssl-with-bazel/crypto/curve25519/internal.h +25 -14
  373. data/third_party/boringssl-with-bazel/crypto/dh/params.cc +1 -1
  374. data/third_party/boringssl-with-bazel/crypto/ec/hash_to_curve.cc +208 -36
  375. data/third_party/boringssl-with-bazel/crypto/err/err.cc +3 -2
  376. data/third_party/boringssl-with-bazel/crypto/evp/evp.cc +3 -0
  377. data/third_party/boringssl-with-bazel/crypto/evp/evp_kem.cc +25 -6
  378. data/third_party/boringssl-with-bazel/crypto/evp/internal.h +15 -11
  379. data/third_party/boringssl-with-bazel/crypto/evp/p_ec.cc +121 -0
  380. data/third_party/boringssl-with-bazel/crypto/evp/p_mlkem.cc +34 -9
  381. data/third_party/boringssl-with-bazel/crypto/evp/p_rsa.cc +76 -8
  382. data/third_party/boringssl-with-bazel/crypto/evp/p_xwing.cc +47 -20
  383. data/third_party/boringssl-with-bazel/crypto/ex_data.cc +1 -1
  384. data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/aes_nohw.cc.inc +1 -1
  385. data/third_party/boringssl-with-bazel/crypto/fipsmodule/aes/gcm.cc.inc +2 -2
  386. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bcm.cc +1 -0
  387. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/add.cc.inc +9 -4
  388. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +4 -4
  389. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/exponentiation.cc.inc +2 -2
  390. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/internal.h +12 -6
  391. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/jacobi.cc.inc +1 -1
  392. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/montgomery_inv.cc.inc +4 -4
  393. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/prime.cc.inc +3 -3
  394. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/rsaz_exp.cc.inc +6 -6
  395. data/third_party/boringssl-with-bazel/crypto/fipsmodule/bn/sqrt.cc.inc +21 -21
  396. data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/aead.cc.inc +4 -2
  397. data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/cipher.cc.inc +97 -132
  398. data/third_party/boringssl-with-bazel/crypto/fipsmodule/cipher/internal.h +7 -6
  399. data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/dh.cc.inc +3 -3
  400. data/third_party/boringssl-with-bazel/crypto/fipsmodule/dh/internal.h +1 -1
  401. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec.cc.inc +77 -17
  402. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/ec_montgomery.cc.inc +13 -13
  403. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/felem.cc.inc +117 -34
  404. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/internal.h +67 -18
  405. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/oct.cc.inc +29 -151
  406. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.cc.inc +740 -0
  407. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256-nistz.h +207 -0
  408. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256.cc.inc +407 -519
  409. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/simple.cc.inc +27 -28
  410. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +1 -1
  411. data/third_party/boringssl-with-bazel/crypto/fipsmodule/entropy/jitter.cc.inc +1 -1
  412. data/third_party/boringssl-with-bazel/crypto/fipsmodule/fips_shared_support.cc +4 -4
  413. data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/internal.h +70 -1
  414. data/third_party/boringssl-with-bazel/crypto/fipsmodule/keccak/keccak.cc.inc +292 -52
  415. data/third_party/boringssl-with-bazel/crypto/fipsmodule/mldsa/mldsa.cc.inc +226 -69
  416. data/third_party/boringssl-with-bazel/crypto/fipsmodule/mlkem/mlkem.cc.inc +238 -83
  417. data/third_party/boringssl-with-bazel/crypto/fipsmodule/rsa/rsa_impl.cc.inc +6 -6
  418. data/third_party/boringssl-with-bazel/crypto/fipsmodule/sha/sha1.cc.inc +2 -2
  419. data/third_party/boringssl-with-bazel/crypto/fipsmodule/slhdsa/fors.cc.inc +1 -1
  420. data/third_party/boringssl-with-bazel/crypto/hpke/hpke.cc +327 -272
  421. data/third_party/boringssl-with-bazel/crypto/hrss/hrss.cc +14 -14
  422. data/third_party/boringssl-with-bazel/crypto/internal.h +63 -0
  423. data/third_party/boringssl-with-bazel/crypto/mem_internal.h +38 -3
  424. data/third_party/boringssl-with-bazel/crypto/obj/obj_dat.h +97 -1
  425. data/third_party/boringssl-with-bazel/crypto/pem/internal.h +86 -0
  426. data/third_party/boringssl-with-bazel/crypto/pem/pem_all.cc +8 -5
  427. data/third_party/boringssl-with-bazel/crypto/pem/pem_lib.cc +41 -73
  428. data/third_party/boringssl-with-bazel/crypto/pem/pem_pk8.cc +3 -0
  429. data/third_party/boringssl-with-bazel/crypto/pem/pem_pkey.cc +10 -4
  430. data/third_party/boringssl-with-bazel/crypto/pem/pem_x509.cc +3 -0
  431. data/third_party/boringssl-with-bazel/crypto/pem/pem_xaux.cc +3 -0
  432. data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7.cc +1 -1
  433. data/third_party/boringssl-with-bazel/crypto/pkcs7/pkcs7_x509.cc +2 -2
  434. data/third_party/boringssl-with-bazel/crypto/pkcs8/pkcs8_x509.cc +1 -1
  435. data/third_party/boringssl-with-bazel/crypto/poly1305/internal.h +17 -0
  436. data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_arm.cc +1 -13
  437. data/third_party/boringssl-with-bazel/crypto/poly1305/poly1305_vec.cc +3 -3
  438. data/third_party/boringssl-with-bazel/crypto/slhdsa/slhdsa.cc +23 -6
  439. data/third_party/boringssl-with-bazel/crypto/stack/stack.cc +7 -0
  440. data/third_party/boringssl-with-bazel/crypto/trust_token/internal.h +1 -1
  441. data/third_party/boringssl-with-bazel/crypto/x509/a_verify.cc +14 -7
  442. data/third_party/boringssl-with-bazel/crypto/x509/internal.h +110 -76
  443. data/third_party/boringssl-with-bazel/crypto/x509/name_print.cc +1 -1
  444. data/third_party/boringssl-with-bazel/crypto/x509/rsa_pss.cc +1 -1
  445. data/third_party/boringssl-with-bazel/crypto/x509/t_req.cc +1 -1
  446. data/third_party/boringssl-with-bazel/crypto/x509/t_x509.cc +6 -5
  447. data/third_party/boringssl-with-bazel/crypto/x509/v3_crld.cc +11 -53
  448. data/third_party/boringssl-with-bazel/crypto/x509/v3_ncons.cc +5 -5
  449. data/third_party/boringssl-with-bazel/crypto/x509/v3_purp.cc +16 -39
  450. data/third_party/boringssl-with-bazel/crypto/x509/v3_skey.cc +1 -1
  451. data/third_party/boringssl-with-bazel/crypto/x509/v3_utl.cc +12 -16
  452. data/third_party/boringssl-with-bazel/crypto/x509/x509_cmp.cc +9 -11
  453. data/third_party/boringssl-with-bazel/crypto/x509/x509_mtc.cc +598 -0
  454. data/third_party/boringssl-with-bazel/crypto/x509/x509_obj.cc +9 -8
  455. data/third_party/boringssl-with-bazel/crypto/x509/x509_set.cc +14 -18
  456. data/third_party/boringssl-with-bazel/crypto/x509/x509_vfy.cc +315 -390
  457. data/third_party/boringssl-with-bazel/crypto/x509/x509_vpm.cc +1 -1
  458. data/third_party/boringssl-with-bazel/crypto/x509/x509name.cc +31 -29
  459. data/third_party/boringssl-with-bazel/crypto/x509/x_all.cc +10 -9
  460. data/third_party/boringssl-with-bazel/crypto/x509/x_crl.cc +3 -53
  461. data/third_party/boringssl-with-bazel/crypto/x509/x_name.cc +37 -59
  462. data/third_party/boringssl-with-bazel/crypto/x509/x_pubkey.cc +29 -47
  463. data/third_party/boringssl-with-bazel/crypto/x509/x_req.cc +2 -1
  464. data/third_party/boringssl-with-bazel/crypto/x509/x_x509.cc +53 -53
  465. data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +24 -0
  466. data/third_party/boringssl-with-bazel/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +24 -0
  467. data/third_party/boringssl-with-bazel/gen/crypto/err_data.cc +509 -497
  468. data/third_party/boringssl-with-bazel/include/openssl/aead.h +7 -19
  469. data/third_party/boringssl-with-bazel/include/openssl/asm_base.h +1 -1
  470. data/third_party/boringssl-with-bazel/include/openssl/asn1.h +6 -10
  471. data/third_party/boringssl-with-bazel/include/openssl/base.h +43 -16
  472. data/third_party/boringssl-with-bazel/include/openssl/bio.h +25 -10
  473. data/third_party/boringssl-with-bazel/include/openssl/bytestring.h +33 -1
  474. data/third_party/boringssl-with-bazel/include/openssl/cipher.h +11 -9
  475. data/third_party/boringssl-with-bazel/include/openssl/configuration.h +18 -0
  476. data/third_party/boringssl-with-bazel/include/openssl/curve25519.h +36 -0
  477. data/third_party/boringssl-with-bazel/include/openssl/digest.h +4 -4
  478. data/third_party/boringssl-with-bazel/include/openssl/ec.h +35 -1
  479. data/third_party/boringssl-with-bazel/include/openssl/ec_key.h +2 -2
  480. data/third_party/boringssl-with-bazel/include/openssl/evp.h +120 -3
  481. data/third_party/boringssl-with-bazel/include/openssl/evp_errors.h +1 -0
  482. data/third_party/boringssl-with-bazel/include/openssl/hmac.h +2 -2
  483. data/third_party/boringssl-with-bazel/include/openssl/hpke.h +38 -7
  484. data/third_party/boringssl-with-bazel/include/openssl/mem.h +5 -5
  485. data/third_party/boringssl-with-bazel/include/openssl/nid.h +42 -0
  486. data/third_party/boringssl-with-bazel/include/openssl/pem.h +650 -351
  487. data/third_party/boringssl-with-bazel/include/openssl/posix_time.h +4 -4
  488. data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols.h +130 -4
  489. data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_S.h +48 -0
  490. data/third_party/boringssl-with-bazel/include/openssl/prefix_symbols_internal_c.h +24 -0
  491. data/third_party/boringssl-with-bazel/include/openssl/rsa.h +1 -1
  492. data/third_party/boringssl-with-bazel/include/openssl/slhdsa.h +25 -1
  493. data/third_party/boringssl-with-bazel/include/openssl/ssl.h +256 -87
  494. data/third_party/boringssl-with-bazel/include/openssl/stack.h +9 -0
  495. data/third_party/boringssl-with-bazel/include/openssl/types.h +18 -0
  496. data/third_party/boringssl-with-bazel/include/openssl/x509.h +40 -21
  497. data/third_party/boringssl-with-bazel/ssl/bio_ssl.cc +3 -5
  498. data/third_party/boringssl-with-bazel/ssl/d1_both.cc +146 -81
  499. data/third_party/boringssl-with-bazel/ssl/d1_lib.cc +39 -34
  500. data/third_party/boringssl-with-bazel/ssl/d1_pkt.cc +6 -6
  501. data/third_party/boringssl-with-bazel/ssl/d1_srtp.cc +10 -8
  502. data/third_party/boringssl-with-bazel/ssl/dtls_method.cc +4 -4
  503. data/third_party/boringssl-with-bazel/ssl/dtls_record.cc +15 -14
  504. data/third_party/boringssl-with-bazel/ssl/encrypted_client_hello.cc +41 -25
  505. data/third_party/boringssl-with-bazel/ssl/extensions.cc +153 -171
  506. data/third_party/boringssl-with-bazel/ssl/handoff.cc +79 -64
  507. data/third_party/boringssl-with-bazel/ssl/handshake.cc +15 -16
  508. data/third_party/boringssl-with-bazel/ssl/handshake_client.cc +35 -78
  509. data/third_party/boringssl-with-bazel/ssl/handshake_server.cc +75 -155
  510. data/third_party/boringssl-with-bazel/ssl/internal.h +419 -308
  511. data/third_party/boringssl-with-bazel/ssl/s3_both.cc +17 -150
  512. data/third_party/boringssl-with-bazel/ssl/s3_lib.cc +2 -3
  513. data/third_party/boringssl-with-bazel/ssl/s3_pkt.cc +10 -9
  514. data/third_party/boringssl-with-bazel/ssl/ssl_asn1.cc +13 -13
  515. data/third_party/boringssl-with-bazel/ssl/ssl_buffer.cc +8 -8
  516. data/third_party/boringssl-with-bazel/ssl/ssl_cert.cc +58 -24
  517. data/third_party/boringssl-with-bazel/ssl/ssl_cipher.cc +198 -26
  518. data/third_party/boringssl-with-bazel/ssl/ssl_credential.cc +164 -37
  519. data/third_party/boringssl-with-bazel/ssl/ssl_file.cc +10 -8
  520. data/third_party/boringssl-with-bazel/ssl/ssl_key_share.cc +2 -95
  521. data/third_party/boringssl-with-bazel/ssl/ssl_lib.cc +785 -472
  522. data/third_party/boringssl-with-bazel/ssl/ssl_privkey.cc +78 -67
  523. data/third_party/boringssl-with-bazel/ssl/ssl_session.cc +187 -150
  524. data/third_party/boringssl-with-bazel/ssl/ssl_stat.cc +6 -3
  525. data/third_party/boringssl-with-bazel/ssl/ssl_transcript.cc +1 -1
  526. data/third_party/boringssl-with-bazel/ssl/ssl_versions.cc +25 -19
  527. data/third_party/boringssl-with-bazel/ssl/ssl_x509.cc +148 -114
  528. data/third_party/boringssl-with-bazel/ssl/t1_enc.cc +28 -19
  529. data/third_party/boringssl-with-bazel/ssl/tls13_both.cc +24 -22
  530. data/third_party/boringssl-with-bazel/ssl/tls13_client.cc +30 -30
  531. data/third_party/boringssl-with-bazel/ssl/tls13_enc.cc +17 -16
  532. data/third_party/boringssl-with-bazel/ssl/tls13_server.cc +55 -63
  533. data/third_party/boringssl-with-bazel/ssl/tls_method.cc +12 -12
  534. data/third_party/boringssl-with-bazel/ssl/tls_record.cc +23 -20
  535. data/third_party/boringssl-with-bazel/third_party/fiat/p256_64.h +38 -0
  536. data/third_party/boringssl-with-bazel/third_party/fiat/p256_64_msvc.h +2 -0
  537. data/third_party/boringssl-with-bazel/third_party/fiat/p256_field.c.inc +26 -0
  538. data/third_party/boringssl-with-bazel/third_party/fiat/p256_point.br.c.inc +0 -54
  539. data/third_party/cares/cares/include/ares.h +8 -0
  540. data/third_party/cares/cares/include/ares_dns_record.h +3 -2
  541. data/third_party/cares/cares/include/ares_version.h +3 -3
  542. data/third_party/cares/cares/src/lib/ares_addrinfo_localhost.c +20 -20
  543. data/third_party/cares/cares/src/lib/ares_cancel.c +17 -8
  544. data/third_party/cares/cares/src/lib/ares_close_sockets.c +81 -16
  545. data/third_party/cares/cares/src/lib/ares_conn.c +256 -10
  546. data/third_party/cares/cares/src/lib/ares_conn.h +40 -3
  547. data/third_party/cares/cares/src/lib/ares_cookie.c +2 -2
  548. data/third_party/cares/cares/src/lib/ares_destroy.c +75 -10
  549. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +85 -10
  550. data/third_party/cares/cares/src/lib/ares_gethostbyaddr.c +5 -0
  551. data/third_party/cares/cares/src/lib/ares_gethostbyname.c +4 -0
  552. data/third_party/cares/cares/src/lib/ares_getnameinfo.c +10 -2
  553. data/third_party/cares/cares/src/lib/ares_hosts_file.c +8 -0
  554. data/third_party/cares/cares/src/lib/ares_inet_net_pton.h +28 -0
  555. data/third_party/cares/cares/src/lib/ares_init.c +55 -10
  556. data/third_party/cares/cares/src/lib/ares_library_init.c +25 -7
  557. data/third_party/cares/cares/src/lib/ares_options.c +38 -10
  558. data/third_party/cares/cares/src/lib/ares_parse_into_addrinfo.c +1 -1
  559. data/third_party/cares/cares/src/lib/ares_private.h +186 -27
  560. data/third_party/cares/cares/src/lib/ares_process.c +604 -112
  561. data/third_party/cares/cares/src/lib/ares_qcache.c +200 -36
  562. data/third_party/cares/cares/src/lib/ares_query.c +5 -0
  563. data/third_party/cares/cares/src/lib/ares_search.c +10 -0
  564. data/third_party/cares/cares/src/lib/ares_send.c +81 -10
  565. data/third_party/cares/cares/src/lib/ares_set_socket_functions.c +3 -1
  566. data/third_party/cares/cares/src/lib/ares_socket.c +28 -0
  567. data/third_party/cares/cares/src/lib/ares_socket.h +23 -0
  568. data/third_party/cares/cares/src/lib/ares_sysconfig.c +6 -3
  569. data/third_party/cares/cares/src/lib/ares_sysconfig_files.c +33 -11
  570. data/third_party/cares/cares/src/lib/ares_sysconfig_win.c +132 -80
  571. data/third_party/cares/cares/src/lib/ares_timeout.c +11 -0
  572. data/third_party/cares/cares/src/lib/ares_update_servers.c +55 -11
  573. data/third_party/cares/cares/src/lib/dsa/ares_array.c +20 -5
  574. data/third_party/cares/cares/src/lib/dsa/ares_htable.c +8 -4
  575. data/third_party/cares/cares/src/lib/dsa/ares_htable_dict.c +2 -0
  576. data/third_party/cares/cares/src/lib/dsa/ares_llist.c +4 -1
  577. data/third_party/cares/cares/src/lib/event/ares_event_configchg.c +5 -2
  578. data/third_party/cares/cares/src/lib/event/ares_event_select.c +14 -1
  579. data/third_party/cares/cares/src/lib/event/ares_event_thread.c +8 -0
  580. data/third_party/cares/cares/src/lib/event/ares_event_wake_pipe.c +7 -1
  581. data/third_party/cares/cares/src/lib/event/ares_event_win32.c +3 -0
  582. data/third_party/cares/cares/src/lib/include/ares_mem.h +3 -0
  583. data/third_party/cares/cares/src/lib/include/ares_str.h +17 -0
  584. data/third_party/cares/cares/src/lib/inet_net_pton.c +37 -28
  585. data/third_party/cares/cares/src/lib/legacy/ares_expand_name.c +1 -1
  586. data/third_party/cares/cares/src/lib/legacy/ares_parse_a_reply.c +5 -2
  587. data/third_party/cares/cares/src/lib/legacy/ares_parse_aaaa_reply.c +5 -2
  588. data/third_party/cares/cares/src/lib/legacy/ares_parse_ns_reply.c +2 -2
  589. data/third_party/cares/cares/src/lib/legacy/ares_parse_ptr_reply.c +2 -2
  590. data/third_party/cares/cares/src/lib/legacy/ares_parse_uri_reply.c +1 -1
  591. data/third_party/cares/cares/src/lib/record/ares_dns_mapping.c +19 -4
  592. data/third_party/cares/cares/src/lib/record/ares_dns_multistring.c +3 -1
  593. data/third_party/cares/cares/src/lib/record/ares_dns_name.c +67 -4
  594. data/third_party/cares/cares/src/lib/record/ares_dns_parse.c +62 -34
  595. data/third_party/cares/cares/src/lib/record/ares_dns_private.h +4 -0
  596. data/third_party/cares/cares/src/lib/record/ares_dns_record.c +47 -7
  597. data/third_party/cares/cares/src/lib/record/ares_dns_write.c +13 -5
  598. data/third_party/cares/cares/src/lib/str/ares_buf.c +33 -16
  599. data/third_party/cares/cares/src/lib/str/ares_str.c +54 -0
  600. data/third_party/cares/cares/src/lib/util/ares_iface_ips.c +22 -10
  601. data/third_party/cares/cares/src/lib/util/ares_iface_ips.h +1 -0
  602. data/third_party/cares/cares/src/lib/util/ares_math.c +17 -2
  603. data/third_party/cares/cares/src/lib/util/ares_math.h +32 -7
  604. data/third_party/cares/cares/src/lib/util/ares_rand.c +4 -4
  605. data/third_party/cares/cares/src/lib/util/ares_threads.c +1 -2
  606. data/third_party/cares/cares/src/lib/util/ares_time.h +1 -0
  607. data/third_party/cares/cares/src/lib/util/ares_uri.c +9 -3
  608. data/third_party/zlib/compress.c +34 -10
  609. data/third_party/zlib/crc32.c +49 -115
  610. data/third_party/zlib/deflate.c +107 -61
  611. data/third_party/zlib/deflate.h +7 -1
  612. data/third_party/zlib/gzguts.h +33 -31
  613. data/third_party/zlib/infback.c +20 -67
  614. data/third_party/zlib/inffast.c +7 -6
  615. data/third_party/zlib/inffixed.h +91 -91
  616. data/third_party/zlib/inflate.c +38 -151
  617. data/third_party/zlib/inflate.h +1 -1
  618. data/third_party/zlib/inftrees.c +134 -9
  619. data/third_party/zlib/inftrees.h +3 -1
  620. data/third_party/zlib/trees.c +14 -12
  621. data/third_party/zlib/uncompr.c +39 -23
  622. data/third_party/zlib/zconf.h +27 -19
  623. data/third_party/zlib/zlib.h +215 -96
  624. data/third_party/zlib/zutil.c +49 -35
  625. data/third_party/zlib/zutil.h +87 -10
  626. metadata +4095 -4049
  627. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +0 -916
  628. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +0 -84
  629. data/src/core/server/xds_channel_stack_modifier.cc +0 -108
  630. data/src/core/server/xds_channel_stack_modifier.h +0 -62
  631. data/src/core/server/xds_server_config_fetcher_legacy.cc +0 -1340
  632. data/third_party/boringssl-with-bazel/crypto/fipsmodule/ec/p256_internal.h +0 -193
  633. data/third_party/boringssl-with-bazel/crypto/kyber/internal.h +0 -165
  634. data/third_party/boringssl-with-bazel/crypto/kyber/kyber.cc +0 -870
@@ -16,6 +16,7 @@
16
16
 
17
17
  #include <assert.h>
18
18
  #include <limits.h>
19
+ #include <stdint.h>
19
20
  #include <stdlib.h>
20
21
  #include <string.h>
21
22
 
@@ -38,6 +39,7 @@
38
39
  #include <openssl/nid.h>
39
40
  #include <openssl/pool.h>
40
41
  #include <openssl/rand.h>
42
+ #include <openssl/span.h>
41
43
 
42
44
  #include "../crypto/bytestring/internal.h"
43
45
  #include "../crypto/internal.h"
@@ -105,20 +107,13 @@ static bool tls1_check_duplicate_extensions(const CBS *cbs) {
105
107
  }
106
108
 
107
109
  static bool is_post_quantum_group(uint16_t id) {
108
- switch (id) {
109
- case SSL_GROUP_X25519_KYBER768_DRAFT00:
110
- case SSL_GROUP_X25519_MLKEM768:
111
- case SSL_GROUP_MLKEM1024:
112
- return true;
113
- default:
114
- return false;
115
- }
110
+ return id == SSL_GROUP_X25519_MLKEM768 || id == SSL_GROUP_MLKEM1024;
116
111
  }
117
112
 
118
- bool ssl_parse_client_hello_with_trailing_data(const SSL *ssl, CBS *cbs,
113
+ bool ssl_parse_client_hello_with_trailing_data(const SSLImpl *ssl, CBS *cbs,
119
114
  SSL_CLIENT_HELLO *out) {
120
115
  OPENSSL_memset(out, 0, sizeof(*out));
121
- out->ssl = const_cast<SSL *>(ssl);
116
+ out->ssl = const_cast<SSLImpl *>(ssl);
122
117
 
123
118
  CBS copy = *cbs;
124
119
  CBS random, session_id;
@@ -207,7 +202,7 @@ bool ssl_client_hello_get_extension(const SSL_CLIENT_HELLO *client_hello,
207
202
  }
208
203
 
209
204
  bool tls1_get_shared_group(SSL_HANDSHAKE *hs, uint16_t *out_group_id) {
210
- SSL *const ssl = hs->ssl;
205
+ SSLImpl *const ssl = hs->ssl;
211
206
  assert(ssl->server);
212
207
 
213
208
  // Clients are not required to send a supported_groups extension. In this
@@ -523,7 +518,7 @@ static bool dont_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) { return true; }
523
518
  static bool ext_sni_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
524
519
  CBB *out_compressible,
525
520
  ssl_client_hello_type_t type) {
526
- const SSL *const ssl = hs->ssl;
521
+ const SSLImpl *const ssl = hs->ssl;
527
522
  // If offering ECH, send the public name instead of the configured name.
528
523
  Span<const uint8_t> hostname;
529
524
  if (type == ssl_client_hello_outer) {
@@ -613,7 +608,7 @@ static bool ext_ech_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
613
608
 
614
609
  static bool ext_ech_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
615
610
  CBS *contents) {
616
- SSL *const ssl = hs->ssl;
611
+ SSLImpl *const ssl = hs->ssl;
617
612
  if (contents == nullptr) {
618
613
  return true;
619
614
  }
@@ -665,7 +660,7 @@ static bool ext_ech_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
665
660
  }
666
661
 
667
662
  static bool ext_ech_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
668
- SSL *const ssl = hs->ssl;
663
+ SSLImpl *const ssl = hs->ssl;
669
664
  if (ssl_protocol_version(ssl) < TLS1_3_VERSION ||
670
665
  ssl->s3->ech_status == ssl_ech_accepted || //
671
666
  hs->ech_keys == nullptr) {
@@ -700,7 +695,7 @@ static bool ext_ech_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
700
695
  static bool ext_ri_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
701
696
  CBB *out_compressible,
702
697
  ssl_client_hello_type_t type) {
703
- const SSL *const ssl = hs->ssl;
698
+ const SSLImpl *const ssl = hs->ssl;
704
699
  // Renegotiation indication is not necessary in TLS 1.3.
705
700
  if (hs->min_version >= TLS1_3_VERSION || //
706
701
  type == ssl_client_hello_inner) {
@@ -725,7 +720,7 @@ static bool ext_ri_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
725
720
 
726
721
  static bool ext_ri_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
727
722
  CBS *contents) {
728
- SSL *const ssl = hs->ssl;
723
+ SSLImpl *const ssl = hs->ssl;
729
724
  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
730
725
  if (contents != nullptr) {
731
726
  *out_alert = SSL_AD_ILLEGAL_PARAMETER;
@@ -804,7 +799,7 @@ static bool ext_ri_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
804
799
 
805
800
  static bool ext_ri_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
806
801
  CBS *contents) {
807
- SSL *const ssl = hs->ssl;
802
+ SSLImpl *const ssl = hs->ssl;
808
803
  // Renegotiation isn't supported as a server so this function should never be
809
804
  // called after the initial handshake.
810
805
  assert(!ssl->s3->initial_handshake_complete);
@@ -839,7 +834,7 @@ static bool ext_ri_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
839
834
  }
840
835
 
841
836
  static bool ext_ri_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
842
- SSL *const ssl = hs->ssl;
837
+ SSLImpl *const ssl = hs->ssl;
843
838
  // Renegotiation isn't supported as a server so this function should never be
844
839
  // called after the initial handshake.
845
840
  assert(!ssl->s3->initial_handshake_complete);
@@ -880,7 +875,7 @@ static bool ext_ems_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
880
875
 
881
876
  static bool ext_ems_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
882
877
  CBS *contents) {
883
- SSL *const ssl = hs->ssl;
878
+ SSLImpl *const ssl = hs->ssl;
884
879
 
885
880
  if (contents != nullptr) {
886
881
  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION || //
@@ -942,7 +937,7 @@ static bool ext_ems_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
942
937
  static bool ext_ticket_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
943
938
  CBB *out_compressible,
944
939
  ssl_client_hello_type_t type) {
945
- const SSL *const ssl = hs->ssl;
940
+ const SSLImpl *const ssl = hs->ssl;
946
941
  // TLS 1.3 uses a different ticket extension.
947
942
  if (hs->min_version >= TLS1_3_VERSION || type == ssl_client_hello_inner ||
948
943
  SSL_get_options(ssl) & SSL_OP_NO_TICKET) {
@@ -973,7 +968,7 @@ static bool ext_ticket_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
973
968
 
974
969
  static bool ext_ticket_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
975
970
  CBS *contents) {
976
- SSL *const ssl = hs->ssl;
971
+ SSLImpl *const ssl = hs->ssl;
977
972
  if (contents == nullptr) {
978
973
  return true;
979
974
  }
@@ -1030,8 +1025,16 @@ static bool ext_sigalgs_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1030
1025
  CBB contents, sigalgs_cbb;
1031
1026
  if (!CBB_add_u16(out_compressible, TLSEXT_TYPE_signature_algorithms) ||
1032
1027
  !CBB_add_u16_length_prefixed(out_compressible, &contents) ||
1033
- !CBB_add_u16_length_prefixed(&contents, &sigalgs_cbb) ||
1034
- !tls12_add_verify_sigalgs(hs, &sigalgs_cbb) ||
1028
+ !CBB_add_u16_length_prefixed(&contents, &sigalgs_cbb)) {
1029
+ return false;
1030
+ }
1031
+ // Add a fake signature algorithm. See RFC 8701.
1032
+ if (hs->ssl->ctx->grease_sigalgs_enabled &&
1033
+ !CBB_add_u16(&sigalgs_cbb,
1034
+ ssl_get_grease_value(hs, ssl_grease_signature_algorithm))) {
1035
+ return false;
1036
+ }
1037
+ if (!tls12_add_verify_sigalgs(hs, &sigalgs_cbb) ||
1035
1038
  !CBB_flush(out_compressible)) {
1036
1039
  return false;
1037
1040
  }
@@ -1083,7 +1086,7 @@ static bool ext_ocsp_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1083
1086
 
1084
1087
  static bool ext_ocsp_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1085
1088
  CBS *contents) {
1086
- SSL *const ssl = hs->ssl;
1089
+ SSLImpl *const ssl = hs->ssl;
1087
1090
  if (contents == nullptr) {
1088
1091
  return true;
1089
1092
  }
@@ -1126,7 +1129,7 @@ static bool ext_ocsp_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1126
1129
  }
1127
1130
 
1128
1131
  static bool ext_ocsp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1129
- SSL *const ssl = hs->ssl;
1132
+ SSLImpl *const ssl = hs->ssl;
1130
1133
  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION ||
1131
1134
  !hs->ocsp_stapling_requested || ssl->s3->session_reused ||
1132
1135
  !ssl_cipher_uses_certificate_auth(hs->new_cipher) ||
@@ -1148,7 +1151,7 @@ static bool ext_ocsp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1148
1151
  static bool ext_npn_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1149
1152
  CBB *out_compressible,
1150
1153
  ssl_client_hello_type_t type) {
1151
- const SSL *const ssl = hs->ssl;
1154
+ const SSLImpl *const ssl = hs->ssl;
1152
1155
  if (ssl->ctx->next_proto_select_cb == nullptr ||
1153
1156
  // Do not allow NPN to change on renegotiation.
1154
1157
  ssl->s3->initial_handshake_complete ||
@@ -1168,7 +1171,7 @@ static bool ext_npn_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1168
1171
 
1169
1172
  static bool ext_npn_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1170
1173
  CBS *contents) {
1171
- SSL *const ssl = hs->ssl;
1174
+ SSLImpl *const ssl = hs->ssl;
1172
1175
  if (contents == nullptr) {
1173
1176
  return true;
1174
1177
  }
@@ -1220,7 +1223,7 @@ static bool ext_npn_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1220
1223
 
1221
1224
  static bool ext_npn_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1222
1225
  CBS *contents) {
1223
- SSL *const ssl = hs->ssl;
1226
+ SSLImpl *const ssl = hs->ssl;
1224
1227
  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
1225
1228
  return true;
1226
1229
  }
@@ -1241,7 +1244,7 @@ static bool ext_npn_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1241
1244
  }
1242
1245
 
1243
1246
  static bool ext_npn_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1244
- SSL *const ssl = hs->ssl;
1247
+ SSLImpl *const ssl = hs->ssl;
1245
1248
  // `next_proto_neg_seen` might have been cleared when an ALPN extension was
1246
1249
  // parsed.
1247
1250
  if (!hs->next_proto_neg_seen) {
@@ -1291,7 +1294,7 @@ static bool ext_sct_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1291
1294
 
1292
1295
  static bool ext_sct_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1293
1296
  CBS *contents) {
1294
- SSL *const ssl = hs->ssl;
1297
+ SSLImpl *const ssl = hs->ssl;
1295
1298
  if (contents == nullptr) {
1296
1299
  return true;
1297
1300
  }
@@ -1343,7 +1346,7 @@ static bool ext_sct_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1343
1346
  }
1344
1347
 
1345
1348
  static bool ext_sct_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1346
- SSL *const ssl = hs->ssl;
1349
+ SSLImpl *const ssl = hs->ssl;
1347
1350
  assert(hs->scts_requested);
1348
1351
  // The extension shouldn't be sent when resuming sessions.
1349
1352
  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION || ssl->s3->session_reused ||
@@ -1371,7 +1374,7 @@ static bool ext_sct_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1371
1374
  static bool ext_alpn_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1372
1375
  CBB *out_compressible,
1373
1376
  ssl_client_hello_type_t type) {
1374
- const SSL *const ssl = hs->ssl;
1377
+ const SSLImpl *const ssl = hs->ssl;
1375
1378
  if (hs->config->alpn_client_proto_list.empty() && SSL_is_quic(ssl)) {
1376
1379
  // ALPN MUST be used with QUIC.
1377
1380
  OPENSSL_PUT_ERROR(SSL, SSL_R_NO_APPLICATION_PROTOCOL);
@@ -1399,7 +1402,7 @@ static bool ext_alpn_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1399
1402
 
1400
1403
  static bool ext_alpn_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1401
1404
  CBS *contents) {
1402
- SSL *const ssl = hs->ssl;
1405
+ SSLImpl *const ssl = hs->ssl;
1403
1406
  if (contents == nullptr) {
1404
1407
  if (SSL_is_quic(ssl)) {
1405
1408
  // ALPN is required when QUIC is used.
@@ -1493,14 +1496,51 @@ bool ssl_alpn_list_contains_protocol(Span<const uint8_t> list,
1493
1496
  return false;
1494
1497
  }
1495
1498
 
1499
+ static int default_alpn_select_cb(SSL *ssl, const uint8_t **out,
1500
+ uint8_t *out_len, const uint8_t *in,
1501
+ unsigned inlen, void *arg) {
1502
+ auto *ssl_impl = FromOpaque(ssl);
1503
+ SSL_HANDSHAKE *hs = ssl_impl->s3->hs.get();
1504
+ if (hs == nullptr) {
1505
+ return SSL_TLSEXT_ERR_ALERT_FATAL;
1506
+ }
1507
+
1508
+ bssl::Span<const uint8_t> client_protos(in, inlen);
1509
+ CBS cbs = client_protos;
1510
+ CBS proto;
1511
+ while (CBS_len(&cbs) != 0) {
1512
+ if (!CBS_get_u8_length_prefixed(&cbs, &proto) || CBS_len(&proto) == 0) {
1513
+ return SSL_TLSEXT_ERR_ALERT_FATAL;
1514
+ }
1515
+ if (ssl_alpn_list_contains_protocol(hs->config->alpn_client_proto_list,
1516
+ proto)) {
1517
+ *out = CBS_data(&proto);
1518
+ *out_len = static_cast<uint8_t>(CBS_len(&proto));
1519
+ return SSL_TLSEXT_ERR_OK;
1520
+ }
1521
+ }
1522
+
1523
+ return SSL_TLSEXT_ERR_ALERT_FATAL;
1524
+ }
1525
+
1496
1526
  bool ssl_negotiate_alpn(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1497
1527
  const SSL_CLIENT_HELLO *client_hello) {
1498
- SSL *const ssl = hs->ssl;
1528
+ SSLImpl *const ssl = hs->ssl;
1499
1529
  CBS contents;
1500
- if (ssl->ctx->alpn_select_cb == nullptr ||
1501
- !ssl_client_hello_get_extension(
1502
- client_hello, &contents,
1503
- TLSEXT_TYPE_application_layer_protocol_negotiation)) {
1530
+ const bool has_extension = ssl_client_hello_get_extension(
1531
+ client_hello, &contents,
1532
+ TLSEXT_TYPE_application_layer_protocol_negotiation);
1533
+
1534
+ auto alpn_select_cb = ssl->ctx->alpn_select_cb;
1535
+ void *alpn_select_cb_arg = ssl->ctx->alpn_select_cb_arg;
1536
+
1537
+ if (alpn_select_cb == nullptr &&
1538
+ !hs->config->alpn_client_proto_list.empty()) {
1539
+ alpn_select_cb = default_alpn_select_cb;
1540
+ alpn_select_cb_arg = nullptr;
1541
+ }
1542
+
1543
+ if (!has_extension || alpn_select_cb == nullptr) {
1504
1544
  if (SSL_is_quic(ssl)) {
1505
1545
  // ALPN is required when QUIC is used.
1506
1546
  OPENSSL_PUT_ERROR(SSL, SSL_R_NO_APPLICATION_PROTOCOL);
@@ -1525,12 +1565,11 @@ bool ssl_negotiate_alpn(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1525
1565
 
1526
1566
  // `protocol_name_list` fits in `unsigned` because TLS extensions use 16-bit
1527
1567
  // lengths.
1528
- const uint8_t *selected;
1529
- uint8_t selected_len;
1530
- int ret = ssl->ctx->alpn_select_cb(
1568
+ const uint8_t *selected = nullptr;
1569
+ uint8_t selected_len = 0;
1570
+ int ret = alpn_select_cb(
1531
1571
  ssl, &selected, &selected_len, CBS_data(&protocol_name_list),
1532
- static_cast<unsigned>(CBS_len(&protocol_name_list)),
1533
- ssl->ctx->alpn_select_cb_arg);
1572
+ static_cast<unsigned>(CBS_len(&protocol_name_list)), alpn_select_cb_arg);
1534
1573
  // ALPN is required when QUIC is used.
1535
1574
  if (SSL_is_quic(ssl) &&
1536
1575
  (ret == SSL_TLSEXT_ERR_NOACK || ret == SSL_TLSEXT_ERR_ALERT_WARNING)) {
@@ -1566,7 +1605,7 @@ bool ssl_negotiate_alpn(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1566
1605
  }
1567
1606
 
1568
1607
  static bool ext_alpn_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1569
- SSL *const ssl = hs->ssl;
1608
+ SSLImpl *const ssl = hs->ssl;
1570
1609
  if (ssl->s3->alpn_selected.empty()) {
1571
1610
  return true;
1572
1611
  }
@@ -1593,7 +1632,7 @@ static bool ext_alpn_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1593
1632
  static bool ext_channel_id_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1594
1633
  CBB *out_compressible,
1595
1634
  ssl_client_hello_type_t type) {
1596
- const SSL *const ssl = hs->ssl;
1635
+ const SSLImpl *const ssl = hs->ssl;
1597
1636
  if (!hs->config->channel_id_private || SSL_is_dtls(ssl) ||
1598
1637
  // Don't offer Channel ID in ClientHelloOuter. ClientHelloOuter handshakes
1599
1638
  // are not authenticated for the name that can learn the Channel ID.
@@ -1636,7 +1675,7 @@ static bool ext_channel_id_parse_serverhello(SSL_HANDSHAKE *hs,
1636
1675
  static bool ext_channel_id_parse_clienthello(SSL_HANDSHAKE *hs,
1637
1676
  uint8_t *out_alert,
1638
1677
  CBS *contents) {
1639
- SSL *const ssl = hs->ssl;
1678
+ SSLImpl *const ssl = hs->ssl;
1640
1679
  if (contents == nullptr || !hs->config->channel_id_enabled ||
1641
1680
  SSL_is_dtls(ssl)) {
1642
1681
  return true;
@@ -1671,7 +1710,7 @@ static bool ext_channel_id_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1671
1710
  static bool ext_srtp_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1672
1711
  CBB *out_compressible,
1673
1712
  ssl_client_hello_type_t type) {
1674
- const SSL *const ssl = hs->ssl;
1713
+ const SSLImpl *const ssl = hs->ssl;
1675
1714
  const STACK_OF(SRTP_PROTECTION_PROFILE) *profiles =
1676
1715
  SSL_get_srtp_profiles(ssl);
1677
1716
  if (profiles == nullptr || //
@@ -1703,7 +1742,7 @@ static bool ext_srtp_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1703
1742
 
1704
1743
  static bool ext_srtp_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1705
1744
  CBS *contents) {
1706
- SSL *const ssl = hs->ssl;
1745
+ SSLImpl *const ssl = hs->ssl;
1707
1746
  if (contents == nullptr) {
1708
1747
  return true;
1709
1748
  }
@@ -1746,7 +1785,7 @@ static bool ext_srtp_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1746
1785
 
1747
1786
  static bool ext_srtp_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1748
1787
  CBS *contents) {
1749
- SSL *const ssl = hs->ssl;
1788
+ SSLImpl *const ssl = hs->ssl;
1750
1789
  // DTLS-SRTP is only defined for DTLS.
1751
1790
  if (contents == nullptr || !SSL_is_dtls(ssl)) {
1752
1791
  return true;
@@ -1787,7 +1826,7 @@ static bool ext_srtp_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1787
1826
  }
1788
1827
 
1789
1828
  static bool ext_srtp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1790
- SSL *const ssl = hs->ssl;
1829
+ SSLImpl *const ssl = hs->ssl;
1791
1830
  if (ssl->s3->srtp_profile == nullptr) {
1792
1831
  return true;
1793
1832
  }
@@ -1872,7 +1911,7 @@ static bool ext_ec_point_parse_clienthello(SSL_HANDSHAKE *hs,
1872
1911
  }
1873
1912
 
1874
1913
  static bool ext_ec_point_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1875
- SSL *const ssl = hs->ssl;
1914
+ SSLImpl *const ssl = hs->ssl;
1876
1915
  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
1877
1916
  return true;
1878
1917
  }
@@ -1894,12 +1933,12 @@ static bool ext_ec_point_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1894
1933
  // https://tools.ietf.org/html/rfc8446#section-4.2.11
1895
1934
 
1896
1935
  bool ssl_setup_pre_shared_keys(SSL_HANDSHAKE *hs) {
1897
- const SSL *const ssl = hs->ssl;
1936
+ const SSLImpl *const ssl = hs->ssl;
1898
1937
  if (hs->max_version < TLS1_3_VERSION) {
1899
1938
  return true;
1900
1939
  }
1901
1940
 
1902
- if (SSL_SESSION *session = ssl->session.get();
1941
+ if (SSLSession *session = ssl->session.get();
1903
1942
  session != nullptr &&
1904
1943
  ssl_session_get_type(session) == SSLSessionType::kPreSharedKey &&
1905
1944
  !hs->pre_shared_keys.Push(UpRef(session))) {
@@ -1938,25 +1977,6 @@ static bool should_offer_psk(const SSL_HANDSHAKE *hs,
1938
1977
  type != ssl_client_hello_outer;
1939
1978
  }
1940
1979
 
1941
- static size_t ext_pre_shared_key_clienthello_length(
1942
- const SSL_HANDSHAKE *hs, ssl_client_hello_type_t type) {
1943
- if (!should_offer_psk(hs, type)) {
1944
- return 0;
1945
- }
1946
-
1947
- // extension value, extension length, identities length, binders length.
1948
- size_t ret = 2 + 2 + 2 + 2;
1949
- for (const auto &psk : hs->pre_shared_keys) {
1950
- // identity
1951
- ret += 2 + ssl_pre_shared_key_identity(psk).size();
1952
- // obfuscated_ticket_age
1953
- ret += 4;
1954
- // binder
1955
- ret += 1 + EVP_MD_size(ssl_pre_shared_key_hash(psk));
1956
- }
1957
- return ret;
1958
- }
1959
-
1960
1980
  // ext_pre_shared_key_add_clienthello writes a pre_shared_key extension to
1961
1981
  // `out_extensions` and flushes `out_client_hello`, invalidating
1962
1982
  // `out_extensions`. `out_extensions` must be a child of `out_client_hello`.
@@ -1969,7 +1989,7 @@ static bool ext_pre_shared_key_add_clienthello(const SSL_HANDSHAKE *hs,
1969
1989
  CBB *out_extensions,
1970
1990
  size_t *out_psk_len,
1971
1991
  ssl_client_hello_type_t type) {
1972
- const SSL *const ssl = hs->ssl;
1992
+ const SSLImpl *const ssl = hs->ssl;
1973
1993
  if (!should_offer_psk(hs, type)) {
1974
1994
  *out_psk_len = 0;
1975
1995
  // Discard empty extensions blocks.
@@ -1998,7 +2018,7 @@ static bool ext_pre_shared_key_add_clienthello(const SSL_HANDSHAKE *hs,
1998
2018
  return false;
1999
2019
  }
2000
2020
  } else {
2001
- const SSL_SESSION *session = std::get<UniquePtr<SSL_SESSION>>(psk).get();
2021
+ const SSLSession *session = std::get<UniquePtr<SSLSession>>(psk).get();
2002
2022
  // At most one PSK will be a session.
2003
2023
  assert(session == ssl->session.get());
2004
2024
  OPENSSL_timeval now = ssl_ctx_get_current_time(ssl->ctx.get());
@@ -2272,7 +2292,7 @@ static bool ext_psk_key_exchange_modes_parse_clienthello(SSL_HANDSHAKE *hs,
2272
2292
  static bool ext_early_data_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
2273
2293
  CBB *out_compressible,
2274
2294
  ssl_client_hello_type_t type) {
2275
- const SSL *const ssl = hs->ssl;
2295
+ const SSLImpl *const ssl = hs->ssl;
2276
2296
  // The second ClientHello never offers early data, and we must have already
2277
2297
  // filled in `early_data_reason` by this point.
2278
2298
  if (ssl->s3->used_hello_retry_request) {
@@ -2300,7 +2320,7 @@ static bool ext_early_data_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
2300
2320
  static bool ext_early_data_parse_serverhello(SSL_HANDSHAKE *hs,
2301
2321
  uint8_t *out_alert,
2302
2322
  CBS *contents) {
2303
- SSL *const ssl = hs->ssl;
2323
+ SSLImpl *const ssl = hs->ssl;
2304
2324
  if (contents == nullptr) {
2305
2325
  if (hs->early_data_offered && !ssl->s3->used_hello_retry_request) {
2306
2326
  ssl->s3->early_data_reason = ssl->s3->session_reused
@@ -2338,7 +2358,7 @@ static bool ext_early_data_parse_serverhello(SSL_HANDSHAKE *hs,
2338
2358
  static bool ext_early_data_parse_clienthello(SSL_HANDSHAKE *hs,
2339
2359
  uint8_t *out_alert,
2340
2360
  CBS *contents) {
2341
- SSL *const ssl = hs->ssl;
2361
+ SSLImpl *const ssl = hs->ssl;
2342
2362
  if (contents == nullptr || ssl_protocol_version(ssl) < TLS1_3_VERSION) {
2343
2363
  return true;
2344
2364
  }
@@ -2372,7 +2392,7 @@ static bool ext_early_data_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
2372
2392
  // https://tools.ietf.org/html/rfc8446#section-4.2.8
2373
2393
 
2374
2394
  bool ssl_setup_key_shares(SSL_HANDSHAKE *hs, uint16_t override_group_id) {
2375
- SSL *const ssl = hs->ssl;
2395
+ SSLImpl *const ssl = hs->ssl;
2376
2396
  hs->key_shares.clear();
2377
2397
  hs->key_share_bytes.Reset();
2378
2398
 
@@ -2636,7 +2656,7 @@ bool ssl_ext_key_share_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
2636
2656
  static bool ext_supported_versions_add_clienthello(
2637
2657
  const SSL_HANDSHAKE *hs, CBB *out, CBB *out_compressible,
2638
2658
  ssl_client_hello_type_t type) {
2639
- const SSL *const ssl = hs->ssl;
2659
+ const SSLImpl *const ssl = hs->ssl;
2640
2660
  if (hs->max_version <= TLS1_2_VERSION) {
2641
2661
  return true;
2642
2662
  }
@@ -2705,7 +2725,7 @@ static bool ext_supported_groups_add_clienthello(const SSL_HANDSHAKE *hs,
2705
2725
  CBB *out,
2706
2726
  CBB *out_compressible,
2707
2727
  ssl_client_hello_type_t type) {
2708
- const SSL *const ssl = hs->ssl;
2728
+ const SSLImpl *const ssl = hs->ssl;
2709
2729
  // In PAKE mode, supported_groups and key_share are not used.
2710
2730
  if (hs->pake_prover != nullptr) {
2711
2731
  return true;
@@ -2876,7 +2896,7 @@ static bool ext_server_padding_parse_clienthello(SSL_HANDSHAKE *hs,
2876
2896
  }
2877
2897
 
2878
2898
  static bool ext_server_padding_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
2879
- SSL *const ssl = hs->ssl;
2899
+ SSLImpl *const ssl = hs->ssl;
2880
2900
  if (ssl_protocol_version(ssl) < TLS1_3_VERSION ||
2881
2901
  !hs->client_requested_server_padding_size ||
2882
2902
  !hs->config->server_padding_enabled) {
@@ -2989,7 +3009,7 @@ static bool ext_trust_anchors_parse_clienthello(SSL_HANDSHAKE *hs,
2989
3009
  }
2990
3010
 
2991
3011
  static bool ext_trust_anchors_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
2992
- SSL *const ssl = hs->ssl;
3012
+ SSLImpl *const ssl = hs->ssl;
2993
3013
  if (ssl_protocol_version(ssl) < TLS1_3_VERSION) {
2994
3014
  return true;
2995
3015
  }
@@ -3123,7 +3143,7 @@ static bool ext_quic_transport_params_add_clienthello_legacy(
3123
3143
  static bool ext_quic_transport_params_parse_serverhello_impl(
3124
3144
  SSL_HANDSHAKE *hs, uint8_t *out_alert, CBS *contents,
3125
3145
  bool used_legacy_codepoint) {
3126
- SSL *const ssl = hs->ssl;
3146
+ SSLImpl *const ssl = hs->ssl;
3127
3147
  if (contents == nullptr) {
3128
3148
  if (used_legacy_codepoint != hs->config->quic_use_legacy_codepoint) {
3129
3149
  // Silently ignore because we expect the other QUIC codepoint.
@@ -3159,7 +3179,7 @@ static bool ext_quic_transport_params_parse_serverhello_legacy(
3159
3179
  static bool ext_quic_transport_params_parse_clienthello_impl(
3160
3180
  SSL_HANDSHAKE *hs, uint8_t *out_alert, CBS *contents,
3161
3181
  bool used_legacy_codepoint) {
3162
- SSL *const ssl = hs->ssl;
3182
+ SSLImpl *const ssl = hs->ssl;
3163
3183
  if (!contents) {
3164
3184
  if (!SSL_is_quic(ssl)) {
3165
3185
  if (hs->config->quic_transport_params.empty()) {
@@ -3625,7 +3645,7 @@ static bool ext_alps_add_clienthello_impl(const SSL_HANDSHAKE *hs, CBB *out,
3625
3645
  CBB *out_compressible,
3626
3646
  ssl_client_hello_type_t type,
3627
3647
  bool use_new_codepoint) {
3628
- const SSL *const ssl = hs->ssl;
3648
+ const SSLImpl *const ssl = hs->ssl;
3629
3649
  if ( // ALPS requires TLS 1.3.
3630
3650
  hs->max_version < TLS1_3_VERSION ||
3631
3651
  // Do not offer ALPS without ALPN.
@@ -3682,7 +3702,7 @@ static bool ext_alps_add_clienthello_old(const SSL_HANDSHAKE *hs, CBB *out,
3682
3702
  static bool ext_alps_parse_serverhello_impl(SSL_HANDSHAKE *hs,
3683
3703
  uint8_t *out_alert, CBS *contents,
3684
3704
  bool use_new_codepoint) {
3685
- SSL *const ssl = hs->ssl;
3705
+ SSLImpl *const ssl = hs->ssl;
3686
3706
  if (contents == nullptr) {
3687
3707
  return true;
3688
3708
  }
@@ -3724,7 +3744,7 @@ static bool ext_alps_parse_serverhello_old(SSL_HANDSHAKE *hs,
3724
3744
 
3725
3745
  static bool ext_alps_add_serverhello_impl(SSL_HANDSHAKE *hs, CBB *out,
3726
3746
  bool use_new_codepoint) {
3727
- SSL *const ssl = hs->ssl;
3747
+ SSLImpl *const ssl = hs->ssl;
3728
3748
  // If early data is accepted, we omit the ALPS extension. It is implicitly
3729
3749
  // carried over from the previous connection.
3730
3750
  if (hs->new_session == nullptr ||
@@ -3766,7 +3786,7 @@ static bool ext_alps_add_serverhello_old(SSL_HANDSHAKE *hs, CBB *out) {
3766
3786
 
3767
3787
  bool ssl_negotiate_alps(SSL_HANDSHAKE *hs, uint8_t *out_alert,
3768
3788
  const SSL_CLIENT_HELLO *client_hello) {
3769
- SSL *const ssl = hs->ssl;
3789
+ SSLImpl *const ssl = hs->ssl;
3770
3790
  if (ssl->s3->alpn_selected.empty()) {
3771
3791
  return true;
3772
3792
  }
@@ -4358,7 +4378,7 @@ static bool ssl_add_clienthello_tlsext_inner(SSL_HANDSHAKE *hs, CBB *out,
4358
4378
  // are written to `extensions` and copied to `extensions_encoded`. Compressed
4359
4379
  // extensions are buffered in `compressed` and written to the end. (ECH can
4360
4380
  // only compress contiguous extensions.)
4361
- SSL *const ssl = hs->ssl;
4381
+ SSLImpl *const ssl = hs->ssl;
4362
4382
  bssl::ScopedCBB compressed, outer_extensions;
4363
4383
  CBB extensions, extensions_encoded;
4364
4384
  if (!CBB_add_u16_length_prefixed(out, &extensions) ||
@@ -4470,11 +4490,8 @@ bool ssl_add_clienthello_tlsext(SSL_HANDSHAKE *hs, CBB *out, CBB *out_encoded,
4470
4490
  return ssl_add_clienthello_tlsext_inner(hs, out, out_encoded);
4471
4491
  }
4472
4492
 
4473
- // Sample the length of the ClientHello thus far, including the message
4474
- // header.
4475
- size_t msg_len = SSL3_HM_HEADER_LENGTH + CBB_len(out);
4476
4493
  assert(out_encoded == nullptr); // Only ClientHelloInner needs two outputs.
4477
- SSL *const ssl = hs->ssl;
4494
+ SSLImpl *const ssl = hs->ssl;
4478
4495
  CBB extensions;
4479
4496
  if (!CBB_add_u16_length_prefixed(out, &extensions)) {
4480
4497
  OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
@@ -4523,66 +4540,29 @@ bool ssl_add_clienthello_tlsext(SSL_HANDSHAKE *hs, CBB *out, CBB *out_encoded,
4523
4540
  last_was_empty = false;
4524
4541
  }
4525
4542
 
4526
- // In cleartext ClientHellos, we add the padding extension to work around
4527
- // bugs. We also apply this padding to ClientHelloOuter, to keep the wire
4528
- // images aligned.
4529
- size_t psk_len = ext_pre_shared_key_clienthello_length(hs, type);
4530
- if (!SSL_is_dtls(ssl) && !SSL_is_quic(ssl) &&
4531
- !ssl->s3->used_hello_retry_request) {
4532
- msg_len += 2 /* length prefix */ + CBB_len(&extensions) + psk_len;
4533
- // The length of the padding extension, excluding the four-byte extension
4534
- // header.
4535
- size_t padding_len = 0;
4536
-
4537
- // The final extension must be non-empty. WebSphere Application
4538
- // Server 7.0 is intolerant to the last extension being zero-length. See
4539
- // https://crbug.com/363583.
4540
- if (last_was_empty && psk_len == 0) {
4541
- padding_len = 1;
4542
- // The addition of the padding extension may push us into the F5 bug.
4543
- msg_len += 4 + padding_len;
4544
- }
4545
-
4546
- // Add padding to workaround bugs in F5 terminators. See RFC 7685.
4547
- //
4548
- // NB: because this code works out the length of all existing extensions
4549
- // it MUST always appear last (save for any PSK extension).
4550
- if (msg_len > 0xff && msg_len < 0x200) {
4551
- // If our calculations already included a padding extension, remove that
4552
- // factor because we're about to change its length.
4553
- if (padding_len != 0) {
4554
- msg_len -= 4 + padding_len;
4555
- }
4556
- padding_len = 0x200 - msg_len;
4557
- // Extensions take at least four bytes to encode. WebSphere Application
4558
- // Server 7.0 is intolerant to the last extension being zero-length, so
4559
- // always include at least one byte of data if including the extension.
4560
- // See https://crbug.com/363583.
4561
- if (padding_len >= 4 + 1) {
4562
- padding_len -= 4;
4563
- } else {
4564
- padding_len = 1;
4565
- }
4566
- }
4567
-
4568
- if (padding_len != 0 &&
4569
- !add_padding_extension(&extensions, TLSEXT_TYPE_padding, padding_len)) {
4543
+ // The final extension must be non-empty. WebSphere Application Server 7.0 is
4544
+ // intolerant to the last extension being zero-length. See
4545
+ // https://crbug.com/363583.
4546
+ bool offering_psk = should_offer_psk(hs, type);
4547
+ if (!offering_psk && last_was_empty && !SSL_is_dtls(ssl) &&
4548
+ !SSL_is_quic(ssl) && !ssl->s3->used_hello_retry_request) {
4549
+ if (!add_padding_extension(&extensions, TLSEXT_TYPE_padding, 1)) {
4570
4550
  return false;
4571
4551
  }
4572
4552
  }
4573
4553
 
4574
4554
  // The PSK extension must be last, including after the padding.
4575
- size_t psk_len_actual;
4576
- if (!ext_pre_shared_key_add_clienthello(hs, out, &extensions, &psk_len_actual,
4555
+ size_t psk_len;
4556
+ if (!ext_pre_shared_key_add_clienthello(hs, out, &extensions, &psk_len,
4577
4557
  type)) {
4578
4558
  return false;
4579
4559
  }
4580
- assert(psk_len_actual == psk_len);
4560
+ assert(offering_psk == (psk_len != 0));
4581
4561
  return true;
4582
4562
  }
4583
4563
 
4584
4564
  bool ssl_add_serverhello_tlsext(SSL_HANDSHAKE *hs, CBB *out) {
4585
- SSL *const ssl = hs->ssl;
4565
+ SSLImpl *const ssl = hs->ssl;
4586
4566
  CBB extensions;
4587
4567
  if (!CBB_add_u16_length_prefixed(out, &extensions)) {
4588
4568
  goto err;
@@ -4682,7 +4662,7 @@ static bool ssl_scan_clienthello_tlsext(SSL_HANDSHAKE *hs,
4682
4662
 
4683
4663
  bool ssl_parse_clienthello_tlsext(SSL_HANDSHAKE *hs,
4684
4664
  const SSL_CLIENT_HELLO *client_hello) {
4685
- SSL *const ssl = hs->ssl;
4665
+ SSLImpl *const ssl = hs->ssl;
4686
4666
  int alert = SSL_AD_DECODE_ERROR;
4687
4667
  if (!ssl_scan_clienthello_tlsext(hs, client_hello, &alert)) {
4688
4668
  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
@@ -4768,7 +4748,7 @@ static bool ssl_scan_serverhello_tlsext(SSL_HANDSHAKE *hs, const CBS *cbs,
4768
4748
  }
4769
4749
 
4770
4750
  static bool ssl_check_clienthello_tlsext(SSL_HANDSHAKE *hs) {
4771
- SSL *const ssl = hs->ssl;
4751
+ SSLImpl *const ssl = hs->ssl;
4772
4752
  int ret = SSL_TLSEXT_ERR_NOACK;
4773
4753
  int al = SSL_AD_UNRECOGNIZED_NAME;
4774
4754
  if (ssl->ctx->servername_callback != nullptr) {
@@ -4794,7 +4774,7 @@ static bool ssl_check_clienthello_tlsext(SSL_HANDSHAKE *hs) {
4794
4774
  }
4795
4775
 
4796
4776
  static bool ssl_check_serverhello_tlsext(SSL_HANDSHAKE *hs) {
4797
- SSL *const ssl = hs->ssl;
4777
+ SSLImpl *const ssl = hs->ssl;
4798
4778
  // ALPS and ALPN have a dependency between each other, so we defer checking
4799
4779
  // consistency to after the callbacks run.
4800
4780
  if (hs->new_session != nullptr && hs->new_session->has_application_settings) {
@@ -4824,7 +4804,7 @@ static bool ssl_check_serverhello_tlsext(SSL_HANDSHAKE *hs) {
4824
4804
  }
4825
4805
 
4826
4806
  bool ssl_parse_serverhello_tlsext(SSL_HANDSHAKE *hs, const CBS *cbs) {
4827
- SSL *const ssl = hs->ssl;
4807
+ SSLImpl *const ssl = hs->ssl;
4828
4808
  int alert = SSL_AD_DECODE_ERROR;
4829
4809
  if (!ssl_scan_serverhello_tlsext(hs, cbs, &alert)) {
4830
4810
  ssl_send_alert(ssl, SSL3_AL_FATAL, alert);
@@ -4984,10 +4964,10 @@ static enum ssl_ticket_aead_result_t ssl_decrypt_ticket_with_method(
4984
4964
  }
4985
4965
 
4986
4966
  enum ssl_ticket_aead_result_t ssl_process_ticket(
4987
- SSL_HANDSHAKE *hs, UniquePtr<SSL_SESSION> *out_session,
4967
+ SSL_HANDSHAKE *hs, UniquePtr<SSLSession> *out_session,
4988
4968
  bool *out_renew_ticket, Span<const uint8_t> ticket,
4989
4969
  Span<const uint8_t> session_id, bool save_ticket) {
4990
- SSL *const ssl = hs->ssl;
4970
+ SSLImpl *const ssl = hs->ssl;
4991
4971
  *out_renew_ticket = false;
4992
4972
  out_session->reset();
4993
4973
 
@@ -5003,22 +4983,24 @@ enum ssl_ticket_aead_result_t ssl_process_ticket(
5003
4983
 
5004
4984
  Array<uint8_t> plaintext;
5005
4985
  enum ssl_ticket_aead_result_t result;
5006
- SSL_HANDSHAKE_HINTS *const hints = hs->hints.get();
5007
- if (is_psk && hints && !hs->hints_requested &&
5008
- !hints->decrypted_psk.empty()) {
5009
- result = plaintext.CopyFrom(hints->decrypted_psk) ? ssl_ticket_aead_success
5010
- : ssl_ticket_aead_error;
5011
- } else if (is_psk && hints && !hs->hints_requested && hints->ignore_psk) {
4986
+ if (is_psk && hs->provided_hints != nullptr &&
4987
+ !hs->provided_hints->decrypted_psk.empty()) {
4988
+ result = plaintext.CopyFrom(hs->provided_hints->decrypted_psk)
4989
+ ? ssl_ticket_aead_success
4990
+ : ssl_ticket_aead_error;
4991
+ } else if (is_psk && hs->provided_hints != nullptr &&
4992
+ hs->provided_hints->ignore_psk) {
5012
4993
  result = ssl_ticket_aead_ignore_ticket;
5013
- } else if (!is_psk && hints && !hs->hints_requested &&
5014
- !hints->decrypted_ticket.empty()) {
5015
- if (plaintext.CopyFrom(hints->decrypted_ticket)) {
4994
+ } else if (!is_psk && hs->provided_hints != nullptr &&
4995
+ !hs->provided_hints->decrypted_ticket.empty()) {
4996
+ if (plaintext.CopyFrom(hs->provided_hints->decrypted_ticket)) {
5016
4997
  result = ssl_ticket_aead_success;
5017
- *out_renew_ticket = hints->renew_ticket;
4998
+ *out_renew_ticket = hs->provided_hints->renew_ticket;
5018
4999
  } else {
5019
5000
  result = ssl_ticket_aead_error;
5020
5001
  }
5021
- } else if (!is_psk && hints && !hs->hints_requested && hints->ignore_ticket) {
5002
+ } else if (!is_psk && hs->provided_hints != nullptr &&
5003
+ hs->provided_hints->ignore_ticket) {
5022
5004
  result = ssl_ticket_aead_ignore_ticket;
5023
5005
  } else if (ssl->session_ctx->ticket_aead_method != nullptr) {
5024
5006
  result = ssl_decrypt_ticket_with_method(hs, &plaintext, out_renew_ticket,
@@ -5038,23 +5020,23 @@ enum ssl_ticket_aead_result_t ssl_process_ticket(
5038
5020
  }
5039
5021
  }
5040
5022
 
5041
- if (hints && hs->hints_requested) {
5023
+ if (hs->pending_hints != nullptr) {
5042
5024
  if (result == ssl_ticket_aead_ignore_ticket) {
5043
5025
  if (is_psk) {
5044
- hints->ignore_psk = true;
5026
+ hs->pending_hints->ignore_psk = true;
5045
5027
  } else {
5046
- hints->ignore_ticket = true;
5028
+ hs->pending_hints->ignore_ticket = true;
5047
5029
  }
5048
5030
  } else if (result == ssl_ticket_aead_success) {
5049
5031
  if (is_psk) {
5050
- if (!hints->decrypted_psk.CopyFrom(plaintext)) {
5032
+ if (!hs->pending_hints->decrypted_psk.CopyFrom(plaintext)) {
5051
5033
  return ssl_ticket_aead_error;
5052
5034
  }
5053
5035
  } else {
5054
- if (!hints->decrypted_ticket.CopyFrom(plaintext)) {
5036
+ if (!hs->pending_hints->decrypted_ticket.CopyFrom(plaintext)) {
5055
5037
  return ssl_ticket_aead_error;
5056
5038
  }
5057
- hints->renew_ticket = *out_renew_ticket;
5039
+ hs->pending_hints->renew_ticket = *out_renew_ticket;
5058
5040
  }
5059
5041
  }
5060
5042
  }
@@ -5064,8 +5046,8 @@ enum ssl_ticket_aead_result_t ssl_process_ticket(
5064
5046
  }
5065
5047
 
5066
5048
  // Decode the session.
5067
- UniquePtr<SSL_SESSION> session(SSL_SESSION_from_bytes(
5068
- plaintext.data(), plaintext.size(), ssl->ctx.get()));
5049
+ UniquePtr<SSLSession> session(FromOpaque(SSL_SESSION_from_bytes(
5050
+ plaintext.data(), plaintext.size(), ssl->ctx.get())));
5069
5051
  if (!session) {
5070
5052
  ERR_clear_error(); // Don't leave an error on the queue.
5071
5053
  return ssl_ticket_aead_ignore_ticket;
@@ -5112,7 +5094,7 @@ bool tls1_get_legacy_signature_algorithm(uint16_t *out, const EVP_PKEY *pkey) {
5112
5094
 
5113
5095
  bool tls1_choose_signature_algorithm(SSL_HANDSHAKE *hs,
5114
5096
  const SSLCredential *cred, uint16_t *out) {
5115
- SSL *const ssl = hs->ssl;
5097
+ SSLImpl *const ssl = hs->ssl;
5116
5098
  if (!cred->UsesPrivateKey()) {
5117
5099
  OPENSSL_PUT_ERROR(SSL, SSL_R_UNKNOWN_CERTIFICATE_TYPE);
5118
5100
  return false;
@@ -5165,7 +5147,7 @@ bool tls1_choose_signature_algorithm(SSL_HANDSHAKE *hs,
5165
5147
  }
5166
5148
 
5167
5149
  bool tls1_verify_channel_id(SSL_HANDSHAKE *hs, const SSLMessage &msg) {
5168
- SSL *const ssl = hs->ssl;
5150
+ SSLImpl *const ssl = hs->ssl;
5169
5151
  // A Channel ID handshake message is structured to contain multiple
5170
5152
  // extensions, but the only one that can be present is Channel ID.
5171
5153
  uint16_t extension_type;
@@ -5268,7 +5250,7 @@ bool tls1_write_channel_id(SSL_HANDSHAKE *hs, CBB *cbb) {
5268
5250
  }
5269
5251
 
5270
5252
  bool tls1_channel_id_hash(SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len) {
5271
- SSL *const ssl = hs->ssl;
5253
+ SSLImpl *const ssl = hs->ssl;
5272
5254
  if (ssl_protocol_version(ssl) >= TLS1_3_VERSION) {
5273
5255
  Array<uint8_t> msg;
5274
5256
  if (!tls13_get_cert_verify_signature_input(hs, &msg,
@@ -5309,7 +5291,7 @@ bool tls1_channel_id_hash(SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len) {
5309
5291
  }
5310
5292
 
5311
5293
  bool tls1_record_handshake_hashes_for_channel_id(SSL_HANDSHAKE *hs) {
5312
- SSL *const ssl = hs->ssl;
5294
+ SSLImpl *const ssl = hs->ssl;
5313
5295
  // This function should never be called for a resumed session because the
5314
5296
  // handshake hashes that we wish to record are for the original, full
5315
5297
  // handshake.
@@ -5356,7 +5338,7 @@ using namespace bssl;
5356
5338
  int SSL_parse_client_hello(const SSL *ssl, SSL_CLIENT_HELLO *out,
5357
5339
  const uint8_t *in, size_t len) {
5358
5340
  CBS cbs = Span(in, len);
5359
- if (!ssl_parse_client_hello_with_trailing_data(ssl, &cbs, out)) {
5341
+ if (!ssl_parse_client_hello_with_trailing_data(FromOpaque(ssl), &cbs, out)) {
5360
5342
  return 0;
5361
5343
  }
5362
5344
  if (CBS_len(&cbs) != 0) {