grpc 1.28.0 → 1.30.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (497) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +7694 -11190
  3. data/include/grpc/grpc.h +2 -2
  4. data/include/grpc/grpc_security.h +22 -9
  5. data/include/grpc/grpc_security_constants.h +1 -0
  6. data/include/grpc/impl/codegen/grpc_types.h +19 -21
  7. data/include/grpc/impl/codegen/port_platform.h +6 -2
  8. data/include/grpc/module.modulemap +24 -39
  9. data/src/core/ext/filters/client_channel/backend_metric.cc +7 -4
  10. data/src/core/ext/filters/client_channel/client_channel.cc +203 -236
  11. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -2
  12. data/src/core/ext/filters/client_channel/health/health_check_client.cc +7 -22
  13. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  14. data/src/core/ext/filters/client_channel/http_proxy.cc +17 -10
  15. data/src/core/ext/filters/client_channel/lb_policy.cc +19 -18
  16. data/src/core/ext/filters/client_channel/lb_policy.h +42 -33
  17. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +83 -0
  18. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +99 -0
  19. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -4
  20. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +240 -301
  21. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
  23. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +11 -9
  24. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -2
  25. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +871 -0
  26. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
  27. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +5 -11
  28. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +734 -0
  29. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +84 -37
  30. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +938 -0
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +528 -0
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -2
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +834 -0
  34. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +6 -2
  35. data/src/core/ext/filters/client_channel/local_subchannel_pool.h +2 -1
  36. data/src/core/ext/filters/client_channel/parse_address.cc +22 -21
  37. data/src/core/ext/filters/client_channel/resolver.cc +5 -8
  38. data/src/core/ext/filters/client_channel/resolver.h +12 -14
  39. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +73 -59
  40. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +35 -35
  41. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -7
  42. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +16 -20
  43. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
  44. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +72 -117
  45. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +184 -133
  46. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -3
  47. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +7 -4
  48. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +40 -43
  49. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +93 -102
  50. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +0 -4
  51. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +2 -2
  52. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +32 -5
  53. data/src/core/ext/filters/client_channel/resolver_factory.h +2 -2
  54. data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -3
  55. data/src/core/ext/filters/client_channel/resolver_registry.h +8 -8
  56. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +16 -16
  57. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +19 -16
  58. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +20 -31
  59. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +4 -3
  60. data/src/core/ext/filters/client_channel/server_address.cc +6 -9
  61. data/src/core/ext/filters/client_channel/server_address.h +6 -12
  62. data/src/core/ext/filters/client_channel/service_config.cc +104 -144
  63. data/src/core/ext/filters/client_channel/service_config.h +28 -98
  64. data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -0
  65. data/src/core/ext/filters/client_channel/service_config_parser.cc +87 -0
  66. data/src/core/ext/filters/client_channel/service_config_parser.h +89 -0
  67. data/src/core/ext/filters/client_channel/subchannel.cc +54 -24
  68. data/src/core/ext/filters/client_channel/subchannel.h +35 -11
  69. data/src/core/ext/filters/client_channel/xds/xds_api.cc +348 -221
  70. data/src/core/ext/filters/client_channel/xds/xds_api.h +37 -37
  71. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +44 -49
  72. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +4 -3
  73. data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +4 -2
  74. data/src/core/ext/filters/client_channel/xds/xds_client.cc +532 -339
  75. data/src/core/ext/filters/client_channel/xds/xds_client.h +57 -22
  76. data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +11 -12
  77. data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +31 -19
  78. data/src/core/ext/filters/http/client/http_client_filter.cc +23 -28
  79. data/src/core/ext/filters/http/client_authority_filter.cc +4 -4
  80. data/src/core/ext/filters/http/http_filters_plugin.cc +27 -12
  81. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +258 -221
  82. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +358 -0
  83. data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +29 -0
  84. data/src/core/ext/filters/message_size/message_size_filter.cc +7 -10
  85. data/src/core/ext/filters/message_size/message_size_filter.h +4 -4
  86. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +4 -4
  87. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
  88. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +23 -22
  89. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  90. data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
  91. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
  92. data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
  93. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
  94. data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -3
  95. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -3
  96. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +29 -16
  97. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -3
  98. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
  99. data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -2
  100. data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
  101. data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
  102. data/src/core/ext/transport/chttp2/transport/internal.h +14 -21
  103. data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
  104. data/src/core/ext/transport/chttp2/transport/writing.cc +15 -8
  105. data/src/core/ext/transport/inproc/inproc_transport.cc +19 -0
  106. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +4 -229
  107. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +5 -875
  108. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +114 -0
  109. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +418 -0
  110. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +72 -0
  111. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +197 -0
  112. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +105 -0
  113. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +378 -0
  114. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +1 -0
  115. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +21 -8
  116. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +43 -7
  117. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +1 -0
  118. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +1 -0
  119. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +1 -0
  120. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +2 -1
  121. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +35 -0
  122. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +78 -0
  123. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +47 -26
  124. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +115 -65
  125. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +1 -0
  126. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +34 -0
  127. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +72 -0
  128. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +2 -1
  129. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +24 -20
  130. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +28 -13
  131. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +1 -0
  132. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +38 -18
  133. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +88 -6
  134. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.c +34 -0
  135. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +89 -0
  136. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -0
  137. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +1 -0
  138. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +1 -0
  139. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +1 -0
  140. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +9 -6
  141. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +12 -4
  142. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +1 -0
  143. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +1 -0
  144. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +15 -10
  145. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +16 -0
  146. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +1 -0
  147. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +2 -1
  148. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +1 -0
  149. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +1 -0
  150. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +1 -0
  151. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +1 -0
  152. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +63 -41
  153. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +173 -77
  154. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +1 -0
  155. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +1 -0
  156. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +1 -0
  157. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +48 -28
  158. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +90 -30
  159. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +1 -0
  160. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +51 -0
  161. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +125 -0
  162. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +1 -0
  163. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +4 -2
  164. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +4 -0
  165. data/src/core/ext/upb-generated/envoy/type/http.upb.c +1 -0
  166. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +16 -0
  167. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +36 -0
  168. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +1 -0
  169. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +1 -0
  170. data/src/core/ext/upb-generated/envoy/type/percent.upb.c +1 -0
  171. data/src/core/ext/upb-generated/envoy/type/range.upb.c +1 -0
  172. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +1 -0
  173. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +1 -0
  174. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +9 -8
  175. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +30 -24
  176. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
  177. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +65 -0
  178. data/src/core/ext/upb-generated/validate/validate.upb.c +21 -20
  179. data/src/core/ext/upb-generated/validate/validate.upb.h +69 -63
  180. data/src/core/lib/channel/channel_args.cc +15 -14
  181. data/src/core/lib/channel/channel_args.h +3 -1
  182. data/src/core/lib/channel/channel_stack.h +20 -13
  183. data/src/core/lib/channel/channelz.cc +5 -6
  184. data/src/core/lib/channel/channelz.h +3 -2
  185. data/src/core/lib/channel/channelz_registry.cc +5 -3
  186. data/src/core/lib/channel/connected_channel.cc +7 -5
  187. data/src/core/lib/channel/context.h +1 -1
  188. data/src/core/lib/channel/handshaker.cc +11 -13
  189. data/src/core/lib/channel/handshaker.h +4 -2
  190. data/src/core/lib/channel/handshaker_registry.cc +5 -17
  191. data/src/core/lib/channel/status_util.cc +2 -3
  192. data/src/core/lib/compression/message_compress.cc +5 -1
  193. data/src/core/lib/debug/stats.cc +21 -27
  194. data/src/core/lib/debug/stats.h +3 -1
  195. data/src/core/lib/gpr/spinlock.h +2 -3
  196. data/src/core/lib/gpr/string.cc +2 -26
  197. data/src/core/lib/gpr/string.h +0 -16
  198. data/src/core/lib/gpr/sync_abseil.cc +2 -0
  199. data/src/core/lib/gpr/time.cc +4 -0
  200. data/src/core/lib/gpr/time_posix.cc +1 -1
  201. data/src/core/lib/gprpp/atomic.h +6 -6
  202. data/src/core/lib/gprpp/fork.cc +1 -1
  203. data/src/core/lib/gprpp/host_port.cc +29 -35
  204. data/src/core/lib/gprpp/host_port.h +14 -17
  205. data/src/core/lib/gprpp/map.h +5 -11
  206. data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
  207. data/src/core/lib/http/format_request.cc +46 -65
  208. data/src/core/lib/http/httpcli.cc +2 -3
  209. data/src/core/lib/http/httpcli.h +2 -3
  210. data/src/core/lib/http/httpcli_security_connector.cc +5 -5
  211. data/src/core/lib/http/parser.h +2 -3
  212. data/src/core/lib/iomgr/buffer_list.h +22 -21
  213. data/src/core/lib/iomgr/call_combiner.h +3 -2
  214. data/src/core/lib/iomgr/cfstream_handle.cc +3 -2
  215. data/src/core/lib/iomgr/closure.h +2 -3
  216. data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
  217. data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -3
  218. data/src/core/lib/iomgr/endpoint_pair.h +2 -3
  219. data/src/core/lib/iomgr/error.cc +6 -9
  220. data/src/core/lib/iomgr/error.h +0 -1
  221. data/src/core/lib/iomgr/ev_apple.cc +356 -0
  222. data/src/core/lib/iomgr/ev_apple.h +43 -0
  223. data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -23
  224. data/src/core/lib/iomgr/ev_epollex_linux.cc +2 -3
  225. data/src/core/lib/iomgr/ev_poll_posix.cc +3 -3
  226. data/src/core/lib/iomgr/ev_posix.cc +2 -3
  227. data/src/core/lib/iomgr/exec_ctx.h +14 -2
  228. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -20
  229. data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
  230. data/src/core/lib/{gprpp/optional.h → iomgr/pollset_uv.h} +11 -12
  231. data/src/core/lib/iomgr/port.h +1 -0
  232. data/src/core/lib/iomgr/python_util.h +46 -0
  233. data/src/core/lib/iomgr/resolve_address.h +4 -6
  234. data/src/core/lib/iomgr/resolve_address_custom.cc +29 -39
  235. data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
  236. data/src/core/lib/iomgr/resolve_address_posix.cc +10 -11
  237. data/src/core/lib/iomgr/resolve_address_windows.cc +8 -17
  238. data/src/core/lib/iomgr/resource_quota.cc +4 -6
  239. data/src/core/lib/iomgr/sockaddr_utils.cc +23 -29
  240. data/src/core/lib/iomgr/sockaddr_utils.h +9 -14
  241. data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
  242. data/src/core/lib/iomgr/socket_mutator.h +2 -3
  243. data/src/core/lib/iomgr/socket_utils_common_posix.cc +7 -26
  244. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  245. data/src/core/lib/iomgr/tcp_client_cfstream.cc +5 -7
  246. data/src/core/lib/iomgr/tcp_client_posix.cc +8 -5
  247. data/src/core/lib/iomgr/tcp_client_windows.cc +2 -3
  248. data/src/core/lib/iomgr/tcp_custom.cc +2 -3
  249. data/src/core/lib/iomgr/tcp_server_custom.cc +5 -9
  250. data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
  251. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -4
  252. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -11
  253. data/src/core/lib/iomgr/tcp_uv.cc +3 -2
  254. data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
  255. data/src/core/lib/iomgr/timer_generic.cc +2 -3
  256. data/src/core/lib/{gprpp/inlined_vector.h → iomgr/timer_generic.h} +19 -17
  257. data/src/core/lib/iomgr/timer_heap.h +2 -3
  258. data/src/core/lib/iomgr/udp_server.cc +9 -14
  259. data/src/core/lib/json/json.h +3 -2
  260. data/src/core/lib/json/json_reader.cc +5 -5
  261. data/src/core/lib/json/json_writer.cc +13 -12
  262. data/src/core/lib/security/credentials/composite/composite_credentials.cc +12 -0
  263. data/src/core/lib/security/credentials/composite/composite_credentials.h +6 -3
  264. data/src/core/lib/security/credentials/credentials.cc +0 -84
  265. data/src/core/lib/security/credentials/credentials.h +8 -59
  266. data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
  267. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +3 -8
  268. data/src/core/lib/security/credentials/iam/iam_credentials.cc +8 -6
  269. data/src/core/lib/security/credentials/iam/iam_credentials.h +4 -0
  270. data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
  271. data/src/core/lib/security/credentials/jwt/json_token.h +2 -5
  272. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -0
  273. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +8 -15
  274. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
  275. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +55 -27
  276. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +9 -3
  277. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +13 -0
  278. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
  279. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -13
  280. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +38 -11
  281. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +21 -6
  282. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +7 -7
  283. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -2
  284. data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
  285. data/src/core/lib/security/security_connector/security_connector.h +1 -1
  286. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +20 -25
  287. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +4 -6
  288. data/src/core/lib/security/security_connector/ssl_utils.cc +59 -12
  289. data/src/core/lib/security/security_connector/ssl_utils.h +12 -10
  290. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +77 -51
  291. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +27 -5
  292. data/src/core/lib/security/transport/client_auth_filter.cc +1 -2
  293. data/src/core/lib/slice/slice_intern.cc +2 -3
  294. data/src/core/lib/slice/slice_internal.h +14 -0
  295. data/src/core/lib/slice/slice_utils.h +9 -0
  296. data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
  297. data/src/core/lib/surface/call.cc +2 -3
  298. data/src/core/lib/surface/call_log_batch.cc +50 -58
  299. data/src/core/lib/surface/channel.cc +53 -31
  300. data/src/core/lib/surface/channel.h +35 -4
  301. data/src/core/lib/surface/channel_ping.cc +2 -3
  302. data/src/core/lib/surface/completion_queue.cc +33 -33
  303. data/src/core/lib/surface/event_string.cc +18 -25
  304. data/src/core/lib/surface/event_string.h +3 -1
  305. data/src/core/lib/surface/init_secure.cc +1 -4
  306. data/src/core/lib/surface/server.cc +570 -369
  307. data/src/core/lib/surface/server.h +32 -0
  308. data/src/core/lib/surface/version.cc +2 -2
  309. data/src/core/lib/transport/byte_stream.h +7 -2
  310. data/src/core/lib/transport/connectivity_state.cc +7 -6
  311. data/src/core/lib/transport/connectivity_state.h +5 -3
  312. data/src/core/lib/transport/metadata.cc +3 -3
  313. data/src/core/lib/transport/metadata_batch.h +2 -3
  314. data/src/core/lib/transport/static_metadata.h +1 -1
  315. data/src/core/lib/transport/status_conversion.cc +6 -14
  316. data/src/core/lib/transport/transport.cc +2 -3
  317. data/src/core/lib/transport/transport.h +3 -2
  318. data/src/core/lib/transport/transport_op_string.cc +61 -102
  319. data/src/core/lib/uri/uri_parser.h +2 -3
  320. data/src/core/plugin_registry/grpc_plugin_registry.cc +20 -4
  321. data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
  322. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +8 -1
  323. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
  324. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +32 -2
  325. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
  326. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
  327. data/src/core/tsi/fake_transport_security.cc +10 -15
  328. data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -2
  329. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
  330. data/src/core/tsi/ssl_transport_security.cc +52 -39
  331. data/src/core/tsi/ssl_transport_security.h +8 -8
  332. data/src/core/tsi/ssl_types.h +0 -2
  333. data/src/core/tsi/transport_security.h +6 -9
  334. data/src/core/tsi/transport_security_grpc.h +2 -3
  335. data/src/core/tsi/transport_security_interface.h +3 -3
  336. data/src/ruby/ext/grpc/rb_call.c +9 -1
  337. data/src/ruby/lib/grpc/errors.rb +103 -42
  338. data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
  339. data/src/ruby/lib/grpc/generic/interceptors.rb +4 -4
  340. data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
  341. data/src/ruby/lib/grpc/generic/service.rb +5 -4
  342. data/src/ruby/lib/grpc/structs.rb +1 -1
  343. data/src/ruby/lib/grpc/version.rb +1 -1
  344. data/src/ruby/pb/generate_proto_ruby.sh +5 -3
  345. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
  346. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
  347. data/src/ruby/spec/debug_message_spec.rb +134 -0
  348. data/src/ruby/spec/generic/service_spec.rb +2 -0
  349. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +5 -0
  350. data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -0
  351. data/src/ruby/spec/testdata/ca.pem +18 -13
  352. data/src/ruby/spec/testdata/client.key +26 -14
  353. data/src/ruby/spec/testdata/client.pem +18 -12
  354. data/src/ruby/spec/testdata/server1.key +26 -14
  355. data/src/ruby/spec/testdata/server1.pem +20 -14
  356. data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
  357. data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
  358. data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
  359. data/third_party/abseil-cpp/absl/time/clock.h +74 -0
  360. data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
  361. data/third_party/abseil-cpp/absl/time/format.cc +153 -0
  362. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
  363. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
  364. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
  365. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
  366. data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
  367. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
  368. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
  369. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
  370. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
  371. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
  372. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
  373. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
  374. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
  375. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
  376. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
  377. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
  378. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
  379. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
  380. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
  381. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
  382. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
  383. data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
  384. data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
  385. data/third_party/abseil-cpp/absl/time/time.cc +499 -0
  386. data/third_party/abseil-cpp/absl/time/time.h +1584 -0
  387. data/third_party/boringssl-with-bazel/err_data.c +329 -297
  388. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +1 -1
  389. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +7 -5
  390. data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +13 -4
  391. data/third_party/boringssl-with-bazel/src/crypto/crypto.c +11 -0
  392. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519.c +18 -26
  393. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519_tables.h +13 -21
  394. data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/internal.h +14 -22
  395. data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +1 -1
  396. data/third_party/boringssl-with-bazel/src/crypto/dh/dh.c +15 -0
  397. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +10 -0
  398. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +425 -0
  399. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +78 -0
  400. data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +2 -2
  401. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +33 -32
  402. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1 -1
  403. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +2 -1
  404. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +3 -3
  405. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +14 -11
  406. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +8 -8
  407. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +30 -154
  408. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +16 -0
  409. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +289 -117
  410. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +13 -27
  411. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
  412. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +25 -7
  413. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +432 -160
  414. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +63 -71
  415. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -14
  416. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9481 -9485
  417. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +80 -99
  418. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +736 -0
  419. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
  420. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +90 -11
  421. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +125 -148
  422. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +189 -3
  423. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +61 -18
  424. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +2 -2
  425. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
  426. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
  427. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
  428. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
  429. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +41 -5
  430. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +32 -17
  431. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +24 -114
  432. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +4 -0
  433. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +1 -0
  434. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +51 -38
  435. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +15 -1
  436. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +44 -35
  437. data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -12
  438. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +15 -1
  439. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +6 -10
  440. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +16 -0
  441. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +4 -0
  442. data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +4 -0
  443. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +278 -0
  444. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1474 -0
  445. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +720 -0
  446. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +16 -0
  447. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +5 -0
  448. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +4 -3
  449. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -1
  450. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +9 -4
  451. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +20 -0
  452. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
  453. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +16 -0
  454. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +6 -0
  455. data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -0
  456. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +5 -0
  457. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -17
  458. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +31 -0
  459. data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +26 -0
  460. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +172 -77
  461. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +1 -0
  462. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +291 -0
  463. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +5 -3
  464. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -0
  465. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +0 -4
  466. data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +3 -3
  467. data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -4
  468. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +146 -57
  469. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +14 -3
  470. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +28 -20
  471. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +12 -4
  472. data/third_party/boringssl-with-bazel/src/ssl/internal.h +64 -47
  473. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +10 -10
  474. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
  475. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -21
  476. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +29 -0
  477. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -0
  478. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +6 -1
  479. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +13 -2
  480. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +64 -5
  481. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +6 -0
  482. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +6 -2
  483. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +47 -53
  484. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -1
  485. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -27
  486. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +23 -75
  487. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +50 -20
  488. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +63 -25
  489. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +245 -175
  490. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +135 -75
  491. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1593 -1672
  492. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +512 -503
  493. metadata +111 -37
  494. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1754
  495. data/src/core/lib/gprpp/string_view.h +0 -60
  496. data/src/core/tsi/grpc_shadow_boringssl.h +0 -3311
  497. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256.c +0 -1063
