grpc 1.69.0 → 1.71.0

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 (1235) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +249 -283
  3. data/include/grpc/event_engine/endpoint_config.h +5 -5
  4. data/include/grpc/event_engine/event_engine.h +44 -5
  5. data/include/grpc/status.h +1 -1
  6. data/include/grpc/support/atm.h +0 -13
  7. data/include/grpc/support/json.h +16 -16
  8. data/src/core/call/request_buffer.cc +224 -0
  9. data/src/core/call/request_buffer.h +192 -0
  10. data/src/core/channelz/channelz.cc +2 -2
  11. data/src/core/channelz/channelz.h +3 -22
  12. data/src/core/channelz/channelz_registry.cc +0 -7
  13. data/src/core/client_channel/client_channel.cc +18 -29
  14. data/src/core/client_channel/client_channel.h +2 -2
  15. data/src/core/client_channel/client_channel_args.h +21 -0
  16. data/src/core/client_channel/client_channel_filter.cc +54 -131
  17. data/src/core/client_channel/client_channel_filter.h +11 -9
  18. data/src/core/client_channel/client_channel_plugin.cc +2 -1
  19. data/src/core/client_channel/client_channel_service_config.cc +1 -1
  20. data/src/core/client_channel/client_channel_service_config.h +5 -5
  21. data/src/core/client_channel/direct_channel.cc +1 -1
  22. data/src/core/client_channel/direct_channel.h +1 -1
  23. data/src/core/client_channel/lb_metadata.cc +7 -8
  24. data/src/core/client_channel/lb_metadata.h +3 -3
  25. data/src/core/client_channel/load_balanced_call_destination.cc +4 -4
  26. data/src/core/client_channel/retry_filter.cc +1 -1
  27. data/src/core/client_channel/retry_filter.h +1 -1
  28. data/src/core/client_channel/retry_filter_legacy_call_data.cc +10 -12
  29. data/src/core/client_channel/retry_filter_legacy_call_data.h +7 -7
  30. data/src/core/client_channel/retry_interceptor.cc +408 -0
  31. data/src/core/client_channel/retry_interceptor.h +157 -0
  32. data/src/core/client_channel/retry_service_config.cc +1 -1
  33. data/src/core/client_channel/retry_service_config.h +16 -3
  34. data/src/core/client_channel/retry_throttle.cc +33 -18
  35. data/src/core/client_channel/retry_throttle.h +3 -3
  36. data/src/core/client_channel/subchannel.cc +43 -76
  37. data/src/core/client_channel/subchannel.h +4 -4
  38. data/src/core/client_channel/subchannel_stream_client.cc +0 -1
  39. data/src/core/client_channel/subchannel_stream_client.h +3 -3
  40. data/src/core/config/config_vars.cc +1 -0
  41. data/src/core/config/config_vars.h +1 -0
  42. data/src/core/config/load_config.cc +3 -2
  43. data/src/core/config/load_config.h +1 -1
  44. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +4 -11
  45. data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +7 -7
  46. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +1 -1
  47. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +8 -15
  48. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +6 -6
  49. data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.cc +1 -1
  50. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +0 -7
  51. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +6 -6
  52. data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.cc +1 -1
  53. data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.h +1 -1
  54. data/src/core/ext/filters/http/client/http_client_filter.cc +1 -6
  55. data/src/core/ext/filters/http/client/http_client_filter.h +4 -4
  56. data/src/core/ext/filters/http/client_authority_filter.cc +6 -11
  57. data/src/core/ext/filters/http/client_authority_filter.h +6 -6
  58. data/src/core/ext/filters/http/message_compress/compression_filter.cc +18 -22
  59. data/src/core/ext/filters/http/message_compress/compression_filter.h +18 -13
  60. data/src/core/ext/filters/http/server/http_server_filter.cc +3 -8
  61. data/src/core/ext/filters/http/server/http_server_filter.h +4 -4
  62. data/src/core/ext/filters/message_size/message_size_filter.cc +13 -25
  63. data/src/core/ext/filters/message_size/message_size_filter.h +20 -21
  64. data/src/core/ext/filters/rbac/rbac_filter.cc +0 -7
  65. data/src/core/ext/filters/rbac/rbac_filter.h +6 -6
  66. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +3 -3
  67. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +1 -6
  68. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +4 -4
  69. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc +1 -1
  70. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +2 -2
  71. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -2
  72. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +4 -3
  73. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +612 -100
  74. data/src/core/ext/transport/chttp2/server/chttp2_server.h +189 -13
  75. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +1 -1
  76. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.cc +2 -2
  77. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +4 -4
  78. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +85 -59
  79. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +7 -7
  80. data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -1
  81. data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -3
  82. data/src/core/ext/transport/chttp2/transport/frame.cc +2 -2
  83. data/src/core/ext/transport/chttp2/transport/frame.h +5 -5
  84. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +8 -8
  85. data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -3
  86. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +5 -5
  87. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +2 -2
  88. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +32 -31
  89. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +6 -7
  90. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +3 -3
  91. data/src/core/ext/transport/chttp2/transport/http2_settings.h +2 -2
  92. data/src/core/ext/transport/chttp2/transport/internal.h +19 -8
  93. data/src/core/ext/transport/chttp2/transport/parsing.cc +14 -14
  94. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +1 -1
  95. data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +2 -2
  96. data/src/core/ext/transport/chttp2/transport/ping_callbacks.h +2 -2
  97. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +2 -2
  98. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +2 -2
  99. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +1 -0
  100. data/src/core/ext/transport/chttp2/transport/varint.cc +4 -4
  101. data/src/core/ext/transport/chttp2/transport/writing.cc +16 -22
  102. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
  103. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +15 -10
  104. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb.h +3 -1
  105. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +16 -0
  106. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +3 -2
  107. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +66 -36
  108. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +19 -17
  109. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +116 -0
  110. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +31 -5
  111. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +2 -0
  112. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +97 -6
  113. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +17 -11
  114. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb.h +151 -0
  115. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.c +60 -0
  116. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.h +32 -0
  117. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +228 -21
  118. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +65 -17
  119. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.h +6 -0
  120. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb.h +7 -106
  121. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.c +7 -28
  122. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.h +0 -2
  123. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +85 -0
  124. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +25 -3
  125. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
  126. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +152 -0
  127. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +40 -10
  128. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.h +2 -0
  129. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +253 -4
  130. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +70 -13
  131. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +4 -0
  132. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb.h +0 -2
  133. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.c +0 -1
  134. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.h +0 -1
  135. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +16 -0
  136. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +3 -2
  137. 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 -0
  138. 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 +13 -2
  139. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +0 -1
  140. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +0 -1
  141. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +102 -24
  142. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.c +28 -19
  143. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +37 -7
  144. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb_minitable.c +7 -5
  145. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb.h +251 -18
  146. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c +41 -16
  147. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.h +2 -0
  148. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb.h +2 -1
  149. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb.h +142 -0
  150. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.c +55 -0
  151. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.h +32 -0
  152. data/src/core/ext/upb-gen/envoy/type/matcher/v3/filter_state.upb.h +33 -0
  153. data/src/core/ext/upb-gen/envoy/type/matcher/v3/filter_state.upb_minitable.c +7 -4
  154. data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump_shared.upbdefs.c +11 -10
  155. data/src/core/ext/upbdefs-gen/envoy/admin/v3/server_info.upbdefs.c +6 -4
  156. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +418 -413
  157. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +161 -153
  158. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
  159. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +270 -261
  160. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.c +46 -0
  161. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.h +33 -0
  162. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +29 -19
  163. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.h +15 -0
  164. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.c +58 -65
  165. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.h +0 -5
  166. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +73 -63
  167. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +49 -48
  168. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +117 -100
  169. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.h +5 -0
  170. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +917 -898
  171. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +10 -0
  172. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/trace.upbdefs.c +15 -18
  173. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +33 -33
  174. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +460 -457
  175. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +16 -19
  176. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +95 -95
  177. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +202 -191
  178. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +19 -17
  179. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.c +148 -135
  180. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
  181. data/src/core/ext/upbdefs-gen/envoy/service/status/v3/csds.upbdefs.c +23 -22
  182. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.c +41 -0
  183. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.h +33 -0
  184. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/filter_state.upbdefs.c +26 -19
  185. data/src/core/filter/blackboard.cc +2 -2
  186. data/src/core/filter/filter_args.h +112 -0
  187. data/src/core/handshaker/handshaker.cc +0 -3
  188. data/src/core/handshaker/http_connect/http_connect_handshaker.cc +4 -6
  189. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +31 -32
  190. data/src/core/handshaker/http_connect/http_proxy_mapper.h +4 -4
  191. data/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc +5 -5
  192. data/src/core/handshaker/http_connect/xds_http_proxy_mapper.h +5 -5
  193. data/src/core/handshaker/proxy_mapper.h +4 -4
  194. data/src/core/handshaker/proxy_mapper_registry.cc +5 -6
  195. data/src/core/handshaker/proxy_mapper_registry.h +4 -4
  196. data/src/core/handshaker/security/secure_endpoint.cc +2 -2
  197. data/src/core/handshaker/security/security_handshaker.cc +3 -5
  198. data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +6 -4
  199. data/src/core/lib/channel/channel_args.cc +13 -13
  200. data/src/core/lib/channel/channel_args.h +8 -8
  201. data/src/core/lib/channel/connected_channel.cc +1 -1
  202. data/src/core/lib/channel/promise_based_filter.cc +9 -9
  203. data/src/core/lib/channel/promise_based_filter.h +84 -159
  204. data/src/core/lib/compression/compression.cc +3 -2
  205. data/src/core/lib/compression/compression_internal.cc +9 -9
  206. data/src/core/lib/compression/compression_internal.h +3 -3
  207. data/src/core/lib/debug/trace_flags.cc +5 -2
  208. data/src/core/lib/debug/trace_flags.h +2 -1
  209. data/src/core/lib/event_engine/ares_resolver.cc +9 -11
  210. data/src/core/lib/event_engine/ares_resolver.h +6 -10
  211. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -4
  212. data/src/core/lib/event_engine/cf_engine/cf_engine.h +2 -4
  213. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +6 -7
  214. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +2 -4
  215. data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +2 -4
  216. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +3 -7
  217. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -4
  218. data/src/core/lib/event_engine/channel_args_endpoint_config.cc +5 -7
  219. data/src/core/lib/event_engine/channel_args_endpoint_config.h +6 -7
  220. data/src/core/lib/event_engine/common_closures.h +2 -4
  221. data/src/core/lib/event_engine/default_event_engine.cc +62 -33
  222. data/src/core/lib/event_engine/default_event_engine.h +24 -33
  223. data/src/core/lib/event_engine/default_event_engine_factory.cc +6 -12
  224. data/src/core/lib/event_engine/default_event_engine_factory.h +2 -4
  225. data/src/core/lib/event_engine/event_engine.cc +2 -4
  226. data/src/core/lib/event_engine/extensions/can_track_errors.h +2 -4
  227. data/src/core/lib/event_engine/extensions/chaotic_good_extension.h +2 -4
  228. data/src/core/lib/event_engine/extensions/supports_fd.h +2 -4
  229. data/src/core/lib/event_engine/extensions/tcp_trace.h +2 -4
  230. data/src/core/lib/event_engine/forkable.cc +2 -4
  231. data/src/core/lib/event_engine/forkable.h +2 -4
  232. data/src/core/lib/event_engine/grpc_polled_fd.h +2 -4
  233. data/src/core/lib/event_engine/handle_containers.h +2 -4
  234. data/src/core/lib/event_engine/memory_allocator_factory.h +2 -4
  235. data/src/core/lib/event_engine/poller.h +2 -4
  236. data/src/core/lib/event_engine/posix.h +2 -4
  237. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -50
  238. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +2 -4
  239. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -51
  240. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +2 -4
  241. data/src/core/lib/event_engine/posix_engine/event_poller.h +2 -4
  242. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +2 -4
  243. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +2 -4
  244. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +2 -4
  245. data/src/core/lib/event_engine/posix_engine/internal_errqueue.cc +2 -4
  246. data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +2 -4
  247. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +2 -4
  248. data/src/core/lib/event_engine/posix_engine/lockfree_event.h +2 -4
  249. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +2 -4
  250. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h +2 -4
  251. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +20 -10
  252. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +2 -4
  253. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +9 -6
  254. data/src/core/lib/event_engine/posix_engine/posix_engine.h +2 -6
  255. data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +2 -4
  256. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +3 -5
  257. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -4
  258. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +2 -4
  259. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +2 -4
  260. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +5 -6
  261. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +2 -4
  262. data/src/core/lib/event_engine/posix_engine/timer.cc +4 -6
  263. data/src/core/lib/event_engine/posix_engine/timer.h +4 -6
  264. data/src/core/lib/event_engine/posix_engine/timer_heap.cc +2 -4
  265. data/src/core/lib/event_engine/posix_engine/timer_heap.h +2 -4
  266. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +5 -7
  267. data/src/core/lib/event_engine/posix_engine/timer_manager.h +4 -6
  268. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +4 -8
  269. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +24 -25
  270. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc +2 -4
  271. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +2 -4
  272. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +2 -4
  273. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +2 -4
  274. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +2 -4
  275. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc +2 -4
  276. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +2 -4
  277. data/src/core/lib/event_engine/query_extensions.h +2 -4
  278. data/src/core/lib/event_engine/ref_counted_dns_resolver_interface.h +2 -4
  279. data/src/core/lib/event_engine/resolved_address.cc +2 -4
  280. data/src/core/lib/event_engine/resolved_address_internal.h +2 -4
  281. data/src/core/lib/event_engine/shim.cc +2 -4
  282. data/src/core/lib/event_engine/shim.h +2 -4
  283. data/src/core/lib/event_engine/slice.cc +2 -4
  284. data/src/core/lib/event_engine/slice_buffer.cc +2 -4
  285. data/src/core/lib/event_engine/tcp_socket_utils.cc +6 -8
  286. data/src/core/lib/event_engine/tcp_socket_utils.h +5 -7
  287. data/src/core/lib/event_engine/thread_local.cc +2 -4
  288. data/src/core/lib/event_engine/thread_local.h +2 -4
  289. data/src/core/lib/event_engine/thread_pool/thread_count.cc +2 -4
  290. data/src/core/lib/event_engine/thread_pool/thread_count.h +4 -18
  291. data/src/core/lib/event_engine/thread_pool/thread_pool.h +2 -4
  292. data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +2 -4
  293. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +3 -5
  294. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +2 -4
  295. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +2 -4
  296. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +2 -4
  297. data/src/core/lib/event_engine/time_util.cc +2 -4
  298. data/src/core/lib/event_engine/time_util.h +2 -4
  299. data/src/core/lib/event_engine/utils.cc +2 -4
  300. data/src/core/lib/event_engine/utils.h +2 -4
  301. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +2 -4
  302. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.h +2 -4
  303. data/src/core/lib/event_engine/windows/iocp.cc +2 -4
  304. data/src/core/lib/event_engine/windows/iocp.h +2 -4
  305. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.cc +2 -4
  306. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.h +2 -4
  307. data/src/core/lib/event_engine/windows/win_socket.cc +2 -4
  308. data/src/core/lib/event_engine/windows/win_socket.h +2 -4
  309. data/src/core/lib/event_engine/windows/windows_endpoint.cc +2 -4
  310. data/src/core/lib/event_engine/windows/windows_endpoint.h +4 -6
  311. data/src/core/lib/event_engine/windows/windows_engine.cc +3 -4
  312. data/src/core/lib/event_engine/windows/windows_engine.h +2 -4
  313. data/src/core/lib/event_engine/windows/windows_listener.cc +2 -4
  314. data/src/core/lib/event_engine/windows/windows_listener.h +2 -4
  315. data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +2 -4
  316. data/src/core/lib/event_engine/work_queue/basic_work_queue.h +2 -4
  317. data/src/core/lib/event_engine/work_queue/work_queue.h +2 -4
  318. data/src/core/lib/experiments/experiments.cc +147 -207
  319. data/src/core/lib/experiments/experiments.h +79 -96
  320. data/src/core/lib/iomgr/buffer_list.h +22 -21
  321. data/src/core/lib/iomgr/cfstream_handle.cc +0 -2
  322. data/src/core/lib/iomgr/closure.h +1 -4
  323. data/src/core/lib/iomgr/combiner.cc +0 -1
  324. data/src/core/lib/iomgr/error.cc +2 -2
  325. data/src/core/lib/iomgr/event_engine_shims/closure.cc +0 -1
  326. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -3
  327. data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +0 -1
  328. data/src/core/lib/iomgr/exec_ctx.cc +1 -7
  329. data/src/core/lib/iomgr/exec_ctx.h +1 -132
  330. data/src/core/lib/iomgr/executor.cc +0 -11
  331. data/src/core/lib/iomgr/resolve_address_posix.cc +0 -2
  332. data/src/core/lib/iomgr/resolve_address_windows.cc +0 -2
  333. data/src/core/lib/iomgr/socket_utils_posix.cc +3 -2
  334. data/src/core/lib/iomgr/tcp_posix.cc +3 -2
  335. data/src/core/lib/iomgr/tcp_server_posix.cc +1 -3
  336. data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
  337. data/src/core/lib/iomgr/timer_manager.cc +1 -9
  338. data/src/core/lib/promise/activity.cc +2 -0
  339. data/src/core/lib/promise/activity.h +33 -12
  340. data/src/core/lib/promise/detail/join_state.h +16 -68
  341. data/src/core/lib/promise/detail/promise_factory.h +85 -25
  342. data/src/core/lib/promise/detail/promise_like.h +16 -19
  343. data/src/core/lib/promise/detail/seq_state.h +102 -315
  344. data/src/core/lib/promise/for_each.h +14 -5
  345. data/src/core/lib/promise/if.h +48 -20
  346. data/src/core/lib/promise/interceptor_list.h +9 -9
  347. data/src/core/lib/promise/latch.h +14 -6
  348. data/src/core/lib/promise/loop.h +58 -18
  349. data/src/core/lib/promise/map.h +145 -49
  350. data/src/core/lib/promise/party.cc +84 -15
  351. data/src/core/lib/promise/party.h +229 -32
  352. data/src/core/lib/promise/pipe.h +12 -12
  353. data/src/core/lib/promise/poll.h +8 -5
  354. data/src/core/lib/promise/prioritized_race.h +16 -22
  355. data/src/core/lib/promise/promise.h +2 -3
  356. data/src/core/lib/promise/race.h +4 -12
  357. data/src/core/lib/promise/seq.h +41 -6
  358. data/src/core/lib/promise/sleep.cc +3 -3
  359. data/src/core/lib/promise/sleep.h +15 -1
  360. data/src/core/lib/promise/status_flag.h +19 -3
  361. data/src/core/lib/promise/try_join.h +119 -5
  362. data/src/core/lib/promise/try_seq.h +39 -12
  363. data/src/core/lib/resource_quota/arena.h +87 -0
  364. data/src/core/lib/resource_quota/connection_quota.h +4 -0
  365. data/src/core/lib/resource_quota/memory_quota.cc +53 -49
  366. data/src/core/lib/resource_quota/memory_quota.h +4 -4
  367. data/src/core/lib/security/authorization/evaluate_args.cc +3 -3
  368. data/src/core/lib/security/authorization/evaluate_args.h +3 -3
  369. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +0 -7
  370. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +6 -6
  371. data/src/core/lib/security/authorization/matchers.h +3 -3
  372. data/src/core/lib/security/authorization/rbac_policy.cc +1 -1
  373. data/src/core/lib/security/authorization/rbac_policy.h +3 -3
  374. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +1 -2
  375. data/src/core/lib/security/credentials/external/external_account_credentials.cc +1 -3
  376. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +0 -1
  377. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +1 -1
  378. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -2
  379. data/src/core/lib/security/credentials/iam/iam_credentials.cc +1 -1
  380. data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -2
  381. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +1 -2
  382. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -2
  383. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +0 -1
  384. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +4 -4
  385. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +3 -3
  386. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +0 -1
  387. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +2 -2
  388. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +12 -13
  389. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +14 -14
  390. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +23 -15
  391. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +3 -3
  392. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.cc +0 -1
  393. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.h +1 -2
  394. data/src/core/lib/security/credentials/tls/tls_credentials.cc +2 -2
  395. data/src/core/lib/security/credentials/token_fetcher/token_fetcher_credentials.cc +4 -5
  396. data/src/core/lib/security/credentials/token_fetcher/token_fetcher_credentials.h +4 -4
  397. data/src/core/lib/security/credentials/xds/xds_credentials.cc +2 -1
  398. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -1
  399. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +3 -3
  400. data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
  401. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +9 -9
  402. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +13 -13
  403. data/src/core/lib/security/transport/auth_filters.h +95 -7
  404. data/src/core/lib/security/transport/client_auth_filter.cc +96 -6
  405. data/src/core/lib/security/transport/server_auth_filter.cc +0 -8
  406. data/src/core/lib/slice/slice_buffer.cc +2 -2
  407. data/src/core/lib/slice/slice_buffer.h +2 -2
  408. data/src/core/lib/surface/call.cc +0 -4
  409. data/src/core/lib/surface/call.h +4 -3
  410. data/src/core/lib/surface/call_utils.cc +2 -2
  411. data/src/core/lib/surface/call_utils.h +10 -4
  412. data/src/core/lib/surface/channel.cc +6 -14
  413. data/src/core/lib/surface/channel.h +3 -3
  414. data/src/core/lib/surface/channel_init.cc +1 -1
  415. data/src/core/lib/surface/client_call.cc +56 -41
  416. data/src/core/lib/surface/client_call.h +7 -2
  417. data/src/core/lib/surface/completion_queue.cc +10 -49
  418. data/src/core/lib/surface/event_string.cc +7 -1
  419. data/src/core/lib/surface/filter_stack_call.cc +2 -4
  420. data/src/core/lib/surface/filter_stack_call.h +1 -1
  421. data/src/core/lib/surface/init.cc +17 -12
  422. data/src/core/lib/surface/init_internally.h +13 -2
  423. data/src/core/lib/surface/legacy_channel.cc +10 -8
  424. data/src/core/lib/surface/legacy_channel.h +2 -2
  425. data/src/core/lib/surface/server_call.cc +116 -84
  426. data/src/core/lib/surface/server_call.h +2 -0
  427. data/src/core/lib/surface/version.cc +2 -2
  428. data/src/core/lib/transport/call_filters.cc +10 -4
  429. data/src/core/lib/transport/call_filters.h +108 -59
  430. data/src/core/lib/transport/call_spine.cc +12 -49
  431. data/src/core/lib/transport/call_spine.h +174 -7
  432. data/src/core/lib/transport/call_state.h +140 -47
  433. data/src/core/lib/transport/connectivity_state.cc +8 -9
  434. data/src/core/lib/transport/connectivity_state.h +2 -4
  435. data/src/core/lib/transport/http2_errors.h +5 -3
  436. data/src/core/lib/transport/interception_chain.cc +8 -0
  437. data/src/core/lib/transport/interception_chain.h +36 -7
  438. data/src/core/lib/transport/metadata.h +88 -0
  439. data/src/core/lib/transport/metadata_batch.cc +2 -2
  440. data/src/core/lib/transport/metadata_batch.h +79 -18
  441. data/src/core/lib/transport/timeout_encoding.cc +15 -15
  442. data/src/core/lib/transport/timeout_encoding.h +3 -2
  443. data/src/core/lib/transport/transport.cc +0 -1
  444. data/src/core/lib/transport/transport.h +12 -7
  445. data/src/core/load_balancing/backend_metric_parser.cc +21 -28
  446. data/src/core/load_balancing/endpoint_list.cc +11 -1
  447. data/src/core/load_balancing/endpoint_list.h +20 -13
  448. data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +1 -6
  449. data/src/core/load_balancing/grpclb/client_load_reporting_filter.h +4 -4
  450. data/src/core/load_balancing/grpclb/grpclb.cc +21 -38
  451. data/src/core/load_balancing/health_check_client.cc +16 -48
  452. data/src/core/load_balancing/health_check_client_internal.h +7 -7
  453. data/src/core/load_balancing/lb_policy.cc +4 -6
  454. data/src/core/load_balancing/lb_policy.h +4 -12
  455. data/src/core/load_balancing/lb_policy_registry.cc +10 -8
  456. data/src/core/load_balancing/outlier_detection/outlier_detection.cc +57 -68
  457. data/src/core/load_balancing/outlier_detection/outlier_detection.h +4 -3
  458. data/src/core/load_balancing/pick_first/pick_first.cc +110 -77
  459. data/src/core/load_balancing/priority/priority.cc +8 -13
  460. data/src/core/load_balancing/ring_hash/ring_hash.cc +210 -158
  461. data/src/core/load_balancing/ring_hash/ring_hash.h +4 -11
  462. data/src/core/load_balancing/rls/rls.cc +105 -194
  463. data/src/core/load_balancing/rls/rls.h +97 -1
  464. data/src/core/load_balancing/round_robin/round_robin.cc +14 -19
  465. data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +4 -4
  466. data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.h +2 -2
  467. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +20 -29
  468. data/src/core/load_balancing/weighted_target/weighted_target.cc +7 -15
  469. data/src/core/load_balancing/xds/cds.cc +11 -15
  470. data/src/core/load_balancing/xds/xds_cluster_impl.cc +15 -18
  471. data/src/core/load_balancing/xds/xds_cluster_manager.cc +10 -18
  472. data/src/core/load_balancing/xds/xds_override_host.cc +45 -92
  473. data/src/core/load_balancing/xds/xds_wrr_locality.cc +10 -12
  474. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +11 -11
  475. data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +10 -15
  476. data/src/core/resolver/dns/native/dns_resolver.cc +1 -1
  477. data/src/core/resolver/fake/fake_resolver.cc +10 -11
  478. data/src/core/resolver/fake/fake_resolver.h +2 -2
  479. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +9 -12
  480. data/src/core/resolver/polling_resolver.cc +2 -5
  481. data/src/core/resolver/polling_resolver.h +3 -3
  482. data/src/core/resolver/resolver_registry.cc +4 -3
  483. data/src/core/resolver/xds/xds_config.cc +6 -6
  484. data/src/core/resolver/xds/xds_config.h +2 -2
  485. data/src/core/resolver/xds/xds_dependency_manager.cc +190 -183
  486. data/src/core/resolver/xds/xds_dependency_manager.h +28 -18
  487. data/src/core/resolver/xds/xds_resolver.cc +81 -122
  488. data/src/core/server/server.cc +353 -95
  489. data/src/core/server/server.h +214 -65
  490. data/src/core/server/server_call_tracer_filter.cc +3 -7
  491. data/src/core/server/server_config_selector_filter.cc +8 -15
  492. data/src/core/server/xds_server_config_fetcher.cc +93 -159
  493. data/src/core/service_config/service_config_channel_arg_filter.cc +7 -19
  494. data/src/core/service_config/service_config_impl.cc +3 -3
  495. data/src/core/telemetry/call_tracer.cc +8 -8
  496. data/src/core/telemetry/call_tracer.h +6 -5
  497. data/src/core/telemetry/metrics.cc +3 -3
  498. data/src/core/telemetry/metrics.h +2 -8
  499. data/src/core/telemetry/tcp_tracer.h +32 -32
  500. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -3
  501. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +14 -14
  502. data/src/core/tsi/fake_transport_security.cc +5 -0
  503. data/src/core/util/backoff.cc +15 -4
  504. data/src/core/util/dump_args.h +1 -9
  505. data/src/core/util/env.h +3 -4
  506. data/src/core/util/examine_stack.cc +2 -2
  507. data/src/core/util/examine_stack.h +3 -4
  508. data/src/core/util/gpr_time.cc +0 -2
  509. data/src/core/util/http_client/httpcli.cc +69 -22
  510. data/src/core/util/http_client/httpcli.h +18 -8
  511. data/src/core/util/http_client/httpcli_security_connector.cc +2 -2
  512. data/src/core/util/json/json_channel_args.h +2 -1
  513. data/src/core/util/json/json_object_loader.cc +4 -4
  514. data/src/core/util/json/json_object_loader.h +12 -12
  515. data/src/core/util/json/json_reader.cc +4 -4
  516. data/src/core/util/json/json_writer.cc +3 -3
  517. data/src/core/util/latent_see.cc +3 -3
  518. data/src/core/util/latent_see.h +2 -2
  519. data/src/core/util/linux/env.cc +3 -4
  520. data/src/core/util/lru_cache.h +4 -4
  521. data/src/core/util/match.h +7 -7
  522. data/src/core/util/matchers.cc +1 -2
  523. data/src/core/util/matchers.h +7 -12
  524. data/src/core/util/posix/env.cc +2 -2
  525. data/src/core/util/posix/sync.cc +0 -1
  526. data/src/core/util/posix/time.cc +0 -1
  527. data/src/core/util/ref_counted.h +1 -0
  528. data/src/core/util/ref_counted_ptr.h +1 -1
  529. data/src/core/util/ring_buffer.h +4 -5
  530. data/src/core/util/status_helper.cc +16 -20
  531. data/src/core/util/status_helper.h +5 -5
  532. data/src/core/util/sync_abseil.cc +0 -1
  533. data/src/core/util/table.h +6 -21
  534. data/src/core/util/time.cc +1 -1
  535. data/src/core/util/time.h +3 -3
  536. data/src/core/util/time_precise.cc +0 -1
  537. data/src/core/util/type_list.h +56 -0
  538. data/src/core/util/uri.cc +6 -4
  539. data/src/core/util/uri.h +7 -0
  540. data/src/core/util/useful.h +13 -15
  541. data/src/core/util/validation_errors.cc +5 -5
  542. data/src/core/util/wait_for_single_owner.h +62 -0
  543. data/src/core/util/windows/env.cc +3 -3
  544. data/src/core/util/windows/sync.cc +0 -1
  545. data/src/core/util/windows/time.cc +0 -1
  546. data/src/core/util/work_serializer.cc +27 -267
  547. data/src/core/util/work_serializer.h +3 -27
  548. data/src/core/xds/grpc/certificate_provider_store.cc +12 -17
  549. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +2 -2
  550. data/src/core/xds/grpc/xds_audit_logger_registry.cc +1 -1
  551. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +11 -14
  552. data/src/core/xds/grpc/xds_bootstrap_grpc.h +2 -2
  553. data/src/core/xds/grpc/xds_certificate_provider.cc +15 -15
  554. data/src/core/xds/grpc/xds_client_grpc.cc +7 -8
  555. data/src/core/xds/grpc/xds_cluster.h +4 -4
  556. data/src/core/xds/grpc/xds_cluster_parser.cc +26 -26
  557. data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +4 -4
  558. data/src/core/xds/grpc/xds_common_types.cc +2 -2
  559. data/src/core/xds/grpc/xds_common_types.h +4 -4
  560. data/src/core/xds/grpc/xds_common_types_parser.cc +29 -31
  561. data/src/core/xds/grpc/xds_common_types_parser.h +8 -7
  562. data/src/core/xds/grpc/xds_endpoint.cc +3 -4
  563. data/src/core/xds/grpc/xds_endpoint_parser.cc +68 -37
  564. data/src/core/xds/grpc/xds_health_status.cc +4 -4
  565. data/src/core/xds/grpc/xds_health_status.h +4 -3
  566. data/src/core/xds/grpc/xds_http_fault_filter.cc +18 -20
  567. data/src/core/xds/grpc/xds_http_fault_filter.h +4 -3
  568. data/src/core/xds/grpc/xds_http_filter.h +3 -3
  569. data/src/core/xds/grpc/xds_http_filter_registry.cc +7 -7
  570. data/src/core/xds/grpc/xds_http_filter_registry.h +3 -3
  571. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +7 -7
  572. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +4 -3
  573. data/src/core/xds/grpc/xds_http_rbac_filter.cc +30 -23
  574. data/src/core/xds/grpc/xds_http_rbac_filter.h +4 -3
  575. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +10 -10
  576. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +4 -3
  577. data/src/core/xds/grpc/xds_lb_policy_registry.cc +4 -4
  578. data/src/core/xds/grpc/xds_listener.cc +4 -6
  579. data/src/core/xds/grpc/xds_listener.h +10 -10
  580. data/src/core/xds/grpc/xds_listener_parser.cc +58 -51
  581. data/src/core/xds/grpc/xds_listener_parser.h +2 -1
  582. data/src/core/xds/grpc/xds_metadata.cc +5 -5
  583. data/src/core/xds/grpc/xds_metadata.h +8 -0
  584. data/src/core/xds/grpc/xds_metadata_parser.cc +65 -52
  585. data/src/core/xds/grpc/xds_route_config.cc +9 -15
  586. data/src/core/xds/grpc/xds_route_config.h +9 -9
  587. data/src/core/xds/grpc/xds_route_config_parser.cc +114 -116
  588. data/src/core/xds/grpc/xds_route_config_parser.h +4 -4
  589. data/src/core/xds/grpc/xds_routing.cc +6 -6
  590. data/src/core/xds/grpc/xds_routing.h +5 -5
  591. data/src/core/xds/grpc/xds_server_grpc.cc +22 -1
  592. data/src/core/xds/grpc/xds_server_grpc.h +5 -2
  593. data/src/core/xds/grpc/xds_server_grpc_interface.h +33 -0
  594. data/src/core/xds/grpc/xds_transport_grpc.cc +5 -6
  595. data/src/core/xds/xds_client/lrs_client.cc +71 -83
  596. data/src/core/xds/xds_client/lrs_client.h +8 -8
  597. data/src/core/xds/xds_client/xds_api.cc +5 -228
  598. data/src/core/xds/xds_client/xds_api.h +1 -133
  599. data/src/core/xds/xds_client/xds_bootstrap.cc +11 -1
  600. data/src/core/xds/xds_client/xds_bootstrap.h +7 -0
  601. data/src/core/xds/xds_client/xds_client.cc +1030 -704
  602. data/src/core/xds/xds_client/xds_client.h +135 -29
  603. data/src/core/xds/xds_client/xds_resource_type.h +2 -3
  604. data/src/core/xds/xds_client/xds_resource_type_impl.h +13 -8
  605. data/src/ruby/ext/grpc/extconf.rb +1 -0
  606. data/src/ruby/lib/grpc/version.rb +1 -1
  607. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_bitstr.c → a_bitstr.cc} +16 -57
  608. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.cc +53 -0
  609. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.cc +47 -0
  610. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_dup.cc +42 -0
  611. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.cc +109 -0
  612. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_i2d_fp.cc +43 -0
  613. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_int.c → a_int.cc} +15 -56
  614. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_mbstr.c → a_mbstr.cc} +22 -62
  615. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_object.c → a_object.cc} +14 -56
  616. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.cc +32 -0
  617. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strex.c → a_strex.cc} +13 -55
  618. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strnid.c → a_strnid.cc} +20 -59
  619. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_time.c → a_time.cc} +41 -76
  620. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_type.c → a_type.cc} +17 -59
  621. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.cc +109 -0
  622. data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_lib.c → asn1_lib.cc} +17 -59
  623. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.cc +61 -0
  624. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.cc +56 -0
  625. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.cc +63 -0
  626. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.cc +52 -0
  627. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +13 -57
  628. data/third_party/boringssl-with-bazel/src/crypto/asn1/{posix_time.c → posix_time.cc} +14 -14
  629. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_dec.c → tasn_dec.cc} +17 -58
  630. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_enc.c → tasn_enc.cc} +22 -61
  631. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.cc +164 -0
  632. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_new.c → tasn_new.cc} +20 -61
  633. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.cc +84 -0
  634. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_utl.c → tasn_utl.cc} +26 -65
  635. data/third_party/boringssl-with-bazel/src/crypto/base64/{base64.c → base64.cc} +22 -67
  636. data/third_party/boringssl-with-bazel/src/crypto/bcm_support.h +19 -13
  637. data/third_party/boringssl-with-bazel/src/crypto/bio/{bio.c → bio.cc} +45 -113
  638. data/third_party/boringssl-with-bazel/src/crypto/bio/{bio_mem.c → bio_mem.cc} +21 -62
  639. data/third_party/boringssl-with-bazel/src/crypto/bio/{connect.c → connect.cc} +40 -73
  640. data/third_party/boringssl-with-bazel/src/crypto/bio/errno.cc +50 -0
  641. data/third_party/boringssl-with-bazel/src/crypto/bio/{fd.c → fd.cc} +14 -56
  642. data/third_party/boringssl-with-bazel/src/crypto/bio/{file.c → file.cc} +17 -59
  643. data/third_party/boringssl-with-bazel/src/crypto/bio/hexdump.cc +152 -0
  644. data/third_party/boringssl-with-bazel/src/crypto/bio/internal.h +13 -55
  645. data/third_party/boringssl-with-bazel/src/crypto/bio/{pair.c → pair.cc} +37 -71
  646. data/third_party/boringssl-with-bazel/src/crypto/bio/printf.cc +59 -0
  647. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.cc +147 -0
  648. data/third_party/boringssl-with-bazel/src/crypto/bio/{socket_helper.c → socket_helper.cc} +13 -13
  649. data/third_party/boringssl-with-bazel/src/crypto/blake2/{blake2.c → blake2.cc} +14 -14
  650. data/third_party/boringssl-with-bazel/src/crypto/{bn_extra/bn_asn1.c → bn/bn_asn1.cc} +13 -13
  651. data/third_party/boringssl-with-bazel/src/crypto/{bn_extra/convert.c → bn/convert.cc} +34 -76
  652. data/third_party/boringssl-with-bazel/src/crypto/buf/buf.cc +118 -0
  653. data/third_party/boringssl-with-bazel/src/crypto/bytestring/asn1_compat.cc +53 -0
  654. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{ber.c → ber.cc} +13 -13
  655. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbb.c → cbb.cc} +45 -61
  656. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbs.c → cbs.cc} +42 -41
  657. data/third_party/boringssl-with-bazel/src/crypto/bytestring/internal.h +13 -13
  658. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{unicode.c → unicode.cc} +13 -13
  659. data/third_party/boringssl-with-bazel/src/crypto/chacha/{chacha.c → chacha.cc} +13 -13
  660. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +18 -18
  661. data/third_party/boringssl-with-bazel/src/crypto/cipher/derive_key.cc +110 -0
  662. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_aesctrhmac.c → cipher/e_aesctrhmac.cc} +18 -23
  663. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_aesgcmsiv.c → cipher/e_aesgcmsiv.cc} +42 -38
  664. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_chacha20poly1305.c → cipher/e_chacha20poly1305.cc} +13 -20
  665. data/third_party/boringssl-with-bazel/src/crypto/cipher/e_des.cc +198 -0
  666. data/third_party/boringssl-with-bazel/src/crypto/cipher/e_null.cc +51 -0
  667. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_rc2.c → cipher/e_rc2.cc} +50 -88
  668. data/third_party/boringssl-with-bazel/src/crypto/cipher/e_rc4.cc +54 -0
  669. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_tls.c → cipher/e_tls.cc} +14 -13
  670. data/third_party/boringssl-with-bazel/src/crypto/cipher/get_cipher.cc +85 -0
  671. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra → cipher}/internal.h +29 -69
  672. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/tls_cbc.c → cipher/tls_cbc.cc} +13 -51
  673. data/third_party/boringssl-with-bazel/src/crypto/conf/{conf.c → conf.cc} +31 -72
  674. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +13 -13
  675. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_apple.c → cpu_aarch64_apple.cc} +14 -14
  676. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_fuchsia.c → cpu_aarch64_fuchsia.cc} +14 -14
  677. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_linux.c → cpu_aarch64_linux.cc} +14 -14
  678. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_openbsd.c → cpu_aarch64_openbsd.cc} +17 -17
  679. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_sysreg.c → cpu_aarch64_sysreg.cc} +15 -14
  680. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.cc +41 -0
  681. data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_freebsd.c → cpu_arm_freebsd.cc} +15 -15
  682. data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_linux.c → cpu_arm_linux.cc} +17 -17
  683. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.h +13 -13
  684. data/third_party/boringssl-with-bazel/src/crypto/{cpu_intel.c → cpu_intel.cc} +60 -99
  685. data/third_party/boringssl-with-bazel/src/crypto/{crypto.c → crypto.cc} +18 -23
  686. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{curve25519.c → curve25519.cc} +40 -43
  687. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.cc +18 -0
  688. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +13 -13
  689. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +13 -13
  690. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{spake25519.c → spake25519.cc} +34 -28
  691. data/third_party/boringssl-with-bazel/src/crypto/des/{des.c → des.cc} +13 -55
  692. data/third_party/boringssl-with-bazel/src/crypto/des/internal.h +27 -69
  693. data/third_party/boringssl-with-bazel/src/crypto/dh/dh_asn1.cc +124 -0
  694. data/third_party/boringssl-with-bazel/src/crypto/{dh_extra/params.c → dh/params.cc} +13 -51
  695. data/third_party/boringssl-with-bazel/src/crypto/{digest_extra/digest_extra.c → digest/digest_extra.cc} +126 -86
  696. data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa.c → dsa.cc} +166 -212
  697. data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa_asn1.c → dsa_asn1.cc} +13 -53
  698. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +13 -15
  699. data/third_party/boringssl-with-bazel/src/crypto/{ec_extra/ec_asn1.c → ec/ec_asn1.cc} +59 -61
  700. data/third_party/boringssl-with-bazel/src/crypto/{ec_extra/ec_derive.c → ec/ec_derive.cc} +13 -13
  701. data/third_party/boringssl-with-bazel/src/crypto/{ec_extra/hash_to_curve.c → ec/hash_to_curve.cc} +79 -77
  702. data/third_party/boringssl-with-bazel/src/crypto/{ec_extra → ec}/internal.h +13 -13
  703. data/third_party/boringssl-with-bazel/src/crypto/ecdh/ecdh.cc +73 -0
  704. data/third_party/boringssl-with-bazel/src/crypto/{ecdsa_extra/ecdsa_asn1.c → ecdsa/ecdsa_asn1.cc} +32 -86
  705. data/third_party/boringssl-with-bazel/src/crypto/engine/{engine.c → engine.cc} +24 -20
  706. data/third_party/boringssl-with-bazel/src/crypto/err/{err.c → err.cc} +41 -134
  707. data/third_party/boringssl-with-bazel/src/crypto/err/internal.h +13 -13
  708. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp.c → evp.cc} +37 -88
  709. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_asn1.c → evp_asn1.cc} +122 -198
  710. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_ctx.c → evp_ctx.cc} +20 -63
  711. data/third_party/boringssl-with-bazel/src/crypto/evp/internal.h +13 -55
  712. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh.c → p_dh.cc} +38 -22
  713. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh_asn1.c → p_dh_asn1.cc} +51 -29
  714. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dsa_asn1.c → p_dsa_asn1.cc} +75 -134
  715. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec.c → p_ec.cc} +31 -75
  716. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec_asn1.c → p_ec_asn1.cc} +36 -82
  717. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519.c → p_ed25519.cc} +34 -31
  718. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519_asn1.c → p_ed25519_asn1.cc} +26 -25
  719. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_hkdf.c → p_hkdf.cc} +30 -26
  720. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa.c → p_rsa.cc} +54 -91
  721. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa_asn1.c → p_rsa_asn1.cc} +26 -69
  722. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519.c → p_x25519.cc} +34 -31
  723. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519_asn1.c → p_x25519_asn1.cc} +30 -29
  724. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.cc +98 -0
  725. data/third_party/boringssl-with-bazel/src/crypto/evp/{print.c → print.cc} +17 -56
  726. data/third_party/boringssl-with-bazel/src/crypto/evp/{scrypt.c → scrypt.cc} +20 -13
  727. data/third_party/boringssl-with-bazel/src/crypto/evp/sign.cc +114 -0
  728. data/third_party/boringssl-with-bazel/src/crypto/ex_data.cc +141 -0
  729. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.cc.inc +191 -0
  730. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes_nohw.c.inc → aes_nohw.cc.inc} +13 -13
  731. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/cbc.c.inc → aes/cbc.cc.inc} +13 -47
  732. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/cfb.c.inc → aes/cfb.cc.inc} +13 -47
  733. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/ctr.cc.inc +100 -0
  734. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/gcm.c.inc → aes/gcm.cc.inc} +175 -314
  735. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/gcm_nohw.c.inc → aes/gcm_nohw.cc.inc} +13 -13
  736. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +419 -70
  737. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{key_wrap.c.inc → key_wrap.cc.inc} +14 -48
  738. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.cc.inc +84 -0
  739. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/ofb.cc.inc +53 -0
  740. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/polyval.c.inc → aes/polyval.cc.inc} +14 -15
  741. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{bcm.c → bcm.cc} +116 -113
  742. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm_interface.h +665 -25
  743. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{add.c.inc → add.cc.inc} +14 -55
  744. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/asm/{x86_64-gcc.c.inc → x86_64-gcc.cc.inc} +19 -6
  745. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bn.c.inc → bn.cc.inc} +25 -79
  746. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bytes.c.inc → bytes.cc.inc} +13 -55
  747. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{cmp.c.inc → cmp.cc.inc} +13 -55
  748. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{ctx.c.inc → ctx.cc.inc} +20 -63
  749. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div.c.inc → div.cc.inc} +42 -93
  750. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div_extra.c.inc → div_extra.cc.inc} +13 -13
  751. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{exponentiation.c.inc → exponentiation.cc.inc} +38 -131
  752. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd.c.inc → gcd.cc.inc} +16 -113
  753. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd_extra.c.inc → gcd_extra.cc.inc} +45 -37
  754. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{generic.c.inc → generic.cc.inc} +13 -55
  755. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +25 -134
  756. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/jacobi.cc.inc +108 -0
  757. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery.c.inc → montgomery.cc.inc} +24 -126
  758. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery_inv.c.inc → montgomery_inv.cc.inc} +13 -13
  759. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{mul.c.inc → mul.cc.inc} +24 -70
  760. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{prime.c.inc → prime.cc.inc} +44 -141
  761. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{random.c.inc → random.cc.inc} +13 -107
  762. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{rsaz_exp.c.inc → rsaz_exp.cc.inc} +18 -13
  763. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.h +20 -17
  764. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{shift.c.inc → shift.cc.inc} +16 -59
  765. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{sqrt.c.inc → sqrt.cc.inc} +13 -53
  766. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{aead.c.inc → aead.cc.inc} +30 -22
  767. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{cipher.c.inc → cipher.cc.inc} +20 -65
  768. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aes.c.inc → e_aes.cc.inc} +113 -335
  769. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aesccm.c.inc → e_aesccm.cc.inc} +21 -58
  770. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/internal.h +14 -65
  771. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cmac/{cmac.c.inc → cmac.cc.inc} +19 -53
  772. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +26 -22
  773. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{check.c.inc → check.cc.inc} +13 -55
  774. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{dh.c.inc → dh.cc.inc} +28 -74
  775. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +13 -15
  776. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digest.c.inc → digest.cc.inc} +30 -68
  777. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.cc.inc +178 -0
  778. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/internal.h +13 -55
  779. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +13 -47
  780. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digestsign/{digestsign.c.inc → digestsign.cc.inc} +14 -55
  781. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +91 -91
  782. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec.c.inc → ec.cc.inc} +24 -81
  783. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_key.c.inc → ec_key.cc.inc} +26 -86
  784. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_montgomery.c.inc → ec_montgomery.cc.inc} +14 -66
  785. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{felem.c.inc → felem.cc.inc} +13 -13
  786. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +19 -66
  787. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{oct.c.inc → oct.cc.inc} +19 -72
  788. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p224-64.c.inc → p224-64.cc.inc} +13 -13
  789. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz-table.h +15 -10
  790. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256-nistz.c.inc → p256-nistz.cc.inc} +37 -30
  791. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.h +22 -17
  792. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256.c.inc → p256.cc.inc} +13 -13
  793. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +13 -13
  794. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{scalar.c.inc → scalar.cc.inc} +21 -15
  795. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple.c.inc → simple.cc.inc} +14 -66
  796. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple_mul.c.inc → simple_mul.cc.inc} +13 -13
  797. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{util.c.inc → util.cc.inc} +13 -13
  798. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{wnaf.c.inc → wnaf.cc.inc} +38 -81
  799. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.cc.inc +88 -0
  800. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/{ecdsa.c.inc → ecdsa.cc.inc} +19 -58
  801. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +13 -13
  802. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/fips_shared_support.cc +28 -0
  803. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/{hkdf.c.inc → hkdf.cc.inc} +13 -13
  804. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hmac/{hmac.c.inc → hmac.cc.inc} +16 -57
  805. data/third_party/boringssl-with-bazel/src/crypto/{keccak → fipsmodule/keccak}/internal.h +13 -13
  806. data/third_party/boringssl-with-bazel/src/crypto/{keccak/keccak.c → fipsmodule/keccak/keccak.cc.inc} +14 -14
  807. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/mldsa/mldsa.cc.inc +1993 -0
  808. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/mlkem/mlkem.cc.inc +1165 -0
  809. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{ctrdrbg.c.inc → ctrdrbg.cc.inc} +22 -28
  810. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +18 -24
  811. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{rand.c.inc → rand.cc.inc} +34 -30
  812. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.cc.inc +147 -0
  813. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +13 -56
  814. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{padding.c.inc → padding.cc.inc} +32 -73
  815. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa.c.inc → rsa.cc.inc} +93 -148
  816. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa_impl.c.inc → rsa_impl.cc.inc} +82 -137
  817. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{fips.c.inc → fips.cc.inc} +26 -18
  818. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{self_check.c.inc → self_check.cc.inc} +68 -64
  819. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/internal.h +34 -34
  820. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/{service_indicator.c.inc → service_indicator.cc.inc} +23 -24
  821. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/internal.h +43 -57
  822. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha1.c.inc → sha1.cc.inc} +39 -88
  823. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha256.c.inc → sha256.cc.inc} +50 -110
  824. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha512.c.inc → sha512.cc.inc} +61 -131
  825. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/address.h +119 -0
  826. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/fors.cc.inc +169 -0
  827. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/fors.h +58 -0
  828. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/merkle.cc.inc +161 -0
  829. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/merkle.h +70 -0
  830. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/params.h +78 -0
  831. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/slhdsa.cc.inc +329 -0
  832. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/thash.cc.inc +173 -0
  833. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/thash.h +85 -0
  834. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/wots.cc.inc +171 -0
  835. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/wots.h +50 -0
  836. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +13 -13
  837. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/{kdf.c.inc → kdf.cc.inc} +13 -51
  838. data/third_party/boringssl-with-bazel/src/crypto/hpke/{hpke.c → hpke.cc} +19 -16
  839. data/third_party/boringssl-with-bazel/src/crypto/hrss/{hrss.c → hrss.cc} +73 -122
  840. data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +13 -13
  841. data/third_party/boringssl-with-bazel/src/crypto/internal.h +242 -442
  842. data/third_party/boringssl-with-bazel/src/crypto/kyber/internal.h +13 -13
  843. data/third_party/boringssl-with-bazel/src/crypto/kyber/{kyber.c → kyber.cc} +52 -28
  844. data/third_party/boringssl-with-bazel/src/crypto/lhash/internal.h +31 -75
  845. data/third_party/boringssl-with-bazel/src/crypto/lhash/{lhash.c → lhash.cc} +21 -62
  846. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md4/md4.c.inc → md4/md4.cc} +21 -67
  847. data/third_party/boringssl-with-bazel/src/crypto/md5/internal.h +37 -0
  848. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md5/md5.c.inc → md5/md5.cc} +17 -58
  849. data/third_party/boringssl-with-bazel/src/crypto/{mem.c → mem.cc} +47 -77
  850. data/third_party/boringssl-with-bazel/src/crypto/mldsa/mldsa.cc +90 -0
  851. data/third_party/boringssl-with-bazel/src/crypto/mlkem/mlkem.cc +97 -1042
  852. data/third_party/boringssl-with-bazel/src/crypto/obj/{obj.c → obj.cc} +40 -85
  853. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +14 -56
  854. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_xref.cc +80 -0
  855. data/third_party/boringssl-with-bazel/src/crypto/pem/internal.h +44 -0
  856. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.cc +149 -0
  857. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_info.c → pem_info.cc} +20 -60
  858. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_lib.c → pem_lib.cc} +59 -107
  859. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_oth.cc +45 -0
  860. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pk8.c → pem_pk8.cc} +13 -55
  861. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pkey.c → pem_pkey.cc} +13 -55
  862. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_x509.cc +22 -0
  863. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_xaux.cc +22 -0
  864. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +13 -13
  865. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7.c → pkcs7.cc} +17 -17
  866. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7_x509.c → pkcs7_x509.cc} +40 -37
  867. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +13 -54
  868. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{p5_pbev2.c → p5_pbev2.cc} +13 -54
  869. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8.c → pkcs8.cc} +170 -210
  870. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8_x509.c → pkcs8_x509.cc} +101 -149
  871. data/third_party/boringssl-with-bazel/src/crypto/poly1305/internal.h +13 -13
  872. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305.c → poly1305.cc} +15 -15
  873. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_arm.c → poly1305_arm.cc} +16 -14
  874. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_vec.c → poly1305_vec.cc} +26 -23
  875. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +13 -13
  876. data/third_party/boringssl-with-bazel/src/crypto/pool/{pool.c → pool.cc} +24 -23
  877. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/deterministic.c → rand/deterministic.cc} +14 -14
  878. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/fork_detect.c → rand/fork_detect.cc} +23 -24
  879. data/third_party/boringssl-with-bazel/src/crypto/rand/forkunsafe.cc +44 -0
  880. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/getentropy.c → rand/getentropy.cc} +13 -13
  881. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra → rand}/getrandom_fillin.h +13 -13
  882. data/third_party/boringssl-with-bazel/src/crypto/rand/ios.cc +42 -0
  883. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/passive.c → rand/passive.cc} +34 -30
  884. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/rand_extra.c → rand/rand.cc} +13 -13
  885. data/third_party/boringssl-with-bazel/src/crypto/rand/sysrand_internal.h +37 -0
  886. data/third_party/boringssl-with-bazel/src/crypto/rand/trusty.cc +46 -0
  887. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/urandom.c → rand/urandom.cc} +19 -19
  888. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/windows.c → rand/windows.cc} +13 -13
  889. data/third_party/boringssl-with-bazel/src/crypto/rc4/rc4.cc +56 -0
  890. data/third_party/boringssl-with-bazel/src/crypto/{refcount.c → refcount.cc} +13 -13
  891. data/third_party/boringssl-with-bazel/src/crypto/rsa/internal.h +36 -0
  892. data/third_party/boringssl-with-bazel/src/crypto/{rsa_extra/rsa_asn1.c → rsa/rsa_asn1.cc} +13 -54
  893. data/third_party/boringssl-with-bazel/src/crypto/{rsa_extra/rsa_crypt.c → rsa/rsa_crypt.cc} +94 -133
  894. data/third_party/boringssl-with-bazel/src/crypto/rsa/rsa_extra.cc +19 -0
  895. data/third_party/boringssl-with-bazel/src/crypto/rsa/rsa_print.cc +27 -0
  896. data/third_party/boringssl-with-bazel/src/crypto/sha/sha1.cc +52 -0
  897. data/third_party/boringssl-with-bazel/src/crypto/sha/sha256.cc +87 -0
  898. data/third_party/boringssl-with-bazel/src/crypto/sha/sha512.cc +104 -0
  899. data/third_party/boringssl-with-bazel/src/crypto/siphash/{siphash.c → siphash.cc} +13 -13
  900. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/slhdsa.cc +113 -0
  901. data/third_party/boringssl-with-bazel/src/crypto/spake2plus/internal.h +204 -0
  902. data/third_party/boringssl-with-bazel/src/crypto/spake2plus/spake2plus.cc +501 -0
  903. data/third_party/boringssl-with-bazel/src/crypto/stack/{stack.c → stack.cc} +23 -61
  904. data/third_party/boringssl-with-bazel/src/crypto/thread.cc +68 -0
  905. data/third_party/boringssl-with-bazel/src/crypto/{thread_none.c → thread_none.cc} +13 -13
  906. data/third_party/boringssl-with-bazel/src/crypto/{thread_pthread.c → thread_pthread.cc} +21 -20
  907. data/third_party/boringssl-with-bazel/src/crypto/{thread_win.c → thread_win.cc} +33 -29
  908. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +13 -13
  909. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{pmbtoken.c → pmbtoken.cc} +159 -171
  910. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{trust_token.c → trust_token.cc} +32 -34
  911. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{voprf.c → voprf.cc} +178 -182
  912. data/third_party/boringssl-with-bazel/src/crypto/x509/a_digest.cc +52 -0
  913. data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.cc +97 -0
  914. data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.cc +74 -0
  915. data/third_party/boringssl-with-bazel/src/crypto/x509/{algorithm.c → algorithm.cc} +14 -56
  916. data/third_party/boringssl-with-bazel/src/crypto/x509/{asn1_gen.c → asn1_gen.cc} +19 -62
  917. data/third_party/boringssl-with-bazel/src/crypto/x509/{by_dir.c → by_dir.cc} +32 -77
  918. data/third_party/boringssl-with-bazel/src/crypto/x509/{by_file.c → by_file.cc} +13 -55
  919. data/third_party/boringssl-with-bazel/src/crypto/x509/ext_dat.h +13 -55
  920. data/third_party/boringssl-with-bazel/src/crypto/x509/i2d_pr.cc +37 -0
  921. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +13 -57
  922. data/third_party/boringssl-with-bazel/src/crypto/x509/{name_print.c → name_print.cc} +13 -55
  923. data/third_party/boringssl-with-bazel/src/crypto/x509/{policy.c → policy.cc} +200 -190
  924. data/third_party/boringssl-with-bazel/src/crypto/x509/{rsa_pss.c → rsa_pss.cc} +59 -96
  925. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.cc +103 -0
  926. data/third_party/boringssl-with-bazel/src/crypto/x509/{t_req.c → t_req.cc} +13 -55
  927. data/third_party/boringssl-with-bazel/src/crypto/x509/{t_x509.c → t_x509.cc} +13 -55
  928. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.cc +79 -0
  929. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_akey.c → v3_akey.cc} +17 -57
  930. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_akeya.cc +31 -0
  931. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_alt.c → v3_alt.cc} +17 -58
  932. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_bcons.cc +95 -0
  933. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_bitst.cc +102 -0
  934. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_conf.c → v3_conf.cc} +18 -60
  935. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_cpols.c → v3_cpols.cc} +60 -98
  936. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_crld.c → v3_crld.cc} +16 -57
  937. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_enum.cc +73 -0
  938. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_extku.cc +114 -0
  939. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_genn.c → v3_genn.cc} +20 -62
  940. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_ia5.cc +79 -0
  941. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_info.c → v3_info.cc} +20 -67
  942. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_int.cc +81 -0
  943. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_lib.c → v3_lib.cc} +23 -63
  944. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ncons.c → v3_ncons.cc} +15 -56
  945. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ocsp.c → v3_ocsp.cc} +17 -9
  946. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_pcons.cc +101 -0
  947. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_pmaps.c → v3_pmaps.cc} +15 -56
  948. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_prn.c → v3_prn.cc} +15 -56
  949. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_purp.c → v3_purp.cc} +29 -63
  950. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_skey.cc +131 -0
  951. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_utl.c → v3_utl.cc} +30 -78
  952. data/third_party/boringssl-with-bazel/src/crypto/x509/x509.cc +47 -0
  953. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_att.c → x509_att.cc} +16 -57
  954. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_cmp.c → x509_cmp.cc} +13 -55
  955. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_d2.cc +66 -0
  956. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_def.cc +44 -0
  957. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_ext.c → x509_ext.cc} +13 -55
  958. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_lu.c → x509_lu.cc} +20 -65
  959. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_obj.c → x509_obj.cc} +13 -55
  960. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_req.c → x509_req.cc} +13 -55
  961. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_set.c → x509_set.cc} +13 -55
  962. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_trs.c → x509_trs.cc} +13 -55
  963. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_txt.c → x509_txt.cc} +13 -55
  964. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_v3.c → x509_v3.cc} +15 -57
  965. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vfy.c → x509_vfy.cc} +229 -267
  966. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vpm.c → x509_vpm.cc} +68 -68
  967. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509cset.c → x509cset.cc} +13 -55
  968. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509name.c → x509name.cc} +13 -55
  969. data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.cc +67 -0
  970. data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.cc +91 -0
  971. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.cc +107 -0
  972. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_all.c → x_all.cc} +23 -61
  973. data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.cc +55 -0
  974. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_crl.c → x_crl.cc} +19 -61
  975. data/third_party/boringssl-with-bazel/src/crypto/x509/x_exten.cc +36 -0
  976. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_name.c → x_name.cc} +52 -87
  977. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_pubkey.c → x_pubkey.cc} +17 -57
  978. data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.cc +74 -0
  979. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.cc +51 -0
  980. data/third_party/boringssl-with-bazel/src/crypto/x509/x_spki.cc +34 -0
  981. data/third_party/boringssl-with-bazel/src/crypto/x509/x_val.cc +28 -0
  982. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509.c → x_x509.cc} +61 -99
  983. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509a.c → x_x509a.cc} +17 -57
  984. data/third_party/boringssl-with-bazel/src/gen/crypto/{err_data.c → err_data.cc} +468 -453
  985. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +13 -13
  986. data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +13 -47
  987. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +13 -51
  988. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +14 -14
  989. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +23 -62
  990. data/third_party/boringssl-with-bazel/src/include/openssl/asn1_mac.h +13 -13
  991. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +248 -328
  992. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +24 -55
  993. data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +13 -55
  994. data/third_party/boringssl-with-bazel/src/include/openssl/bcm_public.h +82 -0
  995. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +13 -55
  996. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +13 -13
  997. data/third_party/boringssl-with-bazel/src/include/openssl/blowfish.h +13 -55
  998. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +14 -121
  999. data/third_party/boringssl-with-bazel/src/include/openssl/buf.h +13 -55
  1000. data/third_party/boringssl-with-bazel/src/include/openssl/buffer.h +13 -13
  1001. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +31 -16
  1002. data/third_party/boringssl-with-bazel/src/include/openssl/cast.h +13 -55
  1003. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +13 -13
  1004. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +31 -59
  1005. data/third_party/boringssl-with-bazel/src/include/openssl/cmac.h +13 -13
  1006. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +13 -55
  1007. data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +13 -13
  1008. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +25 -14
  1009. data/third_party/boringssl-with-bazel/src/include/openssl/ctrdrbg.h +13 -13
  1010. data/third_party/boringssl-with-bazel/src/include/openssl/curve25519.h +13 -13
  1011. data/third_party/boringssl-with-bazel/src/include/openssl/des.h +13 -55
  1012. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +17 -55
  1013. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +19 -56
  1014. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +17 -58
  1015. data/third_party/boringssl-with-bazel/src/include/openssl/dtls1.h +13 -13
  1016. data/third_party/boringssl-with-bazel/src/include/openssl/e_os2.h +13 -13
  1017. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +14 -66
  1018. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +31 -72
  1019. data/third_party/boringssl-with-bazel/src/include/openssl/ecdh.h +14 -65
  1020. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +13 -51
  1021. data/third_party/boringssl-with-bazel/src/include/openssl/engine.h +13 -13
  1022. data/third_party/boringssl-with-bazel/src/include/openssl/err.h +13 -107
  1023. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +14 -56
  1024. data/third_party/boringssl-with-bazel/src/include/openssl/evp_errors.h +13 -55
  1025. data/third_party/boringssl-with-bazel/src/include/openssl/ex_data.h +13 -107
  1026. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/kyber.h +13 -13
  1027. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +13 -13
  1028. data/third_party/boringssl-with-bazel/src/include/openssl/hmac.h +13 -55
  1029. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +13 -13
  1030. data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +13 -13
  1031. data/third_party/boringssl-with-bazel/src/include/openssl/is_boringssl.h +13 -13
  1032. data/third_party/boringssl-with-bazel/src/include/openssl/kdf.h +13 -13
  1033. data/third_party/boringssl-with-bazel/src/include/openssl/lhash.h +13 -55
  1034. data/third_party/boringssl-with-bazel/src/include/openssl/md4.h +13 -55
  1035. data/third_party/boringssl-with-bazel/src/include/openssl/md5.h +13 -55
  1036. data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +13 -55
  1037. data/third_party/boringssl-with-bazel/src/include/openssl/mldsa.h +20 -26
  1038. data/third_party/boringssl-with-bazel/src/include/openssl/mlkem.h +13 -37
  1039. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +27 -69
  1040. data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +13 -55
  1041. data/third_party/boringssl-with-bazel/src/include/openssl/obj_mac.h +13 -13
  1042. data/third_party/boringssl-with-bazel/src/include/openssl/objects.h +13 -13
  1043. data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +13 -13
  1044. data/third_party/boringssl-with-bazel/src/include/openssl/opensslv.h +13 -13
  1045. data/third_party/boringssl-with-bazel/src/include/openssl/ossl_typ.h +13 -13
  1046. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +22 -60
  1047. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs12.h +13 -13
  1048. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +13 -13
  1049. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +13 -55
  1050. data/third_party/boringssl-with-bazel/src/include/openssl/poly1305.h +13 -13
  1051. data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +13 -13
  1052. data/third_party/boringssl-with-bazel/src/include/openssl/posix_time.h +13 -13
  1053. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -13
  1054. data/third_party/boringssl-with-bazel/src/include/openssl/rc4.h +13 -55
  1055. data/third_party/boringssl-with-bazel/src/include/openssl/ripemd.h +13 -55
  1056. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +23 -63
  1057. data/third_party/boringssl-with-bazel/src/include/openssl/safestack.h +13 -13
  1058. data/third_party/boringssl-with-bazel/src/include/openssl/service_indicator.h +13 -13
  1059. data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +15 -95
  1060. data/third_party/boringssl-with-bazel/src/include/openssl/siphash.h +13 -13
  1061. data/third_party/boringssl-with-bazel/src/include/openssl/slhdsa.h +174 -0
  1062. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +24 -32
  1063. data/third_party/boringssl-with-bazel/src/include/openssl/srtp.h +13 -13
  1064. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +358 -290
  1065. data/third_party/boringssl-with-bazel/src/include/openssl/ssl3.h +15 -114
  1066. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +13 -55
  1067. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +23 -13
  1068. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +15 -57
  1069. data/third_party/boringssl-with-bazel/src/include/openssl/time.h +13 -13
  1070. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +27 -156
  1071. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +15 -15
  1072. data/third_party/boringssl-with-bazel/src/include/openssl/type_check.h +13 -55
  1073. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +14 -61
  1074. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +13 -13
  1075. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +13 -13
  1076. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3_errors.h +13 -53
  1077. data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +15 -14
  1078. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +680 -434
  1079. data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +129 -174
  1080. data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +176 -131
  1081. data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +21 -127
  1082. data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +107 -104
  1083. data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +311 -312
  1084. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +54 -47
  1085. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +677 -475
  1086. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +66 -73
  1087. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +61 -153
  1088. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +198 -331
  1089. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +88 -212
  1090. data/third_party/boringssl-with-bazel/src/ssl/internal.h +949 -531
  1091. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +47 -157
  1092. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +29 -159
  1093. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +18 -112
  1094. data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +103 -196
  1095. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +52 -145
  1096. data/third_party/boringssl-with-bazel/src/ssl/ssl_buffer.cc +15 -20
  1097. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +117 -157
  1098. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +229 -365
  1099. data/third_party/boringssl-with-bazel/src/ssl/ssl_credential.cc +216 -31
  1100. data/third_party/boringssl-with-bazel/src/ssl/ssl_file.cc +13 -109
  1101. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +34 -33
  1102. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +194 -350
  1103. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +38 -83
  1104. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +101 -236
  1105. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +17 -91
  1106. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +109 -157
  1107. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +44 -30
  1108. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +66 -195
  1109. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +45 -176
  1110. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +58 -42
  1111. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +146 -94
  1112. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +251 -180
  1113. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +236 -107
  1114. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +64 -117
  1115. data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +52 -134
  1116. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +6 -0
  1117. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +6 -0
  1118. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +4 -1
  1119. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1 -1
  1120. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +3 -0
  1121. metadata +357 -348
  1122. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb.h +0 -426
  1123. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.c +0 -87
  1124. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.h +0 -32
  1125. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb.h +0 -408
  1126. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.c +0 -124
  1127. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.h +0 -38
  1128. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.c +0 -108
  1129. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.h +0 -33
  1130. data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.c +0 -67
  1131. data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.h +0 -48
  1132. data/src/core/util/atm.cc +0 -34
  1133. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +0 -95
  1134. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +0 -89
  1135. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_dup.c +0 -84
  1136. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +0 -151
  1137. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_i2d_fp.c +0 -85
  1138. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.c +0 -74
  1139. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +0 -183
  1140. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.c +0 -103
  1141. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +0 -98
  1142. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +0 -105
  1143. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +0 -94
  1144. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +0 -212
  1145. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +0 -126
  1146. data/third_party/boringssl-with-bazel/src/crypto/bio/errno.c +0 -92
  1147. data/third_party/boringssl-with-bazel/src/crypto/bio/hexdump.c +0 -192
  1148. data/third_party/boringssl-with-bazel/src/crypto/bio/printf.c +0 -102
  1149. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +0 -189
  1150. data/third_party/boringssl-with-bazel/src/crypto/buf/buf.c +0 -158
  1151. data/third_party/boringssl-with-bazel/src/crypto/bytestring/asn1_compat.c +0 -53
  1152. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +0 -127
  1153. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +0 -152
  1154. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_des.c +0 -228
  1155. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_null.c +0 -90
  1156. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_rc4.c +0 -94
  1157. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.c +0 -41
  1158. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +0 -18
  1159. data/third_party/boringssl-with-bazel/src/crypto/dh_extra/dh_asn1.c +0 -165
  1160. data/third_party/boringssl-with-bazel/src/crypto/dilithium/dilithium.c +0 -1539
  1161. data/third_party/boringssl-with-bazel/src/crypto/dilithium/internal.h +0 -58
  1162. data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +0 -124
  1163. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +0 -146
  1164. data/third_party/boringssl-with-bazel/src/crypto/evp/sign.c +0 -156
  1165. data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +0 -236
  1166. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.c.inc +0 -127
  1167. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c.inc +0 -124
  1168. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/jacobi.c.inc +0 -146
  1169. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c.inc +0 -304
  1170. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c.inc +0 -130
  1171. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/fips_shared_support.c +0 -29
  1172. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/internal.h +0 -37
  1173. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c.inc +0 -196
  1174. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +0 -428
  1175. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c.inc +0 -87
  1176. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c.inc +0 -241
  1177. data/third_party/boringssl-with-bazel/src/crypto/mldsa/internal.h +0 -73
  1178. data/third_party/boringssl-with-bazel/src/crypto/mldsa/mldsa.c +0 -1687
  1179. data/third_party/boringssl-with-bazel/src/crypto/mlkem/internal.h +0 -90
  1180. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_xref.c +0 -122
  1181. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +0 -243
  1182. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_oth.c +0 -87
  1183. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_x509.c +0 -64
  1184. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_xaux.c +0 -64
  1185. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +0 -44
  1186. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/ios.c +0 -42
  1187. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/sysrand_internal.h +0 -37
  1188. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/trusty.c +0 -46
  1189. data/third_party/boringssl-with-bazel/src/crypto/rc4/rc4.c +0 -98
  1190. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +0 -79
  1191. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_print.c +0 -22
  1192. data/third_party/boringssl-with-bazel/src/crypto/spx/address.c +0 -101
  1193. data/third_party/boringssl-with-bazel/src/crypto/spx/address.h +0 -50
  1194. data/third_party/boringssl-with-bazel/src/crypto/spx/fors.c +0 -133
  1195. data/third_party/boringssl-with-bazel/src/crypto/spx/fors.h +0 -54
  1196. data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.c +0 -150
  1197. data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.h +0 -61
  1198. data/third_party/boringssl-with-bazel/src/crypto/spx/params.h +0 -71
  1199. data/third_party/boringssl-with-bazel/src/crypto/spx/spx.c +0 -140
  1200. data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.c +0 -53
  1201. data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.h +0 -44
  1202. data/third_party/boringssl-with-bazel/src/crypto/spx/thash.c +0 -136
  1203. data/third_party/boringssl-with-bazel/src/crypto/spx/thash.h +0 -70
  1204. data/third_party/boringssl-with-bazel/src/crypto/spx/wots.c +0 -135
  1205. data/third_party/boringssl-with-bazel/src/crypto/spx/wots.h +0 -45
  1206. data/third_party/boringssl-with-bazel/src/crypto/thread.c +0 -110
  1207. data/third_party/boringssl-with-bazel/src/crypto/x509/a_digest.c +0 -94
  1208. data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.c +0 -136
  1209. data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.c +0 -116
  1210. data/third_party/boringssl-with-bazel/src/crypto/x509/i2d_pr.c +0 -79
  1211. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +0 -145
  1212. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +0 -121
  1213. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_akeya.c +0 -73
  1214. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_bcons.c +0 -135
  1215. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_bitst.c +0 -141
  1216. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_enum.c +0 -112
  1217. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_extku.c +0 -154
  1218. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_ia5.c +0 -122
  1219. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_int.c +0 -121
  1220. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_pcons.c +0 -142
  1221. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_skey.c +0 -170
  1222. data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -89
  1223. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_d2.c +0 -108
  1224. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_def.c +0 -86
  1225. data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.c +0 -109
  1226. data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.c +0 -133
  1227. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +0 -149
  1228. data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +0 -97
  1229. data/third_party/boringssl-with-bazel/src/crypto/x509/x_exten.c +0 -78
  1230. data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.c +0 -116
  1231. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +0 -93
  1232. data/third_party/boringssl-with-bazel/src/crypto/x509/x_spki.c +0 -79
  1233. data/third_party/boringssl-with-bazel/src/crypto/x509/x_val.c +0 -70
  1234. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/dilithium.h +0 -129
  1235. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/spx.h +0 -90
