grpc 1.56.2 → 1.57.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +29 -22
  3. data/include/grpc/event_engine/event_engine.h +22 -32
  4. data/include/grpc/impl/grpc_types.h +3 -0
  5. data/include/grpc/support/port_platform.h +29 -23
  6. data/src/core/ext/filters/client_channel/client_channel.cc +44 -8
  7. data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
  8. data/src/core/ext/filters/client_channel/http_proxy.cc +5 -0
  9. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +21 -52
  10. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +19 -7
  11. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +25 -35
  12. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +78 -132
  13. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +2 -1
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +4 -3
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
  16. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +38 -15
  17. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +3 -5
  18. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +22 -6
  19. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +2 -0
  20. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +97 -71
  21. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -16
  22. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +56 -11
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +25 -0
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -32
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +4 -6
  26. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +20 -79
  27. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
  28. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -19
  29. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +1 -1
  30. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -41
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -67
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +8 -0
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +31 -74
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +7 -51
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +16 -87
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +16 -50
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -74
  38. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -4
  39. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +69 -59
  40. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +7 -2
  41. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +1 -0
  42. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +25 -13
  43. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +366 -311
  44. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +17 -1
  45. data/src/core/ext/filters/client_channel/retry_filter.cc +39 -2498
  46. data/src/core/ext/filters/client_channel/retry_filter.h +91 -1
  47. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.cc +2052 -0
  48. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.h +442 -0
  49. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +38 -58
  50. data/src/core/ext/filters/client_channel/subchannel.h +3 -3
  51. data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -0
  52. data/src/core/ext/filters/rbac/rbac_filter.cc +40 -111
  53. data/src/core/ext/filters/rbac/rbac_filter.h +12 -30
  54. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +162 -86
  55. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +0 -6
  56. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -4
  57. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +131 -186
  58. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +6569 -174
  59. data/src/core/ext/transport/chttp2/transport/decode_huff.h +2278 -441
  60. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -3
  61. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +4 -3
  62. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -8
  63. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -2
  65. data/src/core/ext/transport/chttp2/transport/internal.h +8 -4
  66. data/src/core/ext/transport/chttp2/transport/parsing.cc +15 -3
  67. data/src/core/ext/transport/chttp2/transport/writing.cc +2 -3
  68. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -6
  69. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +143 -0
  70. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -9
  71. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +0 -39
  72. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +13 -8
  73. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +35 -6
  74. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +17 -13
  75. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +85 -20
  76. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +26 -7
  77. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +45 -3
  78. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +4 -3
  79. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +21 -0
  80. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +30 -6
  81. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +180 -0
  82. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +558 -0
  83. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +2710 -0
  84. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +30 -11
  85. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +53 -24
  86. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +30 -5
  87. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +110 -0
  88. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +41 -15
  89. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +150 -27
  90. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +1 -0
  91. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +47 -0
  92. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +93 -0
  93. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +88 -76
  94. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -0
  95. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +11 -12
  96. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +0 -5
  97. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +162 -160
  98. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +129 -118
  99. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +141 -135
  100. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +19 -12
  101. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +38 -30
  102. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
  103. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.c +402 -0
  104. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.h +111 -0
  105. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +80 -74
  106. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +63 -47
  107. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -0
  108. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +315 -293
  109. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  110. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +29 -29
  111. data/src/core/ext/xds/xds_bootstrap_grpc.cc +33 -30
  112. data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -13
  113. data/src/core/ext/xds/xds_client_grpc.cc +11 -6
  114. data/src/core/ext/xds/xds_client_grpc.h +16 -2
  115. data/src/core/ext/xds/xds_client_stats.h +10 -0
  116. data/src/core/ext/xds/xds_cluster.cc +26 -16
  117. data/src/core/ext/xds/xds_endpoint.cc +4 -7
  118. data/src/core/ext/xds/xds_health_status.cc +0 -17
  119. data/src/core/ext/xds/xds_health_status.h +5 -25
  120. data/src/core/ext/xds/xds_lb_policy_registry.cc +39 -0
  121. data/src/core/ext/xds/xds_route_config.cc +4 -0
  122. data/src/core/ext/xds/xds_transport_grpc.cc +1 -3
  123. data/src/core/lib/address_utils/parse_address.cc +63 -1
  124. data/src/core/lib/address_utils/parse_address.h +8 -0
  125. data/src/core/lib/address_utils/sockaddr_utils.cc +46 -1
  126. data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
  127. data/src/core/lib/channel/channel_args.cc +21 -10
  128. data/src/core/lib/channel/channel_args.h +3 -0
  129. data/src/core/lib/channel/connected_channel.cc +4 -1
  130. data/src/core/lib/channel/promise_based_filter.h +1 -0
  131. data/src/core/lib/debug/trace.cc +1 -4
  132. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -1
  133. data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -1
  134. data/src/core/lib/event_engine/event_engine.cc +0 -12
  135. data/src/core/lib/event_engine/forkable.cc +47 -42
  136. data/src/core/lib/event_engine/handle_containers.h +0 -4
  137. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -6
  138. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -6
  139. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +25 -11
  140. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +3 -1
  141. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -1
  142. data/src/core/lib/event_engine/posix_engine/posix_engine.h +8 -12
  143. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +37 -27
  144. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -0
  145. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +4 -2
  146. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +42 -2
  147. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +6 -0
  148. data/src/core/lib/event_engine/posix_engine/timer.h +10 -37
  149. data/src/core/lib/event_engine/tcp_socket_utils.cc +67 -7
  150. data/src/core/lib/event_engine/tcp_socket_utils.h +3 -0
  151. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +90 -37
  152. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +32 -12
  153. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +12 -21
  154. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +8 -12
  155. data/src/core/lib/event_engine/windows/windows_endpoint.cc +55 -54
  156. data/src/core/lib/event_engine/windows/windows_endpoint.h +15 -12
  157. data/src/core/lib/event_engine/windows/windows_engine.cc +2 -1
  158. data/src/core/lib/event_engine/windows/windows_engine.h +8 -12
  159. data/src/core/lib/experiments/config.cc +60 -22
  160. data/src/core/lib/experiments/config.h +20 -8
  161. data/src/core/lib/experiments/experiments.cc +278 -0
  162. data/src/core/lib/experiments/experiments.h +59 -1
  163. data/src/core/lib/gprpp/dual_ref_counted.h +9 -9
  164. data/src/core/lib/gprpp/fork.cc +8 -9
  165. data/src/core/lib/gprpp/fork.h +6 -5
  166. data/src/core/lib/gprpp/if_list.h +4530 -0
  167. data/src/core/lib/gprpp/orphanable.h +3 -3
  168. data/src/core/lib/gprpp/ref_counted.h +6 -6
  169. data/src/core/lib/gprpp/sorted_pack.h +3 -12
  170. data/src/core/lib/gprpp/status_helper.h +16 -15
  171. data/src/core/lib/gprpp/time.h +12 -0
  172. data/src/core/lib/gprpp/type_list.h +32 -0
  173. data/src/core/lib/http/httpcli.h +6 -9
  174. data/src/core/lib/iomgr/error.cc +32 -2
  175. data/src/core/lib/iomgr/error.h +9 -10
  176. data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -7
  177. data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
  178. data/src/core/lib/iomgr/exec_ctx.h +11 -0
  179. data/src/core/lib/iomgr/pollset.h +4 -5
  180. data/src/core/lib/iomgr/port.h +10 -0
  181. data/src/core/lib/iomgr/resolve_address.cc +13 -1
  182. data/src/core/lib/iomgr/resolve_address.h +17 -3
  183. data/src/core/lib/iomgr/sockaddr_posix.h +7 -0
  184. data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -0
  185. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -0
  186. data/src/core/lib/iomgr/socket_utils_posix.h +6 -0
  187. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
  188. data/src/core/lib/iomgr/tcp_posix.cc +21 -4
  189. data/src/core/lib/iomgr/tcp_server_posix.cc +3 -2
  190. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -2
  191. data/src/core/lib/iomgr/tcp_windows.cc +1 -3
  192. data/src/core/lib/iomgr/vsock.cc +59 -0
  193. data/src/core/lib/iomgr/vsock.h +38 -0
  194. data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -6
  195. data/src/core/lib/load_balancing/delegating_helper.h +115 -0
  196. data/src/core/lib/load_balancing/lb_policy.h +20 -0
  197. data/src/core/lib/load_balancing/subchannel_interface.h +6 -0
  198. data/src/core/lib/promise/party.h +1 -1
  199. data/src/core/lib/resolver/resolver_factory.h +3 -2
  200. data/src/core/lib/resolver/server_address.cc +9 -94
  201. data/src/core/lib/resolver/server_address.h +10 -64
  202. data/src/core/lib/resource_quota/memory_quota.h +1 -1
  203. data/src/core/lib/security/credentials/channel_creds_registry.h +51 -27
  204. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +169 -9
  205. data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
  206. data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -1
  207. data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -1
  208. data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -0
  209. data/src/core/lib/security/credentials/fake/fake_credentials.cc +30 -38
  210. data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -0
  211. data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
  212. data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -1
  213. data/src/core/lib/service_config/service_config_call_data.h +5 -0
  214. data/src/core/lib/slice/slice.h +16 -0
  215. data/src/core/lib/surface/call.cc +31 -29
  216. data/src/core/lib/surface/server.h +2 -2
  217. data/src/core/lib/surface/version.cc +2 -2
  218. data/src/core/lib/transport/metadata_batch.cc +7 -7
  219. data/src/core/lib/transport/metadata_batch.h +86 -48
  220. data/src/core/lib/transport/parsed_metadata.h +34 -20
  221. data/src/core/lib/transport/simple_slice_based_metadata.h +9 -2
  222. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +4 -6
  223. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -2
  224. data/src/core/tsi/ssl_transport_security.cc +28 -7
  225. data/src/ruby/bin/math_pb.rb +24 -18
  226. data/src/ruby/ext/grpc/extconf.rb +19 -18
  227. data/src/ruby/ext/grpc/rb_call.c +62 -39
  228. data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
  229. data/src/ruby/ext/grpc/rb_channel.c +126 -49
  230. data/src/ruby/ext/grpc/rb_channel.h +1 -0
  231. data/src/ruby/ext/grpc/rb_channel_args.c +16 -2
  232. data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
  233. data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
  234. data/src/ruby/ext/grpc/rb_compression_options.c +0 -1
  235. data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
  236. data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
  237. data/src/ruby/ext/grpc/rb_grpc.c +192 -30
  238. data/src/ruby/ext/grpc/rb_grpc.h +8 -2
  239. data/src/ruby/ext/grpc/rb_server.c +62 -45
  240. data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
  241. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
  242. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
  243. data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -0
  244. data/src/ruby/lib/grpc/version.rb +1 -1
  245. data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
  246. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
  247. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +25 -111
  248. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +25 -2
  249. data/third_party/boringssl-with-bazel/err_data.c +552 -552
  250. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +5 -5
  251. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +34 -1
  252. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +4 -1
  253. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +3 -3
  254. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +7 -8
  255. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +2 -2
  256. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -2
  257. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +8 -8
  258. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
  259. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +2 -2
  260. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +19 -1
  261. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +8 -1
  262. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +28 -185
  263. data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +3 -7
  264. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +8 -0
  265. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +3 -0
  266. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +49 -46
  267. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +18 -0
  268. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +2809 -7417
  269. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +27 -5
  270. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +20 -0
  271. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +110 -72
  272. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +4 -3
  273. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +15 -14
  274. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +13 -10
  275. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +35 -12
  276. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +2 -4
  277. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +3 -7
  278. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +3 -3
  279. data/third_party/boringssl-with-bazel/src/crypto/evp/print.c +7 -6
  280. data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +34 -72
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +12 -5
  283. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +5 -6
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +12 -6
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +17 -18
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +7 -7
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +5 -6
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +2 -0
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +277 -0
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +180 -404
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +3 -3
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +24 -57
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +17 -13
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +33 -71
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +18 -17
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -7
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +15 -18
  299. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +9 -11
  300. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +24 -24
  301. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +11 -27
  302. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +8 -8
  303. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +4 -4
  304. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
  305. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/hkdf.c +1 -1
  306. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +40 -26
  307. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +21 -7
  308. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +38 -19
  309. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +2 -29
  310. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +55 -0
  311. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +33 -52
  312. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +3 -8
  313. data/third_party/boringssl-with-bazel/src/crypto/internal.h +198 -79
  314. data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +5 -4
  315. data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -8
  316. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +19 -23
  317. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +3 -3
  318. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +3 -3
  319. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +7 -7
  320. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +8 -5
  321. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -0
  322. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +7 -6
  323. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +6 -12
  324. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +48 -0
  325. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fuchsia.c → ios.c} +8 -8
  326. data/third_party/boringssl-with-bazel/src/crypto/{refcount_no_threads.c → rand_extra/trusty.c} +15 -19
  327. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +41 -19
  328. data/third_party/boringssl-with-bazel/src/crypto/{refcount_c11.c → refcount.c} +11 -17
  329. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +147 -72
  330. data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +0 -8
  331. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +6 -35
  332. data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +5 -26
  333. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +14 -18
  334. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +54 -143
  335. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +7 -13
  336. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +1 -1
  337. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +1 -1
  338. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +2 -4
  339. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +2 -2
  340. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +1 -1
  341. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +8 -12
  342. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +19 -20
  343. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -15
  344. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -5
  345. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -1
  346. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +7 -7
  347. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -3
  348. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +4 -6
  349. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +4 -119
  350. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +207 -0
  351. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +5 -0
  352. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -116
  353. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +0 -2
  354. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +6 -0
  355. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +5 -1
  356. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +0 -21
  357. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +21 -2
  358. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +19 -6
  359. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +11 -7
  360. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -14
  361. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +0 -61
  362. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +127 -81
  363. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +224 -209
  364. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +154 -0
  365. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -29
  366. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +4 -4
  367. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +3 -2
  368. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +9 -65
  369. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +20 -20
  370. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  371. data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -11
  372. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +24 -18
  373. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +37 -30
  374. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +125 -26
  375. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -3
  376. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +691 -0
  377. data/third_party/upb/upb/collections/map.c +3 -3
  378. metadata +27 -12
  379. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +0 -42
  380. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +0 -64
  381. data/src/core/ext/transport/chttp2/transport/stream_map.cc +0 -177
  382. data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -68
  383. data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +0 -89
