grpc 1.56.2 → 1.57.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (383) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +29 -22
  3. data/include/grpc/event_engine/event_engine.h +22 -32
  4. data/include/grpc/impl/grpc_types.h +3 -0
  5. data/include/grpc/support/port_platform.h +29 -23
  6. data/src/core/ext/filters/client_channel/client_channel.cc +44 -8
  7. data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
  8. data/src/core/ext/filters/client_channel/http_proxy.cc +5 -0
  9. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +21 -52
  10. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +19 -7
  11. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +25 -35
  12. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +78 -132
  13. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +2 -1
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +4 -3
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
  16. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +38 -15
  17. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +3 -5
  18. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +22 -6
  19. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +2 -0
  20. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +97 -71
  21. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -16
  22. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +56 -11
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +25 -0
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -32
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +4 -6
  26. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +20 -79
  27. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
  28. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -19
  29. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +1 -1
  30. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -41
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -67
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +8 -0
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +31 -74
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +7 -51
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +16 -87
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +16 -50
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -74
  38. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -4
  39. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +69 -59
  40. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +7 -2
  41. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +1 -0
  42. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +25 -13
  43. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +366 -311
  44. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +17 -1
  45. data/src/core/ext/filters/client_channel/retry_filter.cc +39 -2498
  46. data/src/core/ext/filters/client_channel/retry_filter.h +91 -1
  47. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.cc +2052 -0
  48. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.h +442 -0
  49. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +38 -58
  50. data/src/core/ext/filters/client_channel/subchannel.h +3 -3
  51. data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -0
  52. data/src/core/ext/filters/rbac/rbac_filter.cc +40 -111
  53. data/src/core/ext/filters/rbac/rbac_filter.h +12 -30
  54. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +162 -86
  55. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +0 -6
  56. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -4
  57. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +131 -186
  58. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +6569 -174
  59. data/src/core/ext/transport/chttp2/transport/decode_huff.h +2278 -441
  60. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -3
  61. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +4 -3
  62. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -8
  63. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -2
  65. data/src/core/ext/transport/chttp2/transport/internal.h +8 -4
  66. data/src/core/ext/transport/chttp2/transport/parsing.cc +15 -3
  67. data/src/core/ext/transport/chttp2/transport/writing.cc +2 -3
  68. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -6
  69. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +143 -0
  70. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -9
  71. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +0 -39
  72. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +13 -8
  73. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +35 -6
  74. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +17 -13
  75. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +85 -20
  76. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +26 -7
  77. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +45 -3
  78. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +4 -3
  79. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +21 -0
  80. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +30 -6
  81. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +180 -0
  82. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +558 -0
  83. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +2710 -0
  84. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +30 -11
  85. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +53 -24
  86. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +30 -5
  87. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +110 -0
  88. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +41 -15
  89. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +150 -27
  90. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +1 -0
  91. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +47 -0
  92. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +93 -0
  93. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +88 -76
  94. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -0
  95. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +11 -12
  96. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +0 -5
  97. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +162 -160
  98. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +129 -118
  99. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +141 -135
  100. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +19 -12
  101. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +38 -30
  102. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
  103. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.c +402 -0
  104. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.h +111 -0
  105. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +80 -74
  106. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +63 -47
  107. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -0
  108. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +315 -293
  109. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  110. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +29 -29
  111. data/src/core/ext/xds/xds_bootstrap_grpc.cc +33 -30
  112. data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -13
  113. data/src/core/ext/xds/xds_client_grpc.cc +11 -6
  114. data/src/core/ext/xds/xds_client_grpc.h +16 -2
  115. data/src/core/ext/xds/xds_client_stats.h +10 -0
  116. data/src/core/ext/xds/xds_cluster.cc +26 -16
  117. data/src/core/ext/xds/xds_endpoint.cc +4 -7
  118. data/src/core/ext/xds/xds_health_status.cc +0 -17
  119. data/src/core/ext/xds/xds_health_status.h +5 -25
  120. data/src/core/ext/xds/xds_lb_policy_registry.cc +39 -0
  121. data/src/core/ext/xds/xds_route_config.cc +4 -0
  122. data/src/core/ext/xds/xds_transport_grpc.cc +1 -3
  123. data/src/core/lib/address_utils/parse_address.cc +63 -1
  124. data/src/core/lib/address_utils/parse_address.h +8 -0
  125. data/src/core/lib/address_utils/sockaddr_utils.cc +46 -1
  126. data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
  127. data/src/core/lib/channel/channel_args.cc +21 -10
  128. data/src/core/lib/channel/channel_args.h +3 -0
  129. data/src/core/lib/channel/connected_channel.cc +4 -1
  130. data/src/core/lib/channel/promise_based_filter.h +1 -0
  131. data/src/core/lib/debug/trace.cc +1 -4
  132. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -1
  133. data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -1
  134. data/src/core/lib/event_engine/event_engine.cc +0 -12
  135. data/src/core/lib/event_engine/forkable.cc +47 -42
  136. data/src/core/lib/event_engine/handle_containers.h +0 -4
  137. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -6
  138. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -6
  139. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +25 -11
  140. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +3 -1
  141. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -1
  142. data/src/core/lib/event_engine/posix_engine/posix_engine.h +8 -12
  143. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +37 -27
  144. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -0
  145. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +4 -2
  146. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +42 -2
  147. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +6 -0
  148. data/src/core/lib/event_engine/posix_engine/timer.h +10 -37
  149. data/src/core/lib/event_engine/tcp_socket_utils.cc +67 -7
  150. data/src/core/lib/event_engine/tcp_socket_utils.h +3 -0
  151. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +90 -37
  152. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +32 -12
  153. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +12 -21
  154. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +8 -12
  155. data/src/core/lib/event_engine/windows/windows_endpoint.cc +55 -54
  156. data/src/core/lib/event_engine/windows/windows_endpoint.h +15 -12
  157. data/src/core/lib/event_engine/windows/windows_engine.cc +2 -1
  158. data/src/core/lib/event_engine/windows/windows_engine.h +8 -12
  159. data/src/core/lib/experiments/config.cc +60 -22
  160. data/src/core/lib/experiments/config.h +20 -8
  161. data/src/core/lib/experiments/experiments.cc +278 -0
  162. data/src/core/lib/experiments/experiments.h +59 -1
  163. data/src/core/lib/gprpp/dual_ref_counted.h +9 -9
  164. data/src/core/lib/gprpp/fork.cc +8 -9
  165. data/src/core/lib/gprpp/fork.h +6 -5
  166. data/src/core/lib/gprpp/if_list.h +4530 -0
  167. data/src/core/lib/gprpp/orphanable.h +3 -3
  168. data/src/core/lib/gprpp/ref_counted.h +6 -6
  169. data/src/core/lib/gprpp/sorted_pack.h +3 -12
  170. data/src/core/lib/gprpp/status_helper.h +16 -15
  171. data/src/core/lib/gprpp/time.h +12 -0
  172. data/src/core/lib/gprpp/type_list.h +32 -0
  173. data/src/core/lib/http/httpcli.h +6 -9
  174. data/src/core/lib/iomgr/error.cc +32 -2
  175. data/src/core/lib/iomgr/error.h +9 -10
  176. data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -7
  177. data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
  178. data/src/core/lib/iomgr/exec_ctx.h +11 -0
  179. data/src/core/lib/iomgr/pollset.h +4 -5
  180. data/src/core/lib/iomgr/port.h +10 -0
  181. data/src/core/lib/iomgr/resolve_address.cc +13 -1
  182. data/src/core/lib/iomgr/resolve_address.h +17 -3
  183. data/src/core/lib/iomgr/sockaddr_posix.h +7 -0
  184. data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -0
  185. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -0
  186. data/src/core/lib/iomgr/socket_utils_posix.h +6 -0
  187. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
  188. data/src/core/lib/iomgr/tcp_posix.cc +21 -4
  189. data/src/core/lib/iomgr/tcp_server_posix.cc +3 -2
  190. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -2
  191. data/src/core/lib/iomgr/tcp_windows.cc +1 -3
  192. data/src/core/lib/iomgr/vsock.cc +59 -0
  193. data/src/core/lib/iomgr/vsock.h +38 -0
  194. data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -6
  195. data/src/core/lib/load_balancing/delegating_helper.h +115 -0
  196. data/src/core/lib/load_balancing/lb_policy.h +20 -0
  197. data/src/core/lib/load_balancing/subchannel_interface.h +6 -0
  198. data/src/core/lib/promise/party.h +1 -1
  199. data/src/core/lib/resolver/resolver_factory.h +3 -2
  200. data/src/core/lib/resolver/server_address.cc +9 -94
  201. data/src/core/lib/resolver/server_address.h +10 -64
  202. data/src/core/lib/resource_quota/memory_quota.h +1 -1
  203. data/src/core/lib/security/credentials/channel_creds_registry.h +51 -27
  204. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +169 -9
  205. data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
  206. data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -1
  207. data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -1
  208. data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -0
  209. data/src/core/lib/security/credentials/fake/fake_credentials.cc +30 -38
  210. data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -0
  211. data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
  212. data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -1
  213. data/src/core/lib/service_config/service_config_call_data.h +5 -0
  214. data/src/core/lib/slice/slice.h +16 -0
  215. data/src/core/lib/surface/call.cc +31 -29
  216. data/src/core/lib/surface/server.h +2 -2
  217. data/src/core/lib/surface/version.cc +2 -2
  218. data/src/core/lib/transport/metadata_batch.cc +7 -7
  219. data/src/core/lib/transport/metadata_batch.h +86 -48
  220. data/src/core/lib/transport/parsed_metadata.h +34 -20
  221. data/src/core/lib/transport/simple_slice_based_metadata.h +9 -2
  222. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +4 -6
  223. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -2
  224. data/src/core/tsi/ssl_transport_security.cc +28 -7
  225. data/src/ruby/bin/math_pb.rb +24 -18
  226. data/src/ruby/ext/grpc/extconf.rb +19 -18
  227. data/src/ruby/ext/grpc/rb_call.c +62 -39
  228. data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
  229. data/src/ruby/ext/grpc/rb_channel.c +126 -49
  230. data/src/ruby/ext/grpc/rb_channel.h +1 -0
  231. data/src/ruby/ext/grpc/rb_channel_args.c +16 -2
  232. data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
  233. data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
  234. data/src/ruby/ext/grpc/rb_compression_options.c +0 -1
  235. data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
  236. data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
  237. data/src/ruby/ext/grpc/rb_grpc.c +192 -30
  238. data/src/ruby/ext/grpc/rb_grpc.h +8 -2
  239. data/src/ruby/ext/grpc/rb_server.c +62 -45
  240. data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
  241. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
  242. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
  243. data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -0
  244. data/src/ruby/lib/grpc/version.rb +1 -1
  245. data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
  246. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
  247. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +25 -111
  248. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +25 -2
  249. data/third_party/boringssl-with-bazel/err_data.c +552 -552
  250. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +5 -5
  251. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +34 -1
  252. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +4 -1
  253. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +3 -3
  254. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +7 -8
  255. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +2 -2
  256. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -2
  257. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +8 -8
  258. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
  259. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +2 -2
  260. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +19 -1
  261. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +8 -1
  262. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +28 -185
  263. data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +3 -7
  264. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +8 -0
  265. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +3 -0
  266. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +49 -46
  267. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +18 -0
  268. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +2809 -7417
  269. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +27 -5
  270. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +20 -0
  271. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +110 -72
  272. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +4 -3
  273. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +15 -14
  274. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +13 -10
  275. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +35 -12
  276. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +2 -4
  277. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +3 -7
  278. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +3 -3
  279. data/third_party/boringssl-with-bazel/src/crypto/evp/print.c +7 -6
  280. data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +34 -72
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +12 -5
  283. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +5 -6
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +12 -6
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +17 -18
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +7 -7
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +5 -6
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +2 -0
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +277 -0
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +180 -404
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +3 -3
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +24 -57
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +17 -13
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +33 -71
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +18 -17
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -7
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +15 -18
  299. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +9 -11
  300. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +24 -24
  301. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +11 -27
  302. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +8 -8
  303. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +4 -4
  304. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
  305. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/hkdf.c +1 -1
  306. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +40 -26
  307. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +21 -7
  308. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +38 -19
  309. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +2 -29
  310. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +55 -0
  311. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +33 -52
  312. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +3 -8
  313. data/third_party/boringssl-with-bazel/src/crypto/internal.h +198 -79
  314. data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +5 -4
  315. data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -8
  316. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +19 -23
  317. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +3 -3
  318. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +3 -3
  319. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +7 -7
  320. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +8 -5
  321. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -0
  322. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +7 -6
  323. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +6 -12
  324. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +48 -0
  325. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fuchsia.c → ios.c} +8 -8
  326. data/third_party/boringssl-with-bazel/src/crypto/{refcount_no_threads.c → rand_extra/trusty.c} +15 -19
  327. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +41 -19
  328. data/third_party/boringssl-with-bazel/src/crypto/{refcount_c11.c → refcount.c} +11 -17
  329. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +147 -72
  330. data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +0 -8
  331. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +6 -35
  332. data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +5 -26
  333. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +14 -18
  334. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +54 -143
  335. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +7 -13
  336. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +1 -1
  337. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +1 -1
  338. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +2 -4
  339. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +2 -2
  340. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +1 -1
  341. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +8 -12
  342. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +19 -20
  343. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -15
  344. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -5
  345. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -1
  346. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +7 -7
  347. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -3
  348. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +4 -6
  349. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +4 -119
  350. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +207 -0
  351. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +5 -0
  352. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -116
  353. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +0 -2
  354. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +6 -0
  355. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +5 -1
  356. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +0 -21
  357. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +21 -2
  358. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +19 -6
  359. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +11 -7
  360. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -14
  361. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +0 -61
  362. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +127 -81
  363. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +224 -209
  364. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +154 -0
  365. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -29
  366. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +4 -4
  367. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +3 -2
  368. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +9 -65
  369. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +20 -20
  370. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  371. data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -11
  372. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +24 -18
  373. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +37 -30
  374. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +125 -26
  375. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -3
  376. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +691 -0
  377. data/third_party/upb/upb/collections/map.c +3 -3
  378. metadata +27 -12
  379. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +0 -42
  380. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +0 -64
  381. data/src/core/ext/transport/chttp2/transport/stream_map.cc +0 -177
  382. data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -68
  383. data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +0 -89