@@ -129,6 +129,14 @@ const ASN1_TIME *X509_get0_notBefore(const X509 *x)
129
129
  return x->cert_info->validity->notBefore;
130
130
  }
131
131
 
132
+ ASN1_TIME *X509_getm_notBefore(X509 *x)
133
+ {
134
+ // Note this function takes a const |X509| pointer in OpenSSL. We require
135
+ // non-const as this allows mutating |x|. If it comes up for compatibility,
136
+ // we can relax this.
137
+ return x->cert_info->validity->notBefore;
138
+ }
139
+
132
140
  int X509_set_notAfter(X509 *x, const ASN1_TIME *tm)
133
141
  {
134
142
  ASN1_TIME *in;
@@ -151,6 +159,14 @@ const ASN1_TIME *X509_get0_notAfter(const X509 *x)
151
159
  return x->cert_info->validity->notAfter;
152
160
  }
153
161
 
162
+ ASN1_TIME *X509_getm_notAfter(X509 *x)
163
+ {
164
+ // Note this function takes a const |X509| pointer in OpenSSL. We require
165
+ // non-const as this allows mutating |x|. If it comes up for compatibility,
166
+ // we can relax this.
167
+ return x->cert_info->validity->notAfter;
168
+ }
169
+
154
170
  int X509_set_pubkey(X509 *x, EVP_PKEY *pkey)