@@ -1,143 +1,18 @@
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 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
112
- * ECC cipher suite support in OpenSSL originally developed by
113
- * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
114
- */
115
- /* ====================================================================
116
- * Copyright 2005 Nokia. All rights reserved.
117
- *
118
- * The portions of the attached software ("Contribution") is developed by
119
- * Nokia Corporation and is licensed pursuant to the OpenSSL open source
120
- * license.
121
- *
122
- * The Contribution, originally written by Mika Kousa and Pasi Eronen of
123
- * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
124
- * support (see RFC 4279) to OpenSSL.
125
- *
126
- * No patent licenses or other rights except those expressly stated in
127
- * the OpenSSL open source license shall be deemed granted or received
128
- * expressly, by implication, estoppel, or otherwise.
129
- *
130
- * No assurances are provided by Nokia that the Contribution does not
131
- * infringe the patent or other intellectual property rights of any third
132
- * party or that the license provides you with all the necessary rights
133
- * to make use of the Contribution.
134
- *
135
- * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
136
- * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
137
- * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
138
- * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
139
- * OTHERWISE.
140
- */
1
+ // Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
2
+ // Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
3
+ // Copyright 2005 Nokia. All rights reserved.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // https://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
141
16
 
142
17
  #ifndef OPENSSL_HEADER_SSL_INTERNAL_H