@@ -180,11 +180,6 @@ OPENSSL_EXPORT EC_KEY *EVP_PKEY_get1_EC_KEY(const EVP_PKEY *pkey);
180
180
  #define EVP_PKEY_X25519 NID_X25519
181
181
  #define EVP_PKEY_HKDF NID_hkdf
182
182
 
183
- // EVP_PKEY_assign sets the underlying key of |pkey| to |key|, which must be of
184
- // the given type. It returns one if successful or zero if the |type| argument
185
- // is not one of the |EVP_PKEY_*| values or if |key| is NULL.
186
- OPENSSL_EXPORT int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key);
187
-
188
183
  // EVP_PKEY_set_type sets the type of |pkey| to |type|. It returns one if
189
184
  // successful or zero if the |type| argument is not one of the |EVP_PKEY_*|
190
185
  // values. If |pkey| is NULL, it simply reports whether the type is known.
@@ -480,7 +475,7 @@ OPENSSL_EXPORT int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
480
475
  // returns one on success and zero on allocation failure or if iterations is 0.
481
476
  OPENSSL_EXPORT int PKCS5_PBKDF2_HMAC(const char *password, size_t password_len,
482
477
  const uint8_t *salt, size_t salt_len,
483
- unsigned iterations, const EVP_MD *digest,
478
+ uint32_t iterations, const EVP_MD *digest,
484
479
  size_t key_len, uint8_t *out_key);
