grpc 1.69.0 → 1.70.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (640) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +251 -249
  3. data/include/grpc/support/atm.h +0 -13
  4. data/src/core/call/request_buffer.cc +224 -0
  5. data/src/core/call/request_buffer.h +192 -0
  6. data/src/core/client_channel/client_channel.cc +2 -3
  7. data/src/core/client_channel/client_channel_args.h +21 -0
  8. data/src/core/client_channel/client_channel_filter.h +1 -3
  9. data/src/core/client_channel/retry_interceptor.cc +406 -0
  10. data/src/core/client_channel/retry_interceptor.h +157 -0
  11. data/src/core/client_channel/retry_service_config.h +13 -0
  12. data/src/core/client_channel/retry_throttle.cc +33 -18
  13. data/src/core/client_channel/retry_throttle.h +3 -3
  14. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +596 -94
  15. data/src/core/ext/transport/chttp2/server/chttp2_server.h +189 -13
  16. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +1 -0
  17. data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -3
  18. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +40 -1
  19. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb.h +3 -1
  20. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +66 -36
  21. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +19 -17
  22. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +116 -0
  23. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +31 -5
  24. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +2 -0
  25. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +67 -6
  26. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +12 -8
  27. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb.h +151 -0
  28. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.c +60 -0
  29. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.h +32 -0
  30. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +228 -21
  31. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +65 -17
  32. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.h +6 -0
  33. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb.h +7 -106
  34. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.c +7 -28
  35. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.h +0 -2
  36. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +85 -0
  37. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +25 -3
  38. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
  39. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +152 -0
  40. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +40 -10
  41. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.h +2 -0
  42. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +135 -4
  43. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +41 -9
  44. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +2 -0
  45. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb.h +0 -2
  46. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.c +0 -1
  47. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.h +0 -1
  48. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +16 -0
  49. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +3 -2
  50. 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
  51. 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
  52. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +0 -1
  53. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +0 -1
  54. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +102 -24
  55. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.c +28 -19
  56. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb.h +251 -18
  57. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c +41 -16
  58. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.h +2 -0
  59. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb.h +2 -1
  60. data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump_shared.upbdefs.c +11 -10
  61. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +418 -413
  62. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +161 -153
  63. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
  64. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +267 -261
  65. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.c +46 -0
  66. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.h +33 -0
  67. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +29 -19
  68. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.h +15 -0
  69. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.c +58 -65
  70. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.h +0 -5
  71. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +73 -63
  72. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +49 -48
  73. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +117 -100
  74. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.h +5 -0
  75. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +905 -897
  76. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +5 -0
  77. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/trace.upbdefs.c +15 -18
  78. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +460 -457
  79. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +16 -19
  80. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +95 -95
  81. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +202 -191
  82. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.c +148 -135
  83. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
  84. data/src/core/ext/upbdefs-gen/envoy/service/status/v3/csds.upbdefs.c +23 -22
  85. data/src/core/filter/filter_args.h +112 -0
  86. data/src/core/handshaker/http_connect/http_connect_handshaker.cc +1 -1
  87. data/src/core/lib/channel/promise_based_filter.h +5 -79
  88. data/src/core/lib/debug/trace_flags.cc +2 -0
  89. data/src/core/lib/debug/trace_flags.h +1 -0
  90. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +14 -0
  91. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +7 -2
  92. data/src/core/lib/event_engine/posix_engine/posix_engine.h +0 -2
  93. data/src/core/lib/event_engine/windows/windows_engine.cc +1 -0
  94. data/src/core/lib/experiments/experiments.cc +90 -39
  95. data/src/core/lib/experiments/experiments.h +43 -24
  96. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -1
  97. data/src/core/lib/promise/activity.cc +2 -0
  98. data/src/core/lib/promise/activity.h +29 -8
  99. data/src/core/lib/promise/map.h +42 -0
  100. data/src/core/lib/promise/party.cc +36 -1
  101. data/src/core/lib/promise/party.h +13 -5
  102. data/src/core/lib/promise/sleep.h +1 -0
  103. data/src/core/lib/promise/status_flag.h +10 -0
  104. data/src/core/lib/resource_quota/arena.h +8 -0
  105. data/src/core/lib/resource_quota/connection_quota.h +4 -0
  106. data/src/core/lib/surface/call_utils.h +2 -0
  107. data/src/core/lib/surface/client_call.cc +43 -35
  108. data/src/core/lib/surface/client_call.h +5 -0
  109. data/src/core/lib/surface/event_string.cc +7 -1
  110. data/src/core/lib/surface/init_internally.h +13 -2
  111. data/src/core/lib/surface/server_call.cc +100 -85
  112. data/src/core/lib/surface/version.cc +2 -2
  113. data/src/core/lib/transport/call_filters.cc +10 -4
  114. data/src/core/lib/transport/call_filters.h +8 -0
  115. data/src/core/lib/transport/call_spine.cc +36 -71
  116. data/src/core/lib/transport/call_spine.h +131 -7
  117. data/src/core/lib/transport/call_state.h +132 -39
  118. data/src/core/lib/transport/interception_chain.cc +8 -0
  119. data/src/core/lib/transport/interception_chain.h +9 -0
  120. data/src/core/load_balancing/endpoint_list.cc +10 -0
  121. data/src/core/load_balancing/endpoint_list.h +13 -6
  122. data/src/core/load_balancing/lb_policy.h +0 -8
  123. data/src/core/load_balancing/pick_first/pick_first.cc +89 -56
  124. data/src/core/load_balancing/ring_hash/ring_hash.cc +158 -70
  125. data/src/core/load_balancing/ring_hash/ring_hash.h +4 -11
  126. data/src/core/load_balancing/round_robin/round_robin.cc +9 -14
  127. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +12 -15
  128. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +4 -4
  129. data/src/core/resolver/xds/xds_dependency_manager.cc +139 -135
  130. data/src/core/resolver/xds/xds_dependency_manager.h +24 -18
  131. data/src/core/resolver/xds/xds_resolver.cc +28 -47
  132. data/src/core/server/server.cc +290 -24
  133. data/src/core/server/server.h +199 -61
  134. data/src/core/server/xds_server_config_fetcher.cc +78 -142
  135. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  136. data/src/core/util/backoff.cc +15 -4
  137. data/src/core/util/http_client/httpcli.cc +66 -18
  138. data/src/core/util/http_client/httpcli.h +14 -4
  139. data/src/core/util/matchers.h +5 -10
  140. data/src/core/util/ref_counted.h +1 -0
  141. data/src/core/util/ref_counted_ptr.h +1 -1
  142. data/src/core/util/useful.h +9 -11
  143. data/src/core/xds/grpc/xds_endpoint_parser.cc +54 -23
  144. data/src/core/xds/grpc/xds_metadata.h +8 -0
  145. data/src/core/xds/xds_client/xds_api.cc +0 -223
  146. data/src/core/xds/xds_client/xds_api.h +1 -133
  147. data/src/core/xds/xds_client/xds_client.cc +599 -466
  148. data/src/core/xds/xds_client/xds_client.h +107 -26
  149. data/src/core/xds/xds_client/xds_resource_type_impl.h +10 -5
  150. data/src/ruby/ext/grpc/extconf.rb +1 -0
  151. data/src/ruby/lib/grpc/version.rb +1 -1
  152. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_bitstr.c → a_bitstr.cc} +3 -2
  153. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_d2i_fp.c → a_d2i_fp.cc} +1 -1
  154. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_dup.c → a_dup.cc} +1 -1
  155. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_i2d_fp.c → a_i2d_fp.cc} +1 -1
  156. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_int.c → a_int.cc} +2 -1
  157. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_mbstr.c → a_mbstr.cc} +9 -7
  158. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_object.c → a_object.cc} +1 -1
  159. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strnid.c → a_strnid.cc} +7 -4
  160. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_type.c → a_type.cc} +4 -4
  161. data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_lib.c → asn1_lib.cc} +4 -4
  162. data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn_pack.c → asn_pack.cc} +2 -2
  163. data/third_party/boringssl-with-bazel/src/crypto/asn1/{posix_time.c → posix_time.cc} +2 -2
  164. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_dec.c → tasn_dec.cc} +4 -3
  165. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_enc.c → tasn_enc.cc} +9 -6
  166. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_fre.c → tasn_fre.cc} +14 -20
  167. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_new.c → tasn_new.cc} +7 -6
  168. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_utl.c → tasn_utl.cc} +13 -10
  169. data/third_party/boringssl-with-bazel/src/crypto/base64/{base64.c → base64.cc} +9 -12
  170. data/third_party/boringssl-with-bazel/src/crypto/bcm_support.h +7 -1
  171. data/third_party/boringssl-with-bazel/src/crypto/bio/{bio.c → bio.cc} +32 -58
  172. data/third_party/boringssl-with-bazel/src/crypto/bio/{bio_mem.c → bio_mem.cc} +8 -7
  173. data/third_party/boringssl-with-bazel/src/crypto/bio/{connect.c → connect.cc} +24 -16
  174. data/third_party/boringssl-with-bazel/src/crypto/bio/{file.c → file.cc} +3 -3
  175. data/third_party/boringssl-with-bazel/src/crypto/bio/{pair.c → pair.cc} +22 -20
  176. data/third_party/boringssl-with-bazel/src/crypto/bio/{printf.c → printf.cc} +2 -2
  177. data/third_party/boringssl-with-bazel/src/crypto/bio/{socket_helper.c → socket_helper.cc} +1 -1
  178. data/third_party/boringssl-with-bazel/src/crypto/blake2/{blake2.c → blake2.cc} +2 -2
  179. data/third_party/boringssl-with-bazel/src/crypto/bn_extra/{bn_asn1.c → bn_asn1.cc} +1 -1
  180. data/third_party/boringssl-with-bazel/src/crypto/bn_extra/{convert.c → convert.cc} +21 -21
  181. data/third_party/boringssl-with-bazel/src/crypto/buf/{buf.c → buf.cc} +6 -3
  182. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{asn1_compat.c → asn1_compat.cc} +1 -1
  183. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{ber.c → ber.cc} +1 -1
  184. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbb.c → cbb.cc} +33 -49
  185. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbs.c → cbs.cc} +20 -27
  186. data/third_party/boringssl-with-bazel/src/crypto/bytestring/internal.h +1 -1
  187. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{unicode.c → unicode.cc} +1 -1
  188. data/third_party/boringssl-with-bazel/src/crypto/chacha/{chacha.c → chacha.cc} +1 -1
  189. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +1 -1
  190. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_aesctrhmac.c → e_aesctrhmac.cc} +1 -1
  191. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_aesgcmsiv.c → e_aesgcmsiv.cc} +23 -26
  192. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_chacha20poly1305.c → e_chacha20poly1305.cc} +1 -8
  193. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_des.c → e_des.cc} +61 -49
  194. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_null.c → e_null.cc} +12 -9
  195. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_rc2.c → e_rc2.cc} +23 -19
  196. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_rc4.c → e_rc4.cc} +10 -8
  197. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_tls.c → e_tls.cc} +2 -1
  198. data/third_party/boringssl-with-bazel/src/crypto/conf/{conf.c → conf.cc} +17 -14
  199. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +1 -1
  200. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_apple.c → cpu_aarch64_apple.cc} +2 -2
  201. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_fuchsia.c → cpu_aarch64_fuchsia.cc} +2 -2
  202. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_linux.c → cpu_aarch64_linux.cc} +2 -2
  203. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_openbsd.c → cpu_aarch64_openbsd.cc} +4 -4
  204. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_sysreg.c → cpu_aarch64_sysreg.cc} +3 -2
  205. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_win.c → cpu_aarch64_win.cc} +2 -2
  206. data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_freebsd.c → cpu_arm_freebsd.cc} +3 -3
  207. data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_linux.c → cpu_arm_linux.cc} +5 -5
  208. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.h +1 -1
  209. data/third_party/boringssl-with-bazel/src/crypto/{cpu_intel.c → cpu_intel.cc} +47 -32
  210. data/third_party/boringssl-with-bazel/src/crypto/{crypto.c → crypto.cc} +6 -11
  211. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{curve25519.c → curve25519.cc} +28 -31
  212. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{curve25519_64_adx.c → curve25519_64_adx.cc} +1 -1
  213. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +1 -1
  214. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
  215. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{spake25519.c → spake25519.cc} +20 -16
  216. data/third_party/boringssl-with-bazel/src/crypto/dh_extra/{dh_asn1.c → dh_asn1.cc} +2 -2
  217. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/{digest_extra.c → digest_extra.cc} +113 -31
  218. data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa.c → dsa.cc} +153 -154
  219. data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa_asn1.c → dsa_asn1.cc} +2 -2
  220. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +1 -3
  221. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{ec_asn1.c → ec_asn1.cc} +35 -0
  222. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{ec_derive.c → ec_derive.cc} +1 -1
  223. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{hash_to_curve.c → hash_to_curve.cc} +66 -64
  224. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +1 -1
  225. data/third_party/boringssl-with-bazel/src/crypto/ecdsa_extra/{ecdsa_asn1.c → ecdsa_asn1.cc} +15 -25
  226. data/third_party/boringssl-with-bazel/src/crypto/engine/{engine.c → engine.cc} +12 -8
  227. data/third_party/boringssl-with-bazel/src/crypto/err/{err.c → err.cc} +24 -27
  228. data/third_party/boringssl-with-bazel/src/crypto/err/internal.h +1 -1
  229. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp.c → evp.cc} +8 -9
  230. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_ctx.c → evp_ctx.cc} +7 -8
  231. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh.c → p_dh.cc} +23 -14
  232. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh_asn1.c → p_dh_asn1.cc} +38 -21
  233. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dsa_asn1.c → p_dsa_asn1.cc} +19 -24
  234. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec.c → p_ec.cc} +20 -23
  235. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec_asn1.c → p_ec_asn1.cc} +20 -20
  236. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519.c → p_ed25519.cc} +22 -19
  237. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519_asn1.c → p_ed25519_asn1.cc} +14 -13
  238. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_hkdf.c → p_hkdf.cc} +18 -14
  239. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa.c → p_rsa.cc} +38 -37
  240. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa_asn1.c → p_rsa_asn1.cc} +16 -18
  241. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519.c → p_x25519.cc} +22 -19
  242. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519_asn1.c → p_x25519_asn1.cc} +18 -17
  243. data/third_party/boringssl-with-bazel/src/crypto/evp/{pbkdf.c → pbkdf.cc} +2 -2
  244. data/third_party/boringssl-with-bazel/src/crypto/evp/{print.c → print.cc} +4 -5
  245. data/third_party/boringssl-with-bazel/src/crypto/evp/{scrypt.c → scrypt.cc} +7 -5
  246. data/third_party/boringssl-with-bazel/src/crypto/{ex_data.c → ex_data.cc} +3 -4
  247. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes_nohw.c.inc → aes_nohw.cc.inc} +1 -1
  248. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +1 -5
  249. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{key_wrap.c.inc → key_wrap.cc.inc} +1 -1
  250. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{bcm.c → bcm.cc} +96 -101
  251. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm_interface.h +165 -12
  252. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{add.c.inc → add.cc.inc} +1 -0
  253. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/asm/{x86_64-gcc.c.inc → x86_64-gcc.cc.inc} +4 -4
  254. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bn.c.inc → bn.cc.inc} +12 -24
  255. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{ctx.c.inc → ctx.cc.inc} +5 -7
  256. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div.c.inc → div.cc.inc} +29 -38
  257. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div_extra.c.inc → div_extra.cc.inc} +1 -1
  258. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{exponentiation.c.inc → exponentiation.cc.inc} +22 -22
  259. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd.c.inc → gcd.cc.inc} +3 -6
  260. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd_extra.c.inc → gcd_extra.cc.inc} +33 -25
  261. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery.c.inc → montgomery.cc.inc} +10 -17
  262. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{mul.c.inc → mul.cc.inc} +11 -15
  263. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{prime.c.inc → prime.cc.inc} +31 -34
  264. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{shift.c.inc → shift.cc.inc} +3 -4
  265. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{aead.c.inc → aead.cc.inc} +18 -10
  266. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{cipher.c.inc → cipher.cc.inc} +6 -9
  267. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aes.c.inc → e_aes.cc.inc} +46 -54
  268. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cmac/{cmac.c.inc → cmac.cc.inc} +6 -6
  269. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +14 -10
  270. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{dh.c.inc → dh.cc.inc} +15 -19
  271. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +1 -3
  272. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digest.c.inc → digest.cc.inc} +17 -13
  273. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digests.c.inc → digests.cc.inc} +29 -113
  274. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digestsign/{digestsign.c.inc → digestsign.cc.inc} +3 -3
  275. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +1 -1
  276. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec.c.inc → ec.cc.inc} +10 -15
  277. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_key.c.inc → ec_key.cc.inc} +12 -14
  278. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{felem.c.inc → felem.cc.inc} +1 -1
  279. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{oct.c.inc → oct.cc.inc} +5 -6
  280. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p224-64.c.inc → p224-64.cc.inc} +1 -1
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz-table.h +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256-nistz.c.inc → p256-nistz.cc.inc} +15 -13
  283. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256.c.inc → p256.cc.inc} +1 -1
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +1 -1
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{scalar.c.inc → scalar.cc.inc} +1 -1
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple_mul.c.inc → simple_mul.cc.inc} +1 -1
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{util.c.inc → util.cc.inc} +1 -1
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{wnaf.c.inc → wnaf.cc.inc} +24 -15
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/{ecdh.c.inc → ecdh.cc.inc} +14 -5
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/{ecdsa.c.inc → ecdsa.cc.inc} +6 -7
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +1 -1
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{fips_shared_support.c → fips_shared_support.cc} +2 -3
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/{hkdf.c.inc → hkdf.cc.inc} +1 -1
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hmac/{hmac.c.inc → hmac.cc.inc} +3 -2
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm.c.inc → gcm.cc.inc} +69 -21
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm_nohw.c.inc → gcm_nohw.cc.inc} +1 -1
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +53 -33
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{polyval.c.inc → polyval.cc.inc} +2 -3
  299. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{ctrdrbg.c.inc → ctrdrbg.cc.inc} +5 -4
  300. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -1
  301. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{rand.c.inc → rand.cc.inc} +20 -18
  302. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{blinding.c.inc → blinding.cc.inc} +5 -4
  303. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{padding.c.inc → padding.cc.inc} +21 -21
  304. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa.c.inc → rsa.cc.inc} +77 -73
  305. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa_impl.c.inc → rsa_impl.cc.inc} +50 -53
  306. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{fips.c.inc → fips.cc.inc} +14 -6
  307. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{self_check.c.inc → self_check.cc.inc} +56 -52
  308. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/{service_indicator.c.inc → service_indicator.cc.inc} +10 -11
  309. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/internal.h +2 -4
  310. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha1.c.inc → sha1.cc.inc} +26 -33
  311. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha256.c.inc → sha256.cc.inc} +37 -55
  312. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha512.c.inc → sha512.cc.inc} +48 -76
  313. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +1 -1
  314. data/third_party/boringssl-with-bazel/src/crypto/hpke/{hpke.c → hpke.cc} +7 -4
  315. data/third_party/boringssl-with-bazel/src/crypto/hrss/{hrss.c → hrss.cc} +53 -110
  316. data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +1 -1
  317. data/third_party/boringssl-with-bazel/src/crypto/internal.h +191 -248
  318. data/third_party/boringssl-with-bazel/src/crypto/keccak/internal.h +1 -1
  319. data/third_party/boringssl-with-bazel/src/crypto/keccak/{keccak.c → keccak.cc} +1 -1
  320. data/third_party/boringssl-with-bazel/src/crypto/kyber/internal.h +1 -1
  321. data/third_party/boringssl-with-bazel/src/crypto/kyber/{kyber.c → kyber.cc} +1 -1
  322. data/third_party/boringssl-with-bazel/src/crypto/lhash/{lhash.c → lhash.cc} +8 -7
  323. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md4/md4.c.inc → md4/md4.cc} +8 -12
  324. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md5 → md5}/internal.h +1 -1
  325. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md5/md5.c.inc → md5/md5.cc} +4 -3
  326. data/third_party/boringssl-with-bazel/src/crypto/{mem.c → mem.cc} +34 -22
  327. data/third_party/boringssl-with-bazel/src/crypto/mldsa/internal.h +4 -1
  328. data/third_party/boringssl-with-bazel/src/crypto/mldsa/{mldsa.c → mldsa.cc} +646 -543
  329. data/third_party/boringssl-with-bazel/src/crypto/mlkem/internal.h +1 -1
  330. data/third_party/boringssl-with-bazel/src/crypto/mlkem/mlkem.cc +8 -8
  331. data/third_party/boringssl-with-bazel/src/crypto/obj/{obj.c → obj.cc} +27 -30
  332. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_info.c → pem_info.cc} +2 -2
  333. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_lib.c → pem_lib.cc} +3 -4
  334. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_oth.c → pem_oth.cc} +1 -1
  335. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +1 -1
  336. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7.c → pkcs7.cc} +5 -5
  337. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7_x509.c → pkcs7_x509.cc} +26 -25
  338. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +2 -2
  339. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{p5_pbev2.c → p5_pbev2.cc} +2 -2
  340. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8.c → pkcs8.cc} +159 -158
  341. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8_x509.c → pkcs8_x509.cc} +90 -97
  342. data/third_party/boringssl-with-bazel/src/crypto/poly1305/internal.h +1 -1
  343. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305.c → poly1305.cc} +3 -3
  344. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_arm.c → poly1305_arm.cc} +4 -2
  345. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_vec.c → poly1305_vec.cc} +14 -11
  346. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -1
  347. data/third_party/boringssl-with-bazel/src/crypto/pool/{pool.c → pool.cc} +12 -11
  348. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{deterministic.c → deterministic.cc} +2 -2
  349. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fork_detect.c → fork_detect.cc} +11 -12
  350. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{forkunsafe.c → forkunsafe.cc} +2 -2
  351. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{getentropy.c → getentropy.cc} +1 -1
  352. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getrandom_fillin.h +1 -1
  353. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{ios.c → ios.cc} +1 -1
  354. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{passive.c → passive.cc} +22 -18
  355. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{rand_extra.c → rand_extra.cc} +1 -1
  356. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/sysrand_internal.h +1 -1
  357. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{trusty.c → trusty.cc} +1 -1
  358. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{urandom.c → urandom.cc} +7 -7
  359. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{windows.c → windows.cc} +1 -1
  360. data/third_party/boringssl-with-bazel/src/crypto/{refcount.c → refcount.cc} +1 -1
  361. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_asn1.c → rsa_asn1.cc} +2 -2
  362. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_crypt.c → rsa_crypt.cc} +81 -78
  363. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_extra.cc +17 -0
  364. data/third_party/boringssl-with-bazel/src/crypto/sha/sha1.cc +52 -0
  365. data/third_party/boringssl-with-bazel/src/crypto/sha/sha256.cc +87 -0
  366. data/third_party/boringssl-with-bazel/src/crypto/sha/sha512.cc +104 -0
  367. data/third_party/boringssl-with-bazel/src/crypto/siphash/{siphash.c → siphash.cc} +1 -1
  368. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/address.h +123 -0
  369. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/fors.cc +169 -0
  370. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/fors.h +58 -0
  371. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/internal.h +63 -0
  372. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/merkle.cc +161 -0
  373. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/merkle.h +70 -0
  374. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/params.h +83 -0
  375. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/slhdsa.cc +307 -0
  376. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/thash.cc +173 -0
  377. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/thash.h +85 -0
  378. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/wots.cc +171 -0
  379. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/wots.h +50 -0
  380. data/third_party/boringssl-with-bazel/src/crypto/stack/{stack.c → stack.cc} +10 -6
  381. data/third_party/boringssl-with-bazel/src/crypto/{thread_none.c → thread_none.cc} +1 -1
  382. data/third_party/boringssl-with-bazel/src/crypto/{thread_pthread.c → thread_pthread.cc} +9 -8
  383. data/third_party/boringssl-with-bazel/src/crypto/{thread_win.c → thread_win.cc} +21 -17
  384. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +1 -1
  385. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{pmbtoken.c → pmbtoken.cc} +146 -158
  386. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{trust_token.c → trust_token.cc} +19 -21
  387. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{voprf.c → voprf.cc} +165 -169
  388. data/third_party/boringssl-with-bazel/src/crypto/x509/{a_digest.c → a_digest.cc} +1 -1
  389. data/third_party/boringssl-with-bazel/src/crypto/x509/{a_sign.c → a_sign.cc} +37 -34
  390. data/third_party/boringssl-with-bazel/src/crypto/x509/{a_verify.c → a_verify.cc} +1 -1
  391. data/third_party/boringssl-with-bazel/src/crypto/x509/{algorithm.c → algorithm.cc} +1 -1
  392. data/third_party/boringssl-with-bazel/src/crypto/x509/{asn1_gen.c → asn1_gen.cc} +5 -6
  393. data/third_party/boringssl-with-bazel/src/crypto/x509/{by_dir.c → by_dir.cc} +7 -6
  394. data/third_party/boringssl-with-bazel/src/crypto/x509/{policy.c → policy.cc} +188 -178
  395. data/third_party/boringssl-with-bazel/src/crypto/x509/{rsa_pss.c → rsa_pss.cc} +48 -44
  396. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_akey.c → v3_akey.cc} +4 -2
  397. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_alt.c → v3_alt.cc} +5 -5
  398. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_bcons.c → v3_bcons.cc} +3 -1
  399. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_bitst.c → v3_bitst.cc} +6 -3
  400. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_conf.c → v3_conf.cc} +5 -5
  401. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_cpols.c → v3_cpols.cc} +47 -41
  402. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_crld.c → v3_crld.cc} +3 -2
  403. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_enum.c → v3_enum.cc} +5 -2
  404. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_extku.c → v3_extku.cc} +3 -1
  405. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_genn.c → v3_genn.cc} +7 -7
  406. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ia5.c → v3_ia5.cc} +3 -2
  407. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_info.c → v3_info.cc} +4 -2
  408. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_int.c → v3_int.cc} +3 -1
  409. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_lib.c → v3_lib.cc} +9 -6
  410. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ncons.c → v3_ncons.cc} +3 -3
  411. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ocsp.c → v3_ocsp.cc} +4 -1
  412. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_pcons.c → v3_pcons.cc} +3 -3
  413. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_pmaps.c → v3_pmaps.cc} +3 -3
  414. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_prn.c → v3_prn.cc} +2 -1
  415. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_purp.c → v3_purp.cc} +16 -8
  416. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_skey.c → v3_skey.cc} +6 -3
  417. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_utl.c → v3_utl.cc} +15 -10
  418. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_att.c → x509_att.cc} +3 -2
  419. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_lu.c → x509_lu.cc} +6 -5
  420. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_v3.c → x509_v3.cc} +2 -2
  421. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vfy.c → x509_vfy.cc} +216 -212
  422. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vpm.c → x509_vpm.cc} +55 -13
  423. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509spki.c → x509spki.cc} +3 -3
  424. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_all.c → x_all.cc} +10 -6
  425. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_crl.c → x_crl.cc} +6 -6
  426. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_name.c → x_name.cc} +39 -32
  427. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_pubkey.c → x_pubkey.cc} +4 -2
  428. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509.c → x_x509.cc} +48 -44
  429. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509a.c → x_x509a.cc} +4 -2
  430. data/third_party/boringssl-with-bazel/src/gen/crypto/{err_data.c → err_data.cc} +359 -358
  431. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +1 -1
  432. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +1 -1
  433. data/third_party/boringssl-with-bazel/src/include/openssl/asn1_mac.h +1 -1
  434. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +237 -275
  435. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +12 -5
  436. data/third_party/boringssl-with-bazel/src/include/openssl/bcm_public.h +82 -0
  437. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -1
  438. data/third_party/boringssl-with-bazel/src/include/openssl/buffer.h +1 -1
  439. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +1 -1
  440. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
  441. data/third_party/boringssl-with-bazel/src/include/openssl/cmac.h +1 -1
  442. data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +1 -1
  443. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +13 -2
  444. data/third_party/boringssl-with-bazel/src/include/openssl/ctrdrbg.h +1 -1
  445. data/third_party/boringssl-with-bazel/src/include/openssl/curve25519.h +1 -1
  446. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -0
  447. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +6 -1
  448. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +4 -0
  449. data/third_party/boringssl-with-bazel/src/include/openssl/dtls1.h +1 -1
  450. data/third_party/boringssl-with-bazel/src/include/openssl/e_os2.h +1 -1
  451. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +17 -1
  452. data/third_party/boringssl-with-bazel/src/include/openssl/engine.h +1 -1
  453. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +1 -1
  454. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/kyber.h +1 -1
  455. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +1 -1
  456. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
  457. data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +1 -1
  458. data/third_party/boringssl-with-bazel/src/include/openssl/is_boringssl.h +1 -1
  459. data/third_party/boringssl-with-bazel/src/include/openssl/kdf.h +1 -1
  460. data/third_party/boringssl-with-bazel/src/include/openssl/mldsa.h +8 -8
  461. data/third_party/boringssl-with-bazel/src/include/openssl/mlkem.h +1 -1
  462. data/third_party/boringssl-with-bazel/src/include/openssl/obj_mac.h +1 -1
  463. data/third_party/boringssl-with-bazel/src/include/openssl/objects.h +1 -1
  464. data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +1 -1
  465. data/third_party/boringssl-with-bazel/src/include/openssl/opensslv.h +1 -1
  466. data/third_party/boringssl-with-bazel/src/include/openssl/ossl_typ.h +1 -1
  467. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs12.h +1 -1
  468. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +1 -1
  469. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +2 -2
  470. data/third_party/boringssl-with-bazel/src/include/openssl/poly1305.h +1 -1
  471. data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +1 -1
  472. data/third_party/boringssl-with-bazel/src/include/openssl/posix_time.h +1 -1
  473. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +1 -1
  474. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +10 -5
  475. data/third_party/boringssl-with-bazel/src/include/openssl/safestack.h +1 -1
  476. data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +2 -40
  477. data/third_party/boringssl-with-bazel/src/include/openssl/siphash.h +1 -1
  478. data/third_party/boringssl-with-bazel/src/include/openssl/slhdsa.h +133 -0
  479. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +6 -1
  480. data/third_party/boringssl-with-bazel/src/include/openssl/srtp.h +1 -1
  481. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +160 -116
  482. data/third_party/boringssl-with-bazel/src/include/openssl/ssl3.h +1 -0
  483. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +1 -1
  484. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +2 -2
  485. data/third_party/boringssl-with-bazel/src/include/openssl/time.h +1 -1
  486. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -1
  487. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -1
  488. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +1 -1
  489. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3_errors.h +2 -2
  490. data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +2 -6
  491. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +667 -322
  492. data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +116 -119
  493. data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +163 -21
  494. data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +4 -12
  495. data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +94 -49
  496. data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +296 -198
  497. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +23 -14
  498. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +363 -343
  499. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +48 -58
  500. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +44 -36
  501. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +145 -159
  502. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +65 -58
  503. data/third_party/boringssl-with-bazel/src/ssl/internal.h +910 -356
  504. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +29 -41
  505. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +13 -11
  506. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +2 -2
  507. data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +90 -183
  508. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +38 -64
  509. data/third_party/boringssl-with-bazel/src/ssl/ssl_buffer.cc +1 -1
  510. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +103 -44
  511. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +210 -220
  512. data/third_party/boringssl-with-bazel/src/ssl/ssl_credential.cc +70 -12
  513. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +20 -17
  514. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +146 -169
  515. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +15 -16
  516. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +79 -95
  517. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -9
  518. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +91 -16
  519. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +30 -16
  520. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +51 -56
  521. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +22 -25
  522. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +43 -27
  523. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +63 -59
  524. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +204 -121
  525. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +86 -59
  526. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +51 -62
  527. data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +37 -25
  528. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +6 -0
  529. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +6 -0
  530. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +4 -1
  531. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1 -1
  532. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +3 -0
  533. metadata +339 -339
  534. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb.h +0 -426
  535. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.c +0 -87
  536. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.h +0 -32
  537. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb.h +0 -408
  538. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.c +0 -124
  539. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.h +0 -38
  540. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.c +0 -108
  541. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.h +0 -33
  542. data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.c +0 -67
  543. data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.h +0 -48
  544. data/src/core/util/atm.cc +0 -34
  545. data/third_party/boringssl-with-bazel/src/crypto/dilithium/dilithium.c +0 -1539
  546. data/third_party/boringssl-with-bazel/src/crypto/dilithium/internal.h +0 -58
  547. data/third_party/boringssl-with-bazel/src/crypto/spx/address.c +0 -101
  548. data/third_party/boringssl-with-bazel/src/crypto/spx/address.h +0 -50
  549. data/third_party/boringssl-with-bazel/src/crypto/spx/fors.c +0 -133
  550. data/third_party/boringssl-with-bazel/src/crypto/spx/fors.h +0 -54
  551. data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.c +0 -150
  552. data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.h +0 -61
  553. data/third_party/boringssl-with-bazel/src/crypto/spx/params.h +0 -71
  554. data/third_party/boringssl-with-bazel/src/crypto/spx/spx.c +0 -140
  555. data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.c +0 -53
  556. data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.h +0 -44
  557. data/third_party/boringssl-with-bazel/src/crypto/spx/thash.c +0 -136
  558. data/third_party/boringssl-with-bazel/src/crypto/spx/thash.h +0 -70
  559. data/third_party/boringssl-with-bazel/src/crypto/spx/wots.c +0 -135
  560. data/third_party/boringssl-with-bazel/src/crypto/spx/wots.h +0 -45
  561. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/dilithium.h +0 -129
  562. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/spx.h +0 -90
  563. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_bool.c → a_bool.cc} +0 -0
  564. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_gentm.c → a_gentm.cc} +0 -0
  565. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_octet.c → a_octet.cc} +0 -0
  566. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strex.c → a_strex.cc} +0 -0
  567. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_time.c → a_time.cc} +0 -0
  568. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_utctm.c → a_utctm.cc} +0 -0
  569. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_par.c → asn1_par.cc} +0 -0
  570. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{f_int.c → f_int.cc} +0 -0
  571. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{f_string.c → f_string.cc} +0 -0
  572. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_typ.c → tasn_typ.cc} +0 -0
  573. /data/third_party/boringssl-with-bazel/src/crypto/bio/{errno.c → errno.cc} +0 -0
  574. /data/third_party/boringssl-with-bazel/src/crypto/bio/{fd.c → fd.cc} +0 -0
  575. /data/third_party/boringssl-with-bazel/src/crypto/bio/{hexdump.c → hexdump.cc} +0 -0
  576. /data/third_party/boringssl-with-bazel/src/crypto/bio/{socket.c → socket.cc} +0 -0
  577. /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{cipher_extra.c → cipher_extra.cc} +0 -0
  578. /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{derive_key.c → derive_key.cc} +0 -0
  579. /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{tls_cbc.c → tls_cbc.cc} +0 -0
  580. /data/third_party/boringssl-with-bazel/src/crypto/des/{des.c → des.cc} +0 -0
  581. /data/third_party/boringssl-with-bazel/src/crypto/dh_extra/{params.c → params.cc} +0 -0
  582. /data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/{ecdh_extra.c → ecdh_extra.cc} +0 -0
  583. /data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_asn1.c → evp_asn1.cc} +0 -0
  584. /data/third_party/boringssl-with-bazel/src/crypto/evp/{sign.c → sign.cc} +0 -0
  585. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes.c.inc → aes.cc.inc} +0 -0
  586. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{mode_wrappers.c.inc → mode_wrappers.cc.inc} +0 -0
  587. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bytes.c.inc → bytes.cc.inc} +0 -0
  588. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{cmp.c.inc → cmp.cc.inc} +0 -0
  589. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{generic.c.inc → generic.cc.inc} +0 -0
  590. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{jacobi.c.inc → jacobi.cc.inc} +0 -0
  591. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery_inv.c.inc → montgomery_inv.cc.inc} +0 -0
  592. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{random.c.inc → random.cc.inc} +0 -0
  593. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{rsaz_exp.c.inc → rsaz_exp.cc.inc} +0 -0
  594. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{sqrt.c.inc → sqrt.cc.inc} +0 -0
  595. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aesccm.c.inc → e_aesccm.cc.inc} +0 -0
  596. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{check.c.inc → check.cc.inc} +0 -0
  597. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_montgomery.c.inc → ec_montgomery.cc.inc} +0 -0
  598. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple.c.inc → simple.cc.inc} +0 -0
  599. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cbc.c.inc → cbc.cc.inc} +0 -0
  600. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cfb.c.inc → cfb.cc.inc} +0 -0
  601. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ctr.c.inc → ctr.cc.inc} +0 -0
  602. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ofb.c.inc → ofb.cc.inc} +0 -0
  603. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/{kdf.c.inc → kdf.cc.inc} +0 -0
  604. /data/third_party/boringssl-with-bazel/src/crypto/obj/{obj_xref.c → obj_xref.cc} +0 -0
  605. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_all.c → pem_all.cc} +0 -0
  606. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pk8.c → pem_pk8.cc} +0 -0
  607. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pkey.c → pem_pkey.cc} +0 -0
  608. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_x509.c → pem_x509.cc} +0 -0
  609. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_xaux.c → pem_xaux.cc} +0 -0
  610. /data/third_party/boringssl-with-bazel/src/crypto/rc4/{rc4.c → rc4.cc} +0 -0
  611. /data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_print.c → rsa_print.cc} +0 -0
  612. /data/third_party/boringssl-with-bazel/src/crypto/{thread.c → thread.cc} +0 -0
  613. /data/third_party/boringssl-with-bazel/src/crypto/x509/{by_file.c → by_file.cc} +0 -0
  614. /data/third_party/boringssl-with-bazel/src/crypto/x509/{i2d_pr.c → i2d_pr.cc} +0 -0
  615. /data/third_party/boringssl-with-bazel/src/crypto/x509/{name_print.c → name_print.cc} +0 -0
  616. /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_crl.c → t_crl.cc} +0 -0
  617. /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_req.c → t_req.cc} +0 -0
  618. /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_x509.c → t_x509.cc} +0 -0
  619. /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_x509a.c → t_x509a.cc} +0 -0
  620. /data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_akeya.c → v3_akeya.cc} +0 -0
  621. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509.c → x509.cc} +0 -0
  622. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_cmp.c → x509_cmp.cc} +0 -0
  623. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_d2.c → x509_d2.cc} +0 -0
  624. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_def.c → x509_def.cc} +0 -0
  625. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_ext.c → x509_ext.cc} +0 -0
  626. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_obj.c → x509_obj.cc} +0 -0
  627. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_req.c → x509_req.cc} +0 -0
  628. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_set.c → x509_set.cc} +0 -0
  629. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_trs.c → x509_trs.cc} +0 -0
  630. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_txt.c → x509_txt.cc} +0 -0
  631. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509cset.c → x509cset.cc} +0 -0
  632. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509name.c → x509name.cc} +0 -0
  633. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509rset.c → x509rset.cc} +0 -0
  634. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_algor.c → x_algor.cc} +0 -0
  635. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_attrib.c → x_attrib.cc} +0 -0
  636. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_exten.c → x_exten.cc} +0 -0
  637. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_req.c → x_req.cc} +0 -0
  638. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_sig.c → x_sig.cc} +0 -0
  639. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_spki.c → x_spki.cc} +0 -0
  640. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_val.c → x_val.cc} +0 -0
