grpc 1.27.0.pre1 → 1.30.1

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 (972) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +8023 -11437
  3. data/include/grpc/grpc.h +2 -2
  4. data/include/grpc/grpc_security.h +30 -9
  5. data/include/grpc/grpc_security_constants.h +1 -0
  6. data/include/grpc/impl/codegen/grpc_types.h +24 -21
  7. data/include/grpc/impl/codegen/port_platform.h +13 -2
  8. data/include/grpc/impl/codegen/sync.h +5 -3
  9. data/include/grpc/impl/codegen/sync_abseil.h +36 -0
  10. data/include/grpc/module.modulemap +25 -37
  11. data/include/grpc/support/sync_abseil.h +26 -0
  12. data/src/core/ext/filters/client_channel/backend_metric.cc +7 -4
  13. data/src/core/ext/filters/client_channel/client_channel.cc +282 -249
  14. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +31 -47
  15. data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -3
  16. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -2
  17. data/src/core/ext/filters/client_channel/health/health_check_client.cc +7 -22
  18. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  19. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
  20. data/src/core/ext/filters/client_channel/http_proxy.cc +21 -11
  21. data/src/core/ext/filters/client_channel/lb_policy.cc +19 -18
  22. data/src/core/ext/filters/client_channel/lb_policy.h +42 -33
  23. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +83 -0
  24. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +99 -0
  25. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +297 -0
  26. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +83 -0
  27. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +271 -465
  28. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +8 -7
  29. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -2
  30. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +18 -21
  31. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +871 -0
  32. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +10 -14
  33. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +5 -4
  34. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +734 -0
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +148 -98
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +938 -0
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +528 -0
  38. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -2
  39. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +834 -0
  40. data/src/core/ext/filters/client_channel/lb_policy_factory.h +3 -3
  41. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +49 -77
  42. data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
  43. data/src/core/ext/filters/client_channel/local_subchannel_pool.h +2 -1
  44. data/src/core/ext/filters/client_channel/parse_address.cc +22 -21
  45. data/src/core/ext/filters/client_channel/resolver.cc +5 -8
  46. data/src/core/ext/filters/client_channel/resolver.h +12 -14
  47. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +120 -132
  48. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +35 -35
  49. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -7
  50. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +17 -21
  51. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +5 -5
  52. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +72 -117
  53. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +167 -121
  54. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +3 -2
  55. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +3 -2
  56. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +42 -45
  57. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +94 -103
  58. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +0 -4
  59. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -5
  60. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +61 -10
  61. data/src/core/ext/filters/client_channel/resolver_factory.h +2 -2
  62. data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -3
  63. data/src/core/ext/filters/client_channel/resolver_registry.h +8 -8
  64. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +242 -300
  65. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +21 -18
  66. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +56 -206
  67. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +11 -14
  68. data/src/core/ext/filters/client_channel/server_address.h +3 -2
  69. data/src/core/ext/filters/client_channel/service_config.cc +144 -253
  70. data/src/core/ext/filters/client_channel/service_config.h +32 -109
  71. data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -0
  72. data/src/core/ext/filters/client_channel/service_config_parser.cc +87 -0
  73. data/src/core/ext/filters/client_channel/service_config_parser.h +89 -0
  74. data/src/core/ext/filters/client_channel/subchannel.cc +54 -24
  75. data/src/core/ext/filters/client_channel/subchannel.h +35 -11
  76. data/src/core/ext/filters/client_channel/xds/xds_api.cc +1381 -301
  77. data/src/core/ext/filters/client_channel/xds/xds_api.h +211 -152
  78. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +214 -359
  79. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +28 -44
  80. data/src/core/ext/filters/client_channel/xds/xds_channel.h +3 -1
  81. data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +16 -11
  82. data/src/core/ext/filters/client_channel/xds/xds_client.cc +1118 -472
  83. data/src/core/ext/filters/client_channel/xds/xds_client.h +116 -45
  84. data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +59 -135
  85. data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +122 -137
  86. data/src/core/ext/filters/http/client/http_client_filter.cc +23 -28
  87. data/src/core/ext/filters/http/client_authority_filter.cc +4 -4
  88. data/src/core/ext/filters/http/http_filters_plugin.cc +27 -12
  89. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +258 -221
  90. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +358 -0
  91. data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +29 -0
  92. data/src/core/ext/filters/message_size/message_size_filter.cc +38 -44
  93. data/src/core/ext/filters/message_size/message_size_filter.h +5 -5
  94. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -10
  95. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
  96. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +26 -27
  97. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  98. data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
  99. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
  100. data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
  101. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
  102. data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -3
  103. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -3
  104. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +29 -16
  105. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -3
  106. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
  107. data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -2
  108. data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
  109. data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
  110. data/src/core/ext/transport/chttp2/transport/internal.h +14 -21
  111. data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
  112. data/src/core/ext/transport/chttp2/transport/writing.cc +16 -9
  113. data/src/core/ext/transport/inproc/inproc_transport.cc +41 -42
  114. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +17 -0
  115. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +30 -0
  116. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +27 -0
  117. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +54 -0
  118. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +5 -205
  119. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +5 -788
  120. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +114 -0
  121. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +418 -0
  122. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +72 -0
  123. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +197 -0
  124. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +105 -0
  125. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +378 -0
  126. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +5 -362
  127. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +14 -1337
  128. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +403 -0
  129. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +1447 -0
  130. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +30 -8
  131. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +60 -0
  132. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +2 -0
  133. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +2 -0
  134. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +7 -4
  135. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +6 -2
  136. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +35 -0
  137. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +78 -0
  138. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +87 -23
  139. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +262 -62
  140. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +20 -15
  141. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +46 -32
  142. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +34 -0
  143. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +72 -0
  144. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +27 -4
  145. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +70 -0
  146. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +46 -25
  147. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +98 -25
  148. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +2 -0
  149. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +77 -21
  150. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +201 -4
  151. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.c +34 -0
  152. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +89 -0
  153. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +2 -0
  154. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +8 -68
  155. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +14 -201
  156. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +92 -0
  157. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +240 -0
  158. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +2 -71
  159. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +3 -228
  160. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +91 -0
  161. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +266 -0
  162. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +2 -0
  163. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +31 -0
  164. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +53 -0
  165. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +109 -0
  166. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +399 -0
  167. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +18 -0
  168. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +33 -0
  169. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +145 -0
  170. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +527 -0
  171. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +43 -0
  172. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +112 -0
  173. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +30 -0
  174. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +53 -0
  175. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +63 -0
  176. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +199 -0
  177. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +18 -0
  178. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +33 -0
  179. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +815 -0
  180. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +3032 -0
  181. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +59 -0
  182. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +134 -0
  183. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +28 -0
  184. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +53 -0
  185. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +228 -0
  186. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +725 -0
  187. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +316 -0
  188. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +1132 -0
  189. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +33 -0
  190. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +65 -0
  191. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +51 -0
  192. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +125 -0
  193. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +1 -0
  194. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +4 -2
  195. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +4 -0
  196. data/src/core/ext/upb-generated/envoy/type/http.upb.c +1 -0
  197. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +63 -0
  198. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +144 -0
  199. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +53 -0
  200. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +133 -0
  201. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +88 -0
  202. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +258 -0
  203. data/src/core/ext/upb-generated/envoy/type/percent.upb.c +1 -0
  204. data/src/core/ext/upb-generated/envoy/type/range.upb.c +12 -0
  205. data/src/core/ext/upb-generated/envoy/type/range.upb.h +27 -0
  206. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +29 -0
  207. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +62 -0
  208. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +89 -0
  209. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +249 -0
  210. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +9 -8
  211. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +30 -24
  212. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +30 -27
  213. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +64 -52
  214. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +48 -0
  215. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +104 -0
  216. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +17 -0
  217. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +30 -0
  218. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
  219. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +65 -0
  220. data/src/core/ext/upb-generated/validate/validate.upb.c +44 -39
  221. data/src/core/ext/upb-generated/validate/validate.upb.h +155 -119
  222. data/src/core/lib/channel/channel_args.cc +15 -14
  223. data/src/core/lib/channel/channel_args.h +3 -1
  224. data/src/core/lib/channel/channel_stack.h +20 -13
  225. data/src/core/lib/channel/channel_trace.cc +32 -41
  226. data/src/core/lib/channel/channel_trace.h +3 -3
  227. data/src/core/lib/channel/channelz.cc +163 -254
  228. data/src/core/lib/channel/channelz.h +15 -17
  229. data/src/core/lib/channel/channelz_registry.cc +52 -77
  230. data/src/core/lib/channel/channelz_registry.h +4 -4
  231. data/src/core/lib/channel/connected_channel.cc +7 -5
  232. data/src/core/lib/channel/context.h +1 -1
  233. data/src/core/lib/channel/handshaker.cc +11 -13
  234. data/src/core/lib/channel/handshaker.h +4 -2
  235. data/src/core/lib/channel/handshaker_registry.cc +5 -17
  236. data/src/core/lib/channel/status_util.cc +2 -3
  237. data/src/core/lib/compression/message_compress.cc +5 -1
  238. data/src/core/lib/debug/stats.cc +21 -27
  239. data/src/core/lib/debug/stats.h +3 -1
  240. data/src/core/lib/gpr/spinlock.h +2 -3
  241. data/src/core/lib/gpr/string.cc +2 -26
  242. data/src/core/lib/gpr/string.h +0 -16
  243. data/src/core/lib/gpr/sync_abseil.cc +116 -0
  244. data/src/core/lib/gpr/sync_posix.cc +8 -5
  245. data/src/core/lib/gpr/sync_windows.cc +4 -2
  246. data/src/core/lib/gpr/time.cc +4 -0
  247. data/src/core/lib/gpr/time_posix.cc +1 -1
  248. data/src/core/lib/gprpp/atomic.h +6 -6
  249. data/src/core/lib/gprpp/fork.cc +1 -1
  250. data/src/core/lib/gprpp/host_port.cc +30 -36
  251. data/src/core/lib/gprpp/host_port.h +14 -17
  252. data/src/core/lib/gprpp/map.h +5 -11
  253. data/src/core/lib/gprpp/memory.h +2 -6
  254. data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
  255. data/src/core/lib/gprpp/sync.h +9 -0
  256. data/src/core/lib/http/format_request.cc +46 -65
  257. data/src/core/lib/http/httpcli.cc +2 -3
  258. data/src/core/lib/http/httpcli.h +2 -3
  259. data/src/core/lib/http/httpcli_security_connector.cc +5 -5
  260. data/src/core/lib/http/parser.h +2 -3
  261. data/src/core/lib/iomgr/buffer_list.cc +36 -35
  262. data/src/core/lib/iomgr/buffer_list.h +22 -21
  263. data/src/core/lib/iomgr/call_combiner.h +3 -2
  264. data/src/core/lib/iomgr/cfstream_handle.cc +3 -2
  265. data/src/core/lib/iomgr/closure.h +2 -3
  266. data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
  267. data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -3
  268. data/src/core/lib/iomgr/endpoint_pair.h +2 -3
  269. data/src/core/lib/iomgr/error.cc +6 -9
  270. data/src/core/lib/iomgr/error.h +4 -5
  271. data/src/core/lib/iomgr/ev_apple.cc +356 -0
  272. data/src/core/lib/iomgr/ev_apple.h +43 -0
  273. data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -23
  274. data/src/core/lib/iomgr/ev_epollex_linux.cc +14 -7
  275. data/src/core/lib/iomgr/ev_poll_posix.cc +3 -3
  276. data/src/core/lib/iomgr/ev_posix.cc +2 -3
  277. data/src/core/lib/iomgr/exec_ctx.h +14 -2
  278. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -20
  279. data/src/core/lib/iomgr/load_file.cc +1 -0
  280. data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
  281. data/src/core/lib/iomgr/pollset_uv.h +32 -0
  282. data/src/core/lib/iomgr/port.h +1 -0
  283. data/src/core/lib/iomgr/python_util.h +46 -0
  284. data/src/core/lib/iomgr/resolve_address.h +4 -6
  285. data/src/core/lib/iomgr/resolve_address_custom.cc +29 -39
  286. data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
  287. data/src/core/lib/iomgr/resolve_address_posix.cc +10 -11
  288. data/src/core/lib/iomgr/resolve_address_windows.cc +8 -17
  289. data/src/core/lib/iomgr/resource_quota.cc +4 -6
  290. data/src/core/lib/iomgr/sockaddr_utils.cc +23 -29
  291. data/src/core/lib/iomgr/sockaddr_utils.h +9 -14
  292. data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
  293. data/src/core/lib/iomgr/socket_mutator.h +2 -3
  294. data/src/core/lib/iomgr/socket_utils_common_posix.cc +7 -26
  295. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  296. data/src/core/lib/iomgr/tcp_client_cfstream.cc +5 -7
  297. data/src/core/lib/iomgr/tcp_client_posix.cc +25 -22
  298. data/src/core/lib/iomgr/tcp_client_posix.h +6 -6
  299. data/src/core/lib/iomgr/tcp_client_windows.cc +2 -3
  300. data/src/core/lib/iomgr/tcp_custom.cc +2 -3
  301. data/src/core/lib/iomgr/tcp_posix.cc +2 -1
  302. data/src/core/lib/iomgr/tcp_server_custom.cc +5 -9
  303. data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
  304. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -4
  305. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -11
  306. data/src/core/lib/iomgr/tcp_uv.cc +3 -2
  307. data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
  308. data/src/core/lib/iomgr/timer_generic.cc +2 -3
  309. data/src/core/lib/iomgr/timer_generic.h +39 -0
  310. data/src/core/lib/iomgr/timer_heap.h +2 -3
  311. data/src/core/lib/iomgr/udp_server.cc +9 -14
  312. data/src/core/lib/iomgr/work_serializer.cc +155 -0
  313. data/src/core/lib/iomgr/work_serializer.h +65 -0
  314. data/src/core/lib/json/json.h +210 -79
  315. data/src/core/lib/json/json_reader.cc +469 -455
  316. data/src/core/lib/json/json_writer.cc +174 -169
  317. data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
  318. data/src/core/lib/security/credentials/composite/composite_credentials.cc +12 -0
  319. data/src/core/lib/security/credentials/composite/composite_credentials.h +6 -3
  320. data/src/core/lib/security/credentials/credentials.cc +0 -84
  321. data/src/core/lib/security/credentials/credentials.h +8 -59
  322. data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
  323. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +9 -12
  324. data/src/core/lib/security/credentials/iam/iam_credentials.cc +8 -6
  325. data/src/core/lib/security/credentials/iam/iam_credentials.h +4 -0
  326. data/src/core/lib/security/credentials/jwt/json_token.cc +26 -56
  327. data/src/core/lib/security/credentials/jwt/json_token.h +4 -6
  328. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +8 -18
  329. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -0
  330. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +151 -168
  331. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +4 -6
  332. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +91 -60
  333. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +10 -4
  334. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +13 -0
  335. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
  336. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -13
  337. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +40 -12
  338. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +21 -6
  339. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +7 -7
  340. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -2
  341. data/src/core/lib/security/security_connector/local/local_security_connector.cc +6 -8
  342. data/src/core/lib/security/security_connector/security_connector.h +1 -1
  343. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +20 -37
  344. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +4 -6
  345. data/src/core/lib/security/security_connector/ssl_utils.cc +62 -13
  346. data/src/core/lib/security/security_connector/ssl_utils.h +12 -11
  347. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +101 -52
  348. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +32 -6
  349. data/src/core/lib/security/transport/auth_filters.h +0 -5
  350. data/src/core/lib/security/transport/client_auth_filter.cc +1 -2
  351. data/src/core/lib/security/transport/security_handshaker.cc +2 -2
  352. data/src/core/lib/security/util/json_util.cc +22 -15
  353. data/src/core/lib/security/util/json_util.h +2 -2
  354. data/src/core/lib/slice/slice_intern.cc +2 -3
  355. data/src/core/lib/slice/slice_internal.h +14 -0
  356. data/src/core/lib/slice/slice_utils.h +9 -0
  357. data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
  358. data/src/core/lib/surface/call.cc +2 -3
  359. data/src/core/lib/surface/call_log_batch.cc +50 -58
  360. data/src/core/lib/surface/channel.cc +53 -31
  361. data/src/core/lib/surface/channel.h +35 -4
  362. data/src/core/lib/surface/channel_ping.cc +2 -3
  363. data/src/core/lib/surface/completion_queue.cc +33 -33
  364. data/src/core/lib/surface/event_string.cc +18 -25
  365. data/src/core/lib/surface/event_string.h +3 -1
  366. data/src/core/lib/surface/init_secure.cc +1 -4
  367. data/src/core/lib/surface/server.cc +570 -369
  368. data/src/core/lib/surface/server.h +32 -0
  369. data/src/core/lib/surface/version.cc +2 -2
  370. data/src/core/lib/transport/byte_stream.h +7 -2
  371. data/src/core/lib/transport/connectivity_state.cc +7 -6
  372. data/src/core/lib/transport/connectivity_state.h +5 -3
  373. data/src/core/lib/transport/metadata.cc +3 -3
  374. data/src/core/lib/transport/metadata_batch.h +2 -3
  375. data/src/core/lib/transport/static_metadata.h +1 -1
  376. data/src/core/lib/transport/status_conversion.cc +6 -14
  377. data/src/core/lib/transport/transport.cc +2 -3
  378. data/src/core/lib/transport/transport.h +3 -2
  379. data/src/core/lib/transport/transport_op_string.cc +61 -102
  380. data/src/core/lib/uri/uri_parser.h +2 -3
  381. data/src/core/plugin_registry/grpc_plugin_registry.cc +20 -4
  382. data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
  383. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +9 -2
  384. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
  385. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +33 -3
  386. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
  387. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
  388. data/src/core/tsi/fake_transport_security.cc +10 -15
  389. data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -2
  390. data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
  391. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
  392. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -1
  393. data/src/core/tsi/ssl_transport_security.cc +54 -40
  394. data/src/core/tsi/ssl_transport_security.h +8 -8
  395. data/src/core/tsi/ssl_types.h +0 -2
  396. data/src/core/tsi/transport_security.h +6 -9
  397. data/src/core/tsi/transport_security_grpc.h +2 -3
  398. data/src/core/tsi/transport_security_interface.h +3 -3
  399. data/src/ruby/ext/grpc/rb_call.c +9 -1
  400. data/src/ruby/ext/grpc/rb_call_credentials.c +3 -2
  401. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  402. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  403. data/src/ruby/lib/grpc/errors.rb +103 -42
  404. data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
  405. data/src/ruby/lib/grpc/generic/interceptors.rb +4 -4
  406. data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
  407. data/src/ruby/lib/grpc/generic/service.rb +5 -4
  408. data/src/ruby/lib/grpc/structs.rb +1 -1
  409. data/src/ruby/lib/grpc/version.rb +1 -1
  410. data/src/ruby/pb/generate_proto_ruby.sh +5 -3
  411. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
  412. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
  413. data/src/ruby/spec/debug_message_spec.rb +134 -0
  414. data/src/ruby/spec/generic/service_spec.rb +2 -0
  415. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +5 -0
  416. data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -0
  417. data/src/ruby/spec/support/services.rb +10 -4
  418. data/src/ruby/spec/testdata/ca.pem +18 -13
  419. data/src/ruby/spec/testdata/client.key +26 -14
  420. data/src/ruby/spec/testdata/client.pem +18 -12
  421. data/src/ruby/spec/testdata/server1.key +26 -14
  422. data/src/ruby/spec/testdata/server1.pem +20 -14
  423. data/third_party/abseil-cpp/absl/base/attributes.h +13 -1
  424. data/third_party/abseil-cpp/absl/base/config.h +55 -6
  425. data/third_party/abseil-cpp/absl/base/internal/atomic_hook.h +30 -9
  426. data/third_party/abseil-cpp/absl/base/internal/errno_saver.h +43 -0
  427. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +9 -6
  428. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +5 -1
  429. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +2 -2
  430. data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +2 -3
  431. data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +3 -3
  432. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +15 -13
  433. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +12 -0
  434. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +9 -0
  435. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +37 -0
  436. data/third_party/abseil-cpp/absl/base/options.h +9 -12
  437. data/third_party/abseil-cpp/absl/numeric/int128.cc +2 -2
  438. data/third_party/abseil-cpp/absl/numeric/int128.h +1 -1
  439. data/third_party/abseil-cpp/absl/strings/ascii.cc +3 -3
  440. data/third_party/abseil-cpp/absl/strings/ascii.h +4 -3
  441. data/third_party/abseil-cpp/absl/strings/charconv.cc +0 -1
  442. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +2 -2
  443. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +4 -2
  444. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +388 -0
  445. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +432 -0
  446. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +245 -0
  447. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +209 -0
  448. data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +326 -0
  449. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +51 -0
  450. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +415 -0
  451. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +493 -0
  452. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +23 -0
  453. data/third_party/abseil-cpp/absl/strings/internal/str_format/output.cc +72 -0
  454. data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +104 -0
  455. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +334 -0
  456. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +333 -0
  457. data/third_party/abseil-cpp/absl/strings/numbers.cc +54 -5
  458. data/third_party/abseil-cpp/absl/strings/numbers.h +6 -3
  459. data/third_party/abseil-cpp/absl/strings/str_format.h +537 -0
  460. data/third_party/abseil-cpp/absl/strings/string_view.h +31 -24
  461. data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
  462. data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
  463. data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
  464. data/third_party/abseil-cpp/absl/time/clock.h +74 -0
  465. data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
  466. data/third_party/abseil-cpp/absl/time/format.cc +153 -0
  467. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
  468. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
  469. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
  470. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
  471. data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
  472. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
  473. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
  474. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
  475. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
  476. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
  477. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
  478. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
  479. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
  480. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
  481. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
  482. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
  483. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
  484. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
  485. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
  486. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
  487. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
  488. data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
  489. data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
  490. data/third_party/abseil-cpp/absl/time/time.cc +499 -0
  491. data/third_party/abseil-cpp/absl/time/time.h +1584 -0
  492. data/{src/boringssl → third_party/boringssl-with-bazel}/err_data.c +329 -297
  493. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bitstr.c +0 -0
  494. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bool.c +0 -0
  495. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_d2i_fp.c +0 -0
  496. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_dup.c +0 -0
  497. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_enum.c +0 -0
  498. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_gentm.c +0 -0
  499. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_i2d_fp.c +0 -0
  500. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_int.c +0 -0
  501. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_mbstr.c +0 -0
  502. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_object.c +0 -0
  503. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_octet.c +0 -0
  504. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_print.c +0 -0
  505. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_strnid.c +0 -0
  506. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_time.c +3 -4
  507. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_type.c +0 -0
  508. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utctm.c +0 -0
  509. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utf8.c +0 -0
  510. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_lib.c +0 -0
  511. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_locl.h +0 -0
  512. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_par.c +0 -0
  513. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn_pack.c +0 -0
  514. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_enum.c +0 -0
  515. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_int.c +0 -0
  516. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_string.c +0 -0
  517. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_dec.c +0 -0
  518. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_enc.c +0 -0
  519. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_fre.c +0 -0
  520. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_new.c +0 -0
  521. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_typ.c +0 -0
  522. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_utl.c +0 -0
  523. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/time_support.c +0 -0
  524. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/base64/base64.c +0 -0
  525. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio.c +0 -0
  526. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio_mem.c +0 -0
  527. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/connect.c +3 -4
  528. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/fd.c +0 -1
  529. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/file.c +5 -6
  530. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/hexdump.c +0 -0
  531. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/internal.h +0 -0
  532. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/pair.c +0 -1
  533. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/printf.c +0 -0
  534. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/socket.c +0 -0
  535. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/socket_helper.c +0 -0
  536. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/bn_asn1.c +0 -0
  537. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/convert.c +0 -0
  538. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/buf/buf.c +10 -69
  539. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/asn1_compat.c +0 -0
  540. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/ber.c +0 -0
  541. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/cbb.c +41 -2
  542. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/cbs.c +60 -3
  543. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/internal.h +0 -0
  544. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/unicode.c +0 -0
  545. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/chacha/chacha.c +0 -0
  546. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/chacha/internal.h +0 -0
  547. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/cipher_extra.c +0 -0
  548. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/derive_key.c +1 -1
  549. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesccm.c +0 -0
  550. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesctrhmac.c +0 -0
  551. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesgcmsiv.c +8 -0
  552. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_chacha20poly1305.c +0 -0
  553. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_null.c +0 -0
  554. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc2.c +0 -0
  555. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc4.c +0 -0
  556. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_tls.c +0 -0
  557. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/internal.h +0 -0
  558. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/tls_cbc.c +0 -0
  559. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cmac/cmac.c +0 -0
  560. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf.c +0 -0
  561. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf_def.h +0 -0
  562. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/internal.h +0 -0
  563. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-fuchsia.c +0 -0
  564. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-linux.c +0 -0
  565. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm-linux.c +7 -6
  566. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm-linux.h +0 -0
  567. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm.c +0 -0
  568. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-intel.c +13 -4
  569. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-ppc64le.c +0 -0
  570. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/crypto.c +11 -0
  571. data/third_party/{boringssl/third_party/fiat → boringssl-with-bazel/src/crypto/curve25519}/curve25519.c +18 -26
  572. data/third_party/{boringssl/third_party/fiat → boringssl-with-bazel/src/crypto/curve25519}/curve25519_tables.h +13 -21
  573. data/third_party/{boringssl/third_party/fiat → boringssl-with-bazel/src/crypto/curve25519}/internal.h +14 -22
  574. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/curve25519/spake25519.c +1 -1
  575. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/check.c +3 -3
  576. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh.c +16 -2
  577. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh_asn1.c +0 -0
  578. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/params.c +0 -0
  579. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/digest_extra/digest_extra.c +0 -0
  580. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa.c +10 -0
  581. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa_asn1.c +0 -0
  582. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ec_extra/ec_asn1.c +0 -0
  583. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ec_extra/ec_derive.c +2 -3
  584. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +425 -0
  585. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +78 -0
  586. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ecdh_extra/ecdh_extra.c +2 -2
  587. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ecdsa_extra/ecdsa_asn1.c +0 -0
  588. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/engine/engine.c +0 -0
  589. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/err/err.c +39 -38
  590. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/err/internal.h +0 -0
  591. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/digestsign.c +0 -0
  592. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp.c +0 -0
  593. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp_asn1.c +0 -0
  594. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp_ctx.c +0 -0
  595. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/internal.h +0 -0
  596. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_dsa_asn1.c +0 -0
  597. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ec.c +0 -1
  598. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ec_asn1.c +0 -0
  599. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ed25519.c +0 -0
  600. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ed25519_asn1.c +0 -0
  601. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_rsa.c +14 -2
  602. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_rsa_asn1.c +0 -0
  603. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_x25519.c +0 -0
  604. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_x25519_asn1.c +1 -2
  605. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/pbkdf.c +0 -0
  606. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/print.c +0 -0
  607. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/scrypt.c +0 -0
  608. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/sign.c +0 -0
  609. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ex_data.c +0 -0
  610. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.c +108 -0
  611. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1282 -0
  612. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/internal.h +5 -7
  613. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/key_wrap.c +0 -0
  614. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/mode_wrappers.c +0 -2
  615. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bcm.c +4 -1
  616. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/add.c +0 -0
  617. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/asm/x86_64-gcc.c +0 -0
  618. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bn.c +0 -0
  619. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bytes.c +0 -0
  620. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/cmp.c +0 -0
  621. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/ctx.c +0 -0
  622. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/div.c +0 -0
  623. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/div_extra.c +0 -0
  624. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/exponentiation.c +3 -3
  625. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/gcd.c +0 -0
  626. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/gcd_extra.c +0 -0
  627. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/generic.c +0 -0
  628. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/internal.h +14 -11
  629. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/jacobi.c +0 -0
  630. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/montgomery.c +8 -8
  631. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/montgomery_inv.c +0 -0
  632. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/mul.c +30 -154
  633. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/prime.c +11 -12
  634. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/random.c +0 -0
  635. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/rsaz_exp.c +0 -0
  636. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/rsaz_exp.h +0 -0
  637. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/shift.c +0 -0
  638. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/sqrt.c +0 -0
  639. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/aead.c +0 -0
  640. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/cipher.c +0 -0
  641. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/e_aes.c +3 -5
  642. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/e_des.c +0 -0
  643. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/internal.h +0 -0
  644. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/delocate.h +0 -0
  645. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/des.c +0 -0
  646. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/internal.h +0 -0
  647. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/digest.c +0 -0
  648. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/digests.c +16 -0
  649. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/internal.h +0 -0
  650. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/md32_common.h +0 -0
  651. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec.c +289 -117
  652. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec_key.c +14 -28
  653. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
  654. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/felem.c +25 -7
  655. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/internal.h +432 -160
  656. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/oct.c +63 -71
  657. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p224-64.c +5 -14
  658. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9497 -0
  659. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64.c +80 -99
  660. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64.h +0 -0
  661. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +736 -0
  662. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
  663. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +175 -0
  664. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/simple.c +125 -148
  665. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +270 -0
  666. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/util.c +0 -0
  667. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/wnaf.c +61 -18
  668. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ecdh/ecdh.c +2 -2
  669. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
  670. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/fips_shared_support.c +0 -0
  671. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/hmac/hmac.c +0 -0
  672. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/is_fips.c +0 -0
  673. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md4/md4.c +0 -0
  674. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md5/internal.h +0 -0
  675. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md5/md5.c +0 -0
  676. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/cbc.c +0 -0
  677. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/cfb.c +0 -0
  678. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/ctr.c +0 -0
  679. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/gcm.c +45 -193
  680. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +304 -0
  681. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/internal.h +8 -18
  682. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/ofb.c +0 -0
  683. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/polyval.c +0 -0
  684. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/ctrdrbg.c +0 -0
  685. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
  686. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
  687. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
  688. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/internal.h +41 -5
  689. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/rand.c +32 -17
  690. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/urandom.c +24 -114
  691. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/blinding.c +4 -0
  692. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/internal.h +1 -0
  693. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/padding.c +0 -0
  694. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/rsa.c +58 -39
  695. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/rsa_impl.c +72 -49
  696. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/self_check/self_check.c +0 -0
  697. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/internal.h +0 -0
  698. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1-altivec.c +0 -0
  699. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1.c +0 -0
  700. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha256.c +0 -0
  701. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha512.c +44 -35
  702. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/internal.h +0 -0
  703. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/kdf.c +0 -0
  704. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hkdf/hkdf.c +0 -0
  705. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hrss/hrss.c +210 -311
  706. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hrss/internal.h +0 -1
  707. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/internal.h +21 -1
  708. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/lhash/lhash.c +0 -0
  709. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/mem.c +99 -12
  710. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj.c +16 -21
  711. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_dat.h +41 -6
  712. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_xref.c +0 -0
  713. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_all.c +0 -0
  714. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_info.c +0 -1
  715. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_lib.c +7 -7
  716. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_oth.c +0 -1
  717. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_pk8.c +0 -1
  718. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_pkey.c +0 -1
  719. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_x509.c +0 -0
  720. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_xaux.c +0 -0
  721. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/internal.h +0 -0
  722. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/pkcs7.c +0 -0
  723. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/pkcs7_x509.c +1 -1
  724. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/internal.h +0 -0
  725. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/p5_pbev2.c +0 -0
  726. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/pkcs8.c +0 -0
  727. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/pkcs8_x509.c +0 -0
  728. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/internal.h +0 -0
  729. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305.c +2 -2
  730. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305_arm.c +21 -20
  731. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305_vec.c +34 -17
  732. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pool/internal.h +0 -0
  733. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pool/pool.c +1 -2
  734. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/deterministic.c +6 -10
  735. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/forkunsafe.c +0 -0
  736. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/fuchsia.c +0 -0
  737. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/rand_extra.c +0 -0
  738. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/windows.c +16 -0
  739. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rc4/rc4.c +0 -0
  740. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_c11.c +0 -0
  741. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_lock.c +0 -0
  742. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_asn1.c +0 -0
  743. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_print.c +0 -0
  744. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/siphash/siphash.c +3 -1
  745. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/stack/stack.c +0 -0
  746. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread.c +0 -0
  747. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_none.c +0 -0
  748. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_pthread.c +4 -0
  749. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_win.c +4 -0
  750. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +278 -0
  751. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1474 -0
  752. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +720 -0
  753. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_digest.c +0 -0
  754. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_sign.c +0 -0
  755. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_strex.c +0 -0
  756. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_verify.c +0 -1
  757. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/algorithm.c +0 -0
  758. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/asn1_gen.c +0 -0
  759. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/by_dir.c +1 -1
  760. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/by_file.c +0 -1
  761. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/charmap.h +0 -0
  762. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/i2d_pr.c +0 -0
  763. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/internal.h +0 -0
  764. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/rsa_pss.c +0 -0
  765. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_crl.c +0 -0
  766. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_req.c +0 -0
  767. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509.c +0 -0
  768. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509a.c +0 -0
  769. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/vpm_int.h +0 -0
  770. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509.c +0 -0
  771. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_att.c +0 -0
  772. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_cmp.c +0 -1
  773. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_d2.c +0 -0
  774. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_def.c +0 -0
  775. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_ext.c +0 -0
  776. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_lu.c +0 -0
  777. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_obj.c +1 -1
  778. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_r2x.c +0 -1
  779. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_req.c +0 -1
  780. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_set.c +16 -0
  781. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_trs.c +1 -2
  782. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_txt.c +0 -0
  783. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_v3.c +0 -0
  784. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_vfy.c +5 -1
  785. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_vpm.c +3 -4
  786. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509cset.c +0 -0
  787. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509name.c +4 -3
  788. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509rset.c +0 -0
  789. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509spki.c +0 -0
  790. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_algor.c +0 -0
  791. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_all.c +0 -1
  792. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_attrib.c +0 -0
  793. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_crl.c +0 -0
  794. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_exten.c +0 -0
  795. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_info.c +0 -0
  796. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_name.c +0 -0
  797. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pkey.c +0 -0
  798. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pubkey.c +0 -0
  799. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_req.c +0 -0
  800. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_sig.c +0 -0
  801. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_spki.c +0 -0
  802. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_val.c +0 -0
  803. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509.c +0 -0
  804. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509a.c +0 -0
  805. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/ext_dat.h +0 -0
  806. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/internal.h +0 -0
  807. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_cache.c +0 -0
  808. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_data.c +0 -0
  809. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_int.h +0 -0
  810. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_lib.c +0 -0
  811. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_map.c +0 -0
  812. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_node.c +0 -0
  813. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_tree.c +0 -0
  814. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akey.c +0 -0
  815. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akeya.c +0 -0
  816. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_alt.c +3 -3
  817. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bcons.c +0 -0
  818. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bitst.c +0 -0
  819. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_conf.c +0 -0
  820. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_cpols.c +0 -0
  821. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_crld.c +0 -0
  822. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_enum.c +2 -2
  823. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_extku.c +0 -0
  824. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_genn.c +0 -0
  825. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ia5.c +0 -0
  826. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_info.c +4 -5
  827. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_int.c +0 -0
  828. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_lib.c +0 -0
  829. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ncons.c +0 -0
  830. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ocsp.c +0 -0
  831. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pci.c +0 -0
  832. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcia.c +0 -0
  833. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcons.c +0 -0
  834. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pku.c +0 -0
  835. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pmaps.c +0 -0
  836. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_prn.c +0 -0
  837. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_purp.c +2 -3
  838. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_skey.c +0 -0
  839. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_sxnet.c +0 -0
  840. data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_utl.c +11 -12
  841. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/aead.h +0 -0
  842. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/aes.h +0 -0
  843. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/arm_arch.h +0 -0
  844. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1.h +0 -0
  845. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1_mac.h +0 -0
  846. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1t.h +0 -0
  847. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/base.h +5 -1
  848. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/base64.h +0 -0
  849. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bio.h +0 -0
  850. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/blowfish.h +0 -0
  851. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bn.h +32 -20
  852. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buf.h +9 -9
  853. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buffer.h +0 -0
  854. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bytestring.h +34 -0
  855. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cast.h +0 -0
  856. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/chacha.h +0 -0
  857. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cipher.h +0 -0
  858. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cmac.h +0 -0
  859. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/conf.h +0 -0
  860. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cpu.h +0 -0
  861. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/crypto.h +9 -4
  862. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/curve25519.h +0 -0
  863. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/des.h +0 -0
  864. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dh.h +20 -0
  865. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/digest.h +1 -0
  866. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dsa.h +16 -0
  867. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dtls1.h +0 -0
  868. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/e_os2.h +0 -0
  869. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ec.h +11 -4
  870. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ec_key.h +4 -2
  871. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ecdh.h +0 -0
  872. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ecdsa.h +6 -0
  873. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/engine.h +0 -0
  874. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/err.h +13 -9
  875. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/evp.h +20 -0
  876. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ex_data.h +0 -0
  877. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hkdf.h +0 -0
  878. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hmac.h +0 -0
  879. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hrss.h +0 -0
  880. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/is_boringssl.h +0 -0
  881. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/lhash.h +0 -0
  882. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/md4.h +0 -0
  883. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/md5.h +0 -0
  884. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/mem.h +17 -2
  885. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/nid.h +14 -0
  886. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj.h +0 -0
  887. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj_mac.h +0 -0
  888. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/objects.h +0 -0
  889. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslconf.h +0 -0
  890. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslv.h +0 -0
  891. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ossl_typ.h +0 -0
  892. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pem.h +0 -0
  893. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs12.h +0 -0
  894. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs7.h +0 -0
  895. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs8.h +0 -0
  896. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/poly1305.h +5 -7
  897. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pool.h +0 -0
  898. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rand.h +3 -17
  899. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rc4.h +0 -0
  900. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ripemd.h +0 -0
  901. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rsa.h +31 -0
  902. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/safestack.h +0 -0
  903. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/sha.h +26 -0
  904. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/siphash.h +0 -0
  905. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/span.h +0 -0
  906. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/srtp.h +0 -0
  907. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ssl.h +182 -97
  908. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ssl3.h +0 -0
  909. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/stack.h +0 -0
  910. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/thread.h +0 -0
  911. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/tls1.h +1 -3
  912. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +291 -0
  913. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/type_check.h +0 -0
  914. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509.h +5 -3
  915. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509_vfy.h +1 -0
  916. data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509v3.h +0 -0
  917. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/bio_ssl.cc +0 -0
  918. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_both.cc +0 -5
  919. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_lib.cc +3 -3
  920. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_pkt.cc +0 -1
  921. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_srtp.cc +0 -0
  922. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/dtls_method.cc +13 -5
  923. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/dtls_record.cc +0 -0
  924. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handoff.cc +237 -51
  925. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake.cc +19 -7
  926. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake_client.cc +51 -32
  927. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake_server.cc +12 -8
  928. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/internal.h +94 -71
  929. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_both.cc +10 -10
  930. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_lib.cc +4 -5
  931. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_pkt.cc +21 -22
  932. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_aead_ctx.cc +0 -0
  933. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_asn1.cc +30 -2
  934. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_buffer.cc +34 -15
  935. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_cert.cc +4 -1
  936. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_cipher.cc +0 -1
  937. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_file.cc +0 -0
  938. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_key_share.cc +0 -0
  939. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_lib.cc +19 -15
  940. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_privkey.cc +13 -2
  941. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_session.cc +66 -6
  942. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_stat.cc +6 -0
  943. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_transcript.cc +0 -0
  944. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_versions.cc +1 -1
  945. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_x509.cc +0 -0
  946. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/t1_enc.cc +6 -2
  947. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/t1_lib.cc +53 -219
  948. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_both.cc +1 -1
  949. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_client.cc +101 -31
  950. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_enc.cc +28 -76
  951. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_server.cc +111 -104
  952. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls_method.cc +64 -26
  953. data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls_record.cc +7 -2
  954. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_32.h +245 -175
  955. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_64.h +135 -75
  956. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +3147 -0
  957. data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/p256_64.h +512 -503
  958. metadata +648 -503
  959. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1917
  960. data/src/core/lib/gprpp/inlined_vector.h +0 -246
  961. data/src/core/lib/gprpp/optional.h +0 -74
  962. data/src/core/lib/gprpp/string_view.h +0 -169
  963. data/src/core/lib/iomgr/logical_thread.cc +0 -103
  964. data/src/core/lib/iomgr/logical_thread.h +0 -52
  965. data/src/core/lib/json/json.cc +0 -94
  966. data/src/core/tsi/grpc_shadow_boringssl.h +0 -3297
  967. data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +0 -860
  968. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +0 -9501
  969. data/third_party/boringssl/crypto/fipsmodule/ec/scalar.c +0 -96
  970. data/third_party/boringssl/crypto/fipsmodule/ec/simple_mul.c +0 -84
  971. data/third_party/boringssl/third_party/fiat/p256.c +0 -1063
  972. data/third_party/boringssl/third_party/fiat/p256_32.h +0 -3226