485
480
 
486
481
  // PKCS5_PBKDF2_HMAC_SHA1 is the same as PKCS5_PBKDF2_HMAC, but with |digest|
@@ -488,7 +483,7 @@ OPENSSL_EXPORT int PKCS5_PBKDF2_HMAC(const char *password, size_t password_len,
488
483
  OPENSSL_EXPORT int PKCS5_PBKDF2_HMAC_SHA1(const char *password,
489
484
  size_t password_len,
490
485
  const uint8_t *salt, size_t salt_len,
491
- unsigned iterations, size_t key_len,
486
+ uint32_t iterations, size_t key_len,
492
487
  uint8_t *out_key);
493
488
 
494
489
  // EVP_PBE_scrypt expands |password| into a secret key of length |key_len| using
@@ -1032,6 +1027,15 @@ OPENSSL_EXPORT int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx,
1032
1027
  OPENSSL_EXPORT int EVP_PKEY_CTX_set_dsa_paramgen_q_bits(EVP_PKEY_CTX *ctx,
1033
1028
  int qbits);
1034
1029
 
1030
+ // EVP_PKEY_assign sets the underlying key of |pkey| to |key|, which must be of
1031
+ // the given type. If successful, it returns one. If the |type| argument
1032
+ // is not one of |EVP_PKEY_RSA|, |EVP_PKEY_DSA|, or |EVP_PKEY_EC| values or if
1033
+ // |key| is NULL, it returns zero. This function may not be used with other
1034
+ // |EVP_PKEY_*| types.
1035
+ //
1036
+ // Use the |EVP_PKEY_assign_*| functions instead.
1037
+ OPENSSL_EXPORT int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key);
1038
+
1035
1039
 