@@ -175,7 +175,7 @@ static bool tls1_check_duplicate_extensions(const CBS *cbs) {
175
175
  }
176
176
 
177
177
  Array<uint16_t> extension_types;
178
- if (!extension_types.Init(num_extensions)) {
178
+ if (!extension_types.InitForOverwrite(num_extensions)) {
179
179
  return false;
180
180
  }
181
181
 
@@ -243,12 +243,16 @@ bool ssl_parse_client_hello_with_trailing_data(const SSL *ssl, CBS *cbs,
243
243
  out->session_id = CBS_data(&session_id);
244
244
  out->session_id_len = CBS_len(&session_id);
245
245
 
246
- // Skip past DTLS cookie
247
246
  if (SSL_is_dtls(out->ssl)) {
248
247
  CBS cookie;
249
248
  if (!CBS_get_u8_length_prefixed(cbs, &cookie)) {
250
249
  return false;
251
250
  }
251
+ out->dtls_cookie = CBS_data(&cookie);
252
+ out->dtls_cookie_len = CBS_len(&cookie);
253
+ } else {
254
+ out->dtls_cookie = nullptr;
255
+ out->dtls_cookie_len = 0;
252
256
  }
253
257
 
254
258
  CBS cipher_suites, compression_methods;
@@ -513,9 +517,7 @@ static bool ignore_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
513
517
  return true;
514
518
  }
515
519
 
516
- static bool dont_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
517
- return true;
518
- }
520
+ static bool dont_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) { return true; }
519
521
 