143
18
  #define OPENSSL_HEADER_SSL_INTERNAL_H
@@ -147,15 +22,16 @@
147
22
  #include <stdlib.h>
148
23
 
149
24
  #include <algorithm>
25
+ #include <atomic>
150
26
  #include <bitset>
151
27
  #include <initializer_list>
152
28
  #include <limits>
153
29
  #include <new>
30
+ #include <string_view>
154
31
  #include <type_traits>
155
32
  #include <utility>
156
33
 
157
34
  #include <openssl/aead.h>
158
- #include <openssl/aes.h>
159
35
  #include <openssl/curve25519.h>
160
36
  #include <openssl/err.h>
161
37
  #include <openssl/hpke.h>
@@ -168,6 +44,7 @@
168
44
  #include "../crypto/err/internal.h"
169
45
  #include "../crypto/internal.h"
170
46
  #include "../crypto/lhash/internal.h"
47
+ #include "../crypto/spake2plus/internal.h"
171
48
 
172
49
 
173
50
  #if defined(OPENSSL_WINDOWS)
@@ -195,7 +72,7 @@ struct SSL_X509_METHOD;
195
72
  //
196
73
  // Note: unlike |new|, this does not support non-public constructors.
197
74
  template <typename T, typename... Args>
198
- T *New(Args &&... args) {
75
+ T *New(Args &&...args) {
199
76
  void *t = OPENSSL_malloc(sizeof(T));
200
77
  if (t == nullptr) {
201
78
  return nullptr;
@@ -226,7 +103,7 @@ struct DeleterImpl<T, std::enable_if_t<T::kAllowUniquePtr>> {
226
103
  // MakeUnique behaves like |std::make_unique| but returns nullptr on allocation
227
104
  // error.
228
105
  template <typename T, typename... Args>
229
- UniquePtr<T> MakeUnique(Args &&... args) {
106
+ UniquePtr<T> MakeUnique(Args &&...args) {
230
107
  return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
231
108
  }
232
109
 
@@ -253,8 +130,14 @@ class Array {
253
130
  size_t size() const { return size_; }
254
131
  bool empty() const { return size_ == 0; }
255
132
 
256
- const T &operator[](size_t i) const { return data_[i]; }
257
- T &operator[](size_t i) { return data_[i]; }
133
+ const T &operator[](size_t i) const {
134
+ BSSL_CHECK(i < size_);
135
+ return data_[i];
136
+ }
137
+ T &operator[](size_t i) {
138
+ BSSL_CHECK(i < size_);
139
+ return data_[i];
140
+ }
258
141
 
259
142
  T *begin() { return data_; }
260
143
  const T *begin() const { return data_; }
@@ -266,9 +149,7 @@ class Array {
266
149
  // Reset releases the current contents of the array and takes ownership of the
267
150
  // raw pointer supplied by the caller.
268
151
  void Reset(T *new_data, size_t new_size) {
269
- for (size_t i = 0; i < size_; i++) {
270
- data_[i].~T();
271
- }
152
+ std::destroy_n(data_, size_);
272
153
  OPENSSL_free(data_);
273
154
  data_ = new_data;
274
155
  size_ = new_size;
@@ -284,38 +165,35 @@ class Array {
284
165
  }
285
166
 
286
167
  // Init replaces the array with a newly-allocated array of |new_size|
287
- // default-constructed copies of |T|. It returns true on success and false on
288
- // error.
289
- //
290
- // Note that if |T| is a primitive type like |uint8_t|, it is uninitialized.
291
- bool Init(size_t new_size) {
292
- Reset();
293
- if (new_size == 0) {
294
- return true;
295
- }
296
-
297
- if (new_size > std::numeric_limits<size_t>::max() / sizeof(T)) {
298
- OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
168
+ // value-constructed copies of |T|. It returns true on success and false on
169
+ // error. If |T| is a primitive type like |uint8_t|, value-construction means
170
+ // it will be zero-initialized.
171
+ [[nodiscard]] bool Init(size_t new_size) {
172
+ if (!InitUninitialized(new_size)) {
299
173
  return false;
300
174
  }
301
- data_ = reinterpret_cast<T *>(OPENSSL_malloc(new_size * sizeof(T)));
302
- if (data_ == nullptr) {
175
+ std::uninitialized_value_construct_n(data_, size_);
176
+ return true;
177
+ }
178
+
179
+ // InitForOverwrite behaves like |Init| but it default-constructs each element
180
+ // instead. This means that, if |T| is a primitive type, the array will be
181
+ // uninitialized and thus must be filled in by the caller.
182
+ [[nodiscard]] bool InitForOverwrite(size_t new_size) {
183
+ if (!InitUninitialized(new_size)) {
303
184
  return false;
304
185
  }
305
- size_ = new_size;
306
- for (size_t i = 0; i < size_; i++) {
307
- new (&data_[i]) T;
308
- }
186
+ std::uninitialized_default_construct_n(data_, size_);
309
187
  return true;
310
188
  }
311
189
 
312
190
  // CopyFrom replaces the array with a newly-allocated copy of |in|. It returns
313
191
  // true on success and false on error.
314
- bool CopyFrom(Span<const T> in) {
315
- if (!Init(in.size())) {
192
+ [[nodiscard]] bool CopyFrom(Span<const T> in) {
193
+ if (!InitUninitialized(in.size())) {
316
194
  return false;
317
195
  }
318
- std::copy(in.begin(), in.end(), data_);
196
+ std::uninitialized_copy(in.begin(), in.end(), data_);
319
197
  return true;
320
198
  }
321
199
 
@@ -325,75 +203,103 @@ class Array {
325
203
  if (new_size > size_) {
326
204
  abort();
327
205
  }
328
- for (size_t i = new_size; i < size_; i++) {
329
- data_[i].~T();
330
- }
206
+ std::destroy_n(data_ + new_size, size_ - new_size);
331
207
  size_ = new_size;
332
208
  }
333
209
 
334
210
  private:
211
+ // InitUninitialized replaces the array with a newly-allocated array of
212
+ // |new_size| elements, but whose constructor has not yet run. On success, the
213
+ // elements must be constructed before returning control to the caller.
214
+ bool InitUninitialized(size_t new_size) {
215
+ Reset();
216
+ if (new_size == 0) {
217
+ return true;
218
+ }
219
+
220
+ if (new_size > std::numeric_limits<size_t>::max() / sizeof(T)) {
221
+ OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
222
+ return false;
223
+ }
224
+ data_ = reinterpret_cast<T *>(OPENSSL_malloc(new_size * sizeof(T)));
225
+ if (data_ == nullptr) {
226
+ return false;
227
+ }
228
+ size_ = new_size;
229
+ return true;
230
+ }
231
+
335
232
  T *data_ = nullptr;
336
233
  size_t size_ = 0;
337
234
  };
338
235
 
339
- // GrowableArray<T> is an array that owns elements of |T|, backed by an
340
- // Array<T>. When necessary, pushing will automatically trigger a resize.
341
- //
342
- // Note, for simplicity, this class currently differs from |std::vector| in that
343
- // |T| must be efficiently default-constructible. Allocated elements beyond the
344
- // end of the array are constructed and destructed.
236
+ // Vector<T> is a resizable array of elements of |T|.
345
237
  template <typename T>
346
- class GrowableArray {
238
+ class Vector {
347
239
  public:
348
- GrowableArray() = default;
349
- GrowableArray(const GrowableArray &) = delete;
350
- GrowableArray(GrowableArray &&other) { *this = std::move(other); }
351
- ~GrowableArray() {}
352
-
353
- GrowableArray &operator=(const GrowableArray &) = delete;
354
- GrowableArray &operator=(GrowableArray &&other) {
355
- size_ = other.size_;
356
- other.size_ = 0;
357
- array_ = std::move(other.array_);
240
+ Vector() = default;
241
+ Vector(const Vector &) = delete;
242
+ Vector(Vector &&other) { *this = std::move(other); }
243
+ ~Vector() { clear(); }
244
+
245
+ Vector &operator=(const Vector &) = delete;
246
+ Vector &operator=(Vector &&other) {
247
+ clear();
248
+ std::swap(data_, other.data_);
249
+ std::swap(size_, other.size_);
250
+ std::swap(capacity_, other.capacity_);
358
251
  return *this;
359
252
  }
360
253
 
361
- const T *data() const { return array_.data(); }
362
- T *data() { return array_.data(); }
254
+ const T *data() const { return data_; }
255
+ T *data() { return data_; }
363
256
  size_t size() const { return size_; }
364
257
  bool empty() const { return size_ == 0; }
365
258
 
366
- const T &operator[](size_t i) const { return array_[i]; }
367
- T &operator[](size_t i) { return array_[i]; }
259
+ const T &operator[](size_t i) const {
260
+ BSSL_CHECK(i < size_);
261
+ return data_[i];
262
+ }
263
+ T &operator[](size_t i) {
264
+ BSSL_CHECK(i < size_);
265
+ return data_[i];
266
+ }
368
267
 
369
- T *begin() { return array_.data(); }
370
- const T *begin() const { return array_.data(); }
371
- T *end() { return array_.data() + size_; }
372
- const T *end() const { return array_.data() + size_; }
268
+ T *begin() { return data_; }
269
+ const T *begin() const { return data_; }
270
+ T *end() { return data_ + size_; }
271
+ const T *end() const { return data_ + size_; }
373
272
 
374
273
  void clear() {
274
+ std::destroy_n(data_, size_);
275
+ OPENSSL_free(data_);
276
+ data_ = nullptr;
375
277
  size_ = 0;
376
- array_.Reset();
278
+ capacity_ = 0;
377
279
  }
378
280
 
379
281
  // Push adds |elem| at the end of the internal array, growing if necessary. It
380
282
  // returns false when allocation fails.
381
- bool Push(T elem) {
283
+ [[nodiscard]] bool Push(T elem) {
382
284
  if (!MaybeGrow()) {
383
285
  return false;
384
286
  }
385
- array_[size_] = std::move(elem);
287
+ new (&data_[size_]) T(std::move(elem));
386
288
  size_++;
387
289
  return true;
388
290
  }
389
291
 
390
292
  // CopyFrom replaces the contents of the array with a copy of |in|. It returns
391
293
  // true on success and false on allocation error.
392
- bool CopyFrom(Span<const T> in) {
393
- if (!array_.CopyFrom(in)) {
294
+ [[nodiscard]] bool CopyFrom(Span<const T> in) {
295
+ Array<T> copy;
296
+ if (!copy.CopyFrom(in)) {
394
297
  return false;
395
298
  }
396
- size_ = in.size();
299
+
300
+ clear();
301
+ copy.Release(&data_, &size_);
302
+ capacity_ = size_;
397
303
  return true;
398
304
  }
399
305
 
@@ -401,39 +307,249 @@ class GrowableArray {
401
307
  // If there is no room for one more element, creates a new backing array with
402
308
  // double the size of the old one and copies elements over.
403
309
  bool MaybeGrow() {
404
- if (array_.size() == 0) {
405
- return array_.Init(kDefaultSize);
406
- }
407
310
  // No need to grow if we have room for one more T.
408
- if (size_ < array_.size()) {
311
+ if (size_ < capacity_) {
409
312
  return true;
410
313
  }
411
- // Double the array's size if it's safe to do so.
412
- if (array_.size() > std::numeric_limits<size_t>::max() / 2) {
314
+ size_t new_capacity = kDefaultSize;
315
+ if (capacity_ > 0) {
316
+ // Double the array's size if it's safe to do so.
317
+ if (capacity_ > std::numeric_limits<size_t>::max() / 2) {
318
+ OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
319
+ return false;
320
+ }
321
+ new_capacity = capacity_ * 2;
322
+ }
323
+ if (new_capacity > std::numeric_limits<size_t>::max() / sizeof(T)) {
413
324
  OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
414
325
  return false;
415
326
  }
416
- Array<T> new_array;
417
- if (!new_array.Init(array_.size() * 2)) {
327
+ T *new_data =
328
+ reinterpret_cast<T *>(OPENSSL_malloc(new_capacity * sizeof(T)));
329
+ if (new_data == nullptr) {
418
330
  return false;
419
331
  }
420
- for (size_t i = 0; i < array_.size(); i++) {
421
- new_array[i] = std::move(array_[i]);
422
- }
423
- array_ = std::move(new_array);
424
-
332
+ size_t new_size = size_;
333
+ std::uninitialized_move(begin(), end(), new_data);
334
+ clear();
335
+ data_ = new_data;
336
+ size_ = new_size;
337
+ capacity_ = new_capacity;
425
338
  return true;
426
339
  }
427
340
 
428
- // |size_| is the number of elements stored in this GrowableArray.
341
+ // data_ is a pointer to |capacity_| objects of size |T|, the first |size_| of
342
+ // which are constructed.
343
+ T *data_ = nullptr;
344
+ // |size_| is the number of elements stored in this Vector.
429
345
  size_t size_ = 0;
430
- // |array_| is the backing array. Note that |array_.size()| is this
431
- // GrowableArray's current capacity and that |size_ <= array_.size()|.
432
- Array<T> array_;
346
+ // |capacity_| is the number of elements allocated in this Vector.
347
+ size_t capacity_ = 0;
433
348
  // |kDefaultSize| is the default initial size of the backing array.
434
349
  static constexpr size_t kDefaultSize = 16;
435
350
  };
436
351
 
352
+ // A PackedSize is an integer that can store values from 0 to N, represented as
353
+ // a minimal-width integer.
354
+ template <size_t N>
355
+ using PackedSize = std::conditional_t<
356
+ N <= 0xff, uint8_t,
357
+ std::conditional_t<N <= 0xffff, uint16_t,
358
+ std::conditional_t<N <= 0xffffffff, uint32_t, size_t>>>;
359
+
360
+ // An InplaceVector is like a Vector, but stores up to N elements inline in the
361
+ // object. It is inspired by std::inplace_vector in C++26.
362
+ template <typename T, size_t N>
363
+ class InplaceVector {
364
+ public:
365
+ InplaceVector() = default;
366
+ InplaceVector(const InplaceVector &other) { *this = other; }
367
+ InplaceVector(InplaceVector &&other) { *this = std::move(other); }
368
+ ~InplaceVector() { clear(); }
369
+ InplaceVector &operator=(const InplaceVector &other) {
370
+ if (this != &other) {
371
+ CopyFrom(other);
372
+ }
373
+ return *this;
374
+ }
375
+ InplaceVector &operator=(InplaceVector &&other) {
376
+ clear();
377
+ std::uninitialized_move(other.begin(), other.end(), data());
378
+ size_ = other.size();
379
+ return *this;
380
+ }
381
+
382
+ const T *data() const { return reinterpret_cast<const T *>(storage_); }
383
+ T *data() { return reinterpret_cast<T *>(storage_); }
384
+ size_t size() const { return size_; }
385
+ static constexpr size_t capacity() { return N; }
386
+ bool empty() const { return size_ == 0; }
387
+
388
+ const T &operator[](size_t i) const {
389
+ BSSL_CHECK(i < size_);
390
+ return data()[i];
391
+ }
392
+ T &operator[](size_t i) {
393
+ BSSL_CHECK(i < size_);
394
+ return data()[i];
395
+ }
396
+
397
+ T *begin() { return data(); }
398
+ const T *begin() const { return data(); }
399
+ T *end() { return data() + size_; }
400
+ const T *end() const { return data() + size_; }
401
+
402
+ void clear() { Shrink(0); }
403
+
404
+ // Shrink resizes the vector to |new_size|, which must not be larger than the
405
+ // current size. Unlike |Resize|, this can be called when |T| is not
406
+ // default-constructible.
407
+ void Shrink(size_t new_size) {
408
+ BSSL_CHECK(new_size <= size_);
409
+ std::destroy_n(data() + new_size, size_ - new_size);
410
+ size_ = static_cast<PackedSize<N>>(new_size);
411
+ }
412
+
413
+ // TryResize resizes the vector to |new_size| and returns true, or returns
414
+ // false if |new_size| is too large. Any newly-added elements are
415
+ // value-initialized.
416
+ [[nodiscard]] bool TryResize(size_t new_size) {
417
+ if (new_size <= size_) {
418
+ Shrink(new_size);
419
+ return true;
420
+ }
421
+ if (new_size > capacity()) {
422
+ return false;
423
+ }
424
+ std::uninitialized_value_construct_n(data() + size_, new_size - size_);
425
+ size_ = static_cast<PackedSize<N>>(new_size);
426
+ return true;
427
+ }
428
+
429
+ // TryResizeForOverwrite behaves like |TryResize|, but newly-added elements
430
+ // are default-initialized, so POD types may contain uninitialized values that
431
+ // the caller is responsible for filling in.
432
+ [[nodiscard]] bool TryResizeForOverwrite(size_t new_size) {
433
+ if (new_size <= size_) {
434
+ Shrink(new_size);
435
+ return true;
436
+ }
437
+ if (new_size > capacity()) {
438
+ return false;
439
+ }
440
+ std::uninitialized_default_construct_n(data() + size_, new_size - size_);
441
+ size_ = static_cast<PackedSize<N>>(new_size);
442
+ return true;
443
+ }
444
+
445
+ // TryCopyFrom sets the vector to a copy of |in| and returns true, or returns
446
+ // false if |in| is too large.
447
+ [[nodiscard]] bool TryCopyFrom(Span<const T> in) {
448
+ if (in.size() > capacity()) {
449
+ return false;
450
+ }
451
+ clear();
452
+ std::uninitialized_copy(in.begin(), in.end(), data());
453
+ size_ = in.size();
454
+ return true;
455
+ }
456
+
457
+ // TryPushBack appends |val| to the vector and returns a pointer to the
458
+ // newly-inserted value, or nullptr if the vector is at capacity.
459
+ [[nodiscard]] T *TryPushBack(T val) {
460
+ if (size() >= capacity()) {
461
+ return nullptr;
462
+ }
463
+ T *ret = &data()[size_];
464
+ new (ret) T(std::move(val));
465
+ size_++;
466
+ return ret;
467
+ }
468
+
469
+ // The following methods behave like their |Try*| counterparts, but abort the
470
+ // program on failure.
471
+ void Resize(size_t size) { BSSL_CHECK(TryResize(size)); }
472
+ void ResizeForOverwrite(size_t size) {
473
+ BSSL_CHECK(TryResizeForOverwrite(size));
474
+ }
475
+ void CopyFrom(Span<const T> in) { BSSL_CHECK(TryCopyFrom(in)); }
476
+ T &PushBack(T val) {
477
+ T *ret = TryPushBack(std::move(val));
478
+ BSSL_CHECK(ret != nullptr);
479
+ return *ret;
480
+ }
481
+
482
+ template <typename Pred>
483
+ void EraseIf(Pred pred) {
484
+ // See if anything needs to be erased at all. This avoids a self-move.
485
+ auto iter = std::find_if(begin(), end(), pred);
486
+ if (iter == end()) {
487
+ return;
488
+ }
489
+
490
+ // Elements before the first to be erased may be left as-is.
491
+ size_t new_size = iter - begin();
492
+ // Swap all subsequent elements in if they are to be kept.
493
+ for (size_t i = new_size + 1; i < size(); i++) {
494
+ if (!pred((*this)[i])) {
495
+ (*this)[new_size] = std::move((*this)[i]);
496
+ new_size++;
497
+ }
498
+ }
499
+
500
+ Shrink(new_size);
501
+ }
502
+
503
+ private:
504
+ alignas(T) char storage_[sizeof(T[N])];
505
+ PackedSize<N> size_ = 0;
506
+ };
507
+
508
+ // An MRUQueue maintains a queue of up to |N| objects of type |T|. If the queue
509
+ // is at capacity, adding to the queue pops the least recently added element.
510
+ template <typename T, size_t N>
511
+ class MRUQueue {
512
+ public:
513
+ static constexpr bool kAllowUniquePtr = true;
514
+
515
+ MRUQueue() = default;
516
+
517
+ // If we ever need to make this type movable, we could. (The defaults almost
518
+ // work except we need |start_| to be reset when moved-from.)
519
+ MRUQueue(const MRUQueue &other) = delete;
520
+ MRUQueue &operator=(const MRUQueue &other) = delete;
521
+
522
+ bool empty() const { return size() == 0; }
523
+ size_t size() const { return storage_.size(); }
524
+
525
+ T &operator[](size_t i) {
526
+ BSSL_CHECK(i < size());
527
+ return storage_[(start_ + i) % N];
528
+ }
529
+ const T &operator[](size_t i) const {
530
+ return (*const_cast<MRUQueue *>(this))[i];
531
+ }
532
+
533
+ void Clear() {
534
+ storage_.clear();
535
+ start_ = 0;
536
+ }
537
+
538
+ void PushBack(T t) {
539
+ if (storage_.size() < N) {
540
+ assert(start_ == 0);
541
+ storage_.PushBack(std::move(t));
542
+ } else {
543
+ (*this)[0] = std::move(t);
544
+ start_ = (start_ + 1) % N;
545
+ }
546
+ }
547
+
548
+ private:
549
+ InplaceVector<T, N> storage_;
550
+ PackedSize<N> start_ = 0;
551
+ };
552
+
437
553
  // CBBFinishArray behaves like |CBB_finish| but stores the result in an Array.
438
554
  OPENSSL_EXPORT bool CBBFinishArray(CBB *cbb, Array<uint8_t> *out);
439
555
 
@@ -446,7 +562,7 @@ template <typename T, typename Name>
446
562
  inline size_t GetAllNames(const char **out, size_t max_out,
447
563
  Span<const char *const> fixed_names, Name(T::*name),
448
564
  Span<const T> objects) {
449
- auto span = bssl::MakeSpan(out, max_out);
565
+ auto span = bssl::Span(out, max_out);
450
566
  for (size_t i = 0; !span.empty() && i < fixed_names.size(); i++) {
451
567
  span[0] = fixed_names[i];
452
568
  span = span.subspan(1);
@@ -548,6 +664,11 @@ bool ssl_add_supported_versions(const SSL_HANDSHAKE *hs, CBB *cbb,
548
664
  bool ssl_negotiate_version(SSL_HANDSHAKE *hs, uint8_t *out_alert,
549
665
  uint16_t *out_version, const CBS *peer_versions);
550
666
 
667
+ // ssl_has_final_version returns whether |ssl| has determined the final version.
668
+ // This may be used to distinguish the predictive 0-RTT version from the final
669
+ // one.
670
+ bool ssl_has_final_version(const SSL *ssl);
671
+
551
672
  // ssl_protocol_version returns |ssl|'s protocol version. It is an error to
552
673
  // call this function before the version is determined.
553
674
  uint16_t ssl_protocol_version(const SSL *ssl);
@@ -672,7 +793,7 @@ Span<const SSL_CIPHER> AllCiphers();
672
793
  bool ssl_cipher_get_evp_aead(const EVP_AEAD **out_aead,
673
794
  size_t *out_mac_secret_len,
674
795
  size_t *out_fixed_iv_len, const SSL_CIPHER *cipher,
675
- uint16_t version, bool is_dtls);
796
+ uint16_t version);
676
797
 
677
798
  // ssl_get_handshake_digest returns the |EVP_MD| corresponding to |version| and
678
799
  // |cipher|.
@@ -733,7 +854,7 @@ OPENSSL_EXPORT bool ssl_cipher_is_deprecated(const SSL_CIPHER *cipher);
733
854
  // buffer and running hash.
734
855
  class SSLTranscript {
735
856
  public:
736
- SSLTranscript();
857
+ explicit SSLTranscript(bool is_dtls);
737
858
  ~SSLTranscript();
738
859
 
739
860
  SSLTranscript(SSLTranscript &&other) = default;
@@ -764,8 +885,8 @@ class SSLTranscript {
764
885
  bool CopyToHashContext(EVP_MD_CTX *ctx, const EVP_MD *digest) const;
765
886
 
766
887
  Span<const uint8_t> buffer() const {
767
- return MakeConstSpan(reinterpret_cast<const uint8_t *>(buffer_->data),
768
- buffer_->length);
888
+ return Span(reinterpret_cast<const uint8_t *>(buffer_->data),
889
+ buffer_->length);
769
890
  }
770
891
 
771
892
  // FreeBuffer releases the handshake buffer. Subsequent calls to
@@ -796,37 +917,40 @@ class SSLTranscript {
796
917
  bool from_server) const;
797
918
 
798
919
  private:
920
+ // HashBuffer initializes |ctx| to use |digest| and writes the contents of
921
+ // |buffer_| to |ctx|. If this SSLTranscript is for DTLS 1.3, the appropriate
922
+ // bytes in |buffer_| will be skipped when hashing the buffer.
923
+ bool HashBuffer(EVP_MD_CTX *ctx, const EVP_MD *digest) const;
924
+
925
+ // AddToBufferOrHash directly adds the contents of |in| to |buffer_| and/or
926
+ // |hash_|.
927
+ bool AddToBufferOrHash(Span<const uint8_t> in);
928
+
799
929
  // buffer_, if non-null, contains the handshake transcript.
800
930
  UniquePtr<BUF_MEM> buffer_;
801
931
  // hash, if initialized with an |EVP_MD|, maintains the handshake hash.
802
932
  ScopedEVP_MD_CTX hash_;
933
+ // is_dtls_ indicates whether this is a transcript for a DTLS connection.
934
+ bool is_dtls_ : 1;
935
+ // version_ contains the version for the connection (if known).
936
+ uint16_t version_ = 0;
803
937
  };
804
938
 
805
939
  // tls1_prf computes the PRF function for |ssl|. It fills |out|, using |secret|
806
940
  // as the secret and |label| as the label. |seed1| and |seed2| are concatenated
807
941
  // to form the seed parameter. It returns true on success and false on failure.
808
942
  bool tls1_prf(const EVP_MD *digest, Span<uint8_t> out,
809
- Span<const uint8_t> secret, Span<const char> label,
943
+ Span<const uint8_t> secret, std::string_view label,
810
944
  Span<const uint8_t> seed1, Span<const uint8_t> seed2);
811
945
 
812
946
 
813
947
  // Encryption layer.
814
948
 
815
- class RecordNumberEncrypter {
816
- public:
817
- virtual ~RecordNumberEncrypter() = default;
818
- static constexpr bool kAllowUniquePtr = true;
819
-
820
- virtual size_t KeySize() = 0;
821
- virtual bool SetKey(Span<const uint8_t> key) = 0;
822
- virtual bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) = 0;
823
- };
824
-
825
949
  // SSLAEADContext contains information about an AEAD that is being used to
826
950
  // encrypt an SSL connection.
827
951
  class SSLAEADContext {
828
952
  public:
829
- SSLAEADContext(uint16_t version, bool is_dtls, const SSL_CIPHER *cipher);
953
+ explicit SSLAEADContext(const SSL_CIPHER *cipher);
830
954
  ~SSLAEADContext();
831
955
  static constexpr bool kAllowUniquePtr = true;
832
956
 
@@ -834,38 +958,23 @@ class SSLAEADContext {
834
958
  SSLAEADContext &operator=(const SSLAEADContext &&) = delete;
835
959
 
836
960
  // CreateNullCipher creates an |SSLAEADContext| for the null cipher.
837
- static UniquePtr<SSLAEADContext> CreateNullCipher(bool is_dtls);
961
+ static UniquePtr<SSLAEADContext> CreateNullCipher();
838
962
 
839
963
  // Create creates an |SSLAEADContext| using the supplied key material. It
840
964
  // returns nullptr on error. Only one of |Open| or |Seal| may be used with the
841
- // resulting object, depending on |direction|. |version| is the normalized
842
- // protocol version, so DTLS 1.0 is represented as 0x0301, not 0xffef.
965
+ // resulting object, depending on |direction|. |version| is the wire version.
843
966
  static UniquePtr<SSLAEADContext> Create(enum evp_aead_direction_t direction,
844
- uint16_t version, bool is_dtls,
967
+ uint16_t version,
845
968
  const SSL_CIPHER *cipher,
846
969
  Span<const uint8_t> enc_key,
847
970
  Span<const uint8_t> mac_key,
848
971
  Span<const uint8_t> fixed_iv);
849
972
 
850
973
  // CreatePlaceholderForQUIC creates a placeholder |SSLAEADContext| for the
851
- // given cipher and version. The resulting object can be queried for various
852
- // properties but cannot encrypt or decrypt data.
974
+ // given cipher. The resulting object can be queried for various properties
975
+ // but cannot encrypt or decrypt data.
853
976
  static UniquePtr<SSLAEADContext> CreatePlaceholderForQUIC(
854
- uint16_t version, const SSL_CIPHER *cipher);
855
-
856
- // SetVersionIfNullCipher sets the version the SSLAEADContext for the null
857
- // cipher, to make version-specific determinations in the record layer prior
858
- // to a cipher being selected.
859
- void SetVersionIfNullCipher(uint16_t version);
860
-
861
- // ProtocolVersion returns the protocol version associated with this
862
- // SSLAEADContext. It can only be called once |version_| has been set to a
863
- // valid value.
864
- uint16_t ProtocolVersion() const;
865
-
866
- // RecordVersion returns the record version that should be used with this
867
- // SSLAEADContext for record construction and crypto.
868
- uint16_t RecordVersion() const;
977
+ const SSL_CIPHER *cipher);
869
978
 
870
979
  const SSL_CIPHER *cipher() const { return cipher_; }
871
980
 
@@ -878,6 +987,10 @@ class SSLAEADContext {
878
987
  // MaxOverhead returns the maximum overhead of calling |Seal|.
879
988
  size_t MaxOverhead() const;
880
989
 
990
+ // MaxSealInputLen returns the maximum length for |Seal| that can fit in
991
+ // |max_out| output bytes, or zero if no input may fit.
992
+ size_t MaxSealInputLen(size_t max_out) const;
993
+
881
994
  // SuffixLen calculates the suffix length written by |SealScatter| and writes
882
995
  // it to |*out_suffix_len|. It returns true on success and false on error.
883
996
  // |in_len| and |extra_in_len| should equal the argument of the same names
@@ -927,17 +1040,6 @@ class SSLAEADContext {
927
1040
 
928
1041
  bool GetIV(const uint8_t **out_iv, size_t *out_iv_len) const;
929
1042
 
930
- RecordNumberEncrypter *GetRecordNumberEncrypter() {
931
- return rn_encrypter_.get();
932
- }
933
-
934
- // GenerateRecordNumberMask computes the mask used for DTLS 1.3 record number
935
- // encryption (RFC 9147 section 4.2.3), writing it to |out|. The |out| buffer
936
- // must be sized to AES_BLOCK_SIZE. The |sample| buffer must be at least 16
937
- // bytes, as required by the AES and ChaCha20 cipher suites in RFC 9147. Extra
938
- // bytes in |sample| will be ignored.
939
- bool GenerateRecordNumberMask(Span<uint8_t> out, Span<const uint8_t> sample);
940
-
941
1043
  private:
942
1044
  // GetAdditionalData returns the additional data, writing into |storage| if
943
1045
  // necessary.
@@ -946,19 +1048,12 @@ class SSLAEADContext {
946
1048
  uint64_t seqnum, size_t plaintext_len,
947
1049
  Span<const uint8_t> header);
948
1050
 
949
- void CreateRecordNumberEncrypter();
950
-
951
1051
  const SSL_CIPHER *cipher_;
952
1052
  ScopedEVP_AEAD_CTX ctx_;
953
1053
  // fixed_nonce_ contains any bytes of the nonce that are fixed for all
954
1054
  // records.
955
- uint8_t fixed_nonce_[12];
956
- uint8_t fixed_nonce_len_ = 0, variable_nonce_len_ = 0;
957
- // version_ is the wire version that should be used with this AEAD.
958
- uint16_t version_;
959
- UniquePtr<RecordNumberEncrypter> rn_encrypter_;
960
- // is_dtls_ is whether DTLS is being used with this AEAD.
961
- bool is_dtls_;
1055
+ InplaceVector<uint8_t, 12> fixed_nonce_;
1056
+ uint8_t variable_nonce_len_ = 0;
962
1057
  // variable_nonce_included_in_record_ is true if the variable nonce
963
1058
  // for a record is included as a prefix before the ciphertext.
964
1059
  bool variable_nonce_included_in_record_ : 1;
@@ -976,57 +1071,31 @@ class SSLAEADContext {
976
1071
  bool ad_is_header_ : 1;
977
1072
  };
978
1073
 
979
- class AESRecordNumberEncrypter : public RecordNumberEncrypter {
980
- public:
981
- bool SetKey(Span<const uint8_t> key) override;
982
- bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
983
1074
 
984
- private:
985
- AES_KEY key_;
986
- };
1075
+ // DTLS replay bitmap.
987
1076
 
988
- class AES128RecordNumberEncrypter : public AESRecordNumberEncrypter {
1077
+ // DTLSReplayBitmap maintains a sliding window of sequence numbers to detect
1078
+ // replayed packets.
1079
+ class DTLSReplayBitmap {
989
1080
  public:
990
- size_t KeySize() override;
991
- };
1081
+ // ShouldDiscard returns true if |seq_num| has been seen in
1082
+ // |bitmap| or is stale. Otherwise it returns false.
1083
+ bool ShouldDiscard(uint64_t seqnum) const;
992
1084
 
993
- class AES256RecordNumberEncrypter : public AESRecordNumberEncrypter {
994
- public:
995
- size_t KeySize() override;
996
- };
1085
+ // Record updates the bitmap to record receipt of sequence number
1086
+ // |seq_num|. It slides the window forward if needed. It is an error to call
1087
+ // this function on a stale sequence number.
1088
+ void Record(uint64_t seqnum);
997
1089
 
998
- class ChaChaRecordNumberEncrypter : public RecordNumberEncrypter {
999
- public:
1000
- size_t KeySize() override;
1001
- bool SetKey(Span<const uint8_t> key) override;
1002
- bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
1090
+ uint64_t max_seq_num() const { return max_seq_num_; }
1003
1091
 
1004
1092
  private:
1005
- static const size_t kKeySize = 32;
1006
- uint8_t key_[kKeySize];
1007
- };
1008
-
1009
- #if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
1010
- class NullRecordNumberEncrypter : public RecordNumberEncrypter {
1011
- public:
1012
- size_t KeySize() override;
1013
- bool SetKey(Span<const uint8_t> key) override;
1014
- bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) override;
1015
- };
1016
- #endif // BORINGSSL_UNSAFE_FUZZER_MODE
1017
-
1018
-
1019
- // DTLS replay bitmap.
1020
-
1021
- // DTLS1_BITMAP maintains a sliding window of 64 sequence numbers to detect
1022
- // replayed packets. It should be initialized by zeroing every field.
1023
- struct DTLS1_BITMAP {
1024
1093
  // map is a bitset of sequence numbers that have been seen. Bit i corresponds
1025
- // to |max_seq_num - i|.
1026
- std::bitset<256> map;
1027
- // max_seq_num is the largest sequence number seen so far as a 64-bit
1094
+ // to |max_seq_num_ - i|.
1095
+ std::bitset<256> map_;
1096
+ // max_seq_num_ is the largest sequence number seen so far as a 64-bit
1028
1097
  // integer.
1029
- uint64_t max_seq_num = 0;
1098
+ uint64_t max_seq_num_ = 0;
1030
1099
  };
1031
1100
 
1032
1101
  // reconstruct_seqnum takes the low order bits of a record sequence number from
@@ -1038,11 +1107,89 @@ struct DTLS1_BITMAP {
1038
1107
  // successfully deprotected in this epoch. This function returns the sequence
1039
1108
  // number that is numerically closest to one plus |max_valid_seqnum| that when
1040
1109
  // bitwise and-ed with |seq_mask| equals |wire_seq|.
1110
+ //
1111
+ // |max_valid_seqnum| must be most 2^48-1, in which case the output will also be
1112
+ // at most 2^48-1.
1041
1113
  OPENSSL_EXPORT uint64_t reconstruct_seqnum(uint16_t wire_seq, uint64_t seq_mask,
1042
1114
  uint64_t max_valid_seqnum);
1043
1115
 
1116
+
1044
1117
  // Record layer.
1045
1118
 
1119
+ class DTLSRecordNumber {
1120
+ public:
1121
+ static constexpr uint64_t kMaxSequence = (uint64_t{1} << 48) - 1;
1122
+
1123
+ DTLSRecordNumber() = default;
1124
+ DTLSRecordNumber(uint16_t epoch, uint64_t sequence) {
1125
+ BSSL_CHECK(sequence <= kMaxSequence);
1126
+ combined_ = (uint64_t{epoch} << 48) | sequence;
1127
+ }
1128
+
1129
+ static DTLSRecordNumber FromCombined(uint64_t combined) {
1130
+ return DTLSRecordNumber(combined);
1131
+ }
1132
+
1133
+ bool operator==(DTLSRecordNumber r) const {
1134
+ return combined() == r.combined();
1135
+ }
1136
+ bool operator!=(DTLSRecordNumber r) const { return !((*this) == r); }
1137
+ bool operator<(DTLSRecordNumber r) const { return combined() < r.combined(); }
1138
+
1139
+ uint64_t combined() const { return combined_; }
1140
+ uint16_t epoch() const { return combined_ >> 48; }
1141
+ uint64_t sequence() const { return combined_ & kMaxSequence; }
1142
+
1143
+ bool HasNext() const { return sequence() < kMaxSequence; }
1144
+ DTLSRecordNumber Next() const {
1145
+ BSSL_CHECK(HasNext());
1146
+ // This will not overflow into the epoch.
1147
+ return DTLSRecordNumber::FromCombined(combined_ + 1);
1148
+ }
1149
+
1150
+ private:
1151
+ explicit DTLSRecordNumber(uint64_t combined) : combined_(combined) {}
1152
+
1153
+ uint64_t combined_ = 0;
1154
+ };
1155
+
1156
+ class RecordNumberEncrypter {
1157
+ public:
1158
+ static constexpr bool kAllowUniquePtr = true;
1159
+ static constexpr size_t kMaxKeySize = 32;
1160
+
1161
+ // Create returns a DTLS 1.3 record number encrypter for |traffic_secret|, or
1162
+ // nullptr on error.
1163
+ static UniquePtr<RecordNumberEncrypter> Create(
1164
+ const SSL_CIPHER *cipher, Span<const uint8_t> traffic_secret);
1165
+
1166
+ virtual ~RecordNumberEncrypter() = default;
1167
+ virtual size_t KeySize() = 0;
1168
+ virtual bool SetKey(Span<const uint8_t> key) = 0;
1169
+ virtual bool GenerateMask(Span<uint8_t> out, Span<const uint8_t> sample) = 0;
1170
+ };
1171
+
1172
+ struct DTLSReadEpoch {
1173
+ static constexpr bool kAllowUniquePtr = true;
1174
+
1175
+ // TODO(davidben): This could be made slightly more compact if |bitmap| stored
1176
+ // a DTLSRecordNumber.
1177
+ uint16_t epoch = 0;
1178
+ UniquePtr<SSLAEADContext> aead;
1179
+ UniquePtr<RecordNumberEncrypter> rn_encrypter;
1180
+ DTLSReplayBitmap bitmap;
1181
+ };
1182
+
1183
+ struct DTLSWriteEpoch {
1184
+ static constexpr bool kAllowUniquePtr = true;
1185
+
1186
+ uint16_t epoch() const { return next_record.epoch(); }
1187
+
1188
+ DTLSRecordNumber next_record;
1189
+ UniquePtr<SSLAEADContext> aead;
1190
+ UniquePtr<RecordNumberEncrypter> rn_encrypter;
1191
+ };
1192
+
1046
1193
  // ssl_record_prefix_len returns the length of the prefix before the ciphertext
1047
1194
  // of a record for |ssl|.
1048
1195
  //
@@ -1087,8 +1234,10 @@ enum ssl_open_record_t tls_open_record(SSL *ssl, uint8_t *out_type,
1087
1234
 
1088
1235
  // dtls_open_record implements |tls_open_record| for DTLS. It only returns
1089
1236
  // |ssl_open_record_partial| if |in| was empty and sets |*out_consumed| to
1090
- // zero. The caller should read one packet and try again.
1237
+ // zero. The caller should read one packet and try again. On success,
1238
+ // |*out_number| is set to the record number of the record.
1091
1239
  enum ssl_open_record_t dtls_open_record(SSL *ssl, uint8_t *out_type,
1240
+ DTLSRecordNumber *out_number,
1092
1241
  Span<uint8_t> *out,
1093
1242
  size_t *out_consumed,
1094
1243
  uint8_t *out_alert, Span<uint8_t> in);
@@ -1123,13 +1272,18 @@ size_t dtls_max_seal_overhead(const SSL *ssl, uint16_t epoch);
1123
1272
  // front of the plaintext when sealing a record in-place.
1124
1273
  size_t dtls_seal_prefix_len(const SSL *ssl, uint16_t epoch);
1125
1274
 
1275
+ // dtls_seal_max_input_len returns the maximum number of input bytes that can
1276
+ // fit in a record of up to |max_out| bytes, or zero if none may fit.
1277
+ size_t dtls_seal_max_input_len(const SSL *ssl, uint16_t epoch, size_t max_out);
1278
+
1126
1279
  // dtls_seal_record implements |tls_seal_record| for DTLS. |epoch| selects which
1127
1280
  // epoch's cipher state to use. Unlike |tls_seal_record|, |in| and |out| may
1128
1281
  // alias but, if they do, |in| must be exactly |dtls_seal_prefix_len| bytes
1129
- // ahead of |out|.
1130
- bool dtls_seal_record(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out,
1131
- uint8_t type, const uint8_t *in, size_t in_len,
1132
- uint16_t epoch);
1282
+ // ahead of |out|. On success, |*out_number| is set to the record number of the
1283
+ // record.
1284
+ bool dtls_seal_record(SSL *ssl, DTLSRecordNumber *out_number, uint8_t *out,
1285
+ size_t *out_len, size_t max_out, uint8_t type,
1286
+ const uint8_t *in, size_t in_len, uint16_t epoch);
1133
1287
 
1134
1288
  // ssl_process_alert processes |in| as an alert and updates |ssl|'s shutdown
1135
1289
  // state. It returns one of |ssl_open_record_discard|, |ssl_open_record_error|,
@@ -1201,8 +1355,7 @@ class SSLKeyShare {
1201
1355
  // |out_ciphertext|, and sets |*out_secret| to the shared secret. On failure,
1202
1356
  // it returns false and sets |*out_alert| to an alert to send to the peer.
1203
1357
  virtual bool Encap(CBB *out_ciphertext, Array<uint8_t> *out_secret,
1204
- uint8_t *out_alert,
1205
- Span<const uint8_t> peer_key) = 0;
1358
+ uint8_t *out_alert, Span<const uint8_t> peer_key) = 0;
1206
1359
 
1207
1360
  // Decap decapsulates the symmetric secret in |ciphertext|. On success, it
1208
1361
  // returns true and sets |*out_secret| to the shared secret. On failure, it
@@ -1288,21 +1441,13 @@ bool dtls_has_unprocessed_handshake_data(const SSL *ssl);
1288
1441
  // tls_flush_pending_hs_data flushes any handshake plaintext data.
1289
1442
  bool tls_flush_pending_hs_data(SSL *ssl);
1290
1443
 
1291
- struct DTLS_OUTGOING_MESSAGE {
1292
- DTLS_OUTGOING_MESSAGE() {}
1293
- DTLS_OUTGOING_MESSAGE(const DTLS_OUTGOING_MESSAGE &) = delete;
1294
- DTLS_OUTGOING_MESSAGE &operator=(const DTLS_OUTGOING_MESSAGE &) = delete;
1295
-
1296
- void Clear();
1297
-
1298
- Array<uint8_t> data;
1299
- uint16_t epoch = 0;
1300
- bool is_ccs = false;
1301
- };
1302
-
1303
1444
  // dtls_clear_outgoing_messages releases all buffered outgoing messages.
1304
1445
  void dtls_clear_outgoing_messages(SSL *ssl);
1305
1446
 
1447
+ // dtls_clear_unused_write_epochs releases any write epochs that are no longer
1448
+ // needed.
1449
+ void dtls_clear_unused_write_epochs(SSL *ssl);
1450
+
1306
1451
 
1307
1452
  // Callbacks.
1308
1453
 
@@ -1329,11 +1474,9 @@ class SSLBuffer {
1329
1474
  bool empty() const { return size_ == 0; }
1330
1475
  size_t cap() const { return cap_; }
1331
1476
 
1332
- Span<uint8_t> span() { return MakeSpan(data(), size()); }
1477
+ Span<uint8_t> span() { return Span(data(), size()); }
1333
1478
 
1334
- Span<uint8_t> remaining() {
1335
- return MakeSpan(data() + size(), cap() - size());
1336
- }
1479
+ Span<uint8_t> remaining() { return Span(data() + size(), cap() - size()); }
1337
1480
 
1338
1481
  // Clear releases the buffer.
1339
1482
  void Clear();
@@ -1368,9 +1511,6 @@ class SSLBuffer {
1368
1511
  uint16_t cap_ = 0;
1369
1512
  // inline_buf_ is a static buffer for short reads.
1370
1513
  uint8_t inline_buf_[SSL3_RT_HEADER_LENGTH];
1371
- // buf_allocated_ is true if |buf_| points to allocated data and must be freed
1372
- // or false if it points into |inline_buf_|.
1373
- bool buf_allocated_ = false;
1374
1514
  };
1375
1515
 
1376
1516
  // ssl_read_buffer_extend_to extends the read buffer to the desired length. For
@@ -1425,32 +1565,51 @@ enum ssl_key_usage_t {
1425
1565
  OPENSSL_EXPORT bool ssl_cert_check_key_usage(const CBS *in,
1426
1566
  enum ssl_key_usage_t bit);
1427
1567
 
1568
+ // ssl_cert_extract_issuer parses the DER-encoded, X.509 certificate in |in|
1569
+ // and extracts the issuer. On success it returns true and the DER encoded
1570
+ // issuer is in |out_dn|, otherwise it returns false.
1571
+ OPENSSL_EXPORT bool ssl_cert_extract_issuer(const CBS *in, CBS *out_dn);
1572
+
1573
+ // ssl_cert_matches_issuer parses the DER-encoded, X.509 certificate in |in|
1574
+ // and returns true if its issuer is an exact match for the DER encoded
1575
+ // distinguished name in |dn|
1576
+ bool ssl_cert_matches_issuer(const CBS *in, const CBS *dn);
1577
+
1428
1578
  // ssl_cert_parse_pubkey extracts the public key from the DER-encoded, X.509
1429
1579
  // certificate in |in|. It returns an allocated |EVP_PKEY| or else returns
1430
1580
  // nullptr and pushes to the error queue.
1431
1581
  UniquePtr<EVP_PKEY> ssl_cert_parse_pubkey(const CBS *in);
1432
1582
 
1433
- // ssl_parse_client_CA_list parses a CA list from |cbs| in the format used by a
1434
- // TLS CertificateRequest message. On success, it returns a newly-allocated
1435
- // |CRYPTO_BUFFER| list and advances |cbs|. Otherwise, it returns nullptr and
1436
- // sets |*out_alert| to an alert to send to the peer.
1437
- UniquePtr<STACK_OF(CRYPTO_BUFFER)> ssl_parse_client_CA_list(SSL *ssl,
1438
- uint8_t *out_alert,
1439
- CBS *cbs);
1583
+ // SSL_parse_CA_list parses a CA list from |cbs| in the format used by a TLS
1584
+ // CertificateRequest message and Certificate Authorities extension. On success,
1585
+ // it returns a newly-allocated |CRYPTO_BUFFER| list and advances
1586
+ // |cbs|. Otherwise, it returns nullptr and sets |*out_alert| to an alert to
1587
+ // send to the peer.
1588
+ UniquePtr<STACK_OF(CRYPTO_BUFFER)> SSL_parse_CA_list(SSL *ssl,
1589
+ uint8_t *out_alert,
1590
+ CBS *cbs);
1440
1591
 
1441
- // ssl_has_client_CAs returns there are configured CAs.
1592
+ // ssl_has_client_CAs returns whether there are configured CAs.
1442
1593
  bool ssl_has_client_CAs(const SSL_CONFIG *cfg);
1443
1594
 
1444
1595
  // ssl_add_client_CA_list adds the configured CA list to |cbb| in the format
1445
1596
  // used by a TLS CertificateRequest message. It returns true on success and
1446
1597
  // false on error.
1447
- bool ssl_add_client_CA_list(SSL_HANDSHAKE *hs, CBB *cbb);
1598
+ bool ssl_add_client_CA_list(const SSL_HANDSHAKE *hs, CBB *cbb);
1599
+
1600
+ // ssl_has_CA_names returns whether there are configured CA names.
1601
+ bool ssl_has_CA_names(const SSL_CONFIG *cfg);
1602
+
1603
+ // ssl_add_CA_names adds the configured CA_names list to |cbb| in the format
1604
+ // used by a TLS Certificate Authorities extension. It returns true on success
1605
+ // and false on error.
1606
+ bool ssl_add_CA_names(const SSL_HANDSHAKE *hs, CBB *cbb);
1448
1607
 
1449
1608
  // ssl_check_leaf_certificate returns one if |pkey| and |leaf| are suitable as
1450
1609
  // a server's leaf certificate for |hs|. Otherwise, it returns zero and pushes
1451
1610
  // an error on the error queue.
1452
1611
  bool ssl_check_leaf_certificate(SSL_HANDSHAKE *hs, EVP_PKEY *pkey,
1453
- const CRYPTO_BUFFER *leaf);
1612
+ const CRYPTO_BUFFER *leaf);
1454
1613
 
1455
1614
 
1456
1615
  // TLS 1.3 key derivation.
@@ -1502,7 +1661,7 @@ bool tls13_derive_resumption_secret(SSL_HANDSHAKE *hs);
1502
1661
  // |exporter_secret|.
1503
1662
  bool tls13_export_keying_material(SSL *ssl, Span<uint8_t> out,
1504
1663
  Span<const uint8_t> secret,
1505
- Span<const char> label,
1664
+ std::string_view label,
1506
1665
  Span<const uint8_t> context);
1507
1666
 
1508
1667
  // tls13_finished_mac calculates the MAC of the handshake transcript to verify
@@ -1666,6 +1825,8 @@ bool ssl_encrypt_client_hello(SSL_HANDSHAKE *hs, Span<const uint8_t> enc);
1666
1825
  enum class SSLCredentialType {
1667
1826
  kX509,
1668
1827
  kDelegated,
1828
+ kSPAKE2PlusV1Client,
1829
+ kSPAKE2PlusV1Server,
1669
1830
  };
1670
1831
 
1671
1832
  BSSL_NAMESPACE_END
@@ -1677,7 +1838,7 @@ struct ssl_credential_st : public bssl::RefCounted<ssl_credential_st> {
1677
1838
  ssl_credential_st &operator=(const ssl_credential_st &) = delete;
1678
1839
 
1679
1840
  // Dup returns a copy of the credential, or nullptr on error. The |ex_data|
1680
- // values are not copied. This is only used on the default credential, whose
1841
+ // values are not copied. This is only used on the legacy credential, whose
1681
1842
  // |ex_data| is inaccessible.
1682
1843
  bssl::UniquePtr<SSL_CREDENTIAL> Dup() const;
1683
1844
 
@@ -1711,6 +1872,10 @@ struct ssl_credential_st : public bssl::RefCounted<ssl_credential_st> {
1711
1872
  // returns one on success and zero on error.
1712
1873
  bool AppendIntermediateCert(bssl::UniquePtr<CRYPTO_BUFFER> cert);
1713
1874
 
1875
+ // ChainContainsIssuer returns true if |dn| is a byte for byte match with the
1876
+ // issuer of any certificate in |chain|, false otherwise.
1877
+ bool ChainContainsIssuer(bssl::Span<const uint8_t> dn) const;
1878
+
1714
1879
  // type is the credential type and determines which other fields apply.
1715
1880
  bssl::SSLCredentialType type;
1716
1881
 
@@ -1756,8 +1921,34 @@ struct ssl_credential_st : public bssl::RefCounted<ssl_credential_st> {
1756
1921
  // OCSP response to be sent to the client, if requested.
1757
1922
  bssl::UniquePtr<CRYPTO_BUFFER> ocsp_response;
1758
1923
 
1924
+ // SPAKE2+-specific information.
1925
+ bssl::Array<uint8_t> pake_context;
1926
+ bssl::Array<uint8_t> client_identity;
1927
+ bssl::Array<uint8_t> server_identity;
1928
+ bssl::Array<uint8_t> password_verifier_w0;
1929
+ bssl::Array<uint8_t> password_verifier_w1; // server-only
1930
+ bssl::Array<uint8_t> registration_record; // client-only
1931
+ mutable std::atomic<uint32_t> pake_limit;
1932
+
1933
+ // Checks whether there are still permitted PAKE attempts remaining, without
1934
+ // changing the counter.
1935
+ bool HasPAKEAttempts() const;
1936
+
1937
+ // Atomically decrement |pake_limit|. Return true if successful and false if
1938
+ // |pake_limit| is already zero.
1939
+ bool ClaimPAKEAttempt() const;
1940
+
1941
+ // Atomically increment |pake_limit|. This must be paired with a
1942
+ // |ClaimPAKEAttempt| call.
1943
+ void RestorePAKEAttempt() const;
1944
+
1759
1945
  CRYPTO_EX_DATA ex_data;
1760
1946
 
1947
+ // must_match_issuer is a flag indicating that this credential should be
1948
+ // considered only when it matches a peer request for a particular issuer via
1949
+ // a negotiation mechanism (such as the certificate_authorities extension).
1950
+ bool must_match_issuer = false;
1951
+
1761
1952
  private:
1762
1953
  friend RefCounted;
1763
1954
  ~ssl_credential_st();
@@ -1773,6 +1964,11 @@ BSSL_NAMESPACE_BEGIN
1773
1964
  // The pointers in the result are only valid until |hs| is next mutated.
1774
1965
  bool ssl_get_credential_list(SSL_HANDSHAKE *hs, Array<SSL_CREDENTIAL *> *out);
1775
1966
 
1967
+ // ssl_credential_matches_requested_issuers returns true if |cred| is a
1968
+ // usable match for any requested issuers in |hs|, and false with an error
1969
+ // otherwise.
1970
+ bool ssl_credential_matches_requested_issuers(SSL_HANDSHAKE *hs,
1971
+ const SSL_CREDENTIAL *cred);
1776
1972
 
1777
1973
  // Handshake functions.
1778
1974
 
@@ -1896,6 +2092,14 @@ struct SSL_HANDSHAKE_HINTS {
1896
2092
  bool ignore_ticket = false;
1897
2093
  };
1898
2094
 
2095
+ struct SSLPAKEShare {
2096
+ static constexpr bool kAllowUniquePtr = true;
2097
+ uint16_t named_pake;
2098
+ Array<uint8_t> client_identity;
2099
+ Array<uint8_t> server_identity;
2100
+ Array<uint8_t> pake_message;
2101
+ };
2102
+
1899
2103
  struct SSL_HANDSHAKE {
1900
2104
  explicit SSL_HANDSHAKE(SSL *ssl);
1901
2105
  ~SSL_HANDSHAKE();
@@ -1927,18 +2131,13 @@ struct SSL_HANDSHAKE {
1927
2131
  // |SSL_OP_NO_*| and |SSL_CTX_set_max_proto_version| APIs.
1928
2132
  uint16_t max_version = 0;
1929
2133
 
1930
- private:
1931
- size_t hash_len_ = 0;
1932
- uint8_t secret_[SSL_MAX_MD_SIZE] = {0};
1933
- uint8_t early_traffic_secret_[SSL_MAX_MD_SIZE] = {0};
1934
- uint8_t client_handshake_secret_[SSL_MAX_MD_SIZE] = {0};
1935
- uint8_t server_handshake_secret_[SSL_MAX_MD_SIZE] = {0};
1936
- uint8_t client_traffic_secret_0_[SSL_MAX_MD_SIZE] = {0};
1937
- uint8_t server_traffic_secret_0_[SSL_MAX_MD_SIZE] = {0};
1938
- uint8_t expected_client_finished_[SSL_MAX_MD_SIZE] = {0};
1939
-
1940
- public:
1941
- void ResizeSecrets(size_t hash_len);
2134
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> secret;
2135
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> early_traffic_secret;
2136
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> client_handshake_secret;
2137
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> server_handshake_secret;
2138
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> client_traffic_secret_0;
2139
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> server_traffic_secret_0;
2140
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> expected_client_finished;
1942
2141
 
1943
2142
  // GetClientHello, on the server, returns either the normal ClientHello
1944
2143
  // message or the ClientHelloInner if it has been serialized to
@@ -1951,29 +2150,6 @@ struct SSL_HANDSHAKE {
1951
2150
  // SSL_HANDSHAKE.
1952
2151
  bool GetClientHello(SSLMessage *out_msg, SSL_CLIENT_HELLO *out_client_hello);
1953
2152
 
1954
- Span<uint8_t> secret() { return MakeSpan(secret_, hash_len_); }
1955
- Span<const uint8_t> secret() const {
1956
- return MakeConstSpan(secret_, hash_len_);
1957
- }
1958
- Span<uint8_t> early_traffic_secret() {
1959
- return MakeSpan(early_traffic_secret_, hash_len_);
1960
- }
1961
- Span<uint8_t> client_handshake_secret() {
1962
- return MakeSpan(client_handshake_secret_, hash_len_);
1963
- }
1964
- Span<uint8_t> server_handshake_secret() {
1965
- return MakeSpan(server_handshake_secret_, hash_len_);
1966
- }
1967
- Span<uint8_t> client_traffic_secret_0() {
1968
- return MakeSpan(client_traffic_secret_0_, hash_len_);
1969
- }
1970
- Span<uint8_t> server_traffic_secret_0() {
1971
- return MakeSpan(server_traffic_secret_0_, hash_len_);
1972
- }
1973
- Span<uint8_t> expected_client_finished() {
1974
- return MakeSpan(expected_client_finished_, hash_len_);
1975
- }
1976
-
1977
2153
  union {
1978
2154
  // sent is a bitset where the bits correspond to elements of kExtensions
1979
2155
  // in extensions.cc. Each bit is set if that extension was sent in a
@@ -2014,7 +2190,8 @@ struct SSL_HANDSHAKE {
2014
2190
 
2015
2191
  // dtls_cookie is the value of the cookie in DTLS HelloVerifyRequest. If
2016
2192
  // empty, either none was received or HelloVerifyRequest contained an empty
2017
- // cookie.
2193
+ // cookie. Check the received_hello_verify_request field to distinguish an
2194
+ // empty cookie from no HelloVerifyRequest message being received.
2018
2195
  Array<uint8_t> dtls_cookie;
2019
2196
 
2020
2197
  // ech_client_outer contains the outer ECH extension to send in the
@@ -2078,8 +2255,8 @@ struct SSL_HANDSHAKE {
2078
2255
  // server when using a TLS 1.2 PSK key exchange.
2079
2256
  UniquePtr<char> peer_psk_identity_hint;
2080
2257
 
2081
- // ca_names, on the client, contains the list of CAs received in a
2082
- // CertificateRequest message.
2258
+ // ca_names contains the list of CAs received via the Certificate Authorities
2259
+ // extension in our peer's CertificateRequest or ClientHello message
2083
2260
  UniquePtr<STACK_OF(CRYPTO_BUFFER)> ca_names;
2084
2261
 
2085
2262
  // cached_x509_ca_names contains a cache of parsed versions of the elements of
@@ -2181,6 +2358,10 @@ struct SSL_HANDSHAKE {
2181
2358
  // the handshake.
2182
2359
  bool can_early_write : 1;
2183
2360
 
2361
+ // is_early_version is true if the protocol version configured is not
2362
+ // necessarily the final version and is just the predicted 0-RTT version.
2363
+ bool is_early_version : 1;
2364
+
2184
2365
  // next_proto_neg_seen is one of NPN was negotiated.
2185
2366
  bool next_proto_neg_seen : 1;
2186
2367
 
@@ -2222,6 +2403,10 @@ struct SSL_HANDSHAKE {
2222
2403
  // handshake.
2223
2404
  bool channel_id_negotiated : 1;
2224
2405
 
2406
+ // received_hello_verify_request is true if we received a HelloVerifyRequest
2407
+ // message from the server.
2408
+ bool received_hello_verify_request : 1;
2409
+
2225
2410
  // client_version is the value sent or received in the ClientHello version.
2226
2411
  uint16_t client_version = 0;
2227
2412
 
@@ -2241,11 +2426,22 @@ struct SSL_HANDSHAKE {
2241
2426
  uint8_t ech_config_id = 0;
2242
2427
 
2243
2428
  // session_id is the session ID in the ClientHello.
2244
- uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH] = {0};
2245
- uint8_t session_id_len = 0;
2429
+ InplaceVector<uint8_t, SSL_MAX_SSL_SESSION_ID_LENGTH> session_id;
2246
2430
 
2247
2431
  // grease_seed is the entropy for GREASE values.
2248
2432
  uint8_t grease_seed[ssl_grease_last_index + 1] = {0};
2433
+
2434
+ // pake_share is the PAKE message received over the wire, if any.
2435
+ UniquePtr<SSLPAKEShare> pake_share;
2436
+
2437
+ // pake_share_bytes are the bytes of the PAKEShare to send, if any.
2438
+ Array<uint8_t> pake_share_bytes;
2439
+
2440
+ // pake_prover is the PAKE context for a client.
2441
+ UniquePtr<spake2plus::Prover> pake_prover;
2442
+
2443
+ // pake_verifier is the PAKE context for a server.
2444
+ UniquePtr<spake2plus::Verifier> pake_verifier;
2249
2445
  };
2250
2446
 
2251
2447
  // kMaxTickets is the maximum number of tickets to send immediately after the
@@ -2278,10 +2474,9 @@ const char *ssl_server_handshake_state(SSL_HANDSHAKE *hs);
2278
2474
  const char *tls13_client_handshake_state(SSL_HANDSHAKE *hs);
2279
2475
  const char *tls13_server_handshake_state(SSL_HANDSHAKE *hs);
2280
2476
 
2281
- // tls13_add_key_update queues a KeyUpdate message on |ssl|. The
2282
- // |update_requested| argument must be one of |SSL_KEY_UPDATE_REQUESTED| or
2283
- // |SSL_KEY_UPDATE_NOT_REQUESTED|.
2284
- bool tls13_add_key_update(SSL *ssl, int update_requested);
2477
+ // tls13_add_key_update queues a KeyUpdate message on |ssl|. |request_type| must
2478
+ // be one of |SSL_KEY_UPDATE_REQUESTED| or |SSL_KEY_UPDATE_NOT_REQUESTED|.
2479
+ bool tls13_add_key_update(SSL *ssl, int request_type);
2285
2480
 
2286
2481
  // tls13_post_handshake processes a post-handshake message. It returns true on
2287
2482
  // success and false on failure.
@@ -2319,6 +2514,10 @@ bool ssl_setup_extension_permutation(SSL_HANDSHAKE *hs);
2319
2514
  // a single key share of the specified group.
2320
2515
  bool ssl_setup_key_shares(SSL_HANDSHAKE *hs, uint16_t override_group_id);
2321
2516
 
2517
+ // ssl_setup_pake_shares computes the client PAKE shares and saves them in |hs|.
2518
+ // It returns true on success and false on failure.
2519
+ bool ssl_setup_pake_shares(SSL_HANDSHAKE *hs);
2520
+
2322
2521
  bool ssl_ext_key_share_parse_serverhello(SSL_HANDSHAKE *hs,
2323
2522
  Array<uint8_t> *out_secret,
2324
2523
  uint8_t *out_alert, CBS *contents);
@@ -2326,8 +2525,13 @@ bool ssl_ext_key_share_parse_clienthello(SSL_HANDSHAKE *hs, bool *out_found,
2326
2525
  Span<const uint8_t> *out_peer_key,
2327
2526
  uint8_t *out_alert,
2328
2527
  const SSL_CLIENT_HELLO *client_hello);
2528
+ bool ssl_ext_pake_add_serverhello(SSL_HANDSHAKE *hs, CBB *out);
2329
2529
  bool ssl_ext_key_share_add_serverhello(SSL_HANDSHAKE *hs, CBB *out);
2330
2530
 
2531
+ bool ssl_ext_pake_parse_serverhello(SSL_HANDSHAKE *hs,
2532
+ Array<uint8_t> *out_secret,
2533
+ uint8_t *out_alert, CBS *contents);
2534
+
2331
2535
  bool ssl_ext_pre_shared_key_parse_serverhello(SSL_HANDSHAKE *hs,
2332
2536
  uint8_t *out_alert,
2333
2537
  CBS *contents);
@@ -2472,12 +2676,6 @@ bool ssl_log_secret(const SSL *ssl, const char *label,
2472
2676
 
2473
2677
  // ClientHello functions.
2474
2678
 
2475
- // ssl_client_hello_init parses |body| as a ClientHello message, excluding the
2476
- // message header, and writes the result to |*out|. It returns true on success
2477
- // and false on error. This function is exported for testing.
2478
- OPENSSL_EXPORT bool ssl_client_hello_init(const SSL *ssl, SSL_CLIENT_HELLO *out,
2479
- Span<const uint8_t> body);
2480
-
2481
2679
  bool ssl_parse_client_hello_with_trailing_data(const SSL *ssl, CBS *cbs,
2482
2680
  SSL_CLIENT_HELLO *out);
2483
2681
 
@@ -2542,32 +2740,32 @@ struct CERT {
2542
2740
  explicit CERT(const SSL_X509_METHOD *x509_method);
2543
2741
  ~CERT();
2544
2742
 
2545
- bool is_valid() const { return default_credential != nullptr; }
2743
+ bool is_valid() const { return legacy_credential != nullptr; }
2546
2744
 
2547
2745
  // credentials is the list of credentials to select between. Elements of this
2548
2746
  // array immutable.
2549
- GrowableArray<UniquePtr<SSL_CREDENTIAL>> credentials;
2747
+ Vector<UniquePtr<SSL_CREDENTIAL>> credentials;
2550
2748
 
2551
- // default_credential is the credential configured by the legacy,
2749
+ // legacy_credential is the credential configured by the legacy
2552
2750
  // non-credential-based APIs. If IsComplete() returns true, it is appended to
2553
2751
  // the list of credentials.
2554
- UniquePtr<SSL_CREDENTIAL> default_credential;
2752
+ UniquePtr<SSL_CREDENTIAL> legacy_credential;
2555
2753
 
2556
2754
  // x509_method contains pointers to functions that might deal with |X509|
2557
2755
  // compatibility, or might be a no-op, depending on the application.
2558
2756
  const SSL_X509_METHOD *x509_method = nullptr;
2559
2757
 
2560
- // x509_chain may contain a parsed copy of |chain[1..]| from the default
2758
+ // x509_chain may contain a parsed copy of |chain[1..]| from the legacy
2561
2759
  // credential. This is only used as a cache in order to implement “get0”
2562
2760
  // functions that return a non-owning pointer to the certificate chain.
2563
2761
  STACK_OF(X509) *x509_chain = nullptr;
2564
2762
 
2565
2763
  // x509_leaf may contain a parsed copy of the first element of |chain| from
2566
- // the default credential. This is only used as a cache in order to implement
2764
+ // the legacy credential. This is only used as a cache in order to implement
2567
2765
  // “get0” functions that return a non-owning pointer to the certificate chain.
2568
2766
  X509 *x509_leaf = nullptr;
2569
2767
 
2570
- // x509_stash contains the last |X509| object append to the default
2768
+ // x509_stash contains the last |X509| object append to the legacy
2571
2769
  // credential's chain. This is a workaround for some third-party code that
2572
2770
  // continue to use an |X509| object even after passing ownership with an
2573
2771
  // “add0” function.
@@ -2588,8 +2786,7 @@ struct CERT {
2588
2786
 
2589
2787
  // sid_ctx partitions the session space within a shared session cache or
2590
2788
  // ticket key. Only sessions with a matching value will be accepted.
2591
- uint8_t sid_ctx_length = 0;
2592
- uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH] = {0};
2789
+ InplaceVector<uint8_t, SSL_MAX_SID_CTX_LENGTH> sid_ctx;
2593
2790
  };
2594
2791
 
2595
2792
  // |SSL_PROTOCOL_METHOD| abstracts between TLS and DTLS.
@@ -2638,25 +2835,37 @@ struct SSL_PROTOCOL_METHOD {
2638
2835
  // add_change_cipher_spec adds a ChangeCipherSpec record to the pending
2639
2836
  // flight. It returns true on success and false on error.
2640
2837
  bool (*add_change_cipher_spec)(SSL *ssl);
2641
- // flush_flight flushes the pending flight to the transport. It returns one on
2642
- // success and <= 0 on error.
2643
- int (*flush_flight)(SSL *ssl);
2838
+ // finish_flight marks the pending flight as finished and ready to send.
2839
+ // |flush| must be called to write it.
2840
+ void (*finish_flight)(SSL *ssl);
2841
+ // schedule_ack schedules a DTLS 1.3 ACK to be sent, without an ACK delay.
2842
+ // |flush| must be called to write it.
2843
+ void (*schedule_ack)(SSL *ssl);
2844
+ // flush writes any scheduled data to the transport. It returns one on success
2845
+ // and <= 0 on error.
2846
+ int (*flush)(SSL *ssl);
2644
2847
  // on_handshake_complete is called when the handshake is complete.
2645
2848
  void (*on_handshake_complete)(SSL *ssl);
2646
2849
  // set_read_state sets |ssl|'s read cipher state and level to |aead_ctx| and
2647
- // |level|. In QUIC, |aead_ctx| is a placeholder object and |secret_for_quic|
2648
- // is the original secret. This function returns true on success and false on
2649
- // error.
2850
+ // |level|. In QUIC, |aead_ctx| is a placeholder object. In TLS 1.3,
2851
+ // |traffic_secret| is the original traffic secret. This function returns true
2852
+ // on success and false on error.
2853
+ //
2854
+ // TODO(crbug.com/371998381): Take the traffic secrets as input and let the
2855
+ // function create the SSLAEADContext.
2650
2856
  bool (*set_read_state)(SSL *ssl, ssl_encryption_level_t level,
2651
2857
  UniquePtr<SSLAEADContext> aead_ctx,
2652
- Span<const uint8_t> secret_for_quic);
2858
+ Span<const uint8_t> traffic_secret);
2653
2859
  // set_write_state sets |ssl|'s write cipher state and level to |aead_ctx| and
2654
- // |level|. In QUIC, |aead_ctx| is a placeholder object and |secret_for_quic|
2655
- // is the original secret. This function returns true on success and false on
2656
- // error.
2860
+ // |level|. In QUIC, |aead_ctx| is a placeholder object In TLS 1.3,
2861
+ // |traffic_secret| is the original traffic secret. This function returns true
2862
+ // on success and false on error.
2863
+ //
2864
+ // TODO(crbug.com/371998381): Take the traffic secrets as input and let the
2865
+ // function create the SSLAEADContext.
2657
2866
  bool (*set_write_state)(SSL *ssl, ssl_encryption_level_t level,
2658
2867
  UniquePtr<SSLAEADContext> aead_ctx,
2659
- Span<const uint8_t> secret_for_quic);
2868
+ Span<const uint8_t> traffic_secret);
2660
2869
  };
2661
2870
 
2662
2871
  // The following wrappers call |open_*| but handle |read_shutdown| correctly.
@@ -2682,10 +2891,10 @@ ssl_open_record_t ssl_open_app_data(SSL *ssl, Span<uint8_t> *out,
2682
2891
  Span<uint8_t> in);
2683
2892
 
2684
2893
  struct SSL_X509_METHOD {
2685
- // check_client_CA_list returns one if |names| is a good list of X.509
2686
- // distinguished names and zero otherwise. This is used to ensure that we can
2687
- // reject unparsable values at handshake time when using crypto/x509.
2688
- bool (*check_client_CA_list)(STACK_OF(CRYPTO_BUFFER) *names);
2894
+ // check_CA_list returns one if |names| is a good list of X.509 distinguished
2895
+ // names and zero otherwise. This is used to ensure that we can reject
2896
+ // unparsable values at handshake time when using crypto/x509.
2897
+ bool (*check_CA_list)(STACK_OF(CRYPTO_BUFFER) *names);
2689
2898
 
2690
2899
  // cert_clear frees and NULLs all X509 certificate-related state.
2691
2900
  void (*cert_clear)(CERT *cert);
@@ -2846,8 +3055,14 @@ struct SSL3_STATE {
2846
3055
  // needs re-doing when in SSL_accept or SSL_connect
2847
3056
  int rwstate = SSL_ERROR_NONE;
2848
3057
 
2849
- enum ssl_encryption_level_t read_level = ssl_encryption_initial;
2850
- enum ssl_encryption_level_t write_level = ssl_encryption_initial;
3058
+ enum ssl_encryption_level_t quic_read_level = ssl_encryption_initial;
3059
+ enum ssl_encryption_level_t quic_write_level = ssl_encryption_initial;
3060
+
3061
+ // version is the protocol version, or zero if the version has not yet been
3062
+ // set. In clients offering 0-RTT, this version will initially be set to the
3063
+ // early version, then switched to the final version. To distinguish these
3064
+ // cases, use |ssl_has_final_version|.
3065
+ uint16_t version = 0;
2851
3066
 
2852
3067
  // early_data_skipped is the amount of early data that has been skipped by the
2853
3068
  // record layer.
@@ -2870,10 +3085,6 @@ struct SSL3_STATE {
2870
3085
  // messages when 0RTT is rejected.
2871
3086
  bool skip_early_data : 1;
2872
3087
 
2873
- // have_version is true if the connection's final version is known. Otherwise
2874
- // the version has not been negotiated yet.
2875
- bool have_version : 1;
2876
-
2877
3088
  // v2_hello_done is true if the peer's V2ClientHello, if any, has been handled
2878
3089
  // and future messages should use the record layer.
2879
3090
  bool v2_hello_done : 1;
@@ -2899,8 +3110,10 @@ struct SSL3_STATE {
2899
3110
  // Channel ID and the |channel_id| field is filled in.
2900
3111
  bool channel_id_valid : 1;
2901
3112
 
2902
- // key_update_pending is true if we have a KeyUpdate acknowledgment
2903
- // outstanding.
3113
+ // key_update_pending is true if we are in the process of sending a KeyUpdate
3114
+ // message. As a DoS mitigation (and a requirement in DTLS), we never send
3115
+ // more than one KeyUpdate at once. In DTLS, this tracks whether there is an
3116
+ // unACKed KeyUpdate.
2904
3117
  bool key_update_pending : 1;
2905
3118
 
2906
3119
  // early_data_accepted is true if early data was accepted by the server.
@@ -2957,18 +3170,13 @@ struct SSL3_STATE {
2957
3170
  // one.
2958
3171
  UniquePtr<SSL_HANDSHAKE> hs;
2959
3172
 
2960
- uint8_t write_traffic_secret[SSL_MAX_MD_SIZE] = {0};
2961
- uint8_t read_traffic_secret[SSL_MAX_MD_SIZE] = {0};
2962
- uint8_t exporter_secret[SSL_MAX_MD_SIZE] = {0};
2963
- uint8_t write_traffic_secret_len = 0;
2964
- uint8_t read_traffic_secret_len = 0;
2965
- uint8_t exporter_secret_len = 0;
3173
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> write_traffic_secret;
3174
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> read_traffic_secret;
3175
+ InplaceVector<uint8_t, SSL_MAX_MD_SIZE> exporter_secret;
2966
3176
 
2967
3177
  // Connection binding to prevent renegotiation attacks
2968
- uint8_t previous_client_finished[12] = {0};
2969
- uint8_t previous_client_finished_len = 0;
2970
- uint8_t previous_server_finished_len = 0;
2971
- uint8_t previous_server_finished[12] = {0};
3178
+ InplaceVector<uint8_t, 12> previous_client_finished;
3179
+ InplaceVector<uint8_t, 12> previous_server_finished;
2972
3180
 
2973
3181
  uint8_t send_alert[2] = {0};
2974
3182
 
@@ -3031,9 +3239,47 @@ static_assert(DTLS1_RT_MAX_HEADER_LENGTH >= DTLS1_3_RECORD_HEADER_WRITE_LENGTH,
3031
3239
 
3032
3240
  #define DTLS1_HM_HEADER_LENGTH 12
3033
3241
 
3034
- #define DTLS1_CCS_HEADER_LENGTH 1
3242
+ // A DTLSMessageBitmap maintains a list of bits which may be marked to indicate
3243
+ // a portion of a message was received or ACKed.
3244
+ class DTLSMessageBitmap {
3245
+ public:
3246
+ // A Range represents a range of bits from |start|, inclusive, to |end|,
3247
+ // exclusive.
3248
+ struct Range {
3249
+ size_t start = 0;
3250
+ size_t end = 0;
3251
+
3252
+ bool empty() const { return start == end; }
3253
+ size_t size() const { return end - start; }
3254
+ bool operator==(const Range &r) const {
3255
+ return start == r.start && end == r.end;
3256
+ }
3257
+ bool operator!=(const Range &r) const { return !(*this == r); }
3258
+ };
3259
+
3260
+ // Init initializes the structure with |num_bits| unmarked bits, from zero
3261
+ // to |num_bits - 1|.
3262
+ bool Init(size_t num_bits);
3035
3263
 
3036
- #define DTLS1_AL_HEADER_LENGTH 2
3264
+ // MarkRange marks the bits from |start|, inclusive, to |end|, exclusive.
3265
+ void MarkRange(size_t start, size_t end);
3266
+
3267
+ // NextUnmarkedRange returns the next range of unmarked bits, starting from
3268
+ // |start|, inclusive. If all bits after |start| are marked, it returns an
3269
+ // empty range.
3270
+ Range NextUnmarkedRange(size_t start) const;
3271
+
3272
+ // IsComplete returns whether every bit in the bitmask has been marked.
3273
+ bool IsComplete() const { return bytes_.empty(); }
3274
+
3275
+ private:
3276
+ // bytes_ contains the unmarked bits. We maintain an invariant: if |bytes_| is
3277
+ // not empty, some bit is unset.
3278
+ Array<uint8_t> bytes_;
3279
+ // first_unmarked_byte_ is the index of first byte in |bytes_| that is not
3280
+ // 0xff. This is maintained to amortize checking if the message is complete.
3281
+ size_t first_unmarked_byte_ = 0;
3282
+ };
3037
3283
 
3038
3284
  struct hm_header_st {
3039
3285
  uint8_t type;
@@ -3043,28 +3289,47 @@ struct hm_header_st {
3043
3289
  uint32_t frag_len;
3044
3290
  };
3045
3291
 
3046
- // An hm_fragment is an incoming DTLS message, possibly not yet assembled.
3047
- struct hm_fragment {
3292
+ // An DTLSIncomingMessage is an incoming DTLS message, possibly not yet
3293
+ // assembled.
3294
+ struct DTLSIncomingMessage {
3048
3295
  static constexpr bool kAllowUniquePtr = true;
3049
3296
 
3050
- hm_fragment() {}
3051
- hm_fragment(const hm_fragment &) = delete;
3052
- hm_fragment &operator=(const hm_fragment &) = delete;
3053
-
3054
- ~hm_fragment();
3297
+ Span<uint8_t> msg() { return Span(data).subspan(DTLS1_HM_HEADER_LENGTH); }
3298
+ Span<const uint8_t> msg() const {
3299
+ return Span(data).subspan(DTLS1_HM_HEADER_LENGTH);
3300
+ }
3301
+ size_t msg_len() const { return msg().size(); }
3055
3302
 
3056
3303
  // type is the type of the message.
3057
3304
  uint8_t type = 0;
3058
3305
  // seq is the sequence number of this message.
3059
3306
  uint16_t seq = 0;
3060
- // msg_len is the length of the message body.
3061
- uint32_t msg_len = 0;
3062
- // data is a pointer to the message, including message header. It has length
3063
- // |DTLS1_HM_HEADER_LENGTH| + |msg_len|.
3064
- uint8_t *data = nullptr;
3065
- // reassembly is a bitmask of |msg_len| bits corresponding to which parts of
3066
- // the message have been received. It is NULL if the message is complete.
3067
- uint8_t *reassembly = nullptr;
3307
+ // data contains the message, including the message header of length
3308
+ // |DTLS1_HM_HEADER_LENGTH|.
3309
+ Array<uint8_t> data;
3310
+ // reassembly tracks which parts of the message have been received.
3311
+ DTLSMessageBitmap reassembly;
3312
+ };
3313
+
3314
+ struct DTLSOutgoingMessage {
3315
+ size_t msg_len() const {
3316
+ assert(!is_ccs);
3317
+ assert(data.size() >= DTLS1_HM_HEADER_LENGTH);
3318
+ return data.size() - DTLS1_HM_HEADER_LENGTH;
3319
+ }
3320
+
3321
+ bool IsFullyAcked() const {
3322
+ // ACKs only exist in DTLS 1.3, which does not send ChangeCipherSpec.
3323
+ return !is_ccs && acked.IsComplete();
3324
+ }
3325
+
3326
+ Array<uint8_t> data;
3327
+ uint16_t epoch = 0;
3328
+ bool is_ccs = false;
3329
+ // acked tracks which bits of the message have been ACKed by the peer. If
3330
+ // |msg_len| is zero, it tracks one bit for whether the header has been
3331
+ // received.
3332
+ DTLSMessageBitmap acked;
3068
3333
  };
3069
3334
 
3070
3335
  struct OPENSSL_timeval {
@@ -3072,12 +3337,111 @@ struct OPENSSL_timeval {
3072
3337
  uint32_t tv_usec;
3073
3338
  };
3074
3339
 
3340
+ struct DTLSTimer {
3341
+ public:
3342
+ static constexpr uint64_t kNever = UINT64_MAX;
3343
+
3344
+ // StartMicroseconds schedules the timer to expire the specified number of
3345
+ // microseconds from |now|.
3346
+ void StartMicroseconds(OPENSSL_timeval now, uint64_t microseconds);
3347
+
3348
+ // Stop disables the timer.
3349
+ void Stop();
3350
+
3351
+ // IsExpired returns true if the timer was set and is expired at time |now|.
3352
+ bool IsExpired(OPENSSL_timeval now) const;
3353
+
3354
+ // IsSet returns true if the timer is scheduled or expired, and false if it is
3355
+ // stopped.
3356
+ bool IsSet() const;
3357
+
3358
+ // MicrosecondsRemaining returns the time remaining, in microseconds, at
3359
+ // |now|, or |kNever| if the timer is unset.
3360
+ uint64_t MicrosecondsRemaining(OPENSSL_timeval now) const;
3361
+
3362
+ private:
3363
+ // expire_time_ is the time when the timer expires, or zero if the timer is
3364
+ // unset.
3365
+ //
3366
+ // TODO(crbug.com/366284846): This is an extremely inconvenient time
3367
+ // representation. Switch libssl to something like a 64-bit count of
3368
+ // microseconds. While it's decidedly past 1970 now, zero is a less obviously
3369
+ // sound distinguished value for the monotonic clock, so maybe we should use a
3370
+ // different distinguished time, like |INT64_MAX| in the microseconds
3371
+ // representation.
3372
+ OPENSSL_timeval expire_time_ = {0, 0};
3373
+ };
3374
+
3375
+ // DTLS_MAX_EXTRA_WRITE_EPOCHS is the maximum number of additional write epochs
3376
+ // that DTLS may need to retain.
3377
+ //
3378
+ // The maximum is, as a DTLS 1.3 server, immediately after sending Finished. At
3379
+ // this point, the current epoch is the application write keys (epoch 3), but we
3380
+ // may have ServerHello (epoch 0) and EncryptedExtensions (epoch 1) to
3381
+ // retransmit. KeyUpdate does not increase this count. If the server were to
3382
+ // initiate KeyUpdate from this state, it would not apply the new epoch until
3383
+ // the client's ACKs have caught up. At that point, epochs 0 and 1 can be
3384
+ // discarded.
3385
+ #define DTLS_MAX_EXTRA_WRITE_EPOCHS 2
3386
+
3387
+ // DTLS_MAX_ACK_BUFFER is the maximum number of records worth of data we'll keep
3388
+ // track of with DTLS 1.3 ACKs. When we exceed this value, information about
3389
+ // stale records will be dropped. This will not break the connection but may
3390
+ // cause ACKs to perform worse and retransmit unnecessary information.
3391
+ #define DTLS_MAX_ACK_BUFFER 32
3392
+
3393
+ // A DTLSSentRecord records information about a record we sent. Each record
3394
+ // covers all bytes from |first_msg_start| (inclusive) of |first_msg| to
3395
+ // |last_msg_end| (exclusive) of |last_msg|. Messages are referenced by index
3396
+ // into |outgoing_messages|. |last_msg_end| may be |outgoing_messages.size()| if
3397
+ // |last_msg_end| is zero.
3398
+ //
3399
+ // When the message is empty, |first_msg_start| and |last_msg_end| are
3400
+ // maintained as if there is a single bit in the message representing the
3401
+ // header. See |acked| in DTLSOutgoingMessage.
3402
+ struct DTLSSentRecord {
3403
+ DTLSRecordNumber number;
3404
+ PackedSize<SSL_MAX_HANDSHAKE_FLIGHT> first_msg = 0;
3405
+ PackedSize<SSL_MAX_HANDSHAKE_FLIGHT> last_msg = 0;
3406
+ uint32_t first_msg_start = 0;
3407
+ uint32_t last_msg_end = 0;
3408
+ };
3409
+
3410
+ enum class QueuedKeyUpdate {
3411
+ kNone,
3412
+ kUpdateNotRequested,
3413
+ kUpdateRequested,
3414
+ };
3415
+
3416
+ // DTLS_PREV_READ_EPOCH_EXPIRE_SECONDS is how long to retain the previous read
3417
+ // epoch in DTLS 1.3. This value is set based on the following:
3418
+ //
3419
+ // - Section 4.2.1 of RFC 9147 recommends retaining past read epochs for the
3420
+ // default TCP MSL. This accommodates packet reordering with KeyUpdate.
3421
+ //
3422
+ // - Section 5.8.1 of RFC 9147 requires being capable of ACKing the client's
3423
+ // final flight for at least twice the default MSL. That requires retaining
3424
+ // epoch 2 after the handshake.
3425
+ //
3426
+ // - Section 4 of RFC 9293 defines the MSL to be two minutes.
3427
+ #define DTLS_PREV_READ_EPOCH_EXPIRE_SECONDS (4 * 60)
3428
+
3429
+ struct DTLSPrevReadEpoch {
3430
+ static constexpr bool kAllowUniquePtr = true;
3431
+ DTLSReadEpoch epoch;
3432
+ // expire is the expiration time of the read epoch, expressed as a POSIX
3433
+ // timestamp in seconds.
3434
+ uint64_t expire;
3435
+ };
3436
+
3075
3437
  struct DTLS1_STATE {
3076
3438
  static constexpr bool kAllowUniquePtr = true;
3077
3439
 
3078
3440
  DTLS1_STATE();
3079
3441
  ~DTLS1_STATE();
3080
3442
 
3443
+ bool Init();
3444
+
3081
3445
  // has_change_cipher_spec is true if we have received a ChangeCipherSpec from
3082
3446
  // the peer in this epoch.
3083
3447
  bool has_change_cipher_spec : 1;
@@ -3092,36 +3456,63 @@ struct DTLS1_STATE {
3092
3456
  // peer sent the final flight.
3093
3457
  bool flight_has_reply : 1;
3094
3458
 
3095
- // The current data and handshake epoch. This is initially undefined, and
3096
- // starts at zero once the initial handshake is completed.
3097
- uint16_t r_epoch = 0;
3098
- uint16_t w_epoch = 0;
3459
+ // handshake_write_overflow and handshake_read_overflow are true if
3460
+ // handshake_write_seq and handshake_read_seq, respectively have overflowed.
3461
+ bool handshake_write_overflow : 1;
3462
+ bool handshake_read_overflow : 1;
3099
3463
 
3100
- // records being received in the current epoch
3101
- DTLS1_BITMAP bitmap;
3464
+ // sending_flight and sending_ack are true if we are in the process of sending
3465
+ // a handshake flight and ACK, respectively.
3466
+ bool sending_flight : 1;
3467
+ bool sending_ack : 1;
3468
+
3469
+ // queued_key_update, if not kNone, indicates we've queued a KeyUpdate message
3470
+ // to send after the current flight is ACKed.
3471
+ QueuedKeyUpdate queued_key_update : 2;
3102
3472
 
3103
3473
  uint16_t handshake_write_seq = 0;
3104
3474
  uint16_t handshake_read_seq = 0;
3105
3475
 
3106
- // save last sequence number for retransmissions
3107
- uint64_t last_write_sequence = 0;
3108
- UniquePtr<SSLAEADContext> last_aead_write_ctx;
3476
+ // read_epoch is the current read epoch.
3477
+ DTLSReadEpoch read_epoch;
3478
+
3479
+ // next_read_epoch is the next read epoch in DTLS 1.3. It will become
3480
+ // current once a record is received from it.
3481
+ UniquePtr<DTLSReadEpoch> next_read_epoch;
3109
3482
 
3483
+ // prev_read_epoch is the previous read epoch in DTLS 1.3.
3484
+ UniquePtr<DTLSPrevReadEpoch> prev_read_epoch;
3110
3485
 
3111
- // In DTLS 1.3, this contains the write AEAD for the initial encryption level.
3112
- // TODO(crbug.com/boringssl/715): Drop this when it is no longer needed.
3113
- UniquePtr<SSLAEADContext> initial_aead_write_ctx;
3486
+ // write_epoch is the current DTLS write epoch. Non-retransmit records will
3487
+ // generally use this epoch.
3488
+ // TODO(crbug.com/381113363): 0-RTT will be the exception, when implemented.
3489
+ DTLSWriteEpoch write_epoch;
3490
+
3491
+ // extra_write_epochs is the collection available write epochs.
3492
+ InplaceVector<UniquePtr<DTLSWriteEpoch>, DTLS_MAX_EXTRA_WRITE_EPOCHS>
3493
+ extra_write_epochs;
3114
3494
 
3115
3495
  // incoming_messages is a ring buffer of incoming handshake messages that have
3116
3496
  // yet to be processed. The front of the ring buffer is message number
3117
3497
  // |handshake_read_seq|, at position |handshake_read_seq| %
3118
3498
  // |SSL_MAX_HANDSHAKE_FLIGHT|.
3119
- UniquePtr<hm_fragment> incoming_messages[SSL_MAX_HANDSHAKE_FLIGHT];
3499
+ UniquePtr<DTLSIncomingMessage> incoming_messages[SSL_MAX_HANDSHAKE_FLIGHT];
3120
3500
 
3121
3501
  // outgoing_messages is the queue of outgoing messages from the last handshake
3122
3502
  // flight.
3123
- DTLS_OUTGOING_MESSAGE outgoing_messages[SSL_MAX_HANDSHAKE_FLIGHT];
3124
- uint8_t outgoing_messages_len = 0;
3503
+ InplaceVector<DTLSOutgoingMessage, SSL_MAX_HANDSHAKE_FLIGHT>
3504
+ outgoing_messages;
3505
+
3506
+ // sent_records is a queue of records we sent, for processing ACKs. To save
3507
+ // memory in the steady state, the structure is stored on the heap and dropped
3508
+ // when empty.
3509
+ UniquePtr<MRUQueue<DTLSSentRecord, DTLS_MAX_ACK_BUFFER>> sent_records;
3510
+
3511
+ // records_to_ack is a queue of received records that we should ACK. This is
3512
+ // not stored on the heap because, in the steady state, DTLS 1.3 does not
3513
+ // necessarily empty this list. (We probably could drop records from here once
3514
+ // they are sufficiently old.)
3515
+ MRUQueue<DTLSRecordNumber, DTLS_MAX_ACK_BUFFER> records_to_ack;
3125
3516
 
3126
3517
  // outgoing_written is the number of outgoing messages that have been
3127
3518
  // written.
@@ -3136,12 +3527,15 @@ struct DTLS1_STATE {
3136
3527
  // the last time it was reset.
3137
3528
  unsigned num_timeouts = 0;
3138
3529
 
3139
- // Indicates when the last handshake msg or heartbeat sent will
3140
- // timeout.
3141
- struct OPENSSL_timeval next_timeout = {0, 0};
3530
+ // retransmit_timer tracks when to schedule the next DTLS retransmit if we do
3531
+ // not hear from the peer.
3532
+ DTLSTimer retransmit_timer;
3533
+
3534
+ // ack_timer tracks when to send an ACK.
3535
+ DTLSTimer ack_timer;
3142
3536
 
3143
3537
  // timeout_duration_ms is the timeout duration in milliseconds.
3144
- unsigned timeout_duration_ms = 0;
3538
+ uint32_t timeout_duration_ms = 0;
3145
3539
  };
3146
3540
 
3147
3541
  // An ALPSConfig is a pair of ALPN protocol and settings value to use with ALPS.
@@ -3207,6 +3601,13 @@ struct SSL_CONFIG {
3207
3601
  // |client_CA|.
3208
3602
  STACK_OF(X509_NAME) *cached_x509_client_CA = nullptr;
3209
3603
 
3604
+ // For client side, keep the list of CA distinguished names we can use
3605
+ // for the Certificate Authorities extension.
3606
+ // TODO(bbe) having this separate from the client side (above) is mildly
3607
+ // silly, but OpenSSL has *_client_CA API's for this exposed, and for the
3608
+ // moment we are not crossing those streams.
3609
+ UniquePtr<STACK_OF(CRYPTO_BUFFER)> CA_names;
3610
+
3210
3611
  Array<uint16_t> supported_group_list; // our list
3211
3612
 
3212
3613
  // channel_id_private is the client's Channel ID private key, or null if
@@ -3219,7 +3620,7 @@ struct SSL_CONFIG {
3219
3620
 
3220
3621
  // alps_configs contains the list of supported protocols to use with ALPS,
3221
3622
  // along with their corresponding ALPS values.
3222
- GrowableArray<ALPSConfig> alps_configs;
3623
+ Vector<ALPSConfig> alps_configs;
3223
3624
 
3224
3625
  // Contains the QUIC transport params that this endpoint will send.
3225
3626
  Array<uint8_t> quic_transport_params;
@@ -3239,9 +3640,9 @@ struct SSL_CONFIG {
3239
3640
  // structure for the client to use when negotiating ECH.
3240
3641
  Array<uint8_t> client_ech_config_list;
3241
3642
 
3242
- // tls13_cipher_policy limits the set of ciphers that can be selected when
3643
+ // compliance_policy limits the set of ciphers that can be selected when
3243
3644
  // negotiating a TLS 1.3 connection.
3244
- enum ssl_compliance_policy_t tls13_cipher_policy = ssl_compliance_policy_none;
3645
+ enum ssl_compliance_policy_t compliance_policy = ssl_compliance_policy_none;
3245
3646
 
3246
3647
  // verify_mode is a bitmask of |SSL_VERIFY_*| values.
3247
3648
  uint8_t verify_mode = SSL_VERIFY_NONE;
@@ -3304,15 +3705,6 @@ struct SSL_CONFIG {
3304
3705
  // alps_use_new_codepoint if set indicates we use new ALPS extension codepoint
3305
3706
  // to negotiate and convey application settings.
3306
3707
  bool alps_use_new_codepoint : 1;
3307
-
3308
- // check_client_certificate_type indicates whether the client, in TLS 1.2 and
3309
- // below, will check its certificate against the server's requested
3310
- // certificate types.
3311
- bool check_client_certificate_type : 1;
3312
-
3313
- // check_ecdsa_curve indicates whether the server, in TLS 1.2 and below, will
3314
- // check its certificate against the client's supported ECDSA curves.
3315
- bool check_ecdsa_curve : 1;
3316
3708
  };
3317
3709
 
3318
3710
  // From RFC 8446, used in determining PSK modes.
@@ -3330,10 +3722,15 @@ bool ssl_is_key_type_supported(int key_type);
3330
3722
  // counterpart to |privkey|. Otherwise it returns false and pushes a helpful
3331
3723
  // message on the error queue.
3332
3724
  bool ssl_compare_public_and_private_key(const EVP_PKEY *pubkey,
3333
- const EVP_PKEY *privkey);
3725
+ const EVP_PKEY *privkey);
3334
3726
  bool ssl_get_new_session(SSL_HANDSHAKE *hs);
3727
+
3728
+ // ssl_encrypt_ticket encrypt a ticket for |session| and writes the result to
3729
+ // |out|. It returns true on success and false on error. If, on success, nothing
3730
+ // was written to |out|, the caller should skip sending a ticket.
3335
3731
  bool ssl_encrypt_ticket(SSL_HANDSHAKE *hs, CBB *out,
3336
3732
  const SSL_SESSION *session);
3733
+
3337
3734
  bool ssl_ctx_rotate_ticket_encryption_key(SSL_CTX *ctx);
3338
3735
 
3339
3736
  // ssl_session_new returns a newly-allocated blank |SSL_SESSION| or nullptr on
@@ -3354,6 +3751,20 @@ OPENSSL_EXPORT UniquePtr<SSL_SESSION> SSL_SESSION_parse(
3354
3751
  // error.
3355
3752
  OPENSSL_EXPORT bool ssl_session_serialize(const SSL_SESSION *in, CBB *cbb);
3356
3753
 
3754
+ enum class SSLSessionType {
3755
+ // The session is not resumable.
3756
+ kNotResumable,
3757
+ // The session uses a TLS 1.2 session ID.
3758
+ kID,
3759
+ // The session uses a TLS 1.2 ticket.
3760
+ kTicket,
3761
+ // The session uses a TLS 1.3 pre-shared key.
3762
+ kPreSharedKey,
3763
+ };
3764
+
3765
+ // ssl_session_get_type returns the type of |session|.
3766
+ SSLSessionType ssl_session_get_type(const SSL_SESSION *session);
3767
+
3357
3768
  // ssl_session_is_context_valid returns whether |session|'s session ID context
3358
3769
  // matches the one set on |hs|.
3359
3770
  bool ssl_session_is_context_valid(const SSL_HANDSHAKE *hs,
@@ -3438,13 +3849,15 @@ bool tls_init_message(const SSL *ssl, CBB *cbb, CBB *body, uint8_t type);
3438
3849
  bool tls_finish_message(const SSL *ssl, CBB *cbb, Array<uint8_t> *out_msg);
3439
3850
  bool tls_add_message(SSL *ssl, Array<uint8_t> msg);
3440
3851
  bool tls_add_change_cipher_spec(SSL *ssl);
3441
- int tls_flush_flight(SSL *ssl);
3852
+ int tls_flush(SSL *ssl);
3442
3853
 
3443
3854
  bool dtls1_init_message(const SSL *ssl, CBB *cbb, CBB *body, uint8_t type);
3444
3855
  bool dtls1_finish_message(const SSL *ssl, CBB *cbb, Array<uint8_t> *out_msg);
3445
3856
  bool dtls1_add_message(SSL *ssl, Array<uint8_t> msg);
3446
3857
  bool dtls1_add_change_cipher_spec(SSL *ssl);
3447
- int dtls1_flush_flight(SSL *ssl);
3858
+ void dtls1_finish_flight(SSL *ssl);
3859
+ void dtls1_schedule_ack(SSL *ssl);
3860
+ int dtls1_flush(SSL *ssl);
3448
3861
 
3449
3862
  // ssl_add_message_cbb finishes the handshake message in |cbb| and adds it to
3450
3863
  // the pending flight. It returns true on success and false on error.
@@ -3454,6 +3867,9 @@ bool ssl_add_message_cbb(SSL *ssl, CBB *cbb);
3454
3867
  // on success and false on allocation failure.
3455
3868
  bool ssl_hash_message(SSL_HANDSHAKE *hs, const SSLMessage &msg);
3456
3869
 
3870
+ ssl_open_record_t dtls1_process_ack(SSL *ssl, uint8_t *out_alert,
3871
+ DTLSRecordNumber ack_record_number,
3872
+ Span<const uint8_t> data);
3457
3873
  ssl_open_record_t dtls1_open_app_data(SSL *ssl, Span<uint8_t> *out,
3458
3874
  size_t *out_consumed, uint8_t *out_alert,
3459
3875
  Span<uint8_t> in);
@@ -3469,19 +3885,27 @@ int dtls1_write_app_data(SSL *ssl, bool *out_needs_handshake,
3469
3885
  int dtls1_write_record(SSL *ssl, int type, Span<const uint8_t> in,
3470
3886
  uint16_t epoch);
3471
3887
 
3472
- int dtls1_retransmit_outgoing_messages(SSL *ssl);
3473
3888
  bool dtls1_parse_fragment(CBS *cbs, struct hm_header_st *out_hdr,
3474
3889
  CBS *out_body);
3475
- bool dtls1_check_timeout_num(SSL *ssl);
3476
3890
 
3477
- void dtls1_start_timer(SSL *ssl);
3891
+ // DTLS1_MTU_TIMEOUTS is the maximum number of retransmit timeouts to expire
3892
+ // before starting to decrease the MTU.
3893
+ #define DTLS1_MTU_TIMEOUTS 2
3894
+
3895
+ // DTLS1_MAX_TIMEOUTS is the maximum number of retransmit timeouts to expire
3896
+ // before failing the DTLS handshake.
3897
+ #define DTLS1_MAX_TIMEOUTS 12
3898
+
3478
3899
  void dtls1_stop_timer(SSL *ssl);
3479
- bool dtls1_is_timer_expired(SSL *ssl);
3900
+
3480
3901
  unsigned int dtls1_min_mtu(void);
3481
3902
 
3482
3903
  bool dtls1_new(SSL *ssl);
3483
3904
  void dtls1_free(SSL *ssl);
3484
3905
 
3906
+ bool dtls1_process_handshake_fragments(SSL *ssl, uint8_t *out_alert,
3907
+ DTLSRecordNumber record_number,
3908
+ Span<const uint8_t> record);
3485
3909
  bool dtls1_get_message(const SSL *ssl, SSLMessage *out);
3486
3910
  ssl_open_record_t dtls1_open_handshake(SSL *ssl, size_t *out_consumed,
3487
3911
  uint8_t *out_alert, Span<uint8_t> in);
@@ -3500,8 +3924,11 @@ bool tls1_configure_aead(SSL *ssl, evp_aead_direction_t direction,
3500
3924
 
3501
3925
  bool tls1_change_cipher_state(SSL_HANDSHAKE *hs,
3502
3926
  evp_aead_direction_t direction);
3503
- int tls1_generate_master_secret(SSL_HANDSHAKE *hs, uint8_t *out,
3504
- Span<const uint8_t> premaster);
3927
+
3928
+ // tls1_generate_master_secret computes the master secret from |premaster| and
3929
+ // writes it to |out|. |out| must have size |SSL3_MASTER_SECRET_SIZE|.
3930
+ bool tls1_generate_master_secret(SSL_HANDSHAKE *hs, Span<uint8_t> out,
3931
+ Span<const uint8_t> premaster);
3505
3932
 
3506
3933
  // tls1_get_grouplist returns the locally-configured group preference list.
3507
3934
  Span<const uint16_t> tls1_get_grouplist(const SSL_HANDSHAKE *ssl);
@@ -3580,9 +4007,7 @@ bool ssl_can_write(const SSL *ssl);
3580
4007
  // ssl_can_read returns wheter |ssl| is allowed to read.
3581
4008
  bool ssl_can_read(const SSL *ssl);
3582
4009
 
3583
- void ssl_get_current_time(const SSL *ssl, struct OPENSSL_timeval *out_clock);
3584
- void ssl_ctx_get_current_time(const SSL_CTX *ctx,
3585
- struct OPENSSL_timeval *out_clock);
4010
+ OPENSSL_timeval ssl_ctx_get_current_time(const SSL_CTX *ctx);
3586
4011
 
3587
4012
  // ssl_reset_error_state resets state for |SSL_get_error|.
3588
4013
  void ssl_reset_error_state(SSL *ssl);
@@ -3713,6 +4138,8 @@ struct ssl_ctx_st : public bssl::RefCounted<ssl_ctx_st> {
3713
4138
  // |client_CA|.
3714
4139
  STACK_OF(X509_NAME) *cached_x509_client_CA = nullptr;
3715
4140
 
4141
+ // What we put in client hello in the CA extension.
4142
+ bssl::UniquePtr<STACK_OF(CRYPTO_BUFFER)> CA_names;
3716
4143
 
3717
4144
  // Default values to use in SSL structures follow (these are copied by
3718
4145
  // SSL_new)
@@ -3822,7 +4249,7 @@ struct ssl_ctx_st : public bssl::RefCounted<ssl_ctx_st> {
3822
4249
  bssl::UniquePtr<STACK_OF(SRTP_PROTECTION_PROFILE)> srtp_profiles;
3823
4250
 
3824
4251
  // Defined compression algorithms for certificates.
3825
- bssl::GrowableArray<bssl::CertCompressionAlg> cert_compression_algs;
4252
+ bssl::Vector<bssl::CertCompressionAlg> cert_compression_algs;
3826
4253
 
3827
4254
  // Supported group values inherited by SSL structure
3828
4255
  bssl::Array<uint16_t> supported_group_list;
@@ -3858,9 +4285,9 @@ struct ssl_ctx_st : public bssl::RefCounted<ssl_ctx_st> {
3858
4285
  int (*legacy_ocsp_callback)(SSL *ssl, void *arg) = nullptr;
3859
4286
  void *legacy_ocsp_callback_arg = nullptr;
3860
4287
 
3861
- // tls13_cipher_policy limits the set of ciphers that can be selected when
4288
+ // compliance_policy limits the set of ciphers that can be selected when
3862
4289
  // negotiating a TLS 1.3 connection.
3863
- enum ssl_compliance_policy_t tls13_cipher_policy = ssl_compliance_policy_none;
4290
+ enum ssl_compliance_policy_t compliance_policy = ssl_compliance_policy_none;
3864
4291
 
3865
4292
  // verify_sigalgs, if not empty, is the set of signature algorithms
3866
4293
  // accepted from the peer in decreasing order of preference.
@@ -3939,9 +4366,6 @@ struct ssl_st {
3939
4366
  // that instead, and skip the null check.)
3940
4367
  bssl::UniquePtr<bssl::SSL_CONFIG> config;
3941
4368
 
3942
- // version is the protocol version.
3943
- uint16_t version = 0;
3944
-
3945
4369
  uint16_t max_send_fragment = 0;
3946
4370
 
3947
4371
  // There are 2 BIO's even though they are normally both the same. This is so
@@ -3967,11 +4391,9 @@ struct ssl_st {
3967
4391
  // session info
3968
4392
 
3969
4393
  // initial_timeout_duration_ms is the default DTLS timeout duration in
3970
- // milliseconds. It's used to initialize the timer any time it's restarted.
3971
- //
3972
- // RFC 6347 states that implementations SHOULD use an initial timer value of 1
3973
- // second.
3974
- unsigned initial_timeout_duration_ms = 1000;
4394
+ // milliseconds. It's used to initialize the timer any time it's restarted. We
4395
+ // default to RFC 9147's recommendation for real-time applications, 400ms.
4396
+ uint32_t initial_timeout_duration_ms = 400;
3975
4397
 
3976
4398
  // session is the configured session to be offered by the client. This session
3977
4399
  // is immutable.
@@ -4032,17 +4454,14 @@ struct ssl_session_st : public bssl::RefCounted<ssl_session_st> {
4032
4454
  // session. In TLS 1.3 and up, it is the resumption PSK for sessions handed to
4033
4455
  // the caller, but it stores the resumption secret when stored on |SSL|
4034
4456
  // objects.
4035
- uint8_t secret_length = 0;
4036
- uint8_t secret[SSL_MAX_MASTER_KEY_LENGTH] = {0};
4457
+ bssl::InplaceVector<uint8_t, SSL_MAX_MASTER_KEY_LENGTH> secret;
4458
+
4459
+ bssl::InplaceVector<uint8_t, SSL_MAX_SSL_SESSION_ID_LENGTH> session_id;
4037
4460
 
4038
- // session_id - valid?
4039
- uint8_t session_id_length = 0;
4040
- uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH] = {0};
4041
4461
  // this is used to determine whether the session is being reused in
4042
4462
  // the appropriate context. It is up to the application to set this,
4043
4463
  // via SSL_new
4044
- uint8_t sid_ctx_length = 0;
4045
- uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH] = {0};
4464
+ bssl::InplaceVector<uint8_t, SSL_MAX_SID_CTX_LENGTH> sid_ctx;
4046
4465
 
4047
4466
  bssl::UniquePtr<char> psk_identity;
4048
4467
 
@@ -4105,8 +4524,7 @@ struct ssl_session_st : public bssl::RefCounted<ssl_session_st> {
4105
4524
  // original_handshake_hash contains the handshake hash (either SHA-1+MD5 or
4106
4525
  // SHA-2, depending on TLS version) for the original, full handshake that
4107
4526
  // created a session. This is used by Channel IDs during resumption.
4108
- uint8_t original_handshake_hash[EVP_MAX_MD_SIZE] = {0};
4109
- uint8_t original_handshake_hash_len = 0;
4527
+ bssl::InplaceVector<uint8_t, EVP_MAX_MD_SIZE> original_handshake_hash;
4110
4528
 
4111
4529
  uint32_t ticket_lifetime_hint = 0; // Session lifetime hint in seconds
4112
4530
 
@@ -4166,7 +4584,7 @@ struct ssl_session_st : public bssl::RefCounted<ssl_session_st> {
4166
4584
  struct ssl_ech_keys_st : public bssl::RefCounted<ssl_ech_keys_st> {
4167
4585
  ssl_ech_keys_st() : RefCounted(CheckSubClass()) {}
4168
4586
 
4169
- bssl::GrowableArray<bssl::UniquePtr<bssl::ECHServerConfig>> configs;
4587
+ bssl::Vector<bssl::UniquePtr<bssl::ECHServerConfig>> configs;
4170
4588
 
4171
4589
  private:
4172
4590
  friend RefCounted;