1036
1040
  // Preprocessor compatibility section (hidden).
1037
1041
  //
@@ -29,20 +29,6 @@ extern "C" {
29
29
  // event that sufficient random data can not be obtained, |abort| is called.
30
30
  OPENSSL_EXPORT int RAND_bytes(uint8_t *buf, size_t len);
31
31
 
32
- // RAND_get_system_entropy_for_custom_prng writes |len| bytes of random data
33
- // from a system entropy source to |buf|. The maximum length of entropy which
34
- // may be requested is 256 bytes. If more than 256 bytes of data is requested,
35
- // or if sufficient random data can not be obtained, |abort| is called.
36
- // |RAND_bytes| should normally be used instead of this function. This function
37
- // should only be used for seed values or where |malloc| should not be called
38
- // from BoringSSL. This function is not FIPS compliant.
39
- OPENSSL_EXPORT void RAND_get_system_entropy_for_custom_prng(uint8_t *buf,
40
- size_t len);
41
-
42
- // RAND_cleanup frees any resources used by the RNG. This is not safe if other
43
- // threads might still be calling |RAND_bytes|.
44
- OPENSSL_EXPORT void RAND_cleanup(void);
45
-
46
32
 
47
33
  // Obscure functions.
48
34
 
@@ -65,6 +51,16 @@ OPENSSL_EXPORT void RAND_enable_fork_unsafe_buffering(int fd);
65
51
  OPENSSL_EXPORT void RAND_reset_for_fuzzing(void);
66
52
  #endif
67
53
 
54
+ // RAND_get_system_entropy_for_custom_prng writes |len| bytes of random data
55
+ // from a system entropy source to |buf|. The maximum length of entropy which
56
+ // may be requested is 256 bytes. If more than 256 bytes of data is requested,
57
+ // or if sufficient random data can not be obtained, |abort| is called.
58
+ // |RAND_bytes| should normally be used instead of this function. This function
59
+ // should only be used for seed values or where |malloc| should not be called
60
+ // from BoringSSL. This function is not FIPS compliant.
61
+ OPENSSL_EXPORT void RAND_get_system_entropy_for_custom_prng(uint8_t *buf,
62
+ size_t len);
63
+
68
64
 
69
65
  // Deprecated functions
70
66
 
@@ -93,6 +89,9 @@ OPENSSL_EXPORT int RAND_poll(void);
93
89
  // RAND_status returns one.
94
90
  OPENSSL_EXPORT int RAND_status(void);
95
91
 
92
+ // RAND_cleanup does nothing.
93
+ OPENSSL_EXPORT void RAND_cleanup(void);
94
+
96
95
  // rand_meth_st is typedefed to |RAND_METHOD| in base.h. It isn't used; it
97
96
  // exists only to be the return type of |RAND_SSLeay|. It's
98
97
  // external so that variables of this type can be initialized.
@@ -818,67 +818,6 @@ struct rsa_meth_st {
818
818
  };
819
819
 
820
820
 
821
- // Private functions.
822
-
823
- typedef struct bn_blinding_st BN_BLINDING;
824
-
825
- struct rsa_st {
826
- RSA_METHOD *meth;
827
-
828
- // Access to the following fields was historically allowed, but
829
- // deprecated. Use |RSA_get0_*| and |RSA_set0_*| instead. Access to all other
830
- // fields is forbidden and will cause threading errors.
831
- BIGNUM *n;
832
- BIGNUM *e;
833
- BIGNUM *d;
834
- BIGNUM *p;
835
- BIGNUM *q;
836
- BIGNUM *dmp1;
837
- BIGNUM *dmq1;
838
- BIGNUM *iqmp;
839
-
840
- // be careful using this if the RSA structure is shared
841
- CRYPTO_EX_DATA ex_data;
842
- CRYPTO_refcount_t references;
843
- int flags;
844
-
845
- CRYPTO_MUTEX lock;
846
-
847
- // Used to cache montgomery values. The creation of these values is protected
848
- // by |lock|.
849
- BN_MONT_CTX *mont_n;
850
- BN_MONT_CTX *mont_p;
851
- BN_MONT_CTX *mont_q;
852
-
853
- // The following fields are copies of |d|, |dmp1|, and |dmq1|, respectively,
854
- // but with the correct widths to prevent side channels. These must use
855
- // separate copies due to threading concerns caused by OpenSSL's API
856
- // mistakes. See https://github.com/openssl/openssl/issues/5158 and
857
- // the |freeze_private_key| implementation.
858
- BIGNUM *d_fixed, *dmp1_fixed, *dmq1_fixed;
859
-
860
- // inv_small_mod_large_mont is q^-1 mod p in Montgomery form, using |mont_p|,
861
- // if |p| >= |q|. Otherwise, it is p^-1 mod q in Montgomery form, using
862
- // |mont_q|.
863
- BIGNUM *inv_small_mod_large_mont;
864
-
865
- // num_blindings contains the size of the |blindings| and |blindings_inuse|
866
- // arrays. This member and the |blindings_inuse| array are protected by
867
- // |lock|.
868
- size_t num_blindings;
869
- // blindings is an array of BN_BLINDING structures that can be reserved by a
870
- // thread by locking |lock| and changing the corresponding element in
871
- // |blindings_inuse| from 0 to 1.
872
- BN_BLINDING **blindings;
873
- unsigned char *blindings_inuse;
874
- uint64_t blinding_fork_generation;
875
-
876
- // private_key_frozen is one if the key has been used for a private key
877
- // operation and may no longer be mutated.
878
- unsigned private_key_frozen:1;
879
- };
880
-
881
-
882
821
  #if defined(__cplusplus)
883
822
  } // extern C