@@ -72,7 +72,7 @@
72
72
  DEFINE_LHASH_OF(ASN1_STRING_TABLE)
73
73
 
74
74
  static LHASH_OF(ASN1_STRING_TABLE) *string_tables = NULL;
75
- static struct CRYPTO_STATIC_MUTEX string_tables_lock = CRYPTO_STATIC_MUTEX_INIT;
75
+ static CRYPTO_MUTEX string_tables_lock = CRYPTO_MUTEX_INIT;
76
76
 
77
77
  void ASN1_STRING_set_default_mask(unsigned long mask) {}
78
78
 
@@ -176,11 +176,11 @@ static const ASN1_STRING_TABLE *asn1_string_table_get(int nid) {
176
176
  return tbl;
177
177
  }
178
178
 
179
- CRYPTO_STATIC_MUTEX_lock_read(&string_tables_lock);
179
+ CRYPTO_MUTEX_lock_read(&string_tables_lock);
180
180
  if (string_tables != NULL) {
181
181
  tbl = lh_ASN1_STRING_TABLE_retrieve(string_tables, &key);
182
182
  }
183
- CRYPTO_STATIC_MUTEX_unlock_read(&string_tables_lock);
183
+ CRYPTO_MUTEX_unlock_read(&string_tables_lock);
184
184
  // Note returning |tbl| without the lock is only safe because