520
522
  // Server name indication (SNI).
521
523
  //
@@ -566,7 +568,7 @@ static bool ext_sni_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
566
568
  }
567
569
 
568
570
  static bool ext_sni_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
569
- if (hs->ssl->s3->session_reused ||
571
+ if (hs->ssl->s3->session_reused || //
570
572
  !hs->should_ack_sni) {
571
573
  return true;
572
574
  }
@@ -703,20 +705,20 @@ static bool ext_ri_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
703
705
  ssl_client_hello_type_t type) {
704
706
  const SSL *const ssl = hs->ssl;
705
707
  // Renegotiation indication is not necessary in TLS 1.3.
706
- if (hs->min_version >= TLS1_3_VERSION ||
707
- type == ssl_client_hello_inner) {
708
+ if (hs->min_version >= TLS1_3_VERSION || //
709
+ type == ssl_client_hello_inner) {
708
710
  return true;
709
711
  }
710
712
 
711
713
  assert(ssl->s3->initial_handshake_complete ==
712
- (ssl->s3->previous_client_finished_len != 0));
714
+ !ssl->s3->previous_client_finished.empty());
713
715
 
714
716
  CBB contents, prev_finished;
715
717
  if (!CBB_add_u16(out, TLSEXT_TYPE_renegotiate) ||
716
718
  !CBB_add_u16_length_prefixed(out, &contents) ||
717
719
  !CBB_add_u8_length_prefixed(&contents, &prev_finished) ||
718
- !CBB_add_bytes(&prev_finished, ssl->s3->previous_client_finished,
719
- ssl->s3->previous_client_finished_len) ||
720
+ !CBB_add_bytes(&prev_finished, ssl->s3->previous_client_finished.data(),
721
+ ssl->s3->previous_client_finished.size()) ||
720
722
  !CBB_flush(out)) {
721
723
  return false;
722
724
  }
@@ -752,16 +754,11 @@ static bool ext_ri_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
752
754
  return true;
753
755
  }