884
823
 
@@ -1375,10 +1375,15 @@ OPENSSL_EXPORT int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *cipher);
1375
1375
  // function returns |NID_auth_any|.
1376
1376
  OPENSSL_EXPORT int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *cipher);
1377
1377
 
1378
- // SSL_CIPHER_get_prf_nid retuns the NID for |cipher|'s PRF hash. If |cipher| is
1379
- // a pre-TLS-1.2 cipher, it returns |NID_md5_sha1| but note these ciphers use
1378
+ // SSL_CIPHER_get_handshake_digest returns |cipher|'s PRF hash. If |cipher|
1379
+ // is a pre-TLS-1.2 cipher, it returns |EVP_md5_sha1| but note these ciphers use
1380
1380
  // SHA-256 in TLS 1.2. Other return values may be treated uniformly in all
1381
1381
  // applicable versions.
1382
+ OPENSSL_EXPORT const EVP_MD *SSL_CIPHER_get_handshake_digest(
1383
+ const SSL_CIPHER *cipher);
1384
+
1385
+ // SSL_CIPHER_get_prf_nid behaves like |SSL_CIPHER_get_handshake_digest| but
1386
+ // returns the NID constant. Use |SSL_CIPHER_get_handshake_digest| instead.
1382
1387
  OPENSSL_EXPORT int SSL_CIPHER_get_prf_nid(const SSL_CIPHER *cipher);
1383
1388
 
1384
1389
  // SSL_CIPHER_get_min_version returns the minimum protocol version required
@@ -2331,67 +2336,55 @@ OPENSSL_EXPORT int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets);
2331
2336
  OPENSSL_EXPORT size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx);
2332
2337
 
2333
2338
 