@@ -21,246 +21,264 @@
21
21
  #include <string.h>
22
22
 
23
23
  #include <grpc/support/log.h>
24
+ #include <grpc/support/string_util.h>
24
25
 
25
26
  #include "src/core/lib/json/json.h"
26
27
 
27
- typedef enum {
28
- GRPC_JSON_STATE_OBJECT_KEY_BEGIN,
29
- GRPC_JSON_STATE_OBJECT_KEY_STRING,
30
- GRPC_JSON_STATE_OBJECT_KEY_END,
31
- GRPC_JSON_STATE_VALUE_BEGIN,
32
- GRPC_JSON_STATE_VALUE_STRING,
33
- GRPC_JSON_STATE_STRING_ESCAPE,
34
- GRPC_JSON_STATE_STRING_ESCAPE_U1,
35
- GRPC_JSON_STATE_STRING_ESCAPE_U2,
36
- GRPC_JSON_STATE_STRING_ESCAPE_U3,
37
- GRPC_JSON_STATE_STRING_ESCAPE_U4,
38
- GRPC_JSON_STATE_VALUE_NUMBER,
39
- GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL,
40
- GRPC_JSON_STATE_VALUE_NUMBER_ZERO,
41
- GRPC_JSON_STATE_VALUE_NUMBER_DOT,
42
- GRPC_JSON_STATE_VALUE_NUMBER_E,
43
- GRPC_JSON_STATE_VALUE_NUMBER_EPM,
44
- GRPC_JSON_STATE_VALUE_TRUE_R,
45
- GRPC_JSON_STATE_VALUE_TRUE_U,
46
- GRPC_JSON_STATE_VALUE_TRUE_E,
47
- GRPC_JSON_STATE_VALUE_FALSE_A,
48
- GRPC_JSON_STATE_VALUE_FALSE_L,
49
- GRPC_JSON_STATE_VALUE_FALSE_S,
50
- GRPC_JSON_STATE_VALUE_FALSE_E,
51
- GRPC_JSON_STATE_VALUE_NULL_U,
52
- GRPC_JSON_STATE_VALUE_NULL_L1,
53
- GRPC_JSON_STATE_VALUE_NULL_L2,
54
- GRPC_JSON_STATE_VALUE_END,
55
- GRPC_JSON_STATE_END
56
- } grpc_json_reader_state;
57
-
58
- enum {
28
+ #define GRPC_JSON_MAX_DEPTH 255
29
+ #define GRPC_JSON_MAX_ERRORS 16
30
+
31
+ namespace grpc_core {
32
+
33
+ namespace {
34
+
35
+ class JsonReader {
36
+ public:
37
+ static grpc_error* Parse(absl::string_view input, Json* output);
38
+
39
+ private:
40
+ enum class Status {
41
+ GRPC_JSON_DONE, /* The parser finished successfully. */
42
+ GRPC_JSON_PARSE_ERROR, /* The parser found an error in the json stream. */
43
+ GRPC_JSON_INTERNAL_ERROR /* The parser got an internal error. */
44
+ };
45
+
46
+ enum class State {
47
+ GRPC_JSON_STATE_OBJECT_KEY_BEGIN,
48
+ GRPC_JSON_STATE_OBJECT_KEY_STRING,
49
+ GRPC_JSON_STATE_OBJECT_KEY_END,
50
+ GRPC_JSON_STATE_VALUE_BEGIN,
51
+ GRPC_JSON_STATE_VALUE_STRING,
52
+ GRPC_JSON_STATE_STRING_ESCAPE,
53
+ GRPC_JSON_STATE_STRING_ESCAPE_U1,
54
+ GRPC_JSON_STATE_STRING_ESCAPE_U2,
55
+ GRPC_JSON_STATE_STRING_ESCAPE_U3,
56
+ GRPC_JSON_STATE_STRING_ESCAPE_U4,
57
+ GRPC_JSON_STATE_VALUE_NUMBER,
58
+ GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL,
59
+ GRPC_JSON_STATE_VALUE_NUMBER_ZERO,
60
+ GRPC_JSON_STATE_VALUE_NUMBER_DOT,
61
+ GRPC_JSON_STATE_VALUE_NUMBER_E,
62
+ GRPC_JSON_STATE_VALUE_NUMBER_EPM,
63
+ GRPC_JSON_STATE_VALUE_TRUE_R,
64
+ GRPC_JSON_STATE_VALUE_TRUE_U,
65
+ GRPC_JSON_STATE_VALUE_TRUE_E,
66
+ GRPC_JSON_STATE_VALUE_FALSE_A,
67
+ GRPC_JSON_STATE_VALUE_FALSE_L,
68
+ GRPC_JSON_STATE_VALUE_FALSE_S,
69
+ GRPC_JSON_STATE_VALUE_FALSE_E,
70
+ GRPC_JSON_STATE_VALUE_NULL_U,
71
+ GRPC_JSON_STATE_VALUE_NULL_L1,
72
+ GRPC_JSON_STATE_VALUE_NULL_L2,
73
+ GRPC_JSON_STATE_VALUE_END,
74
+ GRPC_JSON_STATE_END
75
+ };
76
+
59
77
  /* The first non-unicode value is 0x110000. But let's pick
60
78
  * a value high enough to start our error codes from. These
61
79
  * values are safe to return from the read_char function.
62
80
  */
63
- GRPC_JSON_READ_CHAR_EOF = 0x7ffffff0,
64
- GRPC_JSON_READ_CHAR_EAGAIN,
65
- GRPC_JSON_READ_CHAR_ERROR
81
+ static constexpr uint32_t GRPC_JSON_READ_CHAR_EOF = 0x7ffffff0;
82
+
83
+ explicit JsonReader(absl::string_view input)
84
+ : original_input_(reinterpret_cast<const uint8_t*>(input.data())),
85
+ input_(original_input_),
86
+ remaining_input_(input.size()) {}
87
+
88
+ Status Run();
89
+ uint32_t ReadChar();
90
+ bool IsComplete();
91
+
92
+ size_t CurrentIndex() const { return input_ - original_input_ - 1; }
93
+
94
+ void StringAddChar(uint32_t c);
95
+ void StringAddUtf32(uint32_t c);
96
+
97
+ Json* CreateAndLinkValue();
98
+ bool StartContainer(Json::Type type);
99
+ void EndContainer();
100
+ void SetKey();
101
+ void SetString();
102
+ bool SetNumber();
103
+ void SetTrue();
104
+ void SetFalse();
105
+ void SetNull();
106
+
107
+ const uint8_t* original_input_;
108
+ const uint8_t* input_;
109
+ size_t remaining_input_;
110
+
111
+ State state_ = State::GRPC_JSON_STATE_VALUE_BEGIN;
112
+ bool escaped_string_was_key_ = false;
113
+ bool container_just_begun_ = false;
114
+ uint16_t unicode_char_ = 0;
115
+ uint16_t unicode_high_surrogate_ = 0;
116
+ std::vector<grpc_error*> errors_;
117
+ bool truncated_errors_ = false;
118
+
119
+ Json root_value_;
120
+ std::vector<Json*> stack_;
121
+
122
+ std::string key_;
123
+ std::string string_;
66
124
  };
67
125
 
68
- typedef struct grpc_json_reader {
69
- /* That structure is fully private, and initialized by grpc_json_reader_init.
70
- * The definition is public so you can put it on your stack.
71
- */
72
-
73
- int depth;
74
- int in_object;
75
- int in_array;
76
- int escaped_string_was_key;
77
- int container_just_begun;
78
- uint16_t unicode_char, unicode_high_surrogate;
79
- grpc_json_reader_state state;
80
-
81
- grpc_json* top;
82
- grpc_json* current_container;
83
- grpc_json* current_value;
84
- uint8_t* input;
85
- uint8_t* key;
86
- uint8_t* string;
87
- uint8_t* string_ptr;
88
- size_t remaining_input;
89
- } grpc_json_reader;
90
-
91
- /* The return type of the parser. */
92
- typedef enum {
93
- GRPC_JSON_DONE, /* The parser finished successfully. */
94
- GRPC_JSON_EAGAIN, /* The parser yields to get more data. */
95
- GRPC_JSON_READ_ERROR, /* The parser passes through a read error. */
96
- GRPC_JSON_PARSE_ERROR, /* The parser found an error in the json stream. */
97
- GRPC_JSON_INTERNAL_ERROR /* The parser got an internal error. */
98
- } grpc_json_reader_status;
99
-
100
- static void json_reader_string_clear(grpc_json_reader* reader) {
101
- if (reader->string) {
102
- GPR_ASSERT(reader->string_ptr < reader->input);
103
- *reader->string_ptr++ = 0;
104
- }
105
- reader->string = reader->string_ptr;
106
- }
107
-
108
- static void json_reader_string_add_char(grpc_json_reader* reader, uint32_t c) {
109
- GPR_ASSERT(reader->string_ptr < reader->input);
110
- GPR_ASSERT(c <= 0xff);
111
- *reader->string_ptr++ = static_cast<uint8_t>(c);
126
+ void JsonReader::StringAddChar(uint32_t c) {
127
+ string_.push_back(static_cast<uint8_t>(c));
112
128
  }
113
129
 
114
- static void json_reader_string_add_utf32(grpc_json_reader* reader, uint32_t c) {
130
+ void JsonReader::StringAddUtf32(uint32_t c) {
115
131
  if (c <= 0x7f) {
116
- json_reader_string_add_char(reader, c);
132
+ StringAddChar(c);
117
133
  } else if (c <= 0x7ff) {
118
134
  uint32_t b1 = 0xc0 | ((c >> 6) & 0x1f);
119
135
  uint32_t b2 = 0x80 | (c & 0x3f);
120
- json_reader_string_add_char(reader, b1);
121
- json_reader_string_add_char(reader, b2);
136
+ StringAddChar(b1);
137
+ StringAddChar(b2);
122
138
  } else if (c <= 0xffff) {
123
139
  uint32_t b1 = 0xe0 | ((c >> 12) & 0x0f);
124
140
  uint32_t b2 = 0x80 | ((c >> 6) & 0x3f);
125
141
  uint32_t b3 = 0x80 | (c & 0x3f);
126
- json_reader_string_add_char(reader, b1);
127
- json_reader_string_add_char(reader, b2);
128
- json_reader_string_add_char(reader, b3);
142
+ StringAddChar(b1);
143
+ StringAddChar(b2);
144
+ StringAddChar(b3);
129
145
  } else if (c <= 0x1fffff) {
130
146
  uint32_t b1 = 0xf0 | ((c >> 18) & 0x07);
131
147
  uint32_t b2 = 0x80 | ((c >> 12) & 0x3f);
132
148
  uint32_t b3 = 0x80 | ((c >> 6) & 0x3f);
133
149
  uint32_t b4 = 0x80 | (c & 0x3f);
134
- json_reader_string_add_char(reader, b1);
135
- json_reader_string_add_char(reader, b2);
136
- json_reader_string_add_char(reader, b3);
137
- json_reader_string_add_char(reader, b4);
150
+ StringAddChar(b1);
151
+ StringAddChar(b2);
152
+ StringAddChar(b3);
153
+ StringAddChar(b4);
138
154
  }
139
155
  }
140
156
 
141
- static uint32_t grpc_json_reader_read_char(grpc_json_reader* reader) {
142
- if (reader->remaining_input == 0) return GRPC_JSON_READ_CHAR_EOF;
143
- uint32_t r = *reader->input++;
144
- reader->remaining_input--;
157
+ uint32_t JsonReader::ReadChar() {
158
+ if (remaining_input_ == 0) return GRPC_JSON_READ_CHAR_EOF;
159
+ const uint32_t r = *input_++;
160
+ --remaining_input_;
145
161
  if (r == 0) {
146
- reader->remaining_input = 0;
162
+ remaining_input_ = 0;
147
163
  return GRPC_JSON_READ_CHAR_EOF;
148
164
  }
149
165
  return r;
150
166
  }
151
167
 
152
- /* Helper function to create a new grpc_json object and link it into
153
- * our tree-in-progress inside our opaque structure.
154
- */
155
- static grpc_json* json_create_and_link(grpc_json_reader* reader,
156
- grpc_json_type type) {
157
- grpc_json* json = grpc_json_create(type);
158
- json->parent = reader->current_container;
159
- json->prev = reader->current_value;
160
- reader->current_value = json;
161
- if (json->prev) {
162
- json->prev->next = json;
163
- }
164
- if (json->parent) {
165
- if (!json->parent->child) {
166
- json->parent->child = json;
167
- }
168
- if (json->parent->type == GRPC_JSON_OBJECT) {
169
- json->key = reinterpret_cast<char*>(reader->key);
168
+ Json* JsonReader::CreateAndLinkValue() {
169
+ Json* value;
170
+ if (stack_.empty()) {
171
+ value = &root_value_;
172
+ } else {
173
+ Json* parent = stack_.back();
174
+ if (parent->type() == Json::Type::OBJECT) {
175
+ if (parent->object_value().find(key_) != parent->object_value().end()) {
176
+ if (errors_.size() == GRPC_JSON_MAX_ERRORS) {
177
+ truncated_errors_ = true;
178
+ } else {
179
+ char* msg;
180
+ gpr_asprintf(&msg, "duplicate key \"%s\" at index %" PRIuPTR,
181
+ key_.c_str(), CurrentIndex());
182
+ errors_.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
183
+ gpr_free(msg);
184
+ }
185
+ }
186
+ value = &(*parent->mutable_object())[std::move(key_)];
187
+ } else {
188
+ GPR_ASSERT(parent->type() == Json::Type::ARRAY);
189
+ parent->mutable_array()->emplace_back();
190
+ value = &parent->mutable_array()->back();
170
191
  }
171
192
  }
172
- if (!reader->top) {
173
- reader->top = json;
174
- }
175
- return json;
193
+ return value;
176
194
  }
177
195
 
178
- static void json_reader_container_begins(grpc_json_reader* reader,
179
- grpc_json_type type) {
180
- GPR_ASSERT(type == GRPC_JSON_ARRAY || type == GRPC_JSON_OBJECT);
181
- grpc_json* container = json_create_and_link(reader, type);
182
- reader->current_container = container;
183
- reader->current_value = nullptr;
184
- }
185
-
186
- static grpc_json_type grpc_json_reader_container_ends(
187
- grpc_json_reader* reader) {
188
- grpc_json_type container_type = GRPC_JSON_TOP_LEVEL;
189
- GPR_ASSERT(reader->current_container);
190
- reader->current_value = reader->current_container;
191
- reader->current_container = reader->current_container->parent;
192
- if (reader->current_container) {
193
- container_type = reader->current_container->type;
196
+ bool JsonReader::StartContainer(Json::Type type) {
197
+ if (stack_.size() == GRPC_JSON_MAX_DEPTH) {
198
+ if (errors_.size() == GRPC_JSON_MAX_ERRORS) {
199
+ truncated_errors_ = true;
200
+ } else {
201
+ char* msg;
202
+ gpr_asprintf(&msg, "exceeded max stack depth (%d) at index %" PRIuPTR,
203
+ GRPC_JSON_MAX_DEPTH, CurrentIndex());
204
+ errors_.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
205
+ gpr_free(msg);
206
+ }
207
+ return false;
194
208
  }
195
- return container_type;
209
+ Json* value = CreateAndLinkValue();
210
+ if (type == Json::Type::OBJECT) {
211
+ *value = Json::Object();
212
+ } else {
213
+ GPR_ASSERT(type == Json::Type::ARRAY);
214
+ *value = Json::Array();
215
+ }
216
+ stack_.push_back(value);
217
+ return true;
196
218
  }
197
219
 
198
- static void json_reader_set_key(grpc_json_reader* reader) {
199
- reader->key = reader->string;
220
+ void JsonReader::EndContainer() {
221
+ GPR_ASSERT(!stack_.empty());
222
+ stack_.pop_back();
200
223
  }
201
224
 
202
- static void json_reader_set_string(grpc_json_reader* reader) {
203
- grpc_json* json = json_create_and_link(reader, GRPC_JSON_STRING);
204
- json->value = reinterpret_cast<char*>(reader->string);
225
+ void JsonReader::SetKey() {
226
+ key_ = std::move(string_);
227
+ string_.clear();
205
228
  }
206
229
 
207
- static int json_reader_set_number(grpc_json_reader* reader) {
208
- grpc_json* json = json_create_and_link(reader, GRPC_JSON_NUMBER);
209
- json->value = reinterpret_cast<char*>(reader->string);
210
- return 1;
230
+ void JsonReader::SetString() {
231
+ Json* value = CreateAndLinkValue();
232
+ *value = std::move(string_);
233
+ string_.clear();
211
234
  }
212
235
 
213
- static void json_reader_set_true(grpc_json_reader* reader) {
214
- json_create_and_link(reader, GRPC_JSON_TRUE);
236
+ bool JsonReader::SetNumber() {
237
+ Json* value = CreateAndLinkValue();
238
+ *value = Json(string_, /*is_number=*/true);
239
+ string_.clear();
240
+ return true;
215
241
  }
216
242
 
217
- static void json_reader_set_false(grpc_json_reader* reader) {
218
- json_create_and_link(reader, GRPC_JSON_FALSE);
243
+ void JsonReader::SetTrue() {
244
+ Json* value = CreateAndLinkValue();
245
+ *value = true;
246
+ string_.clear();
219
247
  }
220
248
 
221
- static void json_reader_set_null(grpc_json_reader* reader) {
222
- json_create_and_link(reader, GRPC_JSON_NULL);
249
+ void JsonReader::SetFalse() {
250
+ Json* value = CreateAndLinkValue();
251
+ *value = false;
252
+ string_.clear();
223
253
  }
224
254
 
225
- static int json_reader_is_complete(grpc_json_reader* reader) {
226
- return ((reader->depth == 0) &&
227
- ((reader->state == GRPC_JSON_STATE_END) ||
228
- (reader->state == GRPC_JSON_STATE_VALUE_END)));
255
+ void JsonReader::SetNull() { CreateAndLinkValue(); }
256
+
257
+ bool JsonReader::IsComplete() {
258
+ return (stack_.empty() && (state_ == State::GRPC_JSON_STATE_END ||
259
+ state_ == State::GRPC_JSON_STATE_VALUE_END));
229
260
  }
230
261
 
231
262
  /* Call this function to start parsing the input. It will return the following:
232
263
  * . GRPC_JSON_DONE if the input got eof, and the parsing finished
233
264
  * successfully.
234
- * . GRPC_JSON_EAGAIN if the read_char function returned again. Call the
235
- * parser again as needed. It is okay to call the parser in polling mode,
236
- * although a bit dull.
237
- * . GRPC_JSON_READ_ERROR if the read_char function returned an error. The
238
- * state isn't broken however, and the function can be called again if the
239
- * error has been corrected. But please use the EAGAIN feature instead for
240
- * consistency.
241
265
  * . GRPC_JSON_PARSE_ERROR if the input was somehow invalid.
242
266
  * . GRPC_JSON_INTERNAL_ERROR if the parser somehow ended into an invalid
243
267
  * internal state.
244
268
  */
245
- static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
246
- uint32_t c, success;
269
+ JsonReader::Status JsonReader::Run() {
270
+ uint32_t c;
247
271
 
248
272
  /* This state-machine is a strict implementation of ECMA-404 */
249
- for (;;) {
250
- c = grpc_json_reader_read_char(reader);
273
+ while (true) {
274
+ c = ReadChar();
251
275
  switch (c) {
252
- /* Let's process the error cases first. */
253
- case GRPC_JSON_READ_CHAR_ERROR:
254
- return GRPC_JSON_READ_ERROR;
255
-
256
- case GRPC_JSON_READ_CHAR_EAGAIN:
257
- return GRPC_JSON_EAGAIN;
258
-
276
+ /* Let's process the error case first. */
259
277
  case GRPC_JSON_READ_CHAR_EOF:
260
- if (json_reader_is_complete(reader)) {
261
- return GRPC_JSON_DONE;
278
+ if (IsComplete()) {
279
+ return Status::GRPC_JSON_DONE;
262
280
  } else {
263
- return GRPC_JSON_PARSE_ERROR;
281
+ return Status::GRPC_JSON_PARSE_ERROR;
264
282
  }
265
283
  break;
266
284
 
@@ -269,34 +287,33 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
269
287
  case '\t':
270
288
  case '\n':
271
289
  case '\r':
272
- switch (reader->state) {
273
- case GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
274
- case GRPC_JSON_STATE_OBJECT_KEY_END:
275
- case GRPC_JSON_STATE_VALUE_BEGIN:
276
- case GRPC_JSON_STATE_VALUE_END:
277
- case GRPC_JSON_STATE_END:
278
- break;
279
-
280
- case GRPC_JSON_STATE_OBJECT_KEY_STRING:
281
- case GRPC_JSON_STATE_VALUE_STRING:
282
- if (c != ' ') return GRPC_JSON_PARSE_ERROR;
283
- if (reader->unicode_high_surrogate != 0)
284
- return GRPC_JSON_PARSE_ERROR;
285
- json_reader_string_add_char(reader, c);
290
+ switch (state_) {
291
+ case State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
292
+ case State::GRPC_JSON_STATE_OBJECT_KEY_END:
293
+ case State::GRPC_JSON_STATE_VALUE_BEGIN:
294
+ case State::GRPC_JSON_STATE_VALUE_END:
295
+ case State::GRPC_JSON_STATE_END:
296
+ break;
297
+
298
+ case State::GRPC_JSON_STATE_OBJECT_KEY_STRING:
299
+ case State::GRPC_JSON_STATE_VALUE_STRING:
300
+ if (c != ' ') return Status::GRPC_JSON_PARSE_ERROR;
301
+ if (unicode_high_surrogate_ != 0) {
302
+ return Status::GRPC_JSON_PARSE_ERROR;
303
+ }
304
+ StringAddChar(c);
286
305
  break;
287
306
 
288
- case GRPC_JSON_STATE_VALUE_NUMBER:
289
- case GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
290
- case GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
291
- case GRPC_JSON_STATE_VALUE_NUMBER_EPM:
292
- success = static_cast<uint32_t>(json_reader_set_number(reader));
293
- if (!success) return GRPC_JSON_PARSE_ERROR;
294
- json_reader_string_clear(reader);
295
- reader->state = GRPC_JSON_STATE_VALUE_END;
307
+ case State::GRPC_JSON_STATE_VALUE_NUMBER:
308
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
309
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
310
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_EPM:
311
+ if (!SetNumber()) return Status::GRPC_JSON_PARSE_ERROR;
312
+ state_ = State::GRPC_JSON_STATE_VALUE_END;
296
313
  break;
297
314
 
298
315
  default:
299
- return GRPC_JSON_PARSE_ERROR;
316
+ return Status::GRPC_JSON_PARSE_ERROR;
300
317
  }
301
318
  break;
302
319
 
@@ -304,182 +321,171 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
304
321
  case ',':
305
322
  case '}':
306
323
  case ']':
307
- switch (reader->state) {
308
- case GRPC_JSON_STATE_OBJECT_KEY_STRING:
309
- case GRPC_JSON_STATE_VALUE_STRING:
310
- if (reader->unicode_high_surrogate != 0) {
311
- return GRPC_JSON_PARSE_ERROR;
324
+ switch (state_) {
325
+ case State::GRPC_JSON_STATE_OBJECT_KEY_STRING:
326
+ case State::GRPC_JSON_STATE_VALUE_STRING:
327
+ if (unicode_high_surrogate_ != 0) {
328
+ return Status::GRPC_JSON_PARSE_ERROR;
312
329
  }
313
- json_reader_string_add_char(reader, c);
314
- break;
315
-
316
- case GRPC_JSON_STATE_VALUE_NUMBER:
317
- case GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
318
- case GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
319
- case GRPC_JSON_STATE_VALUE_NUMBER_EPM:
320
- if (reader->depth == 0) {
321
- return GRPC_JSON_PARSE_ERROR;
322
- } else if ((c == '}') && !reader->in_object) {
323
- return GRPC_JSON_PARSE_ERROR;
324
- } else if ((c == ']') && !reader->in_array) {
325
- return GRPC_JSON_PARSE_ERROR;
330
+ StringAddChar(c);
331
+ break;
332
+
333
+ case State::GRPC_JSON_STATE_VALUE_NUMBER:
334
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
335
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
336
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_EPM:
337
+ if (stack_.empty()) {
338
+ return Status::GRPC_JSON_PARSE_ERROR;
339
+ } else if (c == '}' &&
340
+ stack_.back()->type() != Json::Type::OBJECT) {
341
+ return Status::GRPC_JSON_PARSE_ERROR;
342
+ return Status::GRPC_JSON_PARSE_ERROR;
343
+ } else if (c == ']' && stack_.back()->type() != Json::Type::ARRAY) {
344
+ return Status::GRPC_JSON_PARSE_ERROR;
326
345
  }
327
- success = static_cast<uint32_t>(json_reader_set_number(reader));
328
- if (!success) return GRPC_JSON_PARSE_ERROR;
329
- json_reader_string_clear(reader);
330
- reader->state = GRPC_JSON_STATE_VALUE_END;
346
+ if (!SetNumber()) return Status::GRPC_JSON_PARSE_ERROR;
347
+ state_ = State::GRPC_JSON_STATE_VALUE_END;
331
348
  /* The missing break here is intentional. */
332
349
  /* fallthrough */
333
350
 
334
- case GRPC_JSON_STATE_VALUE_END:
335
- case GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
336
- case GRPC_JSON_STATE_VALUE_BEGIN:
351
+ case State::GRPC_JSON_STATE_VALUE_END:
352
+ case State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
353
+ case State::GRPC_JSON_STATE_VALUE_BEGIN:
337
354
  if (c == ',') {
338
- if (reader->state != GRPC_JSON_STATE_VALUE_END) {
339
- return GRPC_JSON_PARSE_ERROR;
355
+ if (state_ != State::GRPC_JSON_STATE_VALUE_END) {
356
+ return Status::GRPC_JSON_PARSE_ERROR;
340
357
  }
341
- if (reader->in_object) {
342
- reader->state = GRPC_JSON_STATE_OBJECT_KEY_BEGIN;
343
- } else if (reader->in_array) {
344
- reader->state = GRPC_JSON_STATE_VALUE_BEGIN;
358
+ if (!stack_.empty() &&
359
+ stack_.back()->type() == Json::Type::OBJECT) {
360
+ state_ = State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN;
361
+ } else if (!stack_.empty() &&
362
+ stack_.back()->type() == Json::Type::ARRAY) {
363
+ state_ = State::GRPC_JSON_STATE_VALUE_BEGIN;
345
364
  } else {
346
- return GRPC_JSON_PARSE_ERROR;
365
+ return Status::GRPC_JSON_PARSE_ERROR;
347
366
  }
348
367
  } else {
349
- if (reader->depth-- == 0) return GRPC_JSON_PARSE_ERROR;
350
- if ((c == '}') && !reader->in_object) {
351
- return GRPC_JSON_PARSE_ERROR;
368
+ if (stack_.empty()) {
369
+ return Status::GRPC_JSON_PARSE_ERROR;
370
+ }
371
+ if (c == '}' && stack_.back()->type() != Json::Type::OBJECT) {
372
+ return Status::GRPC_JSON_PARSE_ERROR;
352
373
  }
353
- if ((c == '}') &&
354
- (reader->state == GRPC_JSON_STATE_OBJECT_KEY_BEGIN) &&
355
- !reader->container_just_begun) {
356
- return GRPC_JSON_PARSE_ERROR;
374
+ if (c == '}' &&
375
+ state_ == State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN &&
376
+ !container_just_begun_) {
377
+ return Status::GRPC_JSON_PARSE_ERROR;
357
378
  }
358
- if ((c == ']') && !reader->in_array) return GRPC_JSON_PARSE_ERROR;
359
- if ((c == ']') &&
360
- (reader->state == GRPC_JSON_STATE_VALUE_BEGIN) &&
361
- !reader->container_just_begun) {
362
- return GRPC_JSON_PARSE_ERROR;
379
+ if (c == ']' && stack_.back()->type() != Json::Type::ARRAY) {
380
+ return Status::GRPC_JSON_PARSE_ERROR;
363
381
  }
364
- reader->state = GRPC_JSON_STATE_VALUE_END;
365
- switch (grpc_json_reader_container_ends(reader)) {
366
- case GRPC_JSON_OBJECT:
367
- reader->in_object = 1;
368
- reader->in_array = 0;
369
- break;
370
- case GRPC_JSON_ARRAY:
371
- reader->in_object = 0;
372
- reader->in_array = 1;
373
- break;
374
- case GRPC_JSON_TOP_LEVEL:
375
- GPR_ASSERT(reader->depth == 0);
376
- reader->in_object = 0;
377
- reader->in_array = 0;
378
- reader->state = GRPC_JSON_STATE_END;
379
- break;
380
- default:
381
- GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
382
+ if (c == ']' && state_ == State::GRPC_JSON_STATE_VALUE_BEGIN &&
383
+ !container_just_begun_) {
384
+ return Status::GRPC_JSON_PARSE_ERROR;
385
+ }
386
+ state_ = State::GRPC_JSON_STATE_VALUE_END;
387
+ EndContainer();
388
+ if (stack_.empty()) {
389
+ state_ = State::GRPC_JSON_STATE_END;
382
390
  }
383
391
  }
384
392
  break;
385
393
 
386
394
  default:
387
- return GRPC_JSON_PARSE_ERROR;
395
+ return Status::GRPC_JSON_PARSE_ERROR;
388
396
  }
389
397
  break;
390
398
 
391
399
  /* In-string escaping. */
392
400
  case '\\':
393
- switch (reader->state) {
394
- case GRPC_JSON_STATE_OBJECT_KEY_STRING:
395
- reader->escaped_string_was_key = 1;
396
- reader->state = GRPC_JSON_STATE_STRING_ESCAPE;
401
+ switch (state_) {
402
+ case State::GRPC_JSON_STATE_OBJECT_KEY_STRING:
403
+ escaped_string_was_key_ = true;
404
+ state_ = State::GRPC_JSON_STATE_STRING_ESCAPE;
397
405
  break;
398
406
 
399
- case GRPC_JSON_STATE_VALUE_STRING:
400
- reader->escaped_string_was_key = 0;
401
- reader->state = GRPC_JSON_STATE_STRING_ESCAPE;
407
+ case State::GRPC_JSON_STATE_VALUE_STRING:
408
+ escaped_string_was_key_ = false;
409
+ state_ = State::GRPC_JSON_STATE_STRING_ESCAPE;
402
410
  break;
403
411
 
404
412
  /* This is the \\ case. */
405
- case GRPC_JSON_STATE_STRING_ESCAPE:
406
- if (reader->unicode_high_surrogate != 0)
407
- return GRPC_JSON_PARSE_ERROR;
408
- json_reader_string_add_char(reader, '\\');
409
- if (reader->escaped_string_was_key) {
410
- reader->state = GRPC_JSON_STATE_OBJECT_KEY_STRING;
413
+ case State::GRPC_JSON_STATE_STRING_ESCAPE:
414
+ if (unicode_high_surrogate_ != 0)
415
+ return Status::GRPC_JSON_PARSE_ERROR;
416
+ StringAddChar('\\');
417
+ if (escaped_string_was_key_) {
418
+ state_ = State::GRPC_JSON_STATE_OBJECT_KEY_STRING;
411
419
  } else {
412
- reader->state = GRPC_JSON_STATE_VALUE_STRING;
420
+ state_ = State::GRPC_JSON_STATE_VALUE_STRING;
413
421
  }
414
422
  break;
415
423
 
416
424
  default:
417
- return GRPC_JSON_PARSE_ERROR;
425
+ return Status::GRPC_JSON_PARSE_ERROR;
418
426
  }
419
427
  break;
420
428
 
421
429
  default:
422
- reader->container_just_begun = 0;
423
- switch (reader->state) {
424
- case GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
425
- if (c != '"') return GRPC_JSON_PARSE_ERROR;
426
- reader->state = GRPC_JSON_STATE_OBJECT_KEY_STRING;
430
+ container_just_begun_ = false;
431
+ switch (state_) {
432
+ case State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
433
+ if (c != '"') return Status::GRPC_JSON_PARSE_ERROR;
434
+ state_ = State::GRPC_JSON_STATE_OBJECT_KEY_STRING;
427
435
  break;
428
436
 
429
- case GRPC_JSON_STATE_OBJECT_KEY_STRING:
430
- if (reader->unicode_high_surrogate != 0) {
431
- return GRPC_JSON_PARSE_ERROR;
437
+ case State::GRPC_JSON_STATE_OBJECT_KEY_STRING:
438
+ if (unicode_high_surrogate_ != 0) {
439
+ return Status::GRPC_JSON_PARSE_ERROR;
432
440
  }
433
441
  if (c == '"') {
434
- reader->state = GRPC_JSON_STATE_OBJECT_KEY_END;
435
- json_reader_set_key(reader);
436
- json_reader_string_clear(reader);
442
+ state_ = State::GRPC_JSON_STATE_OBJECT_KEY_END;
443
+ SetKey();
437
444
  } else {
438
- if (c < 32) return GRPC_JSON_PARSE_ERROR;
439
- json_reader_string_add_char(reader, c);
445
+ if (c < 32) return Status::GRPC_JSON_PARSE_ERROR;
446
+ StringAddChar(c);
440
447
  }
441
448
  break;
442
449
 
443
- case GRPC_JSON_STATE_VALUE_STRING:
444
- if (reader->unicode_high_surrogate != 0) {
445
- return GRPC_JSON_PARSE_ERROR;
450
+ case State::GRPC_JSON_STATE_VALUE_STRING:
451
+ if (unicode_high_surrogate_ != 0) {
452
+ return Status::GRPC_JSON_PARSE_ERROR;
446
453
  }
447
454
  if (c == '"') {
448
- reader->state = GRPC_JSON_STATE_VALUE_END;
449
- json_reader_set_string(reader);
450
- json_reader_string_clear(reader);
455
+ state_ = State::GRPC_JSON_STATE_VALUE_END;
456
+ SetString();
451
457
  } else {
452
- if (c < 32) return GRPC_JSON_PARSE_ERROR;
453
- json_reader_string_add_char(reader, c);
458
+ if (c < 32) return Status::GRPC_JSON_PARSE_ERROR;
459
+ StringAddChar(c);
454
460
  }
455
461
  break;
456
462
 
457
- case GRPC_JSON_STATE_OBJECT_KEY_END:
458
- if (c != ':') return GRPC_JSON_PARSE_ERROR;
459
- reader->state = GRPC_JSON_STATE_VALUE_BEGIN;
463
+ case State::GRPC_JSON_STATE_OBJECT_KEY_END:
464
+ if (c != ':') return Status::GRPC_JSON_PARSE_ERROR;
465
+ state_ = State::GRPC_JSON_STATE_VALUE_BEGIN;
460
466
  break;
461
467
 
462
- case GRPC_JSON_STATE_VALUE_BEGIN:
468
+ case State::GRPC_JSON_STATE_VALUE_BEGIN:
463
469
  switch (c) {
464
470
  case 't':
465
- reader->state = GRPC_JSON_STATE_VALUE_TRUE_R;
471
+ state_ = State::GRPC_JSON_STATE_VALUE_TRUE_R;
466
472
  break;
467
473
 
468
474
  case 'f':
469
- reader->state = GRPC_JSON_STATE_VALUE_FALSE_A;
475
+ state_ = State::GRPC_JSON_STATE_VALUE_FALSE_A;
470
476
  break;
471
477
 
472
478
  case 'n':
473
- reader->state = GRPC_JSON_STATE_VALUE_NULL_U;
479
+ state_ = State::GRPC_JSON_STATE_VALUE_NULL_U;
474
480
  break;
475
481
 
476
482
  case '"':
477
- reader->state = GRPC_JSON_STATE_VALUE_STRING;
483
+ state_ = State::GRPC_JSON_STATE_VALUE_STRING;
478
484
  break;
479
485
 
480
486
  case '0':
481
- json_reader_string_add_char(reader, c);
482
- reader->state = GRPC_JSON_STATE_VALUE_NUMBER_ZERO;
487
+ StringAddChar(c);
488
+ state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_ZERO;
483
489
  break;
484
490
 
485
491
  case '1':
@@ -492,73 +498,71 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
492
498
  case '8':
493
499
  case '9':
494
500
  case '-':
495
- json_reader_string_add_char(reader, c);
496
- reader->state = GRPC_JSON_STATE_VALUE_NUMBER;
501
+ StringAddChar(c);
502
+ state_ = State::GRPC_JSON_STATE_VALUE_NUMBER;
497
503
  break;
498
504
 
499
505
  case '{':
500
- reader->container_just_begun = 1;
501
- json_reader_container_begins(reader, GRPC_JSON_OBJECT);
502
- reader->depth++;
503
- reader->state = GRPC_JSON_STATE_OBJECT_KEY_BEGIN;
504
- reader->in_object = 1;
505
- reader->in_array = 0;
506
+ container_just_begun_ = true;
507
+ if (!StartContainer(Json::Type::OBJECT)) {
508
+ return Status::GRPC_JSON_PARSE_ERROR;
509
+ }
510
+ state_ = State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN;
506
511
  break;
507
512
 
508
513
  case '[':
509
- reader->container_just_begun = 1;
510
- json_reader_container_begins(reader, GRPC_JSON_ARRAY);
511
- reader->depth++;
512
- reader->in_object = 0;
513
- reader->in_array = 1;
514
+ container_just_begun_ = true;
515
+ if (!StartContainer(Json::Type::ARRAY)) {
516
+ return Status::GRPC_JSON_PARSE_ERROR;
517
+ }
514
518
  break;
515
519
  default:
516
- return GRPC_JSON_PARSE_ERROR;
520
+ return Status::GRPC_JSON_PARSE_ERROR;
517
521
  }
518
522
  break;
519
523
 
520
- case GRPC_JSON_STATE_STRING_ESCAPE:
521
- if (reader->escaped_string_was_key) {
522
- reader->state = GRPC_JSON_STATE_OBJECT_KEY_STRING;
524
+ case State::GRPC_JSON_STATE_STRING_ESCAPE:
525
+ if (escaped_string_was_key_) {
526
+ state_ = State::GRPC_JSON_STATE_OBJECT_KEY_STRING;
523
527
  } else {
524
- reader->state = GRPC_JSON_STATE_VALUE_STRING;
528
+ state_ = State::GRPC_JSON_STATE_VALUE_STRING;
525
529
  }
526
- if (reader->unicode_high_surrogate && c != 'u') {
527
- return GRPC_JSON_PARSE_ERROR;
530
+ if (unicode_high_surrogate_ && c != 'u') {
531
+ return Status::GRPC_JSON_PARSE_ERROR;
528
532
  }
529
533
  switch (c) {
530
534
  case '"':
531
535
  case '/':
532
- json_reader_string_add_char(reader, c);
536
+ StringAddChar(c);
533
537
  break;
534
538
  case 'b':
535
- json_reader_string_add_char(reader, '\b');
539
+ StringAddChar('\b');
536
540
  break;
537
541
  case 'f':
538
- json_reader_string_add_char(reader, '\f');
542
+ StringAddChar('\f');
539
543
  break;
540
544
  case 'n':
541
- json_reader_string_add_char(reader, '\n');
545
+ StringAddChar('\n');
542
546
  break;
543
547
  case 'r':
544
- json_reader_string_add_char(reader, '\r');
548
+ StringAddChar('\r');
545
549
  break;
546
550
  case 't':
547
- json_reader_string_add_char(reader, '\t');
551
+ StringAddChar('\t');
548
552
  break;
549
553
  case 'u':
550
- reader->state = GRPC_JSON_STATE_STRING_ESCAPE_U1;
551
- reader->unicode_char = 0;
554
+ state_ = State::GRPC_JSON_STATE_STRING_ESCAPE_U1;
555
+ unicode_char_ = 0;
552
556
  break;
553
557
  default:
554
- return GRPC_JSON_PARSE_ERROR;
558
+ return Status::GRPC_JSON_PARSE_ERROR;
555
559
  }
556
560
  break;
557
561
 
558
- case GRPC_JSON_STATE_STRING_ESCAPE_U1:
559
- case GRPC_JSON_STATE_STRING_ESCAPE_U2:
560
- case GRPC_JSON_STATE_STRING_ESCAPE_U3:
561
- case GRPC_JSON_STATE_STRING_ESCAPE_U4:
562
+ case State::GRPC_JSON_STATE_STRING_ESCAPE_U1:
563
+ case State::GRPC_JSON_STATE_STRING_ESCAPE_U2:
564
+ case State::GRPC_JSON_STATE_STRING_ESCAPE_U3:
565
+ case State::GRPC_JSON_STATE_STRING_ESCAPE_U4:
562
566
  if ((c >= '0') && (c <= '9')) {
563
567
  c -= '0';
564
568
  } else if ((c >= 'A') && (c <= 'F')) {
@@ -566,62 +570,60 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
566
570
  } else if ((c >= 'a') && (c <= 'f')) {
567
571
  c -= 'a' - 10;
568
572
  } else {
569
- return GRPC_JSON_PARSE_ERROR;
573
+ return Status::GRPC_JSON_PARSE_ERROR;
570
574
  }
571
- reader->unicode_char =
572
- static_cast<uint16_t>(reader->unicode_char << 4);
573
- reader->unicode_char =
574
- static_cast<uint16_t>(reader->unicode_char | c);
575
-
576
- switch (reader->state) {
577
- case GRPC_JSON_STATE_STRING_ESCAPE_U1:
578
- reader->state = GRPC_JSON_STATE_STRING_ESCAPE_U2;
575
+ unicode_char_ = static_cast<uint16_t>(unicode_char_ << 4);
576
+ unicode_char_ = static_cast<uint16_t>(unicode_char_ | c);
577
+
578
+ switch (state_) {
579
+ case State::GRPC_JSON_STATE_STRING_ESCAPE_U1:
580
+ state_ = State::GRPC_JSON_STATE_STRING_ESCAPE_U2;
579
581
  break;
580
- case GRPC_JSON_STATE_STRING_ESCAPE_U2:
581
- reader->state = GRPC_JSON_STATE_STRING_ESCAPE_U3;
582
+ case State::GRPC_JSON_STATE_STRING_ESCAPE_U2:
583
+ state_ = State::GRPC_JSON_STATE_STRING_ESCAPE_U3;
582
584
  break;
583
- case GRPC_JSON_STATE_STRING_ESCAPE_U3:
584
- reader->state = GRPC_JSON_STATE_STRING_ESCAPE_U4;
585
+ case State::GRPC_JSON_STATE_STRING_ESCAPE_U3:
586
+ state_ = State::GRPC_JSON_STATE_STRING_ESCAPE_U4;
585
587
  break;
586
- case GRPC_JSON_STATE_STRING_ESCAPE_U4:
588
+ case State::GRPC_JSON_STATE_STRING_ESCAPE_U4:
587
589
  /* See grpc_json_writer_escape_string to have a description
588
590
  * of what's going on here.
589
591
  */
590
- if ((reader->unicode_char & 0xfc00) == 0xd800) {
592
+ if ((unicode_char_ & 0xfc00) == 0xd800) {
591
593
  /* high surrogate utf-16 */
592
- if (reader->unicode_high_surrogate != 0)
593
- return GRPC_JSON_PARSE_ERROR;
594
- reader->unicode_high_surrogate = reader->unicode_char;
595
- } else if ((reader->unicode_char & 0xfc00) == 0xdc00) {
594
+ if (unicode_high_surrogate_ != 0)
595
+ return Status::GRPC_JSON_PARSE_ERROR;
596
+ unicode_high_surrogate_ = unicode_char_;
597
+ } else if ((unicode_char_ & 0xfc00) == 0xdc00) {
596
598
  /* low surrogate utf-16 */
597
599
  uint32_t utf32;
598
- if (reader->unicode_high_surrogate == 0)
599
- return GRPC_JSON_PARSE_ERROR;
600
+ if (unicode_high_surrogate_ == 0)
601
+ return Status::GRPC_JSON_PARSE_ERROR;
600
602
  utf32 = 0x10000;
601
603
  utf32 += static_cast<uint32_t>(
602
- (reader->unicode_high_surrogate - 0xd800) * 0x400);
603
- utf32 += static_cast<uint32_t>(reader->unicode_char - 0xdc00);
604
- json_reader_string_add_utf32(reader, utf32);
605
- reader->unicode_high_surrogate = 0;
604
+ (unicode_high_surrogate_ - 0xd800) * 0x400);
605
+ utf32 += static_cast<uint32_t>(unicode_char_ - 0xdc00);
606
+ StringAddUtf32(utf32);
607
+ unicode_high_surrogate_ = 0;
606
608
  } else {
607
609
  /* anything else */
608
- if (reader->unicode_high_surrogate != 0)
609
- return GRPC_JSON_PARSE_ERROR;
610
- json_reader_string_add_utf32(reader, reader->unicode_char);
610
+ if (unicode_high_surrogate_ != 0)
611
+ return Status::GRPC_JSON_PARSE_ERROR;
612
+ StringAddUtf32(unicode_char_);
611
613
  }
612
- if (reader->escaped_string_was_key) {
613
- reader->state = GRPC_JSON_STATE_OBJECT_KEY_STRING;
614
+ if (escaped_string_was_key_) {
615
+ state_ = State::GRPC_JSON_STATE_OBJECT_KEY_STRING;
614
616
  } else {
615
- reader->state = GRPC_JSON_STATE_VALUE_STRING;
617
+ state_ = State::GRPC_JSON_STATE_VALUE_STRING;
616
618
  }
617
619
  break;
618
620
  default:
619
- GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
621
+ GPR_UNREACHABLE_CODE(return Status::GRPC_JSON_INTERNAL_ERROR);
620
622
  }
621
623
  break;
622
624
 
623
- case GRPC_JSON_STATE_VALUE_NUMBER:
624
- json_reader_string_add_char(reader, c);
625
+ case State::GRPC_JSON_STATE_VALUE_NUMBER:
626
+ StringAddChar(c);
625
627
  switch (c) {
626
628
  case '0':
627
629
  case '1':
@@ -636,18 +638,18 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
636
638
  break;
637
639
  case 'e':
638
640
  case 'E':
639
- reader->state = GRPC_JSON_STATE_VALUE_NUMBER_E;
641
+ state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_E;
640
642
  break;
641
643
  case '.':
642
- reader->state = GRPC_JSON_STATE_VALUE_NUMBER_DOT;
644
+ state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_DOT;
643
645
  break;
644
646
  default:
645
- return GRPC_JSON_PARSE_ERROR;
647
+ return Status::GRPC_JSON_PARSE_ERROR;
646
648
  }
647
649
  break;
648
650
 
649
- case GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
650
- json_reader_string_add_char(reader, c);
651
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
652
+ StringAddChar(c);
651
653
  switch (c) {
652
654
  case '0':
653
655
  case '1':
@@ -662,21 +664,21 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
662
664
  break;
663
665
  case 'e':
664
666
  case 'E':
665
- reader->state = GRPC_JSON_STATE_VALUE_NUMBER_E;
667
+ state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_E;
666
668
  break;
667
669
  default:
668
- return GRPC_JSON_PARSE_ERROR;
670
+ return Status::GRPC_JSON_PARSE_ERROR;
669
671
  }
670
672
  break;
671
673
 
672
- case GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
673
- if (c != '.') return GRPC_JSON_PARSE_ERROR;
674
- json_reader_string_add_char(reader, c);
675
- reader->state = GRPC_JSON_STATE_VALUE_NUMBER_DOT;
674
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
675
+ if (c != '.') return Status::GRPC_JSON_PARSE_ERROR;
676
+ StringAddChar(c);
677
+ state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_DOT;
676
678
  break;
677
679
 
678
- case GRPC_JSON_STATE_VALUE_NUMBER_DOT:
679
- json_reader_string_add_char(reader, c);
680
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_DOT:
681
+ StringAddChar(c);
680
682
  switch (c) {
681
683
  case '0':
682
684
  case '1':
@@ -688,15 +690,15 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
688
690
  case '7':
689
691
  case '8':
690
692
  case '9':
691
- reader->state = GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL;
693
+ state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL;
692
694
  break;
693
695
  default:
694
- return GRPC_JSON_PARSE_ERROR;
696
+ return Status::GRPC_JSON_PARSE_ERROR;
695
697
  }
696
698
  break;
697
699
 
698
- case GRPC_JSON_STATE_VALUE_NUMBER_E:
699
- json_reader_string_add_char(reader, c);
700
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_E:
701
+ StringAddChar(c);
700
702
  switch (c) {
701
703
  case '0':
702
704
  case '1':
@@ -710,15 +712,15 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
710
712
  case '9':
711
713
  case '+':
712
714
  case '-':
713
- reader->state = GRPC_JSON_STATE_VALUE_NUMBER_EPM;
715
+ state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_EPM;
714
716
  break;
715
717
  default:
716
- return GRPC_JSON_PARSE_ERROR;
718
+ return Status::GRPC_JSON_PARSE_ERROR;
717
719
  }
718
720
  break;
719
721
 
720
- case GRPC_JSON_STATE_VALUE_NUMBER_EPM:
721
- json_reader_string_add_char(reader, c);
722
+ case State::GRPC_JSON_STATE_VALUE_NUMBER_EPM:
723
+ StringAddChar(c);
722
724
  switch (c) {
723
725
  case '0':
724
726
  case '1':
@@ -732,110 +734,122 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
732
734
  case '9':
733
735
  break;
734
736
  default:
735
- return GRPC_JSON_PARSE_ERROR;
737
+ return Status::GRPC_JSON_PARSE_ERROR;
736
738
  }
737
739
  break;
738
740
 
739
- case GRPC_JSON_STATE_VALUE_TRUE_R:
740
- if (c != 'r') return GRPC_JSON_PARSE_ERROR;
741
- reader->state = GRPC_JSON_STATE_VALUE_TRUE_U;
741
+ case State::GRPC_JSON_STATE_VALUE_TRUE_R:
742
+ if (c != 'r') return Status::GRPC_JSON_PARSE_ERROR;
743
+ state_ = State::GRPC_JSON_STATE_VALUE_TRUE_U;
742
744
  break;
743
745
 
744
- case GRPC_JSON_STATE_VALUE_TRUE_U:
745
- if (c != 'u') return GRPC_JSON_PARSE_ERROR;
746
- reader->state = GRPC_JSON_STATE_VALUE_TRUE_E;
746
+ case State::GRPC_JSON_STATE_VALUE_TRUE_U:
747
+ if (c != 'u') return Status::GRPC_JSON_PARSE_ERROR;
748
+ state_ = State::GRPC_JSON_STATE_VALUE_TRUE_E;
747
749
  break;
748
750
 
749
- case GRPC_JSON_STATE_VALUE_TRUE_E:
750
- if (c != 'e') return GRPC_JSON_PARSE_ERROR;
751
- json_reader_set_true(reader);
752
- reader->state = GRPC_JSON_STATE_VALUE_END;
751
+ case State::GRPC_JSON_STATE_VALUE_TRUE_E:
752
+ if (c != 'e') return Status::GRPC_JSON_PARSE_ERROR;
753
+ SetTrue();
754
+ state_ = State::GRPC_JSON_STATE_VALUE_END;
753
755
  break;
754
756
 
755
- case GRPC_JSON_STATE_VALUE_FALSE_A:
756
- if (c != 'a') return GRPC_JSON_PARSE_ERROR;
757
- reader->state = GRPC_JSON_STATE_VALUE_FALSE_L;
757
+ case State::GRPC_JSON_STATE_VALUE_FALSE_A:
758
+ if (c != 'a') return Status::GRPC_JSON_PARSE_ERROR;
759
+ state_ = State::GRPC_JSON_STATE_VALUE_FALSE_L;
758
760
  break;
759
761
 
760
- case GRPC_JSON_STATE_VALUE_FALSE_L:
761
- if (c != 'l') return GRPC_JSON_PARSE_ERROR;
762
- reader->state = GRPC_JSON_STATE_VALUE_FALSE_S;
762
+ case State::GRPC_JSON_STATE_VALUE_FALSE_L:
763
+ if (c != 'l') return Status::GRPC_JSON_PARSE_ERROR;
764
+ state_ = State::GRPC_JSON_STATE_VALUE_FALSE_S;
763
765
  break;
764
766
 
765
- case GRPC_JSON_STATE_VALUE_FALSE_S:
766
- if (c != 's') return GRPC_JSON_PARSE_ERROR;
767
- reader->state = GRPC_JSON_STATE_VALUE_FALSE_E;
767
+ case State::GRPC_JSON_STATE_VALUE_FALSE_S:
768
+ if (c != 's') return Status::GRPC_JSON_PARSE_ERROR;
769
+ state_ = State::GRPC_JSON_STATE_VALUE_FALSE_E;
768
770
  break;
769
771
 
770
- case GRPC_JSON_STATE_VALUE_FALSE_E:
771
- if (c != 'e') return GRPC_JSON_PARSE_ERROR;
772
- json_reader_set_false(reader);
773
- reader->state = GRPC_JSON_STATE_VALUE_END;
772
+ case State::GRPC_JSON_STATE_VALUE_FALSE_E:
773
+ if (c != 'e') return Status::GRPC_JSON_PARSE_ERROR;
774
+ SetFalse();
775
+ state_ = State::GRPC_JSON_STATE_VALUE_END;
774
776
  break;
775
777
 
776
- case GRPC_JSON_STATE_VALUE_NULL_U:
777
- if (c != 'u') return GRPC_JSON_PARSE_ERROR;
778
- reader->state = GRPC_JSON_STATE_VALUE_NULL_L1;
778
+ case State::GRPC_JSON_STATE_VALUE_NULL_U:
779
+ if (c != 'u') return Status::GRPC_JSON_PARSE_ERROR;
780
+ state_ = State::GRPC_JSON_STATE_VALUE_NULL_L1;
779
781
  break;
780
782
 
781
- case GRPC_JSON_STATE_VALUE_NULL_L1:
782
- if (c != 'l') return GRPC_JSON_PARSE_ERROR;
783
- reader->state = GRPC_JSON_STATE_VALUE_NULL_L2;
783
+ case State::GRPC_JSON_STATE_VALUE_NULL_L1:
784
+ if (c != 'l') return Status::GRPC_JSON_PARSE_ERROR;
785
+ state_ = State::GRPC_JSON_STATE_VALUE_NULL_L2;
784
786
  break;
785
787
 
786
- case GRPC_JSON_STATE_VALUE_NULL_L2:
787
- if (c != 'l') return GRPC_JSON_PARSE_ERROR;
788
- json_reader_set_null(reader);
789
- reader->state = GRPC_JSON_STATE_VALUE_END;
788
+ case State::GRPC_JSON_STATE_VALUE_NULL_L2:
789
+ if (c != 'l') return Status::GRPC_JSON_PARSE_ERROR;
790
+ SetNull();
791
+ state_ = State::GRPC_JSON_STATE_VALUE_END;
790
792
  break;
791
793
 
792
794
  /* All of the VALUE_END cases are handled in the specialized case
793
795
  * above. */
794
- case GRPC_JSON_STATE_VALUE_END:
796
+ case State::GRPC_JSON_STATE_VALUE_END:
795
797
  switch (c) {
796
798
  case ',':
797
799
  case '}':
798
800
  case ']':
799
- GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
801
+ GPR_UNREACHABLE_CODE(return Status::GRPC_JSON_INTERNAL_ERROR);
800
802
  break;
801
803
 
802
804
  default:
803
- return GRPC_JSON_PARSE_ERROR;
805
+ return Status::GRPC_JSON_PARSE_ERROR;
804
806
  }
805
807
  break;
806
808
 
807
- case GRPC_JSON_STATE_END:
808
- return GRPC_JSON_PARSE_ERROR;
809
+ case State::GRPC_JSON_STATE_END:
810
+ return Status::GRPC_JSON_PARSE_ERROR;
809
811
  }
810
812
  }
811
813
  }
812
814
 
813
- GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
815
+ GPR_UNREACHABLE_CODE(return Status::GRPC_JSON_INTERNAL_ERROR);
814
816
  }
815
817
 
816
- /* And finally, let's define our public API. */
817
- grpc_json* grpc_json_parse_string_with_len(char* input, size_t size) {
818
- if (input == nullptr) return nullptr;
819
- // Initialize reader.
820
- grpc_json_reader reader;
821
- memset(&reader, 0, sizeof(reader));
822
- reader.string_ptr = reader.input = reinterpret_cast<uint8_t*>(input);
823
- reader.remaining_input = size;
824
- json_reader_string_clear(&reader);
825
- reader.state = GRPC_JSON_STATE_VALUE_BEGIN;
826
- // Perform read.
827
- grpc_json_reader_status status = grpc_json_reader_run(&reader);
828
- // Process results.
829
- grpc_json* json = reader.top;
830
- if ((status != GRPC_JSON_DONE) && json != nullptr) {
831
- grpc_json_destroy(json);
832
- json = nullptr;
818
+ grpc_error* JsonReader::Parse(absl::string_view input, Json* output) {
819
+ JsonReader reader(input);
820
+ Status status = reader.Run();
821
+ if (reader.truncated_errors_) {
822
+ reader.errors_.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
823
+ "too many errors encountered during JSON parsing -- fix reported "
824
+ "errors and try again to see additional errors"));
833
825
  }
834
- return json;
826
+ if (status == Status::GRPC_JSON_INTERNAL_ERROR) {
827
+ char* msg;
828
+ gpr_asprintf(&msg, "internal error in JSON parser at index %" PRIuPTR,
829
+ reader.CurrentIndex());
830
+ reader.errors_.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
831
+ gpr_free(msg);
832
+ } else if (status == Status::GRPC_JSON_PARSE_ERROR) {
833
+ char* msg;
834
+ gpr_asprintf(&msg, "JSON parse error at index %" PRIuPTR,
835
+ reader.CurrentIndex());
836
+ reader.errors_.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
837
+ gpr_free(msg);
838
+ }
839
+ if (!reader.errors_.empty()) {
840
+ return GRPC_ERROR_CREATE_FROM_VECTOR("JSON parsing failed",
841
+ &reader.errors_);
842
+ }
843
+ *output = std::move(reader.root_value_);
844
+ return GRPC_ERROR_NONE;
835
845
  }
836
846
 
837
- #define UNBOUND_JSON_STRING_LENGTH 0x7fffffff
847
+ } // namespace
838
848
 
839
- grpc_json* grpc_json_parse_string(char* input) {
840
- return grpc_json_parse_string_with_len(input, UNBOUND_JSON_STRING_LENGTH);
849
+ Json Json::Parse(absl::string_view json_str, grpc_error** error) {
850
+ Json value;
851
+ *error = JsonReader::Parse(json_str, &value);
852
+ return value;
841
853
  }
854
+
855
+ } // namespace grpc_core