185
185
  // |ASN1_STRING_TABLE_add| cannot modify or delete existing entries. If we
186
186
  // wish to support that, this function must copy the result under a lock.
@@ -196,7 +196,7 @@ int ASN1_STRING_TABLE_add(int nid, long minsize, long maxsize,
196
196
  }
197
197
 
198
198
  int ret = 0;
199
- CRYPTO_STATIC_MUTEX_lock_write(&string_tables_lock);
199
+ CRYPTO_MUTEX_lock_write(&string_tables_lock);
200
200
 
201
201
  if (string_tables == NULL) {
202
202
  string_tables = lh_ASN1_STRING_TABLE_new(table_hash, table_cmp);
@@ -232,7 +232,7 @@ int ASN1_STRING_TABLE_add(int nid, long minsize, long maxsize,
232
232
  ret = 1;
233
233
 
234
234
  err:
235
- CRYPTO_STATIC_MUTEX_unlock_write(&string_tables_lock);
235
+ CRYPTO_MUTEX_unlock_write(&string_tables_lock);
236
236
  return ret;
237
237
  }
238
238
 
@@ -61,6 +61,7 @@
61
61
  #include <time.h>
62
62
 
63
63
  #include <openssl/asn1t.h>
64
+ #include <openssl/bytestring.h>
64
65
  #include <openssl/err.h>
65
66
  #include <openssl/mem.h>
66
67
 
@@ -82,6 +83,10 @@ ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t time) {
82
83
  return ASN1_TIME_adj(s, time, 0, 0);
83
84
  }