2334
- // Elliptic curve Diffie-Hellman.
2335
- //
2336
- // Cipher suites using an ECDHE key exchange perform Diffie-Hellman over an
2337
- // elliptic curve negotiated by both endpoints. See RFC 4492. Only named curves
2338
- // are supported. ECDHE is always enabled, but the curve preferences may be
2339
- // configured with these functions.
2340
- //
2341
- // Note that TLS 1.3 renames these from curves to groups. For consistency, we
2342
- // currently use the TLS 1.2 name in the API.
2343
-
2344
- // SSL_CTX_set1_curves sets the preferred curves for |ctx| to be |curves|. Each
2345
- // element of |curves| should be a curve nid. It returns one on success and
2346
- // zero on failure.
2347
- //
2348
- // Note that this API uses nid values from nid.h and not the |SSL_CURVE_*|
2349
- // values defined below.
2350
- OPENSSL_EXPORT int SSL_CTX_set1_curves(SSL_CTX *ctx, const int *curves,
2351
- size_t curves_len);
2352
-
2353
- // SSL_set1_curves sets the preferred curves for |ssl| to be |curves|. Each
2354
- // element of |curves| should be a curve nid. It returns one on success and
2355
- // zero on failure.
2356
- //
2357
- // Note that this API uses nid values from nid.h and not the |SSL_CURVE_*|
2358
- // values defined below.
2359
- OPENSSL_EXPORT int SSL_set1_curves(SSL *ssl, const int *curves,
2360
- size_t curves_len);
2361
-
2362
- // SSL_CTX_set1_curves_list sets the preferred curves for |ctx| to be the
2363
- // colon-separated list |curves|. Each element of |curves| should be a curve
2364
- // name (e.g. P-256, X25519, ...). It returns one on success and zero on
2365
- // failure.
2366
- OPENSSL_EXPORT int SSL_CTX_set1_curves_list(SSL_CTX *ctx, const char *curves);
2367
-
2368
- // SSL_set1_curves_list sets the preferred curves for |ssl| to be the
2369
- // colon-separated list |curves|. Each element of |curves| should be a curve
2370
- // name (e.g. P-256, X25519, ...). It returns one on success and zero on
2371
- // failure.
2372
- OPENSSL_EXPORT int SSL_set1_curves_list(SSL *ssl, const char *curves);
2373
-
2374
- // SSL_CURVE_* define TLS curve IDs.
2375
- #define SSL_CURVE_SECP224R1 21
2376
- #define SSL_CURVE_SECP256R1 23
2377
- #define SSL_CURVE_SECP384R1 24
2378
- #define SSL_CURVE_SECP521R1 25
2379
- #define SSL_CURVE_X25519 29
2380
- #define SSL_CURVE_X25519_KYBER768_DRAFT00 0x6399
2381
-
2382
- // SSL_get_curve_id returns the ID of the curve used by |ssl|'s most recently
2383
- // completed handshake or 0 if not applicable.
2384
- //
2385
- // TODO(davidben): This API currently does not work correctly if there is a
2386
- // renegotiation in progress. Fix this.
2387
- OPENSSL_EXPORT uint16_t SSL_get_curve_id(const SSL *ssl);
2388
-
2389
- // SSL_get_curve_name returns a human-readable name for the curve specified by
2390
- // the given TLS curve id, or NULL if the curve is unknown.
2391
- OPENSSL_EXPORT const char *SSL_get_curve_name(uint16_t curve_id);
2392
-
2393
- // SSL_get_all_curve_names outputs a list of possible strings
2394
- // |SSL_get_curve_name| may return in this version of BoringSSL. It writes at
2339
+ // Diffie-Hellman groups and ephemeral key exchanges.
2340
+ //
2341
+ // Most TLS handshakes (ECDHE cipher suites in TLS 1.2, and all supported TLS
2342
+ // 1.3 modes) incorporate an ephemeral key exchange, most commonly using
2343
+ // Elliptic Curve Diffie-Hellman (ECDH), as described in RFC 8422. The key
2344
+ // exchange algorithm is negotiated separately from the cipher suite, using
2345
+ // NamedGroup values, which define Diffie-Hellman groups.
2346
+ //
2347
+ // Historically, these values were known as "curves", in reference to ECDH, and
2348
+ // some APIs refer to the original name. RFC 7919 renamed them to "groups" in
2349
+ // reference to Diffie-Hellman in general. These values are also used to select
2350
+ // experimental post-quantum KEMs. Though not Diffie-Hellman groups, KEMs can
2351
+ // fill a similar role in TLS, so they use the same codepoints.
2352
+ //
2353
+ // In TLS 1.2, the ECDH values also negotiate elliptic curves used in ECDSA. In
2354
+ // TLS 1.3 and later, ECDSA curves are part of the signature algorithm. See
2355
+ // |SSL_SIGN_*|.
2356
+
2357
+ // SSL_GROUP_* define TLS group IDs.
2358
+ #define SSL_GROUP_SECP224R1 21
2359
+ #define SSL_GROUP_SECP256R1 23
2360
+ #define SSL_GROUP_SECP384R1 24
2361
+ #define SSL_GROUP_SECP521R1 25
2362
+ #define SSL_GROUP_X25519 29
2363
+ #define SSL_GROUP_X25519_KYBER768_DRAFT00 0x6399
2364
+
2365
+ // SSL_CTX_set1_group_ids sets the preferred groups for |ctx| to |group_ids|.
2366
+ // Each element of |group_ids| should be one of the |SSL_GROUP_*| constants. It
2367
+ // returns one on success and zero on failure.
2368
+ OPENSSL_EXPORT int SSL_CTX_set1_group_ids(SSL_CTX *ctx,
2369
+ const uint16_t *group_ids,
2370
+ size_t num_group_ids);
2371
+
2372
+ // SSL_set1_group_ids sets the preferred groups for |ssl| to |group_ids|. Each
2373
+ // element of |group_ids| should be one of the |SSL_GROUP_*| constants. It
2374
+ // returns one on success and zero on failure.
2375
+ OPENSSL_EXPORT int SSL_set1_group_ids(SSL *ssl, const uint16_t *group_ids,
2376
+ size_t num_group_ids);
2377
+
2378
+ // SSL_get_group_id returns the ID of the group used by |ssl|'s most recently
2379
+ // completed handshake, or 0 if not applicable.
2380
+ OPENSSL_EXPORT uint16_t SSL_get_group_id(const SSL *ssl);
2381
+
2382
+ // SSL_get_group_name returns a human-readable name for the group specified by
2383
+ // the given TLS group ID, or NULL if the group is unknown.
2384
+ OPENSSL_EXPORT const char *SSL_get_group_name(uint16_t group_id);
2385
+
2386
+ // SSL_get_all_group_names outputs a list of possible strings
2387
+ // |SSL_get_group_name| may return in this version of BoringSSL. It writes at
2395
2388
  // most |max_out| entries to |out| and returns the total number it would have
2396
2389
  // written, if |max_out| had been large enough. |max_out| may be initially set
2397
2390
  // to zero to size the output.
@@ -2402,22 +2395,41 @@ OPENSSL_EXPORT const char *SSL_get_curve_name(uint16_t curve_id);
2402
2395
  // placeholder, experimental, or deprecated values that do not apply to every
2403
2396
  // caller. Future versions of BoringSSL may also return strings not in this
2404
2397
  // list, so this does not apply if, say, sending strings across services.
2405
- OPENSSL_EXPORT size_t SSL_get_all_curve_names(const char **out, size_t max_out);
2398
+ OPENSSL_EXPORT size_t SSL_get_all_group_names(const char **out, size_t max_out);
2399
+
2400
+ // The following APIs also configure Diffie-Hellman groups, but use |NID_*|
2401
+ // constants instead of |SSL_GROUP_*| constants. These are provided for OpenSSL
2402
+ // compatibility. Where NIDs are unstable constants specific to OpenSSL and
2403
+ // BoringSSL, group IDs are defined by the TLS protocol. Prefer the group ID
2404
+ // representation if storing persistently, or exporting to another process or
2405
+ // library.
2406
2406
 
2407
- // SSL_CTX_set1_groups calls |SSL_CTX_set1_curves|.
2407
+ // SSL_CTX_set1_groups sets the preferred groups for |ctx| to be |groups|. Each
2408
+ // element of |groups| should be a |NID_*| constant from nid.h. It returns one
2409
+ // on success and zero on failure.
2408
2410
  OPENSSL_EXPORT int SSL_CTX_set1_groups(SSL_CTX *ctx, const int *groups,
2409
- size_t groups_len);
2411
+ size_t num_groups);
2410
2412
 