155
171
  {
156
172
  if ((x == NULL) || (x->cert_info == NULL))
@@ -2148,6 +2148,11 @@ STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx)
2148
2148
  return ctx->chain;
2149
2149
  }
2150
2150
 
2151
+ STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx)
2152
+ {
2153
+ return ctx->chain;
2154
+ }
2155
+
2151
2156
  STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx)
2152
2157
  {
2153
2158
  if (!ctx->chain)
@@ -177,7 +177,7 @@ X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc)
177
177
  }
178
178
 
179
179
  int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
180
- unsigned char *bytes, int len, int loc,
180
+ const unsigned char *bytes, int len, int loc,
181
181
  int set)
182
182
  {
183
183
  X509_NAME_ENTRY *ne;
@@ -191,7 +191,7 @@ int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
191
191
  }
192
192
 
193
193
  int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
194
- unsigned char *bytes, int len, int loc,
194
+ const unsigned char *bytes, int len, int loc,
195
195
  int set)
196
196
  {
197
197
  X509_NAME_ENTRY *ne;
@@ -298,7 +298,8 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
298
298
  }
299
299
 
300
300
  X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
301
- int type, unsigned char *bytes,
301
+ int type,
302
+ const unsigned char *bytes,
302
303
  int len)
303
304
  {
304
305
  const ASN1_OBJECT *obj = OBJ_nid2obj(nid);
@@ -184,7 +184,7 @@ extern "C" {
184
184
  // A consumer may use this symbol in the preprocessor to temporarily build
185
185
  // against multiple revisions of BoringSSL at the same time. It is not
186
186
  // recommended to do so for longer than is necessary.
187
- #define BORINGSSL_API_VERSION 9
187
+ #define BORINGSSL_API_VERSION 10
188
188
 
189
189
  #if defined(BORINGSSL_SHARED_LIBRARY)
190
190
 
@@ -422,6 +422,10 @@ typedef struct ssl_session_st SSL_SESSION;
422
422
  typedef struct ssl_st SSL;
423
423
  typedef struct ssl_ticket_aead_method_st SSL_TICKET_AEAD_METHOD;
424
424
  typedef struct st_ERR_FNS ERR_FNS;
425
+ typedef struct trust_token_st TRUST_TOKEN;
426
+ typedef struct trust_token_client_st TRUST_TOKEN_CLIENT;
427
+ typedef struct trust_token_issuer_st TRUST_TOKEN_ISSUER;
428
+ typedef struct trust_token_method_st TRUST_TOKEN_METHOD;
425
429
  typedef struct v3_ext_ctx X509V3_CTX;
426
430
  typedef struct x509_attributes_st X509_ATTRIBUTE;
427
431
  typedef struct x509_cert_aux_st X509_CERT_AUX;
@@ -60,12 +60,17 @@ OPENSSL_EXPORT int CRYPTO_has_asm(void);
60
60
  OPENSSL_EXPORT int FIPS_mode(void);
61
61
 
62
62
  // BORINGSSL_self_test triggers the FIPS KAT-based self tests. It returns one on
63
- // success and zero on error. The argument is the integrity hash of the FIPS
64
- // module and may be used to check and write flag files to suppress duplicate
65
- // self-tests. If it is all zeros, no flag file will be checked nor written and
66
- // tests will always be run.
63
+ // success and zero on error.
67
64
  OPENSSL_EXPORT int BORINGSSL_self_test(void);
68
65
 
66
+ // CRYPTO_pre_sandbox_init initializes the crypto library, pre-acquiring some
67
+ // unusual resources to aid running in sandboxed environments. It is safe to
68
+ // call this function multiple times and concurrently from multiple threads.
69
+ //
70
+ // For more details on using BoringSSL in a sandboxed environment, see
71
+ // SANDBOXING.md in the source tree.
72
+ OPENSSL_EXPORT void CRYPTO_pre_sandbox_init(void);
73
+
69
74
 
70
75
  // Deprecated functions.
71
76
 
@@ -86,6 +86,21 @@ OPENSSL_EXPORT int DH_up_ref(DH *dh);
86
86
 
87
87
  // Properties.
88
88
 
89
+ // DH_get0_pub_key returns |dh|'s public key.
90
+ OPENSSL_EXPORT const BIGNUM *DH_get0_pub_key(const DH *dh);
91
+
92
+ // DH_get0_priv_key returns |dh|'s private key, or NULL if |dh| is a public key.
93
+ OPENSSL_EXPORT const BIGNUM *DH_get0_priv_key(const DH *dh);
94
+
95
+ // DH_get0_p returns |dh|'s group modulus.
96
+ OPENSSL_EXPORT const BIGNUM *DH_get0_p(const DH *dh);
97
+
98
+ // DH_get0_q returns the size of |dh|'s subgroup, or NULL if it is unset.
99
+ OPENSSL_EXPORT const BIGNUM *DH_get0_q(const DH *dh);
100
+
101
+ // DH_get0_g returns |dh|'s group generator.
102
+ OPENSSL_EXPORT const BIGNUM *DH_get0_g(const DH *dh);
103
+
89
104
  // DH_get0_key sets |*out_pub_key| and |*out_priv_key|, if non-NULL, to |dh|'s
90
105
  // public and private key, respectively. If |dh| is a public key, the private
91
106
  // key will be set to NULL.
@@ -108,6 +123,11 @@ OPENSSL_EXPORT void DH_get0_pqg(const DH *dh, const BIGNUM **out_p,
108
123
  // |p| and |g| must either be specified or already configured on |dh|.
109
124
  OPENSSL_EXPORT int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
110
125
 
126
+ // DH_set_length sets the number of bits to use for the secret exponent when
127
+ // calling |DH_generate_key| on |dh| and returns one. If unset,
128
+ // |DH_generate_key| will use the bit length of p.
129
+ OPENSSL_EXPORT int DH_set_length(DH *dh, unsigned priv_length);
130
+
111
131
 
112
132
  // Standard parameters.
113
133
 
@@ -83,6 +83,7 @@ OPENSSL_EXPORT const EVP_MD *EVP_sha224(void);
83
83
  OPENSSL_EXPORT const EVP_MD *EVP_sha256(void);
84
84
  OPENSSL_EXPORT const EVP_MD *EVP_sha384(void);
85
85
  OPENSSL_EXPORT const EVP_MD *EVP_sha512(void);
86
+ OPENSSL_EXPORT const EVP_MD *EVP_sha512_256(void);
86
87
 
87
88
  // EVP_md5_sha1 is a TLS-specific |EVP_MD| which computes the concatenation of
88
89
  // MD5 and SHA-1, as used in TLS 1.1 and below.
@@ -94,6 +94,22 @@ OPENSSL_EXPORT int DSA_up_ref(DSA *dsa);
94
94
 
95
95
  // Properties.
96
96
 
97
+ // DSA_get0_pub_key returns |dsa|'s public key.
98
+ OPENSSL_EXPORT const BIGNUM *DSA_get0_pub_key(const DSA *dsa);
99
+
100
+ // DSA_get0_priv_key returns |dsa|'s private key, or NULL if |dsa| is a public
101
+ // key.
102
+ OPENSSL_EXPORT const BIGNUM *DSA_get0_priv_key(const DSA *dsa);
103
+
104
+ // DSA_get0_p returns |dsa|'s group modulus.
105
+ OPENSSL_EXPORT const BIGNUM *DSA_get0_p(const DSA *dsa);
106
+
107
+ // DSA_get0_q returns the size of |dsa|'s subgroup.
108
+ OPENSSL_EXPORT const BIGNUM *DSA_get0_q(const DSA *dsa);
109
+
110
+ // DSA_get0_g returns |dsa|'s group generator.
111
+ OPENSSL_EXPORT const BIGNUM *DSA_get0_g(const DSA *dsa);
112
+
97
113
  // DSA_get0_key sets |*out_pub_key| and |*out_priv_key|, if non-NULL, to |dsa|'s
98
114
  // public and private key, respectively. If |dsa| is a public key, the private
99
115
  // key will be set to NULL.
@@ -106,6 +106,12 @@ OPENSSL_EXPORT ECDSA_SIG *ECDSA_SIG_new(void);
106
106
  // ECDSA_SIG_free frees |sig| its member |BIGNUM|s.
107
107
  OPENSSL_EXPORT void ECDSA_SIG_free(ECDSA_SIG *sig);
108
108
 
109
+ // ECDSA_SIG_get0_r returns the r component of |sig|.
110
+ OPENSSL_EXPORT const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig);
111
+
112
+ // ECDSA_SIG_get0_s returns the s component of |sig|.
113
+ OPENSSL_EXPORT const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig);
114
+
109
115
  // ECDSA_SIG_get0 sets |*out_r| and |*out_s|, if non-NULL, to the two
110
116
  // components of |sig|.
111
117
  OPENSSL_EXPORT void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **out_r,
@@ -319,6 +319,7 @@ enum {
319
319
  ERR_LIB_DIGEST,
320
320
  ERR_LIB_CIPHER,
321
321
  ERR_LIB_HKDF,
322
+ ERR_LIB_TRUST_TOKEN,
322
323
  ERR_LIB_USER,
323
324
  ERR_NUM_LIBS
324
325
  };
@@ -362,6 +363,7 @@ enum {
362
363
  #define ERR_R_DIGEST_LIB ERR_LIB_DIGEST
363
364
  #define ERR_R_CIPHER_LIB ERR_LIB_CIPHER
364
365
  #define ERR_R_HKDF_LIB ERR_LIB_HKDF
366
+ #define ERR_R_TRUST_TOKEN_LIB ERR_LIB_TRUST_TOKEN
365
367
 
366
368
  // The following values are global reason codes. They may occur in any library.
367
369
  #define ERR_R_FATAL 64
@@ -4246,6 +4246,11 @@ extern "C" {
4246
4246
  #define NID_X448 961
4247
4247
  #define OBJ_X448 1L, 3L, 101L, 111L
4248
4248
 
4249
+ #define SN_sha512_256 "SHA512-256"
4250
+ #define LN_sha512_256 "sha512-256"
4251
+ #define NID_sha512_256 962
4252
+ #define OBJ_sha512_256 2L, 16L, 840L, 1L, 101L, 3L, 4L, 2L, 6L
4253
+
4249
4254
 
4250
4255
  #if defined(__cplusplus)
4251
4256
  } /* extern C */
@@ -36,26 +36,12 @@ OPENSSL_EXPORT void RAND_cleanup(void);
36
36
  // Obscure functions.
37
37
 
38
38
  #if !defined(OPENSSL_WINDOWS)
39
- // RAND_set_urandom_fd causes the module to use a copy of |fd| for system
40
- // randomness rather opening /dev/urandom internally. The caller retains
41
- // ownership of |fd| and is at liberty to close it at any time. This is useful
42
- // if, due to a sandbox, /dev/urandom isn't available. If used, it must be
43
- // called before the first call to |RAND_bytes|, and it is mutually exclusive
44
- // with |RAND_enable_fork_unsafe_buffering|.
45
- //
46
- // |RAND_set_urandom_fd| does not buffer any entropy, so it is safe to call
47
- // |fork| at any time after calling |RAND_set_urandom_fd|.
48
- OPENSSL_EXPORT void RAND_set_urandom_fd(int fd);
49
-
50
39
  // RAND_enable_fork_unsafe_buffering enables efficient buffered reading of
51
40
  // /dev/urandom. It adds an overhead of a few KB of memory per thread. It must
52
- // be called before the first call to |RAND_bytes| and it is mutually exclusive
53
- // with calls to |RAND_set_urandom_fd|.
41
+ // be called before the first call to |RAND_bytes|.
54
42
  //
55
- // If |fd| is non-negative then a copy of |fd| will be used rather than opening
56
- // /dev/urandom internally. Like |RAND_set_urandom_fd|, the caller retains
57
- // ownership of |fd|. If |fd| is negative then /dev/urandom will be opened and
58
- // any error from open(2) crashes the address space.
43
+ // |fd| must be -1. We no longer support setting the file descriptor with this
44
+ // function.
59
45
  //
60
46
  // It has an unusual name because the buffer is unsafe across calls to |fork|.
61
47
  // Hence, this function should never be called by libraries.
@@ -99,6 +99,36 @@ OPENSSL_EXPORT int RSA_up_ref(RSA *rsa);
99
99
  // RSA_bits returns the size of |rsa|, in bits.
100
100
  OPENSSL_EXPORT unsigned RSA_bits(const RSA *rsa);
101
101
 
102
+ // RSA_get0_n returns |rsa|'s public modulus.
103
+ OPENSSL_EXPORT const BIGNUM *RSA_get0_n(const RSA *rsa);
104
+
105
+ // RSA_get0_e returns |rsa|'s public exponent.
106
+ OPENSSL_EXPORT const BIGNUM *RSA_get0_e(const RSA *rsa);
107
+
108
+ // RSA_get0_d returns |rsa|'s private exponent. If |rsa| is a public key, this
109
+ // value will be NULL.
110
+ OPENSSL_EXPORT const BIGNUM *RSA_get0_d(const RSA *rsa);
111
+
112
+ // RSA_get0_p returns |rsa|'s first private prime factor. If |rsa| is a public
113
+ // key or lacks its prime factors, this value will be NULL.
114
+ OPENSSL_EXPORT const BIGNUM *RSA_get0_p(const RSA *rsa);
115
+
116
+ // RSA_get0_q returns |rsa|'s second private prime factor. If |rsa| is a public
117
+ // key or lacks its prime factors, this value will be NULL.
118
+ OPENSSL_EXPORT const BIGNUM *RSA_get0_q(const RSA *rsa);
119
+
120
+ // RSA_get0_dmp1 returns d (mod p-1) for |rsa|. If |rsa| is a public key or
121
+ // lacks CRT parameters, this value will be NULL.
122
+ OPENSSL_EXPORT const BIGNUM *RSA_get0_dmp1(const RSA *rsa);
123
+
124
+ // RSA_get0_dmq1 returns d (mod q-1) for |rsa|. If |rsa| is a public key or
125
+ // lacks CRT parameters, this value will be NULL.
126
+ OPENSSL_EXPORT const BIGNUM *RSA_get0_dmq1(const RSA *rsa);
127
+
128
+ // RSA_get0_iqmp returns q^-1 (mod p). If |rsa| is a public key or lacks CRT
129
+ // parameters, this value will be NULL.
130
+ OPENSSL_EXPORT const BIGNUM *RSA_get0_iqmp(const RSA *rsa);
131
+
102
132
  // RSA_get0_key sets |*out_n|, |*out_e|, and |*out_d|, if non-NULL, to |rsa|'s
103
133
  // modulus, public exponent, and private exponent, respectively. If |rsa| is a
104
134
  // public key, the private exponent will be set to NULL.
@@ -711,6 +741,7 @@ struct rsa_st {
711
741
  // |blindings_inuse| from 0 to 1.
712
742
  BN_BLINDING **blindings;
713
743
  unsigned char *blindings_inuse;
744
+ uint64_t blinding_fork_generation;
714
745
 
715
746
  // private_key_frozen is one if the key has been used for a private key
716
747
  // operation and may no longer be mutated.
@@ -261,6 +261,32 @@ struct sha512_state_st {
261
261
  };
262
262
 
263
263
 
264
+ // SHA-512-256
265
+ //
266
+ // See https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf section 5.3.6
267
+
268
+ #define SHA512_256_DIGEST_LENGTH 32
269
+
270
+ // SHA512_256_Init initialises |sha| and returns 1.
271
+ OPENSSL_EXPORT int SHA512_256_Init(SHA512_CTX *sha);
272
+
273
+ // SHA512_256_Update adds |len| bytes from |data| to |sha| and returns 1.
274
+ OPENSSL_EXPORT int SHA512_256_Update(SHA512_CTX *sha, const void *data,
275
+ size_t len);
276
+
277
+ // SHA512_256_Final adds the final padding to |sha| and writes the resulting
278
+ // digest to |out|, which must have at least |SHA512_256_DIGEST_LENGTH| bytes of
279
+ // space. It returns one on success and zero on programmer error.
280
+ OPENSSL_EXPORT int SHA512_256_Final(uint8_t out[SHA512_256_DIGEST_LENGTH],
281
+ SHA512_CTX *sha);
282
+
283
+ // SHA512_256 writes the digest of |len| bytes from |data| to |out| and returns
284
+ // |out|. There must be at least |SHA512_256_DIGEST_LENGTH| bytes of space in
285
+ // |out|.
286
+ OPENSSL_EXPORT uint8_t *SHA512_256(const uint8_t *data, size_t len,
287
+ uint8_t out[SHA512_256_DIGEST_LENGTH]);
288
+
289
+
264
290
  #if defined(__cplusplus)
265
291
  } // extern C
266
292
  #endif
@@ -1098,6 +1098,20 @@ OPENSSL_EXPORT int SSL_set_chain_and_key(
1098
1098
  SSL *ssl, CRYPTO_BUFFER *const *certs, size_t num_certs, EVP_PKEY *privkey,
1099
1099
  const SSL_PRIVATE_KEY_METHOD *privkey_method);
1100
1100
 
1101
+ // SSL_CTX_get0_chain returns the list of |CRYPTO_BUFFER|s that were set by
1102
+ // |SSL_CTX_set_chain_and_key|. Reference counts are not incremented by this
1103
+ // call. The return value may be |NULL| if no chain has been set.
1104
+ //
1105
+ // (Note: if a chain was configured by non-|CRYPTO_BUFFER|-based functions then
1106
+ // the return value is undefined and, even if not NULL, the stack itself may
1107
+ // contain nullptrs. Thus you shouldn't mix this function with
1108
+ // non-|CRYPTO_BUFFER| functions for manipulating the chain.)
1109
+ //
1110
+ // There is no |SSL*| version of this function because connections discard
1111
+ // configuration after handshaking, thus making it of questionable utility.
1112
+ OPENSSL_EXPORT const STACK_OF(CRYPTO_BUFFER)*
1113
+ SSL_CTX_get0_chain(const SSL_CTX *ctx);
1114
+
1101
1115
  // SSL_CTX_use_RSAPrivateKey sets |ctx|'s private key to |rsa|. It returns one
1102
1116
  // on success and zero on failure.
1103
1117
  OPENSSL_EXPORT int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
@@ -2436,7 +2450,7 @@ OPENSSL_EXPORT int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
2436
2450
  // one on success and zero on failure.
2437
2451
  //
2438
2452
  // See
2439
- // https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_load_verify_locations.html
2453
+ // https://www.openssl.org/docs/man1.1.0/man3/SSL_CTX_load_verify_locations.html
2440
2454
  // for documentation on the directory format.
2441
2455
  OPENSSL_EXPORT int SSL_CTX_load_verify_locations(SSL_CTX *ctx,
2442
2456
  const char *ca_file,
@@ -2518,20 +2532,22 @@ OPENSSL_EXPORT int SSL_set0_verify_cert_store(SSL *ssl, X509_STORE *store);
2518
2532
  // reference to |store| will be taken.
2519
2533
  OPENSSL_EXPORT int SSL_set1_verify_cert_store(SSL *ssl, X509_STORE *store);
2520
2534
 
2521
- // SSL_CTX_set_ed25519_enabled configures whether |ctx| advertises support for
2522
- // the Ed25519 signature algorithm when using the default preference list. It is
2523
- // disabled by default and may be enabled if the certificate verifier supports
2524
- // Ed25519.
2525
- OPENSSL_EXPORT void SSL_CTX_set_ed25519_enabled(SSL_CTX *ctx, int enabled);
2526
-
2527
2535
  // SSL_CTX_set_verify_algorithm_prefs configures |ctx| to use |prefs| as the
2528
- // preference list when verifying signature's from the peer's long-term key. It
2536
+ // preference list when verifying signatures from the peer's long-term key. It
2529
2537
  // returns one on zero on error. |prefs| should not include the internal-only
2530
2538
  // value |SSL_SIGN_RSA_PKCS1_MD5_SHA1|.
2531
2539
  OPENSSL_EXPORT int SSL_CTX_set_verify_algorithm_prefs(SSL_CTX *ctx,
2532
2540
  const uint16_t *prefs,
2533
2541
  size_t num_prefs);
2534
2542
 
2543
+ // SSL_set_verify_algorithm_prefs configures |ssl| to use |prefs| as the
2544
+ // preference list when verifying signatures from the peer's long-term key. It
2545
+ // returns one on zero on error. |prefs| should not include the internal-only
2546
+ // value |SSL_SIGN_RSA_PKCS1_MD5_SHA1|.
2547
+ OPENSSL_EXPORT int SSL_set_verify_algorithm_prefs(SSL *ssl,
2548
+ const uint16_t *prefs,
2549
+ size_t num_prefs);
2550
+
2535
2551
 
2536
2552
  // Client certificate CA list.
2537
2553
  //
@@ -3051,38 +3067,6 @@ OPENSSL_EXPORT const char *SSL_get_psk_identity_hint(const SSL *ssl);
3051
3067
  OPENSSL_EXPORT const char *SSL_get_psk_identity(const SSL *ssl);
3052
3068
 
3053
3069
 
3054
- // QUIC transport parameters.
3055
- //
3056
- // draft-ietf-quic-tls defines a new TLS extension quic_transport_parameters
3057
- // used by QUIC for each endpoint to unilaterally declare its supported
3058
- // transport parameters. draft-ietf-quic-transport (section 7.4) defines the
3059
- // contents of that extension (a TransportParameters struct) and describes how
3060
- // to handle it and its semantic meaning.
3061
- //
3062
- // BoringSSL handles this extension as an opaque byte string. The caller is
3063
- // responsible for serializing and parsing it.
3064
-
3065
- // SSL_set_quic_transport_params configures |ssl| to send |params| (of length
3066
- // |params_len|) in the quic_transport_parameters extension in either the
3067
- // ClientHello or EncryptedExtensions handshake message. This extension will
3068
- // only be sent if the TLS version is at least 1.3, and for a server, only if
3069
- // the client sent the extension. The buffer pointed to by |params| only need be
3070
- // valid for the duration of the call to this function. This function returns 1
3071
- // on success and 0 on failure.
3072
- OPENSSL_EXPORT int SSL_set_quic_transport_params(SSL *ssl,
3073
- const uint8_t *params,
3074
- size_t params_len);
3075
-
3076
- // SSL_get_peer_quic_transport_params provides the caller with the value of the
3077
- // quic_transport_parameters extension sent by the peer. A pointer to the buffer
3078
- // containing the TransportParameters will be put in |*out_params|, and its
3079
- // length in |*params_len|. This buffer will be valid for the lifetime of the
3080
- // |SSL|. If no params were received from the peer, |*out_params_len| will be 0.
3081
- OPENSSL_EXPORT void SSL_get_peer_quic_transport_params(const SSL *ssl,
3082
- const uint8_t **out_params,
3083
- size_t *out_params_len);
3084
-
3085
-
3086
3070
  // Delegated credentials.
3087
3071
  //
3088
3072
  // *** EXPERIMENTAL — PRONE TO CHANGE ***
@@ -3131,10 +3115,11 @@ OPENSSL_EXPORT int SSL_delegated_credential_used(const SSL *ssl);
3131
3115
  // When configured for QUIC, |SSL_do_handshake| will drive the handshake as
3132
3116
  // before, but it will not use the configured |BIO|. It will call functions on
3133
3117
  // |SSL_QUIC_METHOD| to configure secrets and send data. If data is needed from
3134
- // the peer, it will return |SSL_ERROR_WANT_READ|. When received, the caller
3135
- // should call |SSL_provide_quic_data| and then |SSL_do_handshake| to continue
3136
- // the handshake. After the handshake is complete, the caller should call
3137
- // |SSL_provide_quic_data| for any post-handshake data, followed by
3118
+ // the peer, it will return |SSL_ERROR_WANT_READ|. As the caller receives data
3119
+ // it can decrypt, it calls |SSL_provide_quic_data|. Subsequent
3120
+ // |SSL_do_handshake| calls will then consume that data and progress the
3121
+ // handshake. After the handshake is complete, the caller should continue to
3122
+ // call |SSL_provide_quic_data| for any post-handshake data, followed by
3138
3123
  // |SSL_process_quic_post_handshake| to process it. It is an error to call
3139
3124
  // |SSL_read| and |SSL_write| in QUIC.
3140
3125
  //
@@ -3145,13 +3130,6 @@ OPENSSL_EXPORT int SSL_delegated_credential_used(const SSL *ssl);
3145
3130
  // confirm the handshake. As a client, |SSL_ERROR_EARLY_DATA_REJECTED| and
3146
3131
  // |SSL_reset_early_data_reject| behave as usual.
3147
3132
  //
3148
- // Note that secrets for an encryption level may be available to QUIC before the
3149
- // level is active in TLS. Callers should use |SSL_quic_read_level| to determine
3150
- // the active read level for |SSL_provide_quic_data|. |SSL_do_handshake| will
3151
- // pass the active write level to |SSL_QUIC_METHOD| when writing data. Callers
3152
- // can use |SSL_quic_write_level| to query the active write level when
3153
- // generating their own errors.
3154
- //
3155
3133
  // See https://tools.ietf.org/html/draft-ietf-quic-tls-15#section-4.1 for more
3156
3134
  // details.
3157
3135
  //
@@ -3160,8 +3138,40 @@ OPENSSL_EXPORT int SSL_delegated_credential_used(const SSL *ssl);
3160
3138
  // |SSL_quic_max_handshake_flight_len| to get the maximum buffer length at each
3161
3139
  // encryption level.
3162
3140
  //
3163
- // Note: 0-RTT support is incomplete and does not currently handle QUIC
3164
- // transport parameters and server SETTINGS frame.
3141
+ // QUIC implementations must additionally configure transport parameters with
3142
+ // |SSL_set_quic_transport_params|. |SSL_get_peer_quic_transport_params| may be
3143
+ // used to query the value received from the peer. BoringSSL handles this
3144
+ // extension as an opaque byte string. The caller is responsible for serializing
3145
+ // and parsing them. See draft-ietf-quic-transport (section 7.3) for details.
3146
+ //
3147
+ // QUIC additionally imposes restrictions on 0-RTT. In particular, the QUIC
3148
+ // transport layer requires that if a server accepts 0-RTT data, then the
3149
+ // transport parameters sent on the resumed connection must not lower any limits
3150
+ // compared to the transport parameters that the server sent on the connection
3151
+ // where the ticket for 0-RTT was issued. In effect, the server must remember
3152
+ // the transport parameters with the ticket. Application protocols running on
3153
+ // QUIC may impose similar restrictions, for example HTTP/3's restrictions on
3154
+ // SETTINGS frames.
3155
+ //
3156
+ // BoringSSL imposes a stricter check on the server to enforce these
3157
+ // restrictions. BoringSSL requires that the transport parameters and
3158
+ // application protocol state be a byte-for-byte match between the connection
3159
+ // where the ticket was issued and the connection where it is used for 0-RTT. If
3160
+ // there is a mismatch, BoringSSL will reject early data (but not reject the
3161
+ // resumption attempt).
3162
+ //
3163
+ // BoringSSL does not perform any client-side checks on the transport
3164
+ // parameters received from a server that also accepted early data. It is up to
3165
+ // the caller to verify that the received transport parameters do not lower any
3166
+ // limits, and to close the QUIC connection if that is not the case. The same
3167
+ // holds for any application protocol state remembered for 0-RTT, e.g. HTTP/3
3168
+ // SETTINGS.
3169
+ //
3170
+ // The transport parameter check happens automatically with
3171
+ // |SSL_set_quic_transport_params|. QUIC servers must set application state via
3172
+ // |SSL_set_quic_early_data_context| to configure the application protocol
3173
+ // check. No other mechanisms are provided to have BoringSSL reject early data
3174
+ // because of QUIC transport or application protocol restrictions.
3165
3175
 
3166
3176
  // ssl_encryption_level_t represents a specific QUIC encryption level used to
3167
3177
  // transmit handshake messages.
@@ -3174,26 +3184,51 @@ enum ssl_encryption_level_t BORINGSSL_ENUM_INT {
3174
3184
 
3175
3185
  // ssl_quic_method_st (aka |SSL_QUIC_METHOD|) describes custom QUIC hooks.
3176
3186
  struct ssl_quic_method_st {
3177
- // set_encryption_secrets configures the read and write secrets for the given
3178
- // encryption level. This function will always be called before an encryption
3179
- // level other than |ssl_encryption_initial| is used. Note, however, that
3180
- // secrets for a level may be configured before TLS is ready to send or accept
3181
- // data at that level.
3187
+ // set_read_secret configures the read secret and cipher suite for the given
3188
+ // encryption level. It returns one on success and zero to terminate the
3189
+ // handshake with an error. It will be called at most once per encryption
3190
+ // level.
3182
3191
  //
3183
- // When reading packets at a given level, the QUIC implementation must send
3184
- // ACKs at the same level, so this function provides read and write secrets
3185
- // together. The exception is |ssl_encryption_early_data|, where secrets are
3186
- // only available in the client to server direction. The other secret will be
3187
- // NULL. The server acknowledges such data at |ssl_encryption_application|,
3188
- // which will be configured in the same |SSL_do_handshake| call.
3192
+ // BoringSSL will not release read keys before QUIC may use them. Once a level
3193
+ // has been initialized, QUIC may begin processing data from it. Handshake
3194
+ // data should be passed to |SSL_provide_quic_data| and application data (if
3195
+ // |level| is |ssl_encryption_early_data| or |ssl_encryption_application|) may
3196
+ // be processed according to the rules of the QUIC protocol.
3189
3197
  //
3190
- // This function should use |SSL_get_current_cipher| to determine the TLS
3191
- // cipher suite.
3198
+ // QUIC ACKs packets at the same encryption level they were received at,
3199
+ // except that client |ssl_encryption_early_data| (0-RTT) packets trigger
3200
+ // server |ssl_encryption_application| (1-RTT) ACKs. BoringSSL will always
3201
+ // install ACK-writing keys with |set_write_secret| before the packet-reading
3202
+ // keys with |set_read_secret|. This ensures the caller can always ACK any
3203
+ // packet it decrypts. Note this means the server installs 1-RTT write keys
3204
+ // before 0-RTT read keys.
3192
3205
  //
3193
- // It returns one on success and zero on error.
3194
- int (*set_encryption_secrets)(SSL *ssl, enum ssl_encryption_level_t level,
3195
- const uint8_t *read_secret,
3196
- const uint8_t *write_secret, size_t secret_len);
3206
+ // The converse is not true. An encryption level may be configured with write
3207
+ // secrets a roundtrip before the corresponding secrets for reading ACKs is
3208
+ // available.
3209
+ int (*set_read_secret)(SSL *ssl, enum ssl_encryption_level_t level,
3210
+ const SSL_CIPHER *cipher, const uint8_t *secret,
3211
+ size_t secret_len);
3212
+ // set_write_secret behaves like |set_read_secret| but configures the write
3213
+ // secret and cipher suite for the given encryption level. It will be called
3214
+ // at most once per encryption level.
3215
+ //
3216
+ // BoringSSL will not release write keys before QUIC may use them. If |level|
3217
+ // is |ssl_encryption_early_data| or |ssl_encryption_application|, QUIC may
3218
+ // begin sending application data at |level|. However, note that BoringSSL
3219
+ // configures server |ssl_encryption_application| write keys before the client
3220
+ // Finished. This allows QUIC to send half-RTT data, but the handshake is not
3221
+ // confirmed at this point and, if requesting client certificates, the client
3222
+ // is not yet authenticated.
3223
+ //
3224
+ // See |set_read_secret| for additional invariants between packets and their
3225
+ // ACKs.
3226
+ //
3227
+ // Note that, on 0-RTT reject, the |ssl_encryption_early_data| write secret
3228
+ // may use a different cipher suite from the other keys.
3229
+ int (*set_write_secret)(SSL *ssl, enum ssl_encryption_level_t level,
3230
+ const SSL_CIPHER *cipher, const uint8_t *secret,
3231
+ size_t secret_len);
3197
3232
  // add_handshake_data adds handshake data to the current flight at the given
3198
3233
  // encryption level. It returns one on success and zero on error.
3199
3234
  //
@@ -3201,6 +3236,9 @@ struct ssl_quic_method_st {
3201
3236
  // single handshake flight may include multiple encryption levels. Callers
3202
3237
  // should defer writing data to the network until |flush_flight| to better
3203
3238
  // pack QUIC packets into transport datagrams.
3239
+ //
3240
+ // If |level| is not |ssl_encryption_initial|, this function will not be
3241
+ // called before |level| is initialized with |set_write_secret|.
3204
3242
  int (*add_handshake_data)(SSL *ssl, enum ssl_encryption_level_t level,
3205
3243
  const uint8_t *data, size_t len);
3206
3244
  // flush_flight is called when the current flight is complete and should be
@@ -3209,6 +3247,9 @@ struct ssl_quic_method_st {
3209
3247
  int (*flush_flight)(SSL *ssl);
3210
3248
  // send_alert sends a fatal alert at the specified encryption level. It
3211
3249
  // returns one on success and zero on error.
3250
+ //
3251
+ // If |level| is not |ssl_encryption_initial|, this function will not be
3252
+ // called before |level| is initialized with |set_write_secret|.
3212
3253
  int (*send_alert)(SSL *ssl, enum ssl_encryption_level_t level, uint8_t alert);
3213
3254
  };
3214
3255
 
@@ -3221,15 +3262,22 @@ OPENSSL_EXPORT size_t SSL_quic_max_handshake_flight_len(
3221
3262
  const SSL *ssl, enum ssl_encryption_level_t level);
3222
3263
 
3223
3264
  // SSL_quic_read_level returns the current read encryption level.
3265
+ //
3266
+ // TODO(davidben): Is it still necessary to expose this function to callers?
3267
+ // QUICHE does not use it.
3224
3268
  OPENSSL_EXPORT enum ssl_encryption_level_t SSL_quic_read_level(const SSL *ssl);
3225
3269
 
3226
3270
  // SSL_quic_write_level returns the current write encryption level.
3271
+ //
3272
+ // TODO(davidben): Is it still necessary to expose this function to callers?
3273
+ // QUICHE does not use it.
3227
3274
  OPENSSL_EXPORT enum ssl_encryption_level_t SSL_quic_write_level(const SSL *ssl);
3228
3275
 
3229
3276
  // SSL_provide_quic_data provides data from QUIC at a particular encryption
3230
- // level |level|. It is an error to call this function outside of the handshake
3231
- // or with an encryption level other than the current read level. It returns one
3232
- // on success and zero on error.
3277
+ // level |level|. It returns one on success and zero on error. Note this
3278
+ // function will return zero if the handshake is not expecting data from |level|
3279
+ // at this time. The QUIC implementation should then close the connection with
3280
+ // an error.
3233
3281
  OPENSSL_EXPORT int SSL_provide_quic_data(SSL *ssl,
3234
3282
  enum ssl_encryption_level_t level,
3235
3283
  const uint8_t *data, size_t len);
@@ -3252,6 +3300,36 @@ OPENSSL_EXPORT int SSL_CTX_set_quic_method(SSL_CTX *ctx,
3252
3300
  OPENSSL_EXPORT int SSL_set_quic_method(SSL *ssl,
3253
3301
  const SSL_QUIC_METHOD *quic_method);
3254
3302
 
3303
+ // SSL_set_quic_transport_params configures |ssl| to send |params| (of length
3304
+ // |params_len|) in the quic_transport_parameters extension in either the
3305
+ // ClientHello or EncryptedExtensions handshake message. It is an error to set
3306
+ // transport parameters if |ssl| is not configured for QUIC. The buffer pointed
3307
+ // to by |params| only need be valid for the duration of the call to this
3308
+ // function. This function returns 1 on success and 0 on failure.
3309
+ OPENSSL_EXPORT int SSL_set_quic_transport_params(SSL *ssl,
3310
+ const uint8_t *params,
3311
+ size_t params_len);
3312
+
3313
+ // SSL_get_peer_quic_transport_params provides the caller with the value of the
3314
+ // quic_transport_parameters extension sent by the peer. A pointer to the buffer
3315
+ // containing the TransportParameters will be put in |*out_params|, and its
3316
+ // length in |*params_len|. This buffer will be valid for the lifetime of the
3317
+ // |SSL|. If no params were received from the peer, |*out_params_len| will be 0.
3318
+ OPENSSL_EXPORT void SSL_get_peer_quic_transport_params(
3319
+ const SSL *ssl, const uint8_t **out_params, size_t *out_params_len);
3320
+
3321
+ // SSL_set_quic_early_data_context configures a context string in QUIC servers
3322
+ // for accepting early data. If a resumption connection offers early data, the
3323
+ // server will check if the value matches that of the connection which minted
3324
+ // the ticket. If not, resumption still succeeds but early data is rejected. For
3325
+ // HTTP/3, this should be the serialized server SETTINGS frame.
3326
+ //
3327
+ // This function may be called before |SSL_do_handshake| or during server
3328
+ // certificate selection. It returns 1 on success and 0 on failure.
3329
+ OPENSSL_EXPORT int SSL_set_quic_early_data_context(SSL *ssl,
3330
+ const uint8_t *context,
3331
+ size_t context_len);
3332
+
3255
3333
 
3256
3334
  // Early data.
3257
3335
  //
@@ -3325,6 +3403,18 @@ OPENSSL_EXPORT int SSL_in_early_data(const SSL *ssl);
3325
3403
  // attempted with |session| if enabled.
3326
3404
  OPENSSL_EXPORT int SSL_SESSION_early_data_capable(const SSL_SESSION *session);
3327
3405
 
3406
+ // SSL_SESSION_copy_without_early_data returns a copy of |session| with early
3407
+ // data disabled. If |session| already does not support early data, it returns
3408
+ // |session| with the reference count increased. The caller takes ownership of
3409
+ // the result and must release it with |SSL_SESSION_free|.
3410
+ //
3411
+ // This function may be used on the client to clear early data support from
3412
+ // existing sessions when the server rejects early data. In particular,
3413
+ // |SSL_R_WRONG_VERSION_ON_EARLY_DATA| requires a fresh connection to retry, and
3414
+ // the client would not want 0-RTT enabled for the next connection attempt.
3415
+ OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_copy_without_early_data(
3416
+ SSL_SESSION *session);
3417
+
3328
3418
  // SSL_early_data_accepted returns whether early data was accepted on the
3329
3419
  // handshake performed by |ssl|.
3330
3420
  OPENSSL_EXPORT int SSL_early_data_accepted(const SSL *ssl);
@@ -3374,8 +3464,10 @@ enum ssl_early_data_reason_t BORINGSSL_ENUM_INT {
3374
3464
  ssl_early_data_token_binding = 11,
3375
3465
  // The client and server ticket age were too far apart.
3376
3466
  ssl_early_data_ticket_age_skew = 12,
3467
+ // QUIC parameters differ between this connection and the original.
3468
+ ssl_early_data_quic_parameter_mismatch = 13,
3377
3469
  // The value of the largest entry.
3378
- ssl_early_data_reason_max_value = ssl_early_data_ticket_age_skew,
3470
+ ssl_early_data_reason_max_value = ssl_early_data_quic_parameter_mismatch,
3379
3471
  };
3380
3472
 
3381
3473
  // SSL_get_early_data_reason returns details why 0-RTT was accepted or rejected
@@ -3436,6 +3528,7 @@ OPENSSL_EXPORT enum ssl_early_data_reason_t SSL_get_early_data_reason(
3436
3528
  #define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE
3437
3529
  #define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY
3438
3530
  #define SSL_AD_CERTIFICATE_REQUIRED TLS1_AD_CERTIFICATE_REQUIRED
3531
+ #define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL
3439
3532
 
3440
3533
  // SSL_alert_type_string_long returns a string description of |value| as an
3441
3534
  // alert type (warning or fatal).
@@ -4211,7 +4304,7 @@ OPENSSL_EXPORT int SSL_set1_sigalgs(SSL *ssl, const int *values,
4211
4304
  // SSL_CTX_set1_sigalgs_list takes a textual specification of a set of signature
4212
4305
  // algorithms and configures them on |ctx|. It returns one on success and zero
4213
4306
  // on error. See
4214
- // https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_set1_sigalgs_list.html for
4307
+ // https://www.openssl.org/docs/man1.1.0/man3/SSL_CTX_set1_sigalgs_list.html for
4215
4308
  // a description of the text format. Also note that TLS 1.3 names (e.g.
4216
4309
  // "rsa_pkcs1_md5_sha1") can also be used (as in OpenSSL, although OpenSSL
4217
4310
  // doesn't document that).
@@ -4224,7 +4317,7 @@ OPENSSL_EXPORT int SSL_CTX_set1_sigalgs_list(SSL_CTX *ctx, const char *str);
4224
4317
  // SSL_set1_sigalgs_list takes a textual specification of a set of signature
4225
4318
  // algorithms and configures them on |ssl|. It returns one on success and zero
4226
4319
  // on error. See
4227
- // https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_set1_sigalgs_list.html for
4320
+ // https://www.openssl.org/docs/man1.1.0/man3/SSL_CTX_set1_sigalgs_list.html for
4228
4321
  // a description of the text format. Also note that TLS 1.3 names (e.g.
4229
4322
  // "rsa_pkcs1_md5_sha1") can also be used (as in OpenSSL, although OpenSSL
4230
4323
  // doesn't document that).
@@ -5018,7 +5111,7 @@ BSSL_NAMESPACE_END
5018
5111
  #define SSL_R_UNSUPPORTED_PROTOCOL_FOR_CUSTOM_KEY 252
5019
5112
  #define SSL_R_NO_COMMON_SIGNATURE_ALGORITHMS 253
5020
5113
  #define SSL_R_DOWNGRADE_DETECTED 254
5021
- #define SSL_R_BUFFERED_MESSAGES_ON_CIPHER_CHANGE 255
5114
+ #define SSL_R_EXCESS_HANDSHAKE_DATA 255
5022
5115
  #define SSL_R_INVALID_COMPRESSION_LIST 256
5023
5116
  #define SSL_R_DUPLICATE_EXTENSION 257
5024
5117
  #define SSL_R_MISSING_KEY_SHARE 258
@@ -5067,6 +5160,8 @@ BSSL_NAMESPACE_END
5067
5160
  #define SSL_R_INVALID_DELEGATED_CREDENTIAL 301
5068
5161
  #define SSL_R_KEY_USAGE_BIT_INCORRECT 302
5069
5162
  #define SSL_R_INCONSISTENT_CLIENT_HELLO 303
5163
+ #define SSL_R_CIPHER_MISMATCH_ON_EARLY_DATA 304
5164
+ #define SSL_R_QUIC_TRANSPORT_PARAMETERS_MISCONFIGURED 305
5070
5165
  #define SSL_R_SSLV3_ALERT_CLOSE_NOTIFY 1000
5071
5166
  #define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010
5072
5167
  #define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020