754
756
 
755
- const size_t expected_len = ssl->s3->previous_client_finished_len +
756
- ssl->s3->previous_server_finished_len;
757
-
758
- // Check for logic errors
759
- assert(!expected_len || ssl->s3->previous_client_finished_len);
760
- assert(!expected_len || ssl->s3->previous_server_finished_len);
761
- assert(ssl->s3->initial_handshake_complete ==
762
- (ssl->s3->previous_client_finished_len != 0));
757
+ // Check for logic errors.
758
+ assert(ssl->s3->previous_client_finished.size() ==
759
+ ssl->s3->previous_server_finished.size());
763
760
  assert(ssl->s3->initial_handshake_complete ==
764
- (ssl->s3->previous_server_finished_len != 0));
761
+ !ssl->s3->previous_client_finished.empty());
765
762
 
766
763
  // Parse out the extension contents.
767
764
  CBS renegotiated_connection;
@@ -773,15 +770,22 @@ static bool ext_ri_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
773
770
  }
774
771
 
775
772
  // Check that the extension matches.
776
- if (CBS_len(&renegotiated_connection) != expected_len) {
773
+ CBS client_verify, server_verify;
774
+ if (!CBS_get_bytes(&renegotiated_connection, &client_verify,
775
+ ssl->s3->previous_client_finished.size()) ||
776
+ !CBS_get_bytes(&renegotiated_connection, &server_verify,
777
+ ssl->s3->previous_server_finished.size()) ||
778
+ CBS_len(&renegotiated_connection) != 0) {
777
779
  OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_MISMATCH);
778
780
  *out_alert = SSL_AD_HANDSHAKE_FAILURE;
779
781
  return false;
780
782
  }
781
783
 
782
- const uint8_t *d = CBS_data(&renegotiated_connection);
783
- bool ok = CRYPTO_memcmp(d, ssl->s3->previous_client_finished,
784
- ssl->s3->previous_client_finished_len) == 0;
784
+ bool ok =
785
+ CBS_mem_equal(&client_verify, ssl->s3->previous_client_finished.data(),
786
+ ssl->s3->previous_client_finished.size()) &&
787
+ CBS_mem_equal(&server_verify, ssl->s3->previous_server_finished.data(),
788
+ ssl->s3->previous_server_finished.size());
785
789
  #if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
786
790
  ok = true;
787
791
  #endif
@@ -790,20 +794,8 @@ static bool ext_ri_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
790
794
  *out_alert = SSL_AD_HANDSHAKE_FAILURE;
791
795
  return false;
792
796
  }
793
- d += ssl->s3->previous_client_finished_len;
794
797
 
795
- ok = CRYPTO_memcmp(d, ssl->s3->previous_server_finished,
796
- ssl->s3->previous_server_finished_len) == 0;
797
- #if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
798
- ok = true;
799
- #endif
800
- if (!ok) {
801
- OPENSSL_PUT_ERROR(SSL, SSL_R_RENEGOTIATION_MISMATCH);
802
- *out_alert = SSL_AD_HANDSHAKE_FAILURE;
803
- return false;
804
- }
805
798
  ssl->s3->send_connection_binding = true;
806
-
807
799
  return true;
808
800
  }
809
801
 
@@ -887,7 +879,7 @@ static bool ext_ems_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
887
879
  SSL *const ssl = hs->ssl;
888
880
 