2411
- // SSL_set1_groups calls |SSL_set1_curves|.
2413
+ // SSL_set1_groups sets the preferred groups for |ssl| to be |groups|. Each
2414
+ // element of |groups| should be a |NID_*| constant from nid.h. It returns one
2415
+ // on success and zero on failure.
2412
2416
  OPENSSL_EXPORT int SSL_set1_groups(SSL *ssl, const int *groups,
2413
- size_t groups_len);
2417
+ size_t num_groups);
2414
2418
 
2415
- // SSL_CTX_set1_groups_list calls |SSL_CTX_set1_curves_list|.
2419
+ // SSL_CTX_set1_groups_list decodes |groups| as a colon-separated list of group
2420
+ // names (e.g. "X25519" or "P-256") and sets |ctx|'s preferred groups to the
2421
+ // result. It returns one on success and zero on failure.
2416
2422
  OPENSSL_EXPORT int SSL_CTX_set1_groups_list(SSL_CTX *ctx, const char *groups);
2417
2423
 
2418
- // SSL_set1_groups_list calls |SSL_set1_curves_list|.
2424
+ // SSL_set1_groups_list decodes |groups| as a colon-separated list of group
2425
+ // names (e.g. "X25519" or "P-256") and sets |ssl|'s preferred groups to the
2426
+ // result. It returns one on success and zero on failure.
2419
2427
  OPENSSL_EXPORT int SSL_set1_groups_list(SSL *ssl, const char *groups);
2420
2428
 
2429
+ // SSL_get_negotiated_group returns the NID of the group used by |ssl|'s most
2430
+ // recently completed handshake, or |NID_undef| if not applicable.
2431
+ OPENSSL_EXPORT int SSL_get_negotiated_group(const SSL *ssl);
2432
+
2421
2433
 
2422
2434
  // Certificate verification.
2423
2435
  //
@@ -5090,12 +5102,12 @@ OPENSSL_EXPORT int SSL_state(const SSL *ssl);
5090
5102
  // Use |SSL_CTX_set_quiet_shutdown| instead.
5091
5103
  OPENSSL_EXPORT void SSL_set_shutdown(SSL *ssl, int mode);
5092
5104
 
5093
- // SSL_CTX_set_tmp_ecdh calls |SSL_CTX_set1_curves| with a one-element list
5094
- // containing |ec_key|'s curve.
5105
+ // SSL_CTX_set_tmp_ecdh calls |SSL_CTX_set1_groups| with a one-element list
5106
+ // containing |ec_key|'s curve. The remainder of |ec_key| is ignored.
5095
5107
  OPENSSL_EXPORT int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key);
5096
5108
 
5097
- // SSL_set_tmp_ecdh calls |SSL_set1_curves| with a one-element list containing
5098
- // |ec_key|'s curve.
5109
+ // SSL_set_tmp_ecdh calls |SSL_set1_groups| with a one-element list containing
5110
+ // |ec_key|'s curve. The remainder of |ec_key| is ignored.
5099
5111
  OPENSSL_EXPORT int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key);
5100
5112
 
5101
5113
  // SSL_add_dir_cert_subjects_to_stack lists files in directory |dir|. It calls
@@ -5244,12 +5256,41 @@ OPENSSL_EXPORT int SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg);
5244
5256
  SSL_R_TLSV1_ALERT_BAD_CERTIFICATE_HASH_VALUE
5245
5257
  #define SSL_R_TLSV1_CERTIFICATE_REQUIRED SSL_R_TLSV1_ALERT_CERTIFICATE_REQUIRED
5246
5258
 
5247
- // SSL_CIPHER_get_value calls |SSL_CIPHER_get_protocol_id|.
5248
- //
5249
- // TODO(davidben): |SSL_CIPHER_get_value| was our name for this function, but
5250
- // upstream added it as |SSL_CIPHER_get_protocol_id|. Switch callers to the new
5251
- // name and remove this one.
5252
- OPENSSL_EXPORT uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *cipher);
5259
+ // The following symbols are compatibility aliases for |SSL_GROUP_*|.
5260
+ #define SSL_CURVE_SECP224R1 SSL_GROUP_SECP224R1
5261
+ #define SSL_CURVE_SECP256R1 SSL_GROUP_SECP256R1
5262
+ #define SSL_CURVE_SECP384R1 SSL_GROUP_SECP384R1
5263
+ #define SSL_CURVE_SECP521R1 SSL_GROUP_SECP521R1
5264
+ #define SSL_CURVE_X25519 SSL_GROUP_X25519
5265
+ #define SSL_CURVE_X25519_KYBER768_DRAFT00 SSL_GROUP_X25519_KYBER768_DRAFT00
5266
+
5267
+ // SSL_get_curve_id calls |SSL_get_group_id|.
5268
+ OPENSSL_EXPORT uint16_t SSL_get_curve_id(const SSL *ssl);
5269
+
5270
+ // SSL_get_curve_name calls |SSL_get_group_name|.
5271
+ OPENSSL_EXPORT const char *SSL_get_curve_name(uint16_t curve_id);
5272
+
5273
+ // SSL_get_all_curve_names calls |SSL_get_all_group_names|.
5274
+ OPENSSL_EXPORT size_t SSL_get_all_curve_names(const char **out, size_t max_out);
5275
+
5276
+ // SSL_CTX_set1_curves calls |SSL_CTX_set1_groups|.
5277
+ OPENSSL_EXPORT int SSL_CTX_set1_curves(SSL_CTX *ctx, const int *curves,
5278
+ size_t num_curves);
5279
+
5280
+ // SSL_set1_curves calls |SSL_set1_groups|.
5281
+ OPENSSL_EXPORT int SSL_set1_curves(SSL *ssl, const int *curves,
5282
+ size_t num_curves);
5283
+
5284
+ // SSL_CTX_set1_curves_list calls |SSL_CTX_set1_groups_list|.
5285
+ OPENSSL_EXPORT int SSL_CTX_set1_curves_list(SSL_CTX *ctx, const char *curves);
5286
+
5287
+ // SSL_set1_curves_list calls |SSL_set1_groups_list|.
5288
+ OPENSSL_EXPORT int SSL_set1_curves_list(SSL *ssl, const char *curves);
5289
+
5290
+ // TLSEXT_nid_unknown is a constant used in OpenSSL for
5291
+ // |SSL_get_negotiated_group| to return an unrecognized group. BoringSSL never
5292
+ // returns this value, but we define this constant for compatibility.
5293
+ #define TLSEXT_nid_unknown 0x1000000
5253
5294
 