84
85
 
86
+ static int fits_in_utc_time(const struct tm *tm) {
87
+ return 50 <= tm->tm_year && tm->tm_year < 150;
88
+ }
89
+
85
90
  ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, int64_t posix_time, int offset_day,
86
91
  long offset_sec) {
87
92
  struct tm tm;
@@ -95,7 +100,7 @@ ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, int64_t posix_time, int offset_day,
95
100
  return NULL;
96
101
  }
97
102
  }
98
- if ((tm.tm_year >= 50) && (tm.tm_year < 150)) {
103
+ if (fits_in_utc_time(&tm)) {
99
104
  return ASN1_UTCTIME_adj(s, posix_time, offset_day, offset_sec);
100
105
  }
101
106
  return ASN1_GENERALIZEDTIME_adj(s, posix_time, offset_day, offset_sec);
@@ -171,6 +176,34 @@ int ASN1_TIME_set_string(ASN1_TIME *s, const char *str) {
171
176
  ASN1_GENERALIZEDTIME_set_string(s, str);
172
177
  }
173
178
 
179
+ int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) {
180
+ CBS cbs;
181
+ CBS_init(&cbs, (const uint8_t*)str, strlen(str));
182
+ int type;
183
+ struct tm tm;
184
+ if (CBS_parse_utc_time(&cbs, /*out_tm=*/NULL,
185
+ /*allow_timezone_offset=*/0)) {
186
+ type = V_ASN1_UTCTIME;
187
+ } else if (CBS_parse_generalized_time(&cbs, &tm,
188
+ /*allow_timezone_offset=*/0)) {
189
+ type = V_ASN1_GENERALIZEDTIME;
190
+ if (fits_in_utc_time(&tm)) {
191
+ type = V_ASN1_UTCTIME;
192
+ CBS_skip(&cbs, 2);
193
+ }
194
+ } else {
195
+ return 0;
196
+ }
197
+
198
+ if (s != NULL) {
199
+ if (!ASN1_STRING_set(s, CBS_data(&cbs), CBS_len(&cbs))) {
200
+ return 0;
201
+ }
202
+ s->type = type;
203
+ }
204
+ return 1;
205
+ }
206
+
174
207
  static int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *t,