889
881
  if (contents != NULL) {
890
- if (ssl_protocol_version(ssl) >= TLS1_3_VERSION ||
882
+ if (ssl_protocol_version(ssl) >= TLS1_3_VERSION || //
891
883
  CBS_len(contents) != 0) {
892
884
  return false;
893
885
  }
@@ -953,17 +945,14 @@ static bool ext_ticket_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
953
945
  return true;
954
946
  }
955
947
 
956
- Span<const uint8_t> ticket;
957
-
958
948
  // Renegotiation does not participate in session resumption. However, still
959
949
  // advertise the extension to avoid potentially breaking servers which carry
960
950
  // over the state from the previous handshake, such as OpenSSL servers
961
951
  // without upstream's 3c3f0259238594d77264a78944d409f2127642c4.
962
- if (!ssl->s3->initial_handshake_complete &&
952
+ Span<const uint8_t> ticket;
953
+ if (!ssl->s3->initial_handshake_complete && //
963
954
  ssl->session != nullptr &&
964
- !ssl->session->ticket.empty() &&
965
- // Don't send TLS 1.3 session tickets in the ticket extension.
966
- ssl_session_protocol_version(ssl->session.get()) < TLS1_3_VERSION) {
955
+ ssl_session_get_type(ssl->session.get()) == SSLSessionType::kTicket) {
967
956
  ticket = ssl->session->ticket;
968
957
  }
969
958
 
@@ -1199,7 +1188,7 @@ static bool ext_npn_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1199
1188
 
1200
1189
  while (CBS_len(contents) != 0) {
1201
1190
  CBS proto;
1202
- if (!CBS_get_u8_length_prefixed(contents, &proto) ||
1191
+ if (!CBS_get_u8_length_prefixed(contents, &proto) || //
1203
1192
  CBS_len(&proto) == 0) {
1204
1193
  return false;
1205
1194
  }
@@ -1233,9 +1222,9 @@ static bool ext_npn_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1233
1222
  return false;
1234
1223
  }
1235
1224
 
1236
- if (contents == NULL ||
1237
- ssl->s3->initial_handshake_complete ||
1238
- ssl->ctx->next_protos_advertised_cb == NULL ||
1225
+ if (contents == NULL || //
1226
+ ssl->s3->initial_handshake_complete || //
1227
+ ssl->ctx->next_protos_advertised_cb == NULL || //
1239
1228
  SSL_is_dtls(ssl)) {
1240
1229
  return true;
1241
1230
  }
@@ -1263,9 +1252,9 @@ static bool ext_npn_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1263
1252
  }
1264
1253
 
1265
1254
  CBB contents;
1266
- if (!CBB_add_u16(out, TLSEXT_TYPE_next_proto_neg) ||
1267
- !CBB_add_u16_length_prefixed(out, &contents) ||
1268
- !CBB_add_bytes(&contents, npa, npa_len) ||
1255
+ if (!CBB_add_u16(out, TLSEXT_TYPE_next_proto_neg) || //
1256
+ !CBB_add_u16_length_prefixed(out, &contents) || //
1257
+ !CBB_add_bytes(&contents, npa, npa_len) || //
1269
1258
  !CBB_flush(out)) {
1270
1259
  return false;
1271
1260
  }
@@ -1376,7 +1365,7 @@ static bool ext_alpn_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1376
1365
  CBB *out_compressible,
1377
1366
  ssl_client_hello_type_t type) {
1378
1367
  const SSL *const ssl = hs->ssl;
1379
- if (hs->config->alpn_client_proto_list.empty() && ssl->quic_method) {
1368
+ if (hs->config->alpn_client_proto_list.empty() && SSL_is_quic(ssl)) {
1380
1369
  // ALPN MUST be used with QUIC.
1381
1370
  OPENSSL_PUT_ERROR(SSL, SSL_R_NO_APPLICATION_PROTOCOL);
1382
1371
  return false;
@@ -1405,7 +1394,7 @@ static bool ext_alpn_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1405
1394
  CBS *contents) {
1406
1395
  SSL *const ssl = hs->ssl;
1407
1396
  if (contents == NULL) {
1408
- if (ssl->quic_method) {
1397
+ if (SSL_is_quic(ssl)) {
1409
1398
  // ALPN is required when QUIC is used.
1410
1399
  OPENSSL_PUT_ERROR(SSL, SSL_R_NO_APPLICATION_PROTOCOL);
1411
1400
  *out_alert = SSL_AD_NO_APPLICATION_PROTOCOL;
@@ -1427,11 +1416,11 @@ static bool ext_alpn_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1427
1416
  // The extension data consists of a ProtocolNameList which must have
1428
1417
  // exactly one ProtocolName. Each of these is length-prefixed.
1429
1418
  CBS protocol_name_list, protocol_name;
1430
- if (!CBS_get_u16_length_prefixed(contents, &protocol_name_list) ||
1431
- CBS_len(contents) != 0 ||
1432
- !CBS_get_u8_length_prefixed(&protocol_name_list, &protocol_name) ||
1419
+ if (!CBS_get_u16_length_prefixed(contents, &protocol_name_list) || //
1420
+ CBS_len(contents) != 0 || //
1421
+ !CBS_get_u8_length_prefixed(&protocol_name_list, &protocol_name) || //
1433
1422
  // Empty protocol names are forbidden.
1434
- CBS_len(&protocol_name) == 0 ||
1423
+ CBS_len(&protocol_name) == 0 || //
1435
1424
  CBS_len(&protocol_name_list) != 0) {
1436
1425
  return false;
1437
1426
  }
@@ -1505,7 +1494,7 @@ bool ssl_negotiate_alpn(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1505
1494
  !ssl_client_hello_get_extension(
1506
1495
  client_hello, &contents,
1507
1496
  TLSEXT_TYPE_application_layer_protocol_negotiation)) {
1508
- if (ssl->quic_method) {
1497
+ if (SSL_is_quic(ssl)) {
1509
1498
  // ALPN is required when QUIC is used.
1510
1499
  OPENSSL_PUT_ERROR(SSL, SSL_R_NO_APPLICATION_PROTOCOL);
1511
1500
  *out_alert = SSL_AD_NO_APPLICATION_PROTOCOL;
@@ -1519,8 +1508,8 @@ bool ssl_negotiate_alpn(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1519
1508
  hs->next_proto_neg_seen = false;
1520
1509
 
1521
1510
  CBS protocol_name_list;
1522
- if (!CBS_get_u16_length_prefixed(&contents, &protocol_name_list) ||
1523
- CBS_len(&contents) != 0 ||
1511
+ if (!CBS_get_u16_length_prefixed(&contents, &protocol_name_list) || //
1512
+ CBS_len(&contents) != 0 || //
1524
1513
  !ssl_is_valid_alpn_list(protocol_name_list)) {
1525
1514
  OPENSSL_PUT_ERROR(SSL, SSL_R_PARSE_TLSEXT);
1526
1515
  *out_alert = SSL_AD_DECODE_ERROR;
@@ -1536,7 +1525,7 @@ bool ssl_negotiate_alpn(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1536
1525
  static_cast<unsigned>(CBS_len(&protocol_name_list)),
1537
1526
  ssl->ctx->alpn_select_cb_arg);
1538
1527
  // ALPN is required when QUIC is used.
1539
- if (ssl->quic_method &&
1528
+ if (SSL_is_quic(ssl) &&
1540
1529
  (ret == SSL_TLSEXT_ERR_NOACK || ret == SSL_TLSEXT_ERR_ALERT_WARNING)) {
1541
1530
  ret = SSL_TLSEXT_ERR_ALERT_FATAL;
1542
1531
  }
@@ -1678,8 +1667,8 @@ static bool ext_srtp_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1678
1667
  const SSL *const ssl = hs->ssl;
1679
1668
  const STACK_OF(SRTP_PROTECTION_PROFILE) *profiles =
1680
1669
  SSL_get_srtp_profiles(ssl);
1681
- if (profiles == NULL ||
1682
- sk_SRTP_PROTECTION_PROFILE_num(profiles) == 0 ||
1670
+ if (profiles == NULL || //
1671
+ sk_SRTP_PROTECTION_PROFILE_num(profiles) == 0 || //
1683
1672
  !SSL_is_dtls(ssl)) {
1684
1673
  return true;
1685
1674
  }
@@ -1719,10 +1708,10 @@ static bool ext_srtp_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1719
1708
  assert(SSL_is_dtls(ssl));
1720
1709
  CBS profile_ids, srtp_mki;
1721
1710
  uint16_t profile_id;
1722
- if (!CBS_get_u16_length_prefixed(contents, &profile_ids) ||
1723
- !CBS_get_u16(&profile_ids, &profile_id) ||
1724
- CBS_len(&profile_ids) != 0 ||
1725
- !CBS_get_u8_length_prefixed(contents, &srtp_mki) ||
1711
+ if (!CBS_get_u16_length_prefixed(contents, &profile_ids) || //
1712
+ !CBS_get_u16(&profile_ids, &profile_id) || //
1713
+ CBS_len(&profile_ids) != 0 || //
1714
+ !CBS_get_u8_length_prefixed(contents, &srtp_mki) || //
1726
1715
  CBS_len(contents) != 0) {
1727
1716
  OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
1728
1717
  return false;
@@ -1802,8 +1791,7 @@ static bool ext_srtp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
1802
1791
  !CBB_add_u16_length_prefixed(out, &contents) ||
1803
1792
  !CBB_add_u16_length_prefixed(&contents, &profile_ids) ||
1804
1793
  !CBB_add_u16(&profile_ids, ssl->s3->srtp_profile->id) ||
1805
- !CBB_add_u8(&contents, 0 /* empty MKI */) ||
1806
- !CBB_flush(out)) {
1794
+ !CBB_add_u8(&contents, 0 /* empty MKI */) || !CBB_flush(out)) {
1807
1795
  return false;
1808
1796
  }
1809
1797
 
@@ -1839,8 +1827,8 @@ static bool ext_ec_point_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
1839
1827
  return ext_ec_point_add_extension(hs, out);
1840
1828
  }
1841
1829
 
1842
- static bool ext_ec_point_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1843
- CBS *contents) {
1830
+ static bool ext_ec_point_parse_serverhello(SSL_HANDSHAKE *hs,
1831
+ uint8_t *out_alert, CBS *contents) {
1844
1832
  if (contents == NULL) {
1845
1833
  return true;
1846
1834
  }
@@ -1867,8 +1855,8 @@ static bool ext_ec_point_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert
1867
1855
  return true;
1868
1856
  }
1869
1857
 
1870
- static bool ext_ec_point_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
1871
- CBS *contents) {
1858
+ static bool ext_ec_point_parse_clienthello(SSL_HANDSHAKE *hs,
1859
+ uint8_t *out_alert, CBS *contents) {
1872
1860
  if (ssl_protocol_version(hs->ssl) >= TLS1_3_VERSION) {
1873
1861
  return true;
1874
1862
  }
@@ -1902,7 +1890,8 @@ static bool should_offer_psk(const SSL_HANDSHAKE *hs,
1902
1890
  ssl_client_hello_type_t type) {
1903
1891
  const SSL *const ssl = hs->ssl;
1904
1892
  if (hs->max_version < TLS1_3_VERSION || ssl->session == nullptr ||
1905
- ssl_session_protocol_version(ssl->session.get()) < TLS1_3_VERSION ||
1893
+ ssl_session_get_type(ssl->session.get()) !=
1894
+ SSLSessionType::kPreSharedKey ||
1906
1895
  // TODO(https://crbug.com/boringssl/275): Should we synthesize a
1907
1896
  // placeholder PSK, at least when we offer early data? Otherwise
1908
1897
  // ClientHelloOuter will contain an early_data extension without a
@@ -1942,8 +1931,7 @@ static bool ext_pre_shared_key_add_clienthello(const SSL_HANDSHAKE *hs,
1942
1931
  return true;
1943
1932
  }
1944
1933
 
1945
- struct OPENSSL_timeval now;
1946
- ssl_get_current_time(ssl, &now);
1934
+ OPENSSL_timeval now = ssl_ctx_get_current_time(ssl->ctx.get());
1947
1935
  uint32_t ticket_age = 1000 * (now.tv_sec - ssl->session->time);
1948
1936
  uint32_t obfuscated_ticket_age = ticket_age + ssl->session->ticket_age_add;
1949
1937
 
@@ -1973,7 +1961,7 @@ bool ssl_ext_pre_shared_key_parse_serverhello(SSL_HANDSHAKE *hs,
1973
1961
  uint8_t *out_alert,
1974
1962
  CBS *contents) {
1975
1963
  uint16_t psk_id;
1976
- if (!CBS_get_u16(contents, &psk_id) ||
1964
+ if (!CBS_get_u16(contents, &psk_id) || //
1977
1965
  CBS_len(contents) != 0) {
1978
1966
  OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
1979
1967
  *out_alert = SSL_AD_DECODE_ERROR;
@@ -2005,11 +1993,11 @@ bool ssl_ext_pre_shared_key_parse_clienthello(
2005
1993
 
2006
1994
  // We only process the first PSK identity since we don't support pure PSK.
2007
1995
  CBS identities, binders;
2008
- if (!CBS_get_u16_length_prefixed(contents, &identities) ||
2009
- !CBS_get_u16_length_prefixed(&identities, out_ticket) ||
2010
- !CBS_get_u32(&identities, out_obfuscated_ticket_age) ||
2011
- !CBS_get_u16_length_prefixed(contents, &binders) ||
2012
- CBS_len(&binders) == 0 ||
1996
+ if (!CBS_get_u16_length_prefixed(contents, &identities) || //
1997
+ !CBS_get_u16_length_prefixed(&identities, out_ticket) || //
1998
+ !CBS_get_u32(&identities, out_obfuscated_ticket_age) || //
1999
+ !CBS_get_u16_length_prefixed(contents, &binders) || //
2000
+ CBS_len(&binders) == 0 || //
2013
2001
  CBS_len(contents) != 0) {
2014
2002
  OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
2015
2003
  *out_alert = SSL_AD_DECODE_ERROR;
@@ -2062,10 +2050,10 @@ bool ssl_ext_pre_shared_key_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
2062
2050
  }
2063
2051
 
2064
2052
  CBB contents;
2065
- if (!CBB_add_u16(out, TLSEXT_TYPE_pre_shared_key) ||
2066
- !CBB_add_u16_length_prefixed(out, &contents) ||
2053
+ if (!CBB_add_u16(out, TLSEXT_TYPE_pre_shared_key) || //
2054
+ !CBB_add_u16_length_prefixed(out, &contents) || //
2067
2055
  // We only consider the first identity for resumption
2068
- !CBB_add_u16(&contents, 0) ||
2056
+ !CBB_add_u16(&contents, 0) || //
2069
2057
  !CBB_flush(out)) {
2070
2058
  return false;
2071
2059
  }
@@ -2104,8 +2092,8 @@ static bool ext_psk_key_exchange_modes_parse_clienthello(SSL_HANDSHAKE *hs,
2104
2092
  }
2105
2093
 
2106
2094
  CBS ke_modes;
2107
- if (!CBS_get_u8_length_prefixed(contents, &ke_modes) ||
2108
- CBS_len(&ke_modes) == 0 ||
2095
+ if (!CBS_get_u8_length_prefixed(contents, &ke_modes) || //
2096
+ CBS_len(&ke_modes) == 0 || //
2109
2097
  CBS_len(contents) != 0) {
2110
2098
  *out_alert = SSL_AD_DECODE_ERROR;
2111
2099
  return false;
@@ -2142,8 +2130,8 @@ static bool ext_early_data_add_clienthello(const SSL_HANDSHAKE *hs, CBB *out,
2142
2130
  // send the extension in both ClientHellos. This ensures that, if the server
2143
2131
  // handshakes with ClientHelloOuter, it can skip past early data. See
2144
2132
  // draft-ietf-tls-esni-13, section 6.1.
2145
- if (!CBB_add_u16(out_compressible, TLSEXT_TYPE_early_data) ||
2146
- !CBB_add_u16(out_compressible, 0) ||
2133
+ if (!CBB_add_u16(out_compressible, TLSEXT_TYPE_early_data) || //
2134
+ !CBB_add_u16(out_compressible, 0) || //
2147
2135
  !CBB_flush(out_compressible)) {
2148
2136
  return false;
2149
2137
  }
@@ -2190,10 +2178,10 @@ static bool ext_early_data_parse_serverhello(SSL_HANDSHAKE *hs,
2190
2178
  }
2191
2179
 
2192
2180
  static bool ext_early_data_parse_clienthello(SSL_HANDSHAKE *hs,
2193
- uint8_t *out_alert, CBS *contents) {
2181
+ uint8_t *out_alert,
2182
+ CBS *contents) {
2194
2183
  SSL *const ssl = hs->ssl;
2195
- if (contents == NULL ||
2196
- ssl_protocol_version(ssl) < TLS1_3_VERSION) {
2184
+ if (contents == NULL || ssl_protocol_version(ssl) < TLS1_3_VERSION) {
2197
2185
  return true;
2198
2186
  }
2199
2187
 
@@ -2211,8 +2199,8 @@ static bool ext_early_data_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
2211
2199
  return true;
2212
2200
  }
2213
2201
 
2214
- if (!CBB_add_u16(out, TLSEXT_TYPE_early_data) ||
2215
- !CBB_add_u16(out, 0) ||
2202
+ if (!CBB_add_u16(out, TLSEXT_TYPE_early_data) || //
2203
+ !CBB_add_u16(out, 0) || //
2216
2204
  !CBB_flush(out)) {
2217
2205
  return false;
2218
2206
  }
@@ -2502,14 +2490,12 @@ static bool ext_supported_groups_add_clienthello(const SSL_HANDSHAKE *hs,
2502
2490
 
2503
2491
  // Add a fake group. See RFC 8701.
2504
2492
  if (ssl->ctx->grease_enabled &&
2505
- !CBB_add_u16(&groups_bytes,
2506
- ssl_get_grease_value(hs, ssl_grease_group))) {
2493
+ !CBB_add_u16(&groups_bytes, ssl_get_grease_value(hs, ssl_grease_group))) {
2507
2494
  return false;
2508
2495
  }
2509
2496
 
2510
2497
  for (uint16_t group : tls1_get_grouplist(hs)) {
2511
- if (is_post_quantum_group(group) &&
2512
- hs->max_version < TLS1_3_VERSION) {
2498
+ if (is_post_quantum_group(group) && hs->max_version < TLS1_3_VERSION) {
2513
2499
  continue;
2514
2500
  }
2515
2501
  if (!CBB_add_u16(&groups_bytes, group)) {
@@ -2536,7 +2522,7 @@ static bool parse_u16_array(const CBS *cbs, Array<uint16_t> *out) {
2536
2522
  }
2537
2523
 
2538
2524
  Array<uint16_t> ret;
2539
- if (!ret.Init(CBS_len(&copy) / 2)) {
2525
+ if (!ret.InitForOverwrite(CBS_len(&copy) / 2)) {
2540
2526
  return false;
2541
2527
  }
2542
2528
  for (size_t i = 0; i < ret.size(); i++) {
@@ -2552,16 +2538,16 @@ static bool parse_u16_array(const CBS *cbs, Array<uint16_t> *out) {
2552
2538
  }
2553
2539
 
2554
2540
  static bool ext_supported_groups_parse_clienthello(SSL_HANDSHAKE *hs,
2555
- uint8_t *out_alert,
2541
+ uint8_t *out_alert,
2556
2542
  CBS *contents) {
2557
2543
  if (contents == NULL) {
2558
2544
  return true;
2559
2545
  }
2560
2546
 
2561
2547
  CBS supported_group_list;
2562
- if (!CBS_get_u16_length_prefixed(contents, &supported_group_list) ||
2563
- CBS_len(&supported_group_list) == 0 ||
2564
- CBS_len(contents) != 0 ||
2548
+ if (!CBS_get_u16_length_prefixed(contents, &supported_group_list) || //
2549
+ CBS_len(&supported_group_list) == 0 || //
2550
+ CBS_len(contents) != 0 || //
2565
2551
  !parse_u16_array(&supported_group_list, &hs->peer_supported_group_list)) {
2566
2552
  return false;
2567
2553
  }
@@ -2570,14 +2556,53 @@ static bool ext_supported_groups_parse_clienthello(SSL_HANDSHAKE *hs,
2570
2556
  }
2571
2557
 
2572
2558
 
2559
+ // Certificate Authorities.
2560
+ //
2561
+ // https://tools.ietf.org/html/rfc8446#section-4.2.4
2562
+
2563
+ static bool ext_certificate_authorities_add_clienthello(
2564
+ const SSL_HANDSHAKE *hs, CBB *out, CBB *out_compressible,
2565
+ ssl_client_hello_type_t type) {
2566
+ if (ssl_has_CA_names(hs->config)) {
2567
+ CBB ca_contents;
2568
+ if (!CBB_add_u16(out, TLSEXT_TYPE_certificate_authorities) || //
2569
+ !CBB_add_u16_length_prefixed(out, &ca_contents) || //
2570
+ !ssl_add_CA_names(hs, &ca_contents) || //
2571
+ !CBB_flush(out)) {
2572
+ return false;
2573
+ }
2574
+ }
2575
+ return true;
2576
+ }
2577
+
2578
+ static bool ext_certificate_authorities_parse_clienthello(SSL_HANDSHAKE *hs,
2579
+ uint8_t *out_alert,
2580
+ CBS *contents) {
2581
+ if (contents == NULL) {
2582
+ return true;
2583
+ }
2584
+
2585
+ if (CBS_len(contents) == 0) {
2586
+ return false;
2587
+ }
2588
+
2589
+ hs->ca_names = SSL_parse_CA_list(hs->ssl, out_alert, contents);
2590
+ if (!hs->ca_names) {
2591
+ return false;
2592
+ }
2593
+
2594
+ return true;
2595
+ }
2596
+
2597
+
2573
2598
  // QUIC Transport Parameters
2574
2599
 
2575
2600
  static bool ext_quic_transport_params_add_clienthello_impl(
2576
2601
  const SSL_HANDSHAKE *hs, CBB *out, bool use_legacy_codepoint) {
2577
- if (hs->config->quic_transport_params.empty() && !hs->ssl->quic_method) {
2602
+ if (hs->config->quic_transport_params.empty() && !SSL_is_quic(hs->ssl)) {
2578
2603
  return true;
2579
2604
  }
2580
- if (hs->config->quic_transport_params.empty() || !hs->ssl->quic_method) {
2605
+ if (hs->config->quic_transport_params.empty() || !SSL_is_quic(hs->ssl)) {
2581
2606
  // QUIC Transport Parameters must be sent over QUIC, and they must not be
2582
2607
  // sent over non-QUIC transports. If transport params are set, then
2583
2608
  // SSL(_CTX)_set_quic_method must also be called.
@@ -2629,7 +2654,7 @@ static bool ext_quic_transport_params_parse_serverhello_impl(
2629
2654
  // Silently ignore because we expect the other QUIC codepoint.
2630
2655
  return true;
2631
2656
  }
2632
- if (!ssl->quic_method) {
2657
+ if (!SSL_is_quic(ssl)) {
2633
2658
  return true;
2634
2659
  }
2635
2660
  *out_alert = SSL_AD_MISSING_EXTENSION;
@@ -2637,7 +2662,7 @@ static bool ext_quic_transport_params_parse_serverhello_impl(
2637
2662
  }
2638
2663
  // The extensions parser will check for unsolicited extensions before
2639
2664
  // calling the callback.
2640
- assert(ssl->quic_method != nullptr);
2665
+ assert(SSL_is_quic(ssl));
2641
2666
  assert(ssl_protocol_version(ssl) == TLS1_3_VERSION);
2642
2667
  assert(used_legacy_codepoint == hs->config->quic_use_legacy_codepoint);
2643
2668
  return ssl->s3->peer_quic_transport_params.CopyFrom(*contents);
@@ -2661,7 +2686,7 @@ static bool ext_quic_transport_params_parse_clienthello_impl(
2661
2686
  bool used_legacy_codepoint) {
2662
2687
  SSL *const ssl = hs->ssl;
2663
2688
  if (!contents) {
2664
- if (!ssl->quic_method) {
2689
+ if (!SSL_is_quic(ssl)) {
2665
2690
  if (hs->config->quic_transport_params.empty()) {
2666
2691
  return true;
2667
2692
  }
@@ -2678,7 +2703,7 @@ static bool ext_quic_transport_params_parse_clienthello_impl(
2678
2703
  *out_alert = SSL_AD_MISSING_EXTENSION;
2679
2704
  return false;
2680
2705
  }
2681
- if (!ssl->quic_method) {
2706
+ if (!SSL_is_quic(ssl)) {
2682
2707
  if (used_legacy_codepoint) {
2683
2708
  // Ignore the legacy private-use codepoint because that could be sent
2684
2709
  // to mean something else than QUIC transport parameters.
@@ -2712,12 +2737,12 @@ static bool ext_quic_transport_params_parse_clienthello_legacy(
2712
2737
 
2713
2738
  static bool ext_quic_transport_params_add_serverhello_impl(
2714
2739
  SSL_HANDSHAKE *hs, CBB *out, bool use_legacy_codepoint) {
2715
- if (hs->ssl->quic_method == nullptr && use_legacy_codepoint) {
2740
+ if (!SSL_is_quic(hs->ssl) && use_legacy_codepoint) {
2716
2741
  // Ignore the legacy private-use codepoint because that could be sent
2717
2742
  // to mean something else than QUIC transport parameters.
2718
2743
  return true;
2719
2744
  }
2720
- assert(hs->ssl->quic_method != nullptr);
2745
+ assert(SSL_is_quic(hs->ssl));
2721
2746
  if (hs->config->quic_transport_params.empty()) {
2722
2747
  // Transport parameters must be set when using QUIC.
2723
2748
  OPENSSL_PUT_ERROR(SSL, SSL_R_QUIC_TRANSPORT_PARAMETERS_MISCONFIGURED);
@@ -2779,9 +2804,9 @@ static bool ext_delegated_credential_parse_clienthello(SSL_HANDSHAKE *hs,
2779
2804
  // The contents of the extension are the signature algorithms the client will
2780
2805
  // accept for a delegated credential.
2781
2806
  CBS sigalg_list;
2782
- if (!CBS_get_u16_length_prefixed(contents, &sigalg_list) ||
2783
- CBS_len(&sigalg_list) == 0 ||
2784
- CBS_len(contents) != 0 ||
2807
+ if (!CBS_get_u16_length_prefixed(contents, &sigalg_list) || //
2808
+ CBS_len(&sigalg_list) == 0 || //
2809
+ CBS_len(contents) != 0 || //
2785
2810
  !parse_u16_array(&sigalg_list, &hs->peer_delegated_credential_sigalgs)) {
2786
2811
  return false;
2787
2812
  }
@@ -2840,16 +2865,16 @@ static bool cert_compression_parse_clienthello(SSL_HANDSHAKE *hs,
2840
2865
  const size_t num_algs = ctx->cert_compression_algs.size();
2841
2866
 
2842
2867
  CBS alg_ids;
2843
- if (!CBS_get_u8_length_prefixed(contents, &alg_ids) ||
2844
- CBS_len(contents) != 0 ||
2845
- CBS_len(&alg_ids) == 0 ||
2868
+ if (!CBS_get_u8_length_prefixed(contents, &alg_ids) || //
2869
+ CBS_len(contents) != 0 || //
2870
+ CBS_len(&alg_ids) == 0 || //
2846
2871
  CBS_len(&alg_ids) % 2 == 1) {
2847
2872
  return false;
2848
2873
  }
2849
2874
 
2850
2875
  const size_t num_given_alg_ids = CBS_len(&alg_ids) / 2;
2851
2876
  Array<uint16_t> given_alg_ids;
2852
- if (!given_alg_ids.Init(num_given_alg_ids)) {
2877
+ if (!given_alg_ids.InitForOverwrite(num_given_alg_ids)) {
2853
2878
  return false;
2854
2879
  }
2855
2880
 
@@ -2917,7 +2942,7 @@ static bool ext_alps_add_clienthello_impl(const SSL_HANDSHAKE *hs, CBB *out,
2917
2942
  ssl_client_hello_type_t type,
2918
2943
  bool use_new_codepoint) {
2919
2944
  const SSL *const ssl = hs->ssl;
2920
- if (// ALPS requires TLS 1.3.
2945
+ if ( // ALPS requires TLS 1.3.
2921
2946
  hs->max_version < TLS1_3_VERSION ||
2922
2947
  // Do not offer ALPS without ALPN.
2923
2948
  hs->config->alpn_client_proto_list.empty() ||
@@ -2971,8 +2996,7 @@ static bool ext_alps_add_clienthello_old(const SSL_HANDSHAKE *hs, CBB *out,
2971
2996
  }
2972
2997
 
2973
2998
  static bool ext_alps_parse_serverhello_impl(SSL_HANDSHAKE *hs,
2974
- uint8_t *out_alert,
2975
- CBS *contents,
2999
+ uint8_t *out_alert, CBS *contents,
2976
3000
  bool use_new_codepoint) {
2977
3001
  SSL *const ssl = hs->ssl;
2978
3002
  if (contents == nullptr) {
@@ -3002,16 +3026,14 @@ static bool ext_alps_parse_serverhello_impl(SSL_HANDSHAKE *hs,
3002
3026
  return true;
3003
3027
  }
3004
3028
 
3005
- static bool ext_alps_parse_serverhello(SSL_HANDSHAKE *hs,
3006
- uint8_t *out_alert,
3029
+ static bool ext_alps_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
3007
3030
  CBS *contents) {
3008
3031
  return ext_alps_parse_serverhello_impl(hs, out_alert, contents,
3009
3032
  /*use_new_codepoint=*/true);
3010
3033
  }
3011
3034
 
3012
3035
  static bool ext_alps_parse_serverhello_old(SSL_HANDSHAKE *hs,
3013
- uint8_t *out_alert,
3014
- CBS *contents) {
3036
+ uint8_t *out_alert, CBS *contents) {
3015
3037
  return ext_alps_parse_serverhello_impl(hs, out_alert, contents,
3016
3038
  /*use_new_codepoint=*/false);
3017
3039
  }
@@ -3027,7 +3049,7 @@ static bool ext_alps_add_serverhello_impl(SSL_HANDSHAKE *hs, CBB *out,
3027
3049
  return true;
3028
3050
  }
3029
3051
 
3030
- if (use_new_codepoint != hs->config->alps_use_new_codepoint) {
3052
+ if (use_new_codepoint != hs->config->alps_use_new_codepoint) {
3031
3053
  // Do nothing, we'll send the other codepoint.
3032
3054
  return true;
3033
3055
  }
@@ -3080,8 +3102,8 @@ bool ssl_negotiate_alps(SSL_HANDSHAKE *hs, uint8_t *out_alert,
3080
3102
  // Check if the client supports ALPS with the selected ALPN.
3081
3103
  bool found = false;
3082
3104
  CBS alps_list;
3083
- if (!CBS_get_u16_length_prefixed(&alps_contents, &alps_list) ||
3084
- CBS_len(&alps_contents) != 0 ||
3105
+ if (!CBS_get_u16_length_prefixed(&alps_contents, &alps_list) || //
3106
+ CBS_len(&alps_contents) != 0 || //
3085
3107
  CBS_len(&alps_list) == 0) {
3086
3108
  OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
3087
3109
  *out_alert = SSL_AD_DECODE_ERROR;
@@ -3116,185 +3138,192 @@ bool ssl_negotiate_alps(SSL_HANDSHAKE *hs, uint8_t *out_alert,
3116
3138
 
3117
3139
  // kExtensions contains all the supported extensions.
3118
3140
  static const struct tls_extension kExtensions[] = {
3119
- {
3120
- TLSEXT_TYPE_server_name,
3121
- ext_sni_add_clienthello,
3122
- ext_sni_parse_serverhello,
3123
- ext_sni_parse_clienthello,
3124
- ext_sni_add_serverhello,
3125
- },
3126
- {
3127
- TLSEXT_TYPE_encrypted_client_hello,
3128
- ext_ech_add_clienthello,
3129
- ext_ech_parse_serverhello,
3130
- ext_ech_parse_clienthello,
3131
- ext_ech_add_serverhello,
3132
- },
3133
- {
3134
- TLSEXT_TYPE_extended_master_secret,
3135
- ext_ems_add_clienthello,
3136
- ext_ems_parse_serverhello,
3137
- ext_ems_parse_clienthello,
3138
- ext_ems_add_serverhello,
3139
- },
3140
- {
3141
- TLSEXT_TYPE_renegotiate,
3142
- ext_ri_add_clienthello,
3143
- ext_ri_parse_serverhello,
3144
- ext_ri_parse_clienthello,
3145
- ext_ri_add_serverhello,
3146
- },
3147
- {
3148
- TLSEXT_TYPE_supported_groups,
3149
- ext_supported_groups_add_clienthello,
3150
- ext_supported_groups_parse_serverhello,
3151
- ext_supported_groups_parse_clienthello,
3152
- dont_add_serverhello,
3153
- },
3154
- {
3155
- TLSEXT_TYPE_ec_point_formats,
3156
- ext_ec_point_add_clienthello,
3157
- ext_ec_point_parse_serverhello,
3158
- ext_ec_point_parse_clienthello,
3159
- ext_ec_point_add_serverhello,
3160
- },
3161
- {
3162
- TLSEXT_TYPE_session_ticket,
3163
- ext_ticket_add_clienthello,
3164
- ext_ticket_parse_serverhello,
3165
- // Ticket extension client parsing is handled in ssl_session.c
3166
- ignore_parse_clienthello,
3167
- ext_ticket_add_serverhello,
3168
- },
3169
- {
3170
- TLSEXT_TYPE_application_layer_protocol_negotiation,
3171
- ext_alpn_add_clienthello,
3172
- ext_alpn_parse_serverhello,
3173
- // ALPN is negotiated late in |ssl_negotiate_alpn|.
3174
- ignore_parse_clienthello,
3175
- ext_alpn_add_serverhello,
3176
- },
3177
- {
3178
- TLSEXT_TYPE_status_request,
3179
- ext_ocsp_add_clienthello,
3180
- ext_ocsp_parse_serverhello,
3181
- ext_ocsp_parse_clienthello,
3182
- ext_ocsp_add_serverhello,
3183
- },
3184
- {
3185
- TLSEXT_TYPE_signature_algorithms,
3186
- ext_sigalgs_add_clienthello,
3187
- forbid_parse_serverhello,
3188
- ext_sigalgs_parse_clienthello,
3189
- dont_add_serverhello,
3190
- },
3191
- {
3192
- TLSEXT_TYPE_next_proto_neg,
3193
- ext_npn_add_clienthello,
3194
- ext_npn_parse_serverhello,
3195
- ext_npn_parse_clienthello,
3196
- ext_npn_add_serverhello,
3197
- },
3198
- {
3199
- TLSEXT_TYPE_certificate_timestamp,
3200
- ext_sct_add_clienthello,
3201
- ext_sct_parse_serverhello,
3202
- ext_sct_parse_clienthello,
3203
- ext_sct_add_serverhello,
3204
- },
3205
- {
3206
- TLSEXT_TYPE_channel_id,
3207
- ext_channel_id_add_clienthello,
3208
- ext_channel_id_parse_serverhello,
3209
- ext_channel_id_parse_clienthello,
3210
- ext_channel_id_add_serverhello,
3211
- },
3212
- {
3213
- TLSEXT_TYPE_srtp,
3214
- ext_srtp_add_clienthello,
3215
- ext_srtp_parse_serverhello,
3216
- ext_srtp_parse_clienthello,
3217
- ext_srtp_add_serverhello,
3218
- },
3219
- {
3220
- TLSEXT_TYPE_key_share,
3221
- ext_key_share_add_clienthello,
3222
- forbid_parse_serverhello,
3223
- ignore_parse_clienthello,
3224
- dont_add_serverhello,
3225
- },
3226
- {
3227
- TLSEXT_TYPE_psk_key_exchange_modes,
3228
- ext_psk_key_exchange_modes_add_clienthello,
3229
- forbid_parse_serverhello,
3230
- ext_psk_key_exchange_modes_parse_clienthello,
3231
- dont_add_serverhello,
3232
- },
3233
- {
3234
- TLSEXT_TYPE_early_data,
3235
- ext_early_data_add_clienthello,
3236
- ext_early_data_parse_serverhello,
3237
- ext_early_data_parse_clienthello,
3238
- ext_early_data_add_serverhello,
3239
- },
3240
- {
3241
- TLSEXT_TYPE_supported_versions,
3242
- ext_supported_versions_add_clienthello,
3243
- forbid_parse_serverhello,
3244
- ignore_parse_clienthello,
3245
- dont_add_serverhello,
3246
- },
3247
- {
3248
- TLSEXT_TYPE_cookie,
3249
- ext_cookie_add_clienthello,
3250
- forbid_parse_serverhello,
3251
- ignore_parse_clienthello,
3252
- dont_add_serverhello,
3253
- },
3254
- {
3255
- TLSEXT_TYPE_quic_transport_parameters,
3256
- ext_quic_transport_params_add_clienthello,
3257
- ext_quic_transport_params_parse_serverhello,
3258
- ext_quic_transport_params_parse_clienthello,
3259
- ext_quic_transport_params_add_serverhello,
3260
- },
3261
- {
3262
- TLSEXT_TYPE_quic_transport_parameters_legacy,
3263
- ext_quic_transport_params_add_clienthello_legacy,
3264
- ext_quic_transport_params_parse_serverhello_legacy,
3265
- ext_quic_transport_params_parse_clienthello_legacy,
3266
- ext_quic_transport_params_add_serverhello_legacy,
3267
- },
3268
- {
3269
- TLSEXT_TYPE_cert_compression,
3270
- cert_compression_add_clienthello,
3271
- cert_compression_parse_serverhello,
3272
- cert_compression_parse_clienthello,
3273
- cert_compression_add_serverhello,
3274
- },
3275
- {
3276
- TLSEXT_TYPE_delegated_credential,
3277
- ext_delegated_credential_add_clienthello,
3278
- forbid_parse_serverhello,
3279
- ext_delegated_credential_parse_clienthello,
3280
- dont_add_serverhello,
3281
- },
3282
- {
3283
- TLSEXT_TYPE_application_settings,
3284
- ext_alps_add_clienthello,
3285
- ext_alps_parse_serverhello,
3286
- // ALPS is negotiated late in |ssl_negotiate_alpn|.
3287
- ignore_parse_clienthello,
3288
- ext_alps_add_serverhello,
3289
- },
3290
- {
3291
- TLSEXT_TYPE_application_settings_old,
3292
- ext_alps_add_clienthello_old,
3293
- ext_alps_parse_serverhello_old,
3294
- // ALPS is negotiated late in |ssl_negotiate_alpn|.
3295
- ignore_parse_clienthello,
3296
- ext_alps_add_serverhello_old,
3297
- },
3141
+ {
3142
+ TLSEXT_TYPE_server_name,
3143
+ ext_sni_add_clienthello,
3144
+ ext_sni_parse_serverhello,
3145
+ ext_sni_parse_clienthello,
3146
+ ext_sni_add_serverhello,
3147
+ },
3148
+ {
3149
+ TLSEXT_TYPE_encrypted_client_hello,
3150
+ ext_ech_add_clienthello,
3151
+ ext_ech_parse_serverhello,
3152
+ ext_ech_parse_clienthello,
3153
+ ext_ech_add_serverhello,
3154
+ },
3155
+ {
3156
+ TLSEXT_TYPE_extended_master_secret,
3157
+ ext_ems_add_clienthello,
3158
+ ext_ems_parse_serverhello,
3159
+ ext_ems_parse_clienthello,
3160
+ ext_ems_add_serverhello,
3161
+ },
3162
+ {
3163
+ TLSEXT_TYPE_renegotiate,
3164
+ ext_ri_add_clienthello,
3165
+ ext_ri_parse_serverhello,
3166
+ ext_ri_parse_clienthello,
3167
+ ext_ri_add_serverhello,
3168
+ },
3169
+ {
3170
+ TLSEXT_TYPE_supported_groups,
3171
+ ext_supported_groups_add_clienthello,
3172
+ ext_supported_groups_parse_serverhello,
3173
+ ext_supported_groups_parse_clienthello,
3174
+ dont_add_serverhello,
3175
+ },
3176
+ {
3177
+ TLSEXT_TYPE_ec_point_formats,
3178
+ ext_ec_point_add_clienthello,
3179
+ ext_ec_point_parse_serverhello,
3180
+ ext_ec_point_parse_clienthello,
3181
+ ext_ec_point_add_serverhello,
3182
+ },
3183
+ {
3184
+ TLSEXT_TYPE_session_ticket,
3185
+ ext_ticket_add_clienthello,
3186
+ ext_ticket_parse_serverhello,
3187
+ // Ticket extension client parsing is handled in ssl_session.c
3188
+ ignore_parse_clienthello,
3189
+ ext_ticket_add_serverhello,
3190
+ },
3191
+ {
3192
+ TLSEXT_TYPE_application_layer_protocol_negotiation,
3193
+ ext_alpn_add_clienthello,
3194
+ ext_alpn_parse_serverhello,
3195
+ // ALPN is negotiated late in |ssl_negotiate_alpn|.
3196
+ ignore_parse_clienthello,
3197
+ ext_alpn_add_serverhello,
3198
+ },
3199
+ {
3200
+ TLSEXT_TYPE_status_request,
3201
+ ext_ocsp_add_clienthello,
3202
+ ext_ocsp_parse_serverhello,
3203
+ ext_ocsp_parse_clienthello,
3204
+ ext_ocsp_add_serverhello,
3205
+ },
3206
+ {
3207
+ TLSEXT_TYPE_signature_algorithms,
3208
+ ext_sigalgs_add_clienthello,
3209
+ forbid_parse_serverhello,
3210
+ ext_sigalgs_parse_clienthello,
3211
+ dont_add_serverhello,
3212
+ },
3213
+ {
3214
+ TLSEXT_TYPE_next_proto_neg,
3215
+ ext_npn_add_clienthello,
3216
+ ext_npn_parse_serverhello,
3217
+ ext_npn_parse_clienthello,
3218
+ ext_npn_add_serverhello,
3219
+ },
3220
+ {
3221
+ TLSEXT_TYPE_certificate_timestamp,
3222
+ ext_sct_add_clienthello,
3223
+ ext_sct_parse_serverhello,
3224
+ ext_sct_parse_clienthello,
3225
+ ext_sct_add_serverhello,
3226
+ },
3227
+ {
3228
+ TLSEXT_TYPE_channel_id,
3229
+ ext_channel_id_add_clienthello,
3230
+ ext_channel_id_parse_serverhello,
3231
+ ext_channel_id_parse_clienthello,
3232
+ ext_channel_id_add_serverhello,
3233
+ },
3234
+ {
3235
+ TLSEXT_TYPE_srtp,
3236
+ ext_srtp_add_clienthello,
3237
+ ext_srtp_parse_serverhello,
3238
+ ext_srtp_parse_clienthello,
3239
+ ext_srtp_add_serverhello,
3240
+ },
3241
+ {
3242
+ TLSEXT_TYPE_key_share,
3243
+ ext_key_share_add_clienthello,
3244
+ forbid_parse_serverhello,
3245
+ ignore_parse_clienthello,
3246
+ dont_add_serverhello,
3247
+ },
3248
+ {
3249
+ TLSEXT_TYPE_psk_key_exchange_modes,
3250
+ ext_psk_key_exchange_modes_add_clienthello,
3251
+ forbid_parse_serverhello,
3252
+ ext_psk_key_exchange_modes_parse_clienthello,
3253
+ dont_add_serverhello,
3254
+ },
3255
+ {
3256
+ TLSEXT_TYPE_early_data,
3257
+ ext_early_data_add_clienthello,
3258
+ ext_early_data_parse_serverhello,
3259
+ ext_early_data_parse_clienthello,
3260
+ ext_early_data_add_serverhello,
3261
+ },
3262
+ {
3263
+ TLSEXT_TYPE_supported_versions,
3264
+ ext_supported_versions_add_clienthello,
3265
+ forbid_parse_serverhello,
3266
+ ignore_parse_clienthello,
3267
+ dont_add_serverhello,
3268
+ },
3269
+ {
3270
+ TLSEXT_TYPE_cookie,
3271
+ ext_cookie_add_clienthello,
3272
+ forbid_parse_serverhello,
3273
+ ignore_parse_clienthello,
3274
+ dont_add_serverhello,
3275
+ },
3276
+ {
3277
+ TLSEXT_TYPE_quic_transport_parameters,
3278
+ ext_quic_transport_params_add_clienthello,
3279
+ ext_quic_transport_params_parse_serverhello,
3280
+ ext_quic_transport_params_parse_clienthello,
3281
+ ext_quic_transport_params_add_serverhello,
3282
+ },
3283
+ {
3284
+ TLSEXT_TYPE_quic_transport_parameters_legacy,
3285
+ ext_quic_transport_params_add_clienthello_legacy,
3286
+ ext_quic_transport_params_parse_serverhello_legacy,
3287
+ ext_quic_transport_params_parse_clienthello_legacy,
3288
+ ext_quic_transport_params_add_serverhello_legacy,
3289
+ },
3290
+ {
3291
+ TLSEXT_TYPE_cert_compression,
3292
+ cert_compression_add_clienthello,
3293
+ cert_compression_parse_serverhello,
3294
+ cert_compression_parse_clienthello,
3295
+ cert_compression_add_serverhello,
3296
+ },
3297
+ {
3298
+ TLSEXT_TYPE_delegated_credential,
3299
+ ext_delegated_credential_add_clienthello,
3300
+ forbid_parse_serverhello,
3301
+ ext_delegated_credential_parse_clienthello,
3302
+ dont_add_serverhello,
3303
+ },
3304
+ {
3305
+ TLSEXT_TYPE_application_settings,
3306
+ ext_alps_add_clienthello,
3307
+ ext_alps_parse_serverhello,
3308
+ // ALPS is negotiated late in |ssl_negotiate_alpn|.
3309
+ ignore_parse_clienthello,
3310
+ ext_alps_add_serverhello,
3311
+ },
3312
+ {
3313
+ TLSEXT_TYPE_application_settings_old,
3314
+ ext_alps_add_clienthello_old,
3315
+ ext_alps_parse_serverhello_old,
3316
+ // ALPS is negotiated late in |ssl_negotiate_alpn|.
3317
+ ignore_parse_clienthello,
3318
+ ext_alps_add_serverhello_old,
3319
+ },
3320
+ {
3321
+ TLSEXT_TYPE_certificate_authorities,
3322
+ ext_certificate_authorities_add_clienthello,
3323
+ forbid_parse_serverhello,
3324
+ ext_certificate_authorities_parse_clienthello,
3325
+ dont_add_serverhello,
3326
+ },
3298
3327
  };
3299
3328
 
3300
3329
  #define kNumExtensions (sizeof(kExtensions) / sizeof(struct tls_extension))
@@ -3316,7 +3345,7 @@ bool ssl_setup_extension_permutation(SSL_HANDSHAKE *hs) {
3316
3345
  uint32_t seeds[kNumExtensions - 1];
3317
3346
  Array<uint8_t> permutation;
3318
3347
  if (!RAND_bytes(reinterpret_cast<uint8_t *>(seeds), sizeof(seeds)) ||
3319
- !permutation.Init(kNumExtensions)) {
3348
+ !permutation.InitForOverwrite(kNumExtensions)) {
3320
3349
  return false;
3321
3350
  }
3322
3351
  for (size_t i = 0; i < kNumExtensions; i++) {
@@ -3527,7 +3556,7 @@ bool ssl_add_clienthello_tlsext(SSL_HANDSHAKE *hs, CBB *out, CBB *out_encoded,
3527
3556
  // bugs. We also apply this padding to ClientHelloOuter, to keep the wire
3528
3557
  // images aligned.
3529
3558
  size_t psk_extension_len = ext_pre_shared_key_clienthello_length(hs, type);
3530
- if (!SSL_is_dtls(ssl) && !ssl->quic_method &&
3559
+ if (!SSL_is_dtls(ssl) && !SSL_is_quic(ssl) &&
3531
3560
  !ssl->s3->used_hello_retry_request) {
3532
3561
  header_len +=
3533
3562
  SSL3_HM_HEADER_LENGTH + 2 + CBB_len(&extensions) + psk_extension_len;
@@ -3609,7 +3638,7 @@ bool ssl_add_serverhello_tlsext(SSL_HANDSHAKE *hs, CBB *out) {
3609
3638
  }
3610
3639
 
3611
3640
  // Discard empty extensions blocks before TLS 1.3.
3612
- if (ssl_protocol_version(ssl) < TLS1_3_VERSION &&
3641
+ if (ssl_protocol_version(ssl) < TLS1_3_VERSION && //
3613
3642
  CBB_len(&extensions) == 0) {
3614
3643
  CBB_discard_child(out);
3615
3644
  }
@@ -3882,7 +3911,7 @@ static enum ssl_ticket_aead_result_t decrypt_ticket_with_cipher_ctx(
3882
3911
  if (ciphertext.size() >= INT_MAX) {
3883
3912
  return ssl_ticket_aead_ignore_ticket;
3884
3913
  }
3885
- if (!plaintext.Init(ciphertext.size())) {
3914
+ if (!plaintext.InitForOverwrite(ciphertext.size())) {
3886
3915
  return ssl_ticket_aead_error;
3887
3916
  }
3888
3917
  int len1, len2;
@@ -3957,8 +3986,8 @@ static enum ssl_ticket_aead_result_t ssl_decrypt_ticket_with_ticket_keys(
3957
3986
  }
3958
3987
  if (!HMAC_Init_ex(hmac_ctx.get(), key->hmac_key, sizeof(key->hmac_key),
3959
3988
  tlsext_tick_md(), NULL) ||
3960
- !EVP_DecryptInit_ex(cipher_ctx.get(), cipher, NULL,
3961
- key->aes_key, iv.data())) {
3989
+ !EVP_DecryptInit_ex(cipher_ctx.get(), cipher, NULL, key->aes_key,
3990
+ iv.data())) {
3962
3991
  return ssl_ticket_aead_error;
3963
3992
  }
3964
3993
  }
@@ -3970,7 +3999,7 @@ static enum ssl_ticket_aead_result_t ssl_decrypt_ticket_with_method(
3970
3999
  SSL_HANDSHAKE *hs, Array<uint8_t> *out, bool *out_renew_ticket,
3971
4000
  Span<const uint8_t> ticket) {
3972
4001
  Array<uint8_t> plaintext;
3973
- if (!plaintext.Init(ticket.size())) {
4002
+ if (!plaintext.InitForOverwrite(ticket.size())) {
3974
4003
  return ssl_ticket_aead_error;
3975
4004
  }
3976
4005
 
@@ -4079,9 +4108,8 @@ enum ssl_ticket_aead_result_t ssl_process_ticket(
4079
4108
  // Envoy's tests expect the session to have a session ID that matches the
4080
4109
  // placeholder used by the client. It's unclear whether this is a good idea,
4081
4110
  // but we maintain it for now.
4082
- SHA256(ticket.data(), ticket.size(), session->session_id);
4083
- // Other consumers may expect a non-empty session ID to indicate resumption.
4084
- session->session_id_length = SHA256_DIGEST_LENGTH;
4111
+ session->session_id.ResizeForOverwrite(SHA256_DIGEST_LENGTH);
4112
+ SHA256(ticket.data(), ticket.size(), session->session_id.data());
4085
4113
 
4086
4114
  *out_session = std::move(session);
4087
4115
  return ssl_ticket_aead_success;
@@ -4173,10 +4201,10 @@ bool tls1_verify_channel_id(SSL_HANDSHAKE *hs, const SSLMessage &msg) {
4173
4201
  // extensions, but the only one that can be present is Channel ID.
4174
4202
  uint16_t extension_type;
4175
4203
  CBS channel_id = msg.body, extension;
4176
- if (!CBS_get_u16(&channel_id, &extension_type) ||
4177
- !CBS_get_u16_length_prefixed(&channel_id, &extension) ||
4178
- CBS_len(&channel_id) != 0 ||
4179
- extension_type != TLSEXT_TYPE_channel_id ||
4204
+ if (!CBS_get_u16(&channel_id, &extension_type) || //
4205
+ !CBS_get_u16_length_prefixed(&channel_id, &extension) || //
4206
+ CBS_len(&channel_id) != 0 || //
4207
+ extension_type != TLSEXT_TYPE_channel_id || //
4180
4208
  CBS_len(&extension) != TLSEXT_CHANNEL_ID_SIZE) {
4181
4209
  OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
4182
4210
  ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
@@ -4257,12 +4285,12 @@ bool tls1_write_channel_id(SSL_HANDSHAKE *hs, CBB *cbb) {
4257
4285
  }
4258
4286
 
4259
4287
  CBB child;
4260
- if (!CBB_add_u16(cbb, TLSEXT_TYPE_channel_id) ||
4261
- !CBB_add_u16_length_prefixed(cbb, &child) ||
4262
- !BN_bn2cbb_padded(&child, 32, x.get()) ||
4263
- !BN_bn2cbb_padded(&child, 32, y.get()) ||
4264
- !BN_bn2cbb_padded(&child, 32, sig->r) ||
4265
- !BN_bn2cbb_padded(&child, 32, sig->s) ||
4288
+ if (!CBB_add_u16(cbb, TLSEXT_TYPE_channel_id) || //
4289
+ !CBB_add_u16_length_prefixed(cbb, &child) || //
4290
+ !BN_bn2cbb_padded(&child, 32, x.get()) || //
4291
+ !BN_bn2cbb_padded(&child, 32, y.get()) || //
4292
+ !BN_bn2cbb_padded(&child, 32, sig->r) || //
4293
+ !BN_bn2cbb_padded(&child, 32, sig->s) || //
4266
4294
  !CBB_flush(cbb)) {
4267
4295
  return false;
4268
4296
  }
@@ -4292,12 +4320,12 @@ bool tls1_channel_id_hash(SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len) {
4292
4320
  if (ssl->session != NULL) {
4293
4321
  static const char kResumptionMagic[] = "Resumption";
4294
4322
  SHA256_Update(&ctx, kResumptionMagic, sizeof(kResumptionMagic));
4295
- if (ssl->session->original_handshake_hash_len == 0) {
4323
+ if (ssl->session->original_handshake_hash.empty()) {
4296
4324
  OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
4297
4325
  return false;
4298
4326
  }
4299
- SHA256_Update(&ctx, ssl->session->original_handshake_hash,
4300
- ssl->session->original_handshake_hash_len);
4327
+ SHA256_Update(&ctx, ssl->session->original_handshake_hash.data(),
4328
+ ssl->session->original_handshake_hash.size());
4301
4329
  }
4302
4330
 
4303
4331
  uint8_t hs_hash[EVP_MAX_MD_SIZE];
@@ -4320,20 +4348,14 @@ bool tls1_record_handshake_hashes_for_channel_id(SSL_HANDSHAKE *hs) {
4320
4348
  return false;
4321
4349
  }
4322
4350
 
4323
- static_assert(
4324
- sizeof(hs->new_session->original_handshake_hash) == EVP_MAX_MD_SIZE,
4325
- "original_handshake_hash is too small");
4326
-
4327
4351
  size_t digest_len;
4328
- if (!hs->transcript.GetHash(hs->new_session->original_handshake_hash,
4352
+ hs->new_session->original_handshake_hash.ResizeForOverwrite(
4353
+ hs->transcript.DigestLen());
4354
+ if (!hs->transcript.GetHash(hs->new_session->original_handshake_hash.data(),
4329
4355
  &digest_len)) {
4330
4356
  return false;
4331
4357
  }
4332
-
4333
- static_assert(EVP_MAX_MD_SIZE <= 0xff,
4334
- "EVP_MAX_MD_SIZE does not fit in uint8_t");
4335
- hs->new_session->original_handshake_hash_len = (uint8_t)digest_len;
4336
-
4358
+ assert(digest_len == hs->new_session->original_handshake_hash.size());
4337
4359
  return true;
4338
4360
  }
4339
4361
 
@@ -4343,16 +4365,14 @@ bool ssl_is_sct_list_valid(const CBS *contents) {
4343
4365
  // of the SCTs may be empty.
4344
4366
  CBS copy = *contents;
4345
4367
  CBS sct_list;
4346
- if (!CBS_get_u16_length_prefixed(&copy, &sct_list) ||
4347
- CBS_len(&copy) != 0 ||
4368
+ if (!CBS_get_u16_length_prefixed(&copy, &sct_list) || CBS_len(&copy) != 0 ||
4348
4369
  CBS_len(&sct_list) == 0) {
4349
4370
  return false;
4350
4371
  }
4351
4372
 
4352
4373
  while (CBS_len(&sct_list) > 0) {
4353
4374
  CBS sct;
4354
- if (!CBS_get_u16_length_prefixed(&sct_list, &sct) ||
4355
- CBS_len(&sct) == 0) {
4375
+ if (!CBS_get_u16_length_prefixed(&sct_list, &sct) || CBS_len(&sct) == 0) {
4356
4376
  return false;
4357
4377
  }
4358
4378
  }