5254
5295
 
5255
5296
  // Compliance policy configurations
@@ -5351,6 +5392,7 @@ OPENSSL_EXPORT int SSL_set_compliance_policy(
5351
5392
  #define SSL_CTRL_GET_CLIENT_CERT_TYPES doesnt_exist
5352
5393
  #define SSL_CTRL_GET_EXTRA_CHAIN_CERTS doesnt_exist
5353
5394
  #define SSL_CTRL_GET_MAX_CERT_LIST doesnt_exist
5395
+ #define SSL_CTRL_GET_NEGOTIATED_GROUP doesnt_exist
5354
5396
  #define SSL_CTRL_GET_NUM_RENEGOTIATIONS doesnt_exist
5355
5397
  #define SSL_CTRL_GET_READ_AHEAD doesnt_exist
5356
5398
  #define SSL_CTRL_GET_RI_SUPPORT doesnt_exist
@@ -5366,6 +5408,8 @@ OPENSSL_EXPORT int SSL_set_compliance_policy(
5366
5408
  #define SSL_CTRL_SESS_NUMBER doesnt_exist
5367
5409
  #define SSL_CTRL_SET_CURVES doesnt_exist
5368
5410
  #define SSL_CTRL_SET_CURVES_LIST doesnt_exist
5411
+ #define SSL_CTRL_SET_GROUPS doesnt_exist
5412
+ #define SSL_CTRL_SET_GROUPS_LIST doesnt_exist
5369
5413
  #define SSL_CTRL_SET_ECDH_AUTO doesnt_exist
5370
5414
  #define SSL_CTRL_SET_MAX_CERT_LIST doesnt_exist
5371
5415
  #define SSL_CTRL_SET_MAX_SEND_FRAGMENT doesnt_exist
@@ -5415,6 +5459,7 @@ OPENSSL_EXPORT int SSL_set_compliance_policy(
5415
5459
  #define SSL_CTX_set0_chain SSL_CTX_set0_chain
5416
5460
  #define SSL_CTX_set1_chain SSL_CTX_set1_chain
5417
5461
  #define SSL_CTX_set1_curves SSL_CTX_set1_curves
5462
+ #define SSL_CTX_set1_groups SSL_CTX_set1_groups
5418
5463
  #define SSL_CTX_set_max_cert_list SSL_CTX_set_max_cert_list
5419
5464
  #define SSL_CTX_set_max_send_fragment SSL_CTX_set_max_send_fragment
5420
5465
  #define SSL_CTX_set_mode SSL_CTX_set_mode
@@ -5439,6 +5484,7 @@ OPENSSL_EXPORT int SSL_set_compliance_policy(
5439
5484
  #define SSL_get0_chain_certs SSL_get0_chain_certs
5440
5485
  #define SSL_get_max_cert_list SSL_get_max_cert_list
5441
5486
  #define SSL_get_mode SSL_get_mode
5487
+ #define SSL_get_negotiated_group SSL_get_negotiated_group
5442
5488
  #define SSL_get_options SSL_get_options
5443
5489
  #define SSL_get_secure_renegotiation_support \
5444
5490
  SSL_get_secure_renegotiation_support
@@ -5448,6 +5494,7 @@ OPENSSL_EXPORT int SSL_set_compliance_policy(
5448
5494
  #define SSL_set0_chain SSL_set0_chain
5449
5495
  #define SSL_set1_chain SSL_set1_chain
5450
5496
  #define SSL_set1_curves SSL_set1_curves
5497
+ #define SSL_set1_groups SSL_set1_groups
5451
5498
  #define SSL_set_max_cert_list SSL_set_max_cert_list
5452
5499
  #define SSL_set_max_send_fragment SSL_set_max_send_fragment
5453
5500
  #define SSL_set_mode SSL_set_mode
@@ -5637,7 +5684,6 @@ BSSL_NAMESPACE_END
5637
5684
  #define SSL_R_NO_CIPHER_MATCH 177
5638
5685
  #define SSL_R_NO_COMPRESSION_SPECIFIED 178
5639
5686
  #define SSL_R_NO_METHOD_SPECIFIED 179
5640
- #define SSL_R_NO_P256_SUPPORT 180
5641
5687
  #define SSL_R_NO_PRIVATE_KEY_ASSIGNED 181
5642
5688
  #define SSL_R_NO_RENEGOTIATION 182
5643
5689
  #define SSL_R_NO_REQUIRED_DIGEST 183