175
208
  int allow_timezone_offset) {
176
209
  if (t == NULL) {
@@ -83,11 +83,14 @@ int ASN1_UTCTIME_check(const ASN1_UTCTIME *d) {
83
83
  }
84
84
 
85
85
  int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) {
86
+ // Although elsewhere we allow timezone offsets with UTCTime, to be compatible
87
+ // with some existing misissued certificates, this function is used to
88
+ // construct new certificates and can be stricter.
86
89
  size_t len = strlen(str);
87
90
  CBS cbs;
88
91
  CBS_init(&cbs, (const uint8_t *)str, len);
89
92
  if (!CBS_parse_utc_time(&cbs, /*out_tm=*/NULL,
90
- /*allow_timezone_offset=*/1)) {
93
+ /*allow_timezone_offset=*/0)) {
91
94
  return 0;
92
95
  }
93
96
  if (s != NULL) {
@@ -628,14 +628,14 @@ void BIO_set_retry_special(BIO *bio) {
628
628
 
629
629
  int BIO_set_write_buffer_size(BIO *bio, int buffer_size) { return 0; }
630
630
 
631
- static struct CRYPTO_STATIC_MUTEX g_index_lock = CRYPTO_STATIC_MUTEX_INIT;
631
+ static CRYPTO_MUTEX g_index_lock = CRYPTO_MUTEX_INIT;
632
632
  static int g_index = BIO_TYPE_START;
633
633
 
634
634
  int BIO_get_new_index(void) {
635
- CRYPTO_STATIC_MUTEX_lock_write(&g_index_lock);
635
+ CRYPTO_MUTEX_lock_write(&g_index_lock);
636
636
  // If |g_index| exceeds 255, it will collide with the flags bits.
637
637
  int ret = g_index > 255 ? -1 : g_index++;
638
- CRYPTO_STATIC_MUTEX_unlock_write(&g_index_lock);
638
+ CRYPTO_MUTEX_unlock_write(&g_index_lock);
639
639
  return ret;
640
640
  }
641
641
 
@@ -206,7 +206,6 @@ static int mem_gets(BIO *bio, char *buf, int size) {
206
206
 
207
207
  static long mem_ctrl(BIO *bio, int cmd, long num, void *ptr) {
208
208
  long ret = 1;
209
- char **pptr;
210
209
 
211
210
  BUF_MEM *b = (BUF_MEM *)bio->ptr;
212
211
 
@@ -232,8 +231,8 @@ static long mem_ctrl(BIO *bio, int cmd, long num, void *ptr) {
232
231
  case BIO_CTRL_INFO:
233
232
  ret = (long)b->length;
234
233
  if (ptr != NULL) {
235
- pptr = (char **)ptr;
236
- *pptr = (char *)&b->data[0];
234
+ char **pptr = ptr;
235
+ *pptr = b->data;
237
236
  }
238
237
  break;
239
238
  case BIO_C_SET_BUF_MEM:
@@ -243,8 +242,8 @@ static long mem_ctrl(BIO *bio, int cmd, long num, void *ptr) {
243
242
  break;
244
243
  case BIO_C_GET_BUF_MEM_PTR:
245
244
  if (ptr != NULL) {
246
- pptr = (char **)ptr;
247
- *pptr = (char *)b;
245
+ BUF_MEM **pptr = ptr;
246
+ *pptr = b;
248
247
  }
249
248
  break;
250
249
  case BIO_CTRL_GET_CLOSE:
@@ -294,15 +293,15 @@ int BIO_mem_contents(const BIO *bio, const uint8_t **out_contents,
294
293
  }
295
294
 
296
295
  long BIO_get_mem_data(BIO *bio, char **contents) {
297
- return BIO_ctrl(bio, BIO_CTRL_INFO, 0, (char *) contents);
296
+ return BIO_ctrl(bio, BIO_CTRL_INFO, 0, contents);
298
297
  }
299
298
 
300
299
  int BIO_get_mem_ptr(BIO *bio, BUF_MEM **out) {
301
- return (int)BIO_ctrl(bio, BIO_C_GET_BUF_MEM_PTR, 0, (char *) out);
300
+ return (int)BIO_ctrl(bio, BIO_C_GET_BUF_MEM_PTR, 0, out);
302
301
  }
303
302
 
304
303
  int BIO_set_mem_buf(BIO *bio, BUF_MEM *b, int take_ownership) {
305
- return (int)BIO_ctrl(bio, BIO_C_SET_BUF_MEM, take_ownership, (char *) b);
304
+ return (int)BIO_ctrl(bio, BIO_C_SET_BUF_MEM, take_ownership, b);
306
305
  }
307
306
 
308
307
  int BIO_set_mem_eof_return(BIO *bio, int eof_value) {
@@ -56,7 +56,7 @@
56
56
 
57
57
  #include <openssl/bio.h>
58
58
 
59
- #if !defined(OPENSSL_TRUSTY)
59
+ #if !defined(OPENSSL_NO_SOCK)
60
60
 
61
61
  #include <assert.h>
62
62
  #include <errno.h>
@@ -544,4 +544,4 @@ int BIO_do_connect(BIO *bio) {
544
544
  return (int)BIO_ctrl(bio, BIO_C_DO_STATE_MACHINE, 0, NULL);
545
545
  }
546
546
 
547
- #endif // OPENSSL_TRUSTY
547
+ #endif // OPENSSL_NO_SOCK
@@ -56,7 +56,7 @@
56
56
 
57
57
  #include <openssl/bio.h>
58
58
 
59
- #if !defined(OPENSSL_TRUSTY)
59
+ #if !defined(OPENSSL_NO_POSIX_IO)
60
60
 
61
61
  #include <errno.h>
62
62
  #include <string.h>
@@ -276,4 +276,4 @@ int BIO_get_fd(BIO *bio, int *out_fd) {
276
276
  return (int)BIO_ctrl(bio, BIO_C_GET_FD, 0, (char *) out_fd);
277
277
  }
278
278
 
279
- #endif // OPENSSL_TRUSTY
279
+ #endif // OPENSSL_NO_POSIX_IO
@@ -172,7 +172,6 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) {
172
172
  long ret = 1;
173
173
  FILE *fp = (FILE *)b->ptr;
174
174
  FILE **fpp;
175
- char p[4];
176
175
 
177
176
  switch (cmd) {
178
177
  case BIO_CTRL_RESET:
@@ -197,27 +196,28 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) {
197
196
  case BIO_C_SET_FILENAME:
198
197
  file_free(b);
199
198
  b->shutdown = (int)num & BIO_CLOSE;
199
+ const char *mode;
200
200
  if (num & BIO_FP_APPEND) {
201
201
  if (num & BIO_FP_READ) {
202
- OPENSSL_strlcpy(p, "a+", sizeof(p));
202
+ mode = "a+";
203
203
  } else {
204
- OPENSSL_strlcpy(p, "a", sizeof(p));
204
+ mode = "a";
205
205
  }
206
206
  } else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE)) {
207
- OPENSSL_strlcpy(p, "r+", sizeof(p));
207
+ mode = "r+";
208
208
  } else if (num & BIO_FP_WRITE) {
209
- OPENSSL_strlcpy(p, "w", sizeof(p));
209
+ mode = "w";
210
210
  } else if (num & BIO_FP_READ) {
211
- OPENSSL_strlcpy(p, "r", sizeof(p));
211
+ mode = "r";
212
212
  } else {
213
213
  OPENSSL_PUT_ERROR(BIO, BIO_R_BAD_FOPEN_MODE);
214
214
  ret = 0;
215
215
  break;
216
216
  }
217
- fp = fopen(ptr, p);
217
+ fp = fopen(ptr, mode);
218
218
  if (fp == NULL) {
219
219
  OPENSSL_PUT_SYSTEM_ERROR();
220
- ERR_add_error_data(5, "fopen('", ptr, "','", p, "')");
220
+ ERR_add_error_data(5, "fopen('", ptr, "','", mode, "')");
221
221
  OPENSSL_PUT_ERROR(BIO, ERR_R_SYS_LIB);
222
222
  ret = 0;
223
223
  break;
@@ -56,7 +56,7 @@
56
56
 
57
57
  #include <openssl/bio.h>
58
58
 
59
- #if !defined(OPENSSL_TRUSTY)
59
+ #if !defined(OPENSSL_NO_SOCK)
60
60
 
61
61
  #include <fcntl.h>
62
62
  #include <string.h>
@@ -186,4 +186,4 @@ BIO *BIO_new_socket(int fd, int close_flag) {
186
186
  return ret;
187
187
  }
188
188
 
189
- #endif // OPENSSL_TRUSTY
189
+ #endif // OPENSSL_NO_SOCK
@@ -20,7 +20,7 @@
20
20
  #include <openssl/bio.h>
21
21
  #include <openssl/err.h>
22
22
 
23
- #if !defined(OPENSSL_TRUSTY)
23
+ #if !defined(OPENSSL_NO_SOCK)
24
24
 
25
25
  #include <fcntl.h>
26
26
  #include <string.h>
@@ -121,4 +121,4 @@ int bio_sock_error(int sock) {
121
121
  return error;
122
122
  }
123
123
 
124
- #endif // OPENSSL_TRUSTY
124
+ #endif // OPENSSL_NO_SOCK
@@ -91,7 +91,25 @@ void CRYPTO_chacha_20(uint8_t *out, const uint8_t *in, size_t in_len,
91
91
  }
92
92
  #endif
93
93
 
94
- ChaCha20_ctr32(out, in, in_len, key_ptr, counter_nonce);
94
+ while (in_len > 0) {
95
+ // The assembly functions do not have defined overflow behavior. While
96
+ // overflow is almost always a bug in the caller, we prefer our functions to
97
+ // behave the same across platforms, so divide into multiple calls to avoid
98
+ // this case.
99
+ uint64_t todo = 64 * ((UINT64_C(1) << 32) - counter_nonce[0]);
100
+ if (todo > in_len) {
101
+ todo = in_len;
102
+ }
103
+
104
+ ChaCha20_ctr32(out, in, (size_t)todo, key_ptr, counter_nonce);
105
+ in += todo;
106
+ out += todo;
107
+ in_len -= todo;
108
+
109
+ // We're either done and will next break out of the loop, or we stopped at
110
+ // the wraparound point and the counter should continue at zero.
111
+ counter_nonce[0] = 0;
112
+ }
95
113
  }
96
114
 
97
115
  #else
@@ -32,7 +32,14 @@ void CRYPTO_hchacha20(uint8_t out[32], const uint8_t key[32],
32
32
  defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64))
33
33
  #define CHACHA20_ASM
34
34
 
35
- // ChaCha20_ctr32 is defined in asm/chacha-*.pl.
35
+ // ChaCha20_ctr32 encrypts |in_len| bytes from |in| and writes the result to
36
+ // |out|. If |in| and |out| alias, they must be equal.
37
+ //
38
+ // |counter[0]| is the initial 32-bit block counter, and the remainder is the
39
+ // 96-bit nonce. If the counter overflows, the output is undefined. The function
40
+ // will produce output, but the output may vary by machine and may not be
41
+ // self-consistent. (On some architectures, the assembly implements a mix of
42
+ // 64-bit and 32-bit counters.)
36
43
  void ChaCha20_ctr32(uint8_t *out, const uint8_t *in, size_t in_len,
37
44
  const uint32_t key[8], const uint32_t counter[4]);
38
45
  #endif
@@ -68,21 +68,10 @@
68
68
  #include "conf_def.h"
69
69
  #include "internal.h"
70
70
  #include "../internal.h"
71
- #include "../lhash/internal.h"
72
71
 
73
72
 
74
- DEFINE_LHASH_OF(CONF_VALUE)
75
-
76
- struct conf_st {
77
- LHASH_OF(CONF_VALUE) *data;
78
- };
79
-
80
73
  static const char kDefaultSectionName[] = "default";
81
74
 
82
- // The maximum length we can grow a value to after variable expansion. 64k
83
- // should be more than enough for all reasonable uses.
84
- #define MAX_CONF_VALUE_LENGTH 65536
85
-
86
75
  static uint32_t conf_value_hash(const CONF_VALUE *v) {
87
76
  const uint32_t section_hash = v->section ? OPENSSL_strhash(v->section) : 0;
88
77
  const uint32_t name_hash = v->name ? OPENSSL_strhash(v->name) : 0;
@@ -139,24 +128,23 @@ CONF_VALUE *CONF_VALUE_new(void) {
139
128
  }
140
129
 
141
130
  static void value_free_contents(CONF_VALUE *value) {
142
- if (value->section) {
143
- OPENSSL_free(value->section);
144
- }
131
+ OPENSSL_free(value->section);
145
132
  if (value->name) {
146
133
  OPENSSL_free(value->name);
147
- if (value->value) {
148
- OPENSSL_free(value->value);
149
- }
134
+ OPENSSL_free(value->value);
150
135
  } else {
151
- if (value->value) {
152
- sk_CONF_VALUE_free((STACK_OF(CONF_VALUE)*)value->value);
153
- }
136
+ // TODO(davidben): When |value->name| is NULL, |CONF_VALUE| is actually an
137
+ // entirely different structure. This is fragile and confusing. Make a
138
+ // proper |CONF_SECTION| type that doesn't require this.
139
+ sk_CONF_VALUE_free((STACK_OF(CONF_VALUE) *)value->value);
154
140
  }
155
141
  }
156
142
 
157
143
  static void value_free(CONF_VALUE *value) {
158
- value_free_contents(value);
159
- OPENSSL_free(value);
144
+ if (value != NULL) {
145
+ value_free_contents(value);
146
+ OPENSSL_free(value);
147
+ }
160
148
  }
161
149
 
162
150
  static void value_free_arg(CONF_VALUE *value, void *arg) { value_free(value); }
@@ -192,28 +180,21 @@ static CONF_VALUE *NCONF_new_section(const CONF *conf, const char *section) {
192
180
  if (!lh_CONF_VALUE_insert(conf->data, &old_value, v)) {
193
181
  goto err;
194
182
  }
195
- if (old_value) {
196
- value_free(old_value);
197
- }
183
+ value_free(old_value);
198
184
  ok = 1;
199
185
 
200
186
  err:
201
187
  if (!ok) {
202
- if (sk != NULL) {
203
- sk_CONF_VALUE_free(sk);
204
- }
205
- if (v != NULL) {
206
- OPENSSL_free(v);
207
- }
188
+ sk_CONF_VALUE_free(sk);
189
+ OPENSSL_free(v);
208
190
  v = NULL;
209
191
  }
210
192
  return v;
211
193
  }
212
194
 
213
195
  static int str_copy(CONF *conf, char *section, char **pto, char *from) {
214
- int q, r, rr = 0, to = 0, len = 0;
215
- char *s, *e, *rp, *rrp, *np, *cp, v;
216
- const char *p;
196
+ int q, to = 0, len = 0;
197
+ char v;
217
198
  BUF_MEM *buf;
218
199
 
219
200
  buf = BUF_MEM_new();
@@ -242,22 +223,6 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from) {
242
223
  if (*from == q) {
243
224
  from++;
244
225
  }
245
- } else if (IS_DQUOTE(conf, *from)) {
246
- q = *from;
247
- from++;
248
- while (!IS_EOF(conf, *from)) {
249
- if (*from == q) {
250
- if (*(from + 1) == q) {
251
- from++;
252
- } else {
253
- break;
254
- }
255
- }
256
- buf->data[to++] = *(from++);
257
- }
258
- if (*from == q) {
259
- from++;
260
- }
261
226
  } else if (IS_ESC(conf, *from)) {
262
227
  from++;
263
228
  v = *(from++);
@@ -276,102 +241,23 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from) {
276
241
  } else if (IS_EOF(conf, *from)) {
277
242
  break;
278
243
  } else if (*from == '$') {
279
- // try to expand it
280
- rrp = NULL;
281
- s = &(from[1]);
282
- if (*s == '{') {
283
- q = '}';
284
- } else if (*s == '(') {
285
- q = ')';
286
- } else {
287
- q = 0;
288
- }
289
-
290
- if (q) {
291
- s++;
292
- }
293
- cp = section;
294
- e = np = s;
295
- while (IS_ALPHA_NUMERIC(conf, *e)) {
296
- e++;
297
- }
298
- if (e[0] == ':' && e[1] == ':') {
299
- cp = np;
300
- rrp = e;
301
- rr = *e;
302
- *rrp = '\0';
303
- e += 2;
304
- np = e;
305
- while (IS_ALPHA_NUMERIC(conf, *e)) {
306
- e++;
307
- }
308
- }
309
- r = *e;
310
- *e = '\0';
311
- rp = e;
312
- if (q) {
313
- if (r != q) {
314
- OPENSSL_PUT_ERROR(CONF, CONF_R_NO_CLOSE_BRACE);
315
- goto err;
316
- }
317
- e++;
318
- }
319
- // So at this point we have
320
- // np which is the start of the name string which is
321
- // '\0' terminated.
322
- // cp which is the start of the section string which is
323
- // '\0' terminated.
324
- // e is the 'next point after'.
325
- // r and rr are the chars replaced by the '\0'
326
- // rp and rrp is where 'r' and 'rr' came from.
327
- p = NCONF_get_string(conf, cp, np);
328
- if (rrp != NULL) {
329
- *rrp = rr;
330
- }
331
- *rp = r;
332
- if (p == NULL) {
333
- OPENSSL_PUT_ERROR(CONF, CONF_R_VARIABLE_HAS_NO_VALUE);
334
- goto err;
335
- }
336
- size_t newsize = strlen(p) + buf->length - (e - from);
337
- if (newsize > MAX_CONF_VALUE_LENGTH) {
338
- OPENSSL_PUT_ERROR(CONF, CONF_R_VARIABLE_EXPANSION_TOO_LONG);
339
- goto err;
340
- }
341
- if (!BUF_MEM_grow_clean(buf, newsize)) {
342
- goto err;
343
- }
344
- while (*p) {
345
- buf->data[to++] = *(p++);
346
- }
347
-
348
- /* Since we change the pointer 'from', we also have
349
- to change the perceived length of the string it
350
- points at. /RL */
351
- len -= e - from;
352
- from = e;
353
-
354
- /* In case there were no braces or parenthesis around
355
- the variable reference, we have to put back the
356
- character that was replaced with a '\0'. /RL */
357
- *rp = r;
244
+ // Historically, $foo would expand to a previously-parsed value. This
245
+ // feature has been removed as it was unused and is a DoS vector.
246
+ OPENSSL_PUT_ERROR(CONF, CONF_R_VARIABLE_EXPANSION_NOT_SUPPORTED);
247
+ goto err;
358
248
  } else {
359
249
  buf->data[to++] = *(from++);
360
250
  }
361
251
  }
362
252
 
363
253
  buf->data[to] = '\0';
364
- if (*pto != NULL) {
365
- OPENSSL_free(*pto);
366
- }
254
+ OPENSSL_free(*pto);
367
255
  *pto = buf->data;
368
256
  OPENSSL_free(buf);
369
257
  return 1;
370
258
 
371
259
  err:
372
- if (buf != NULL) {
373
- BUF_MEM_free(buf);
374
- }
260
+ BUF_MEM_free(buf);
375
261
  return 0;
376
262
  }
377
263
 
@@ -472,33 +358,8 @@ static char *scan_quote(CONF *conf, char *p) {
472
358
  return p;
473
359
  }
474
360
 
475
-
476
- static char *scan_dquote(CONF *conf, char *p) {
477
- int q = *p;
478
-
479
- p++;
480
- while (!(IS_EOF(conf, *p))) {
481
- if (*p == q) {
482
- if (*(p + 1) == q) {
483
- p++;
484
- } else {
485
- break;
486
- }
487
- }
488
- p++;
489
- }
490
- if (*p == q) {
491
- p++;
492
- }
493
- return p;
494
- }
495
-
496
361
  static void clear_comments(CONF *conf, char *p) {
497
362
  for (;;) {
498
- if (IS_FCOMMENT(conf, *p)) {
499
- *p = '\0';
500
- return;
501
- }
502
363
  if (!IS_WS(conf, *p)) {
503
364
  break;
504
365
  }
@@ -510,10 +371,6 @@ static void clear_comments(CONF *conf, char *p) {
510
371
  *p = '\0';
511
372
  return;
512
373
  }
513
- if (IS_DQUOTE(conf, *p)) {
514
- p = scan_dquote(conf, p);
515
- continue;
516
- }
517
374
  if (IS_QUOTE(conf, *p)) {
518
375
  p = scan_quote(conf, p);
519
376
  continue;
@@ -707,21 +564,13 @@ static int def_load_bio(CONF *conf, BIO *in, long *out_error_line) {
707
564
  v = NULL;
708
565
  }
709
566
  }
710
- if (buff != NULL) {
711
- BUF_MEM_free(buff);
712
- }
713
- if (section != NULL) {
714
- OPENSSL_free(section);
715
- }
567
+ BUF_MEM_free(buff);
568
+ OPENSSL_free(section);
716
569
  return 1;
717
570
 
718
571
  err:
719
- if (buff != NULL) {
720
- BUF_MEM_free(buff);
721
- }
722
- if (section != NULL) {
723
- OPENSSL_free(section);
724
- }
572
+ BUF_MEM_free(buff);
573
+ OPENSSL_free(section);
725
574
  if (out_error_line != NULL) {
726
575
  *out_error_line = eline;
727
576
  }
@@ -729,15 +578,9 @@ err:
729
578
  ERR_add_error_data(2, "line ", btmp);
730
579
 
731
580
  if (v != NULL) {
732
- if (v->name != NULL) {
733
- OPENSSL_free(v->name);
734
- }
735
- if (v->value != NULL) {
736
- OPENSSL_free(v->value);
737
- }
738
- if (v != NULL) {
739
- OPENSSL_free(v);
740
- }
581
+ OPENSSL_free(v->name);
582
+ OPENSSL_free(v->value);
583
+ OPENSSL_free(v);
741
584
  }
742
585
  return 0;
743
586
  }
@@ -55,8 +55,9 @@
55
55
  * [including the GNU Public Licence.]
56
56
  */
57
57
 
58
- /* THIS FILE WAS AUTOMAGICALLY GENERATED!
59
- Please modify and use keysets.pl to regenerate it. */
58
+ // This file was historically generated by keysets.pl in OpenSSL.
59
+ //
60
+ // TODO(davidben): Replace it with something more readable.
60
61
 
61
62
  #define CONF_NUMBER 1
62
63
  #define CONF_UPPER 2
@@ -66,9 +67,7 @@
66
67
  #define CONF_WS 16
67
68
  #define CONF_ESC 32
68
69
  #define CONF_QUOTE 64
69
- #define CONF_DQUOTE 1024
70
70
  #define CONF_COMMENT 128
71
- #define CONF_FCOMMENT 2048
72
71
  #define CONF_EOF 8
73
72
  #define CONF_HIGHBIT 4096
74
73
  #define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
@@ -78,7 +77,6 @@
78
77
 
79
78
  #define KEYTYPES(c) CONF_type_default
80
79
  #define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
81
- #define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
82
80
  #define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
83
81
  #define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
84
82
  #define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
@@ -87,8 +85,6 @@
87
85
  #define IS_ALPHA_NUMERIC_PUNCT(c,a) \
88
86
  (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
89
87
  #define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
90
- #define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
91
- #define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
92
88
 
93
89
  static const unsigned short CONF_type_default[256]={
94
90
  0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,