grpc 1.4.5 → 1.6.0.pre1

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 (928) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1235 -1100
  3. data/etc/roots.pem +0 -412
  4. data/include/grpc/byte_buffer.h +10 -25
  5. data/include/grpc/byte_buffer_reader.h +10 -25
  6. data/include/grpc/census.h +10 -25
  7. data/include/grpc/compression.h +10 -25
  8. data/include/grpc/grpc.h +15 -26
  9. data/include/grpc/grpc_cronet.h +10 -25
  10. data/include/grpc/grpc_posix.h +10 -25
  11. data/include/grpc/grpc_security.h +10 -25
  12. data/include/grpc/grpc_security_constants.h +10 -25
  13. data/include/grpc/impl/codegen/atm.h +11 -25
  14. data/include/grpc/impl/codegen/atm_gcc_atomic.h +10 -25
  15. data/include/grpc/impl/codegen/atm_gcc_sync.h +10 -25
  16. data/include/grpc/impl/codegen/atm_windows.h +10 -25
  17. data/include/grpc/impl/codegen/byte_buffer_reader.h +11 -26
  18. data/include/grpc/impl/codegen/compression_types.h +12 -27
  19. data/include/grpc/impl/codegen/connectivity_state.h +10 -25
  20. data/include/grpc/impl/codegen/exec_ctx_fwd.h +10 -25
  21. data/include/grpc/impl/codegen/gpr_slice.h +10 -25
  22. data/include/grpc/impl/codegen/gpr_types.h +10 -25
  23. data/include/grpc/impl/codegen/grpc_types.h +42 -43
  24. data/include/grpc/impl/codegen/port_platform.h +10 -25
  25. data/include/grpc/impl/codegen/propagation_bits.h +10 -25
  26. data/include/grpc/impl/codegen/slice.h +13 -28
  27. data/include/grpc/impl/codegen/status.h +10 -25
  28. data/include/grpc/impl/codegen/sync.h +10 -25
  29. data/include/grpc/impl/codegen/sync_generic.h +10 -25
  30. data/include/grpc/impl/codegen/sync_posix.h +10 -25
  31. data/include/grpc/impl/codegen/sync_windows.h +10 -25
  32. data/include/grpc/load_reporting.h +10 -25
  33. data/include/grpc/slice.h +10 -25
  34. data/include/grpc/slice_buffer.h +10 -25
  35. data/include/grpc/status.h +10 -25
  36. data/include/grpc/support/alloc.h +10 -25
  37. data/include/grpc/support/atm.h +10 -25
  38. data/include/grpc/support/atm_gcc_atomic.h +10 -25
  39. data/include/grpc/support/atm_gcc_sync.h +10 -25
  40. data/include/grpc/support/atm_windows.h +10 -25
  41. data/include/grpc/support/avl.h +46 -49
  42. data/include/grpc/support/cmdline.h +10 -25
  43. data/include/grpc/support/cpu.h +10 -25
  44. data/include/grpc/support/histogram.h +10 -25
  45. data/include/grpc/support/host_port.h +10 -25
  46. data/include/grpc/support/log.h +10 -25
  47. data/include/grpc/support/log_windows.h +10 -25
  48. data/include/grpc/support/port_platform.h +10 -25
  49. data/include/grpc/support/string_util.h +10 -25
  50. data/include/grpc/support/subprocess.h +10 -25
  51. data/include/grpc/support/sync.h +10 -25
  52. data/include/grpc/support/sync_generic.h +10 -25
  53. data/include/grpc/support/sync_posix.h +10 -25
  54. data/include/grpc/support/sync_windows.h +10 -25
  55. data/include/grpc/support/thd.h +10 -25
  56. data/include/grpc/support/time.h +10 -25
  57. data/include/grpc/support/tls.h +10 -25
  58. data/include/grpc/support/tls_gcc.h +10 -25
  59. data/include/grpc/support/tls_msvc.h +10 -25
  60. data/include/grpc/support/tls_pthread.h +10 -25
  61. data/include/grpc/support/useful.h +10 -25
  62. data/include/grpc/support/workaround_list.h +11 -26
  63. data/src/boringssl/err_data.c +277 -259
  64. data/src/core/ext/census/aggregation.h +10 -25
  65. data/src/core/ext/census/base_resources.c +10 -25
  66. data/src/core/ext/census/base_resources.h +10 -25
  67. data/src/core/ext/census/census_interface.h +10 -25
  68. data/src/core/ext/census/census_rpc_stats.h +10 -25
  69. data/src/core/ext/census/context.c +10 -25
  70. data/src/core/ext/census/gen/census.pb.c +10 -25
  71. data/src/core/ext/census/gen/census.pb.h +10 -25
  72. data/src/core/ext/census/gen/trace_context.pb.c +10 -25
  73. data/src/core/ext/census/gen/trace_context.pb.h +10 -25
  74. data/src/core/ext/census/grpc_context.c +10 -25
  75. data/src/core/ext/census/grpc_filter.c +11 -26
  76. data/src/core/ext/census/grpc_filter.h +10 -25
  77. data/src/core/ext/census/grpc_plugin.c +10 -25
  78. data/src/core/ext/census/initialize.c +10 -25
  79. data/src/core/ext/census/intrusive_hash_map.c +10 -25
  80. data/src/core/ext/census/intrusive_hash_map.h +10 -25
  81. data/src/core/ext/census/intrusive_hash_map_internal.h +10 -25
  82. data/src/core/ext/census/mlog.c +10 -25
  83. data/src/core/ext/census/mlog.h +10 -25
  84. data/src/core/ext/census/operation.c +10 -25
  85. data/src/core/ext/census/placeholders.c +10 -25
  86. data/src/core/ext/census/resource.c +10 -25
  87. data/src/core/ext/census/resource.h +10 -25
  88. data/src/core/ext/census/rpc_metric_id.h +10 -25
  89. data/src/core/ext/census/trace_context.c +10 -25
  90. data/src/core/ext/census/trace_context.h +10 -25
  91. data/src/core/ext/census/trace_label.h +10 -25
  92. data/src/core/ext/census/trace_propagation.h +10 -25
  93. data/src/core/ext/census/trace_status.h +10 -25
  94. data/src/core/ext/census/trace_string.h +10 -25
  95. data/src/core/ext/census/tracing.c +10 -26
  96. data/src/core/ext/census/tracing.h +10 -25
  97. data/src/core/ext/filters/client_channel/channel_connectivity.c +20 -33
  98. data/src/core/ext/filters/client_channel/client_channel.c +617 -520
  99. data/src/core/ext/filters/client_channel/client_channel.h +15 -28
  100. data/src/core/ext/filters/client_channel/client_channel_factory.c +13 -31
  101. data/src/core/ext/filters/client_channel/client_channel_factory.h +10 -25
  102. data/src/core/ext/filters/client_channel/client_channel_plugin.c +16 -29
  103. data/src/core/ext/filters/client_channel/connector.c +10 -25
  104. data/src/core/ext/filters/client_channel/connector.h +10 -25
  105. data/src/core/ext/filters/client_channel/http_connect_handshaker.c +15 -30
  106. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +10 -25
  107. data/src/core/ext/filters/client_channel/http_proxy.c +112 -38
  108. data/src/core/ext/filters/client_channel/http_proxy.h +10 -25
  109. data/src/core/ext/filters/client_channel/lb_policy.c +32 -36
  110. data/src/core/ext/filters/client_channel/lb_policy.h +24 -27
  111. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +14 -30
  112. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +10 -25
  113. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +464 -279
  114. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +10 -25
  115. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +15 -28
  116. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.c +40 -48
  117. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +65 -49
  118. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +31 -31
  119. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +47 -32
  120. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +11 -26
  121. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +13 -9
  122. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +27 -21
  123. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +373 -136
  124. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +504 -279
  125. data/src/core/ext/filters/client_channel/lb_policy_factory.c +12 -31
  126. data/src/core/ext/filters/client_channel/lb_policy_factory.h +12 -27
  127. data/src/core/ext/filters/client_channel/lb_policy_registry.c +10 -25
  128. data/src/core/ext/filters/client_channel/lb_policy_registry.h +10 -25
  129. data/src/core/ext/filters/client_channel/parse_address.c +10 -25
  130. data/src/core/ext/filters/client_channel/parse_address.h +10 -25
  131. data/src/core/ext/filters/client_channel/proxy_mapper.c +10 -25
  132. data/src/core/ext/filters/client_channel/proxy_mapper.h +10 -25
  133. data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +10 -25
  134. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +10 -25
  135. data/src/core/ext/filters/client_channel/resolver.c +33 -38
  136. data/src/core/ext/filters/client_channel/resolver.h +19 -30
  137. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +153 -50
  138. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +14 -27
  139. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +33 -30
  140. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +326 -116
  141. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +35 -36
  142. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c +60 -0
  143. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c +19 -34
  144. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +254 -0
  145. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +60 -0
  146. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +16 -28
  147. data/src/core/ext/filters/client_channel/resolver_factory.c +10 -25
  148. data/src/core/ext/filters/client_channel/resolver_factory.h +10 -25
  149. data/src/core/ext/filters/client_channel/resolver_registry.c +10 -25
  150. data/src/core/ext/filters/client_channel/resolver_registry.h +10 -25
  151. data/src/core/ext/filters/client_channel/retry_throttle.c +23 -34
  152. data/src/core/ext/filters/client_channel/retry_throttle.h +10 -25
  153. data/src/core/ext/filters/client_channel/subchannel.c +33 -55
  154. data/src/core/ext/filters/client_channel/subchannel.h +16 -26
  155. data/src/core/ext/filters/client_channel/subchannel_index.c +55 -92
  156. data/src/core/ext/filters/client_channel/subchannel_index.h +26 -29
  157. data/src/core/ext/filters/client_channel/uri_parser.c +10 -25
  158. data/src/core/ext/filters/client_channel/uri_parser.h +10 -25
  159. data/src/core/ext/filters/deadline/deadline_filter.c +30 -45
  160. data/src/core/ext/filters/deadline/deadline_filter.h +10 -25
  161. data/src/core/ext/filters/http/client/http_client_filter.c +255 -294
  162. data/src/core/ext/filters/http/client/http_client_filter.h +10 -25
  163. data/src/core/ext/filters/http/http_filters_plugin.c +11 -26
  164. data/src/core/ext/filters/http/message_compress/message_compress_filter.c +133 -105
  165. data/src/core/ext/filters/http/message_compress/message_compress_filter.h +10 -25
  166. data/src/core/ext/filters/http/server/http_server_filter.c +17 -32
  167. data/src/core/ext/filters/http/server/http_server_filter.h +10 -25
  168. data/src/core/ext/filters/load_reporting/load_reporting.c +11 -30
  169. data/src/core/ext/filters/load_reporting/load_reporting.h +10 -25
  170. data/src/core/ext/filters/load_reporting/load_reporting_filter.c +11 -26
  171. data/src/core/ext/filters/load_reporting/load_reporting_filter.h +10 -25
  172. data/src/core/ext/filters/max_age/max_age_filter.c +28 -43
  173. data/src/core/ext/filters/max_age/max_age_filter.h +10 -25
  174. data/src/core/ext/filters/message_size/message_size_filter.c +24 -37
  175. data/src/core/ext/filters/message_size/message_size_filter.h +10 -25
  176. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +16 -31
  177. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +10 -25
  178. data/src/core/ext/filters/workarounds/workaround_utils.c +12 -26
  179. data/src/core/ext/filters/workarounds/workaround_utils.h +11 -26
  180. data/src/core/ext/transport/chttp2/alpn/alpn.c +10 -25
  181. data/src/core/ext/transport/chttp2/alpn/alpn.h +10 -25
  182. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +13 -28
  183. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +10 -25
  184. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +13 -30
  185. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +12 -29
  186. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +13 -30
  187. data/src/core/ext/transport/chttp2/server/chttp2_server.c +11 -26
  188. data/src/core/ext/transport/chttp2/server/chttp2_server.h +10 -25
  189. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +10 -25
  190. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +10 -25
  191. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +10 -25
  192. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +11 -25
  193. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +10 -25
  194. data/src/core/ext/transport/chttp2/transport/bin_encoder.c +10 -25
  195. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +10 -25
  196. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +15 -27
  197. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +421 -443
  198. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +14 -25
  199. data/src/core/ext/transport/chttp2/transport/flow_control.c +500 -0
  200. data/src/core/ext/transport/chttp2/transport/frame.h +10 -25
  201. data/src/core/ext/transport/chttp2/transport/frame_data.c +20 -28
  202. data/src/core/ext/transport/chttp2/transport/frame_data.h +10 -25
  203. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +10 -25
  204. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +10 -25
  205. data/src/core/ext/transport/chttp2/transport/frame_ping.c +11 -26
  206. data/src/core/ext/transport/chttp2/transport/frame_ping.h +10 -25
  207. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +11 -26
  208. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +10 -25
  209. data/src/core/ext/transport/chttp2/transport/frame_settings.c +16 -29
  210. data/src/core/ext/transport/chttp2/transport/frame_settings.h +10 -25
  211. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -33
  212. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +10 -25
  213. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +18 -31
  214. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +12 -25
  215. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +15 -30
  216. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +10 -25
  217. data/src/core/ext/transport/chttp2/transport/hpack_table.c +10 -25
  218. data/src/core/ext/transport/chttp2/transport/hpack_table.h +10 -25
  219. data/src/core/ext/transport/chttp2/transport/http2_settings.c +10 -25
  220. data/src/core/ext/transport/chttp2/transport/http2_settings.h +10 -25
  221. data/src/core/ext/transport/chttp2/transport/huffsyms.c +10 -25
  222. data/src/core/ext/transport/chttp2/transport/huffsyms.h +10 -25
  223. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +10 -25
  224. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +10 -25
  225. data/src/core/ext/transport/chttp2/transport/internal.h +191 -179
  226. data/src/core/ext/transport/chttp2/transport/parsing.c +33 -102
  227. data/src/core/ext/transport/chttp2/transport/stream_lists.c +26 -28
  228. data/src/core/ext/transport/chttp2/transport/stream_map.c +10 -25
  229. data/src/core/ext/transport/chttp2/transport/stream_map.h +10 -25
  230. data/src/core/ext/transport/chttp2/transport/varint.c +14 -25
  231. data/src/core/ext/transport/chttp2/transport/varint.h +10 -25
  232. data/src/core/ext/transport/chttp2/transport/writing.c +164 -106
  233. data/src/core/ext/transport/inproc/inproc_plugin.c +29 -0
  234. data/src/core/ext/transport/inproc/inproc_transport.c +1303 -0
  235. data/src/core/ext/transport/inproc/inproc_transport.h +41 -0
  236. data/src/core/lib/channel/channel_args.c +52 -27
  237. data/src/core/lib/channel/channel_args.h +18 -27
  238. data/src/core/lib/channel/channel_stack.c +11 -26
  239. data/src/core/lib/channel/channel_stack.h +12 -27
  240. data/src/core/lib/channel/channel_stack_builder.c +11 -26
  241. data/src/core/lib/channel/channel_stack_builder.h +10 -25
  242. data/src/core/lib/channel/connected_channel.c +10 -25
  243. data/src/core/lib/channel/connected_channel.h +10 -25
  244. data/src/core/lib/channel/context.h +10 -25
  245. data/src/core/lib/channel/handshaker.c +14 -29
  246. data/src/core/lib/channel/handshaker.h +10 -25
  247. data/src/core/lib/channel/handshaker_factory.c +10 -25
  248. data/src/core/lib/channel/handshaker_factory.h +10 -25
  249. data/src/core/lib/channel/handshaker_registry.c +10 -25
  250. data/src/core/lib/channel/handshaker_registry.h +10 -25
  251. data/src/core/lib/compression/algorithm_metadata.h +10 -25
  252. data/src/core/lib/compression/compression.c +10 -25
  253. data/src/core/lib/compression/message_compress.c +10 -25
  254. data/src/core/lib/compression/message_compress.h +10 -25
  255. data/src/core/lib/compression/stream_compression.c +191 -0
  256. data/src/core/lib/compression/stream_compression.h +90 -0
  257. data/src/core/lib/debug/trace.c +28 -29
  258. data/src/core/lib/debug/trace.h +16 -30
  259. data/src/core/lib/http/format_request.c +10 -25
  260. data/src/core/lib/http/format_request.h +10 -25
  261. data/src/core/lib/http/httpcli.c +19 -35
  262. data/src/core/lib/http/httpcli.h +10 -25
  263. data/src/core/lib/http/httpcli_security_connector.c +17 -30
  264. data/src/core/lib/http/parser.c +11 -26
  265. data/src/core/lib/http/parser.h +10 -25
  266. data/src/core/lib/iomgr/closure.c +62 -25
  267. data/src/core/lib/iomgr/closure.h +81 -26
  268. data/src/core/lib/iomgr/combiner.c +103 -200
  269. data/src/core/lib/iomgr/combiner.h +14 -32
  270. data/src/core/lib/iomgr/endpoint.c +10 -29
  271. data/src/core/lib/iomgr/endpoint.h +10 -29
  272. data/src/core/lib/iomgr/endpoint_pair.h +10 -25
  273. data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -25
  274. data/src/core/lib/iomgr/endpoint_pair_uv.c +10 -25
  275. data/src/core/lib/iomgr/endpoint_pair_windows.c +10 -25
  276. data/src/core/lib/iomgr/error.c +45 -46
  277. data/src/core/lib/iomgr/error.h +21 -34
  278. data/src/core/lib/iomgr/error_internal.h +10 -25
  279. data/src/core/lib/iomgr/ev_epoll1_linux.c +279 -179
  280. data/src/core/lib/iomgr/ev_epoll1_linux.h +10 -25
  281. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +75 -264
  282. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +10 -25
  283. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +44 -199
  284. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +10 -25
  285. data/src/core/lib/iomgr/ev_epollex_linux.c +184 -247
  286. data/src/core/lib/iomgr/ev_epollex_linux.h +10 -25
  287. data/src/core/lib/iomgr/ev_epollsig_linux.c +116 -323
  288. data/src/core/lib/iomgr/ev_epollsig_linux.h +10 -25
  289. data/src/core/lib/iomgr/ev_poll_posix.c +328 -184
  290. data/src/core/lib/iomgr/ev_poll_posix.h +10 -25
  291. data/src/core/lib/iomgr/ev_posix.c +25 -56
  292. data/src/core/lib/iomgr/ev_posix.h +15 -44
  293. data/src/core/lib/iomgr/ev_windows.c +11 -26
  294. data/src/core/lib/iomgr/exec_ctx.c +36 -45
  295. data/src/core/lib/iomgr/exec_ctx.h +10 -25
  296. data/src/core/lib/iomgr/executor.c +152 -127
  297. data/src/core/lib/iomgr/executor.h +18 -26
  298. data/src/core/lib/iomgr/gethostname.h +26 -0
  299. data/src/core/lib/iomgr/gethostname_fallback.c +27 -0
  300. data/src/core/lib/iomgr/gethostname_host_name_max.c +37 -0
  301. data/src/core/lib/iomgr/gethostname_sysconf.c +37 -0
  302. data/src/core/lib/iomgr/iocp_windows.c +10 -25
  303. data/src/core/lib/iomgr/iocp_windows.h +10 -25
  304. data/src/core/lib/iomgr/iomgr.c +17 -28
  305. data/src/core/lib/iomgr/iomgr.h +12 -27
  306. data/src/core/lib/iomgr/iomgr_internal.h +10 -25
  307. data/src/core/lib/iomgr/iomgr_posix.c +11 -26
  308. data/src/core/lib/iomgr/iomgr_posix.h +10 -25
  309. data/src/core/lib/iomgr/iomgr_uv.c +19 -26
  310. data/src/core/lib/iomgr/iomgr_uv.h +37 -0
  311. data/src/core/lib/iomgr/iomgr_windows.c +10 -25
  312. data/src/core/lib/iomgr/is_epollexclusive_available.c +10 -25
  313. data/src/core/lib/iomgr/is_epollexclusive_available.h +10 -25
  314. data/src/core/lib/iomgr/load_file.c +10 -25
  315. data/src/core/lib/iomgr/load_file.h +10 -25
  316. data/src/core/lib/iomgr/lockfree_event.c +22 -35
  317. data/src/core/lib/iomgr/lockfree_event.h +13 -27
  318. data/src/core/lib/iomgr/nameser.h +104 -0
  319. data/src/core/lib/iomgr/network_status_tracker.c +10 -25
  320. data/src/core/lib/iomgr/network_status_tracker.h +10 -25
  321. data/src/core/lib/iomgr/polling_entity.c +10 -25
  322. data/src/core/lib/iomgr/polling_entity.h +14 -34
  323. data/src/core/lib/iomgr/pollset.h +14 -25
  324. data/src/core/lib/iomgr/pollset_set.h +10 -25
  325. data/src/core/lib/iomgr/pollset_set_uv.c +10 -25
  326. data/src/core/lib/iomgr/pollset_set_windows.c +10 -25
  327. data/src/core/lib/iomgr/pollset_set_windows.h +10 -25
  328. data/src/core/lib/iomgr/pollset_uv.c +25 -26
  329. data/src/core/lib/iomgr/pollset_uv.h +10 -25
  330. data/src/core/lib/iomgr/pollset_windows.c +17 -27
  331. data/src/core/lib/iomgr/pollset_windows.h +10 -25
  332. data/src/core/lib/iomgr/port.h +24 -25
  333. data/src/core/lib/iomgr/resolve_address.h +10 -25
  334. data/src/core/lib/iomgr/resolve_address_posix.c +13 -28
  335. data/src/core/lib/iomgr/resolve_address_uv.c +31 -35
  336. data/src/core/lib/iomgr/resolve_address_windows.c +13 -28
  337. data/src/core/lib/iomgr/resource_quota.c +52 -67
  338. data/src/core/lib/iomgr/resource_quota.h +10 -25
  339. data/src/core/lib/iomgr/sockaddr.h +10 -25
  340. data/src/core/lib/iomgr/sockaddr_posix.h +10 -25
  341. data/src/core/lib/iomgr/sockaddr_utils.c +15 -25
  342. data/src/core/lib/iomgr/sockaddr_utils.h +12 -25
  343. data/src/core/lib/iomgr/sockaddr_windows.h +10 -25
  344. data/src/core/lib/iomgr/socket_factory_posix.c +13 -31
  345. data/src/core/lib/iomgr/socket_factory_posix.h +10 -25
  346. data/src/core/lib/iomgr/socket_mutator.c +14 -31
  347. data/src/core/lib/iomgr/socket_mutator.h +10 -25
  348. data/src/core/lib/iomgr/socket_utils.h +10 -25
  349. data/src/core/lib/iomgr/socket_utils_common_posix.c +10 -25
  350. data/src/core/lib/iomgr/socket_utils_linux.c +10 -25
  351. data/src/core/lib/iomgr/socket_utils_posix.c +10 -25
  352. data/src/core/lib/iomgr/socket_utils_posix.h +10 -25
  353. data/src/core/lib/iomgr/socket_utils_uv.c +10 -25
  354. data/src/core/lib/iomgr/socket_utils_windows.c +10 -25
  355. data/src/core/lib/iomgr/socket_windows.c +12 -27
  356. data/src/core/lib/iomgr/socket_windows.h +10 -25
  357. data/src/core/lib/iomgr/sys_epoll_wrapper.h +10 -25
  358. data/src/core/lib/iomgr/tcp_client.h +10 -25
  359. data/src/core/lib/iomgr/tcp_client_posix.c +21 -34
  360. data/src/core/lib/iomgr/tcp_client_posix.h +10 -25
  361. data/src/core/lib/iomgr/tcp_client_uv.c +18 -27
  362. data/src/core/lib/iomgr/tcp_client_windows.c +14 -29
  363. data/src/core/lib/iomgr/tcp_posix.c +36 -55
  364. data/src/core/lib/iomgr/tcp_posix.h +10 -25
  365. data/src/core/lib/iomgr/tcp_server.h +10 -25
  366. data/src/core/lib/iomgr/tcp_server_posix.c +16 -31
  367. data/src/core/lib/iomgr/tcp_server_utils_posix.h +10 -25
  368. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +11 -26
  369. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +10 -25
  370. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +10 -25
  371. data/src/core/lib/iomgr/tcp_server_uv.c +103 -64
  372. data/src/core/lib/iomgr/tcp_server_windows.c +14 -29
  373. data/src/core/lib/iomgr/tcp_uv.c +41 -45
  374. data/src/core/lib/iomgr/tcp_uv.h +10 -25
  375. data/src/core/lib/iomgr/tcp_windows.c +39 -53
  376. data/src/core/lib/iomgr/tcp_windows.h +10 -25
  377. data/src/core/lib/iomgr/time_averaged_stats.c +10 -25
  378. data/src/core/lib/iomgr/time_averaged_stats.h +10 -25
  379. data/src/core/lib/iomgr/timer.h +18 -27
  380. data/src/core/lib/iomgr/timer_generic.c +91 -87
  381. data/src/core/lib/iomgr/timer_generic.h +10 -25
  382. data/src/core/lib/iomgr/timer_heap.c +10 -25
  383. data/src/core/lib/iomgr/timer_heap.h +10 -25
  384. data/src/core/lib/iomgr/timer_manager.c +178 -100
  385. data/src/core/lib/iomgr/timer_manager.h +10 -25
  386. data/src/core/lib/iomgr/timer_uv.c +23 -33
  387. data/src/core/lib/iomgr/timer_uv.h +10 -25
  388. data/src/core/lib/iomgr/udp_server.c +17 -32
  389. data/src/core/lib/iomgr/udp_server.h +10 -25
  390. data/src/core/lib/iomgr/unix_sockets_posix.c +10 -25
  391. data/src/core/lib/iomgr/unix_sockets_posix.h +10 -25
  392. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +10 -25
  393. data/src/core/lib/iomgr/wakeup_fd_cv.c +10 -25
  394. data/src/core/lib/iomgr/wakeup_fd_cv.h +13 -28
  395. data/src/core/lib/iomgr/wakeup_fd_eventfd.c +10 -25
  396. data/src/core/lib/iomgr/wakeup_fd_nospecial.c +10 -25
  397. data/src/core/lib/iomgr/wakeup_fd_pipe.c +10 -25
  398. data/src/core/lib/iomgr/wakeup_fd_pipe.h +10 -25
  399. data/src/core/lib/iomgr/wakeup_fd_posix.c +10 -25
  400. data/src/core/lib/iomgr/wakeup_fd_posix.h +10 -25
  401. data/src/core/lib/json/json.c +10 -25
  402. data/src/core/lib/json/json.h +10 -25
  403. data/src/core/lib/json/json_common.h +10 -25
  404. data/src/core/lib/json/json_reader.c +11 -25
  405. data/src/core/lib/json/json_reader.h +10 -25
  406. data/src/core/lib/json/json_string.c +10 -25
  407. data/src/core/lib/json/json_writer.c +10 -25
  408. data/src/core/lib/json/json_writer.h +10 -25
  409. data/src/core/lib/profiling/basic_timers.c +10 -25
  410. data/src/core/lib/profiling/stap_timers.c +10 -25
  411. data/src/core/lib/profiling/timers.h +10 -25
  412. data/src/core/lib/security/context/security_context.c +32 -40
  413. data/src/core/lib/security/context/security_context.h +15 -26
  414. data/src/core/lib/security/credentials/composite/composite_credentials.c +76 -81
  415. data/src/core/lib/security/credentials/composite/composite_credentials.h +10 -25
  416. data/src/core/lib/security/credentials/credentials.c +29 -49
  417. data/src/core/lib/security/credentials/credentials.h +48 -61
  418. data/src/core/lib/security/credentials/credentials_metadata.c +34 -78
  419. data/src/core/lib/security/credentials/fake/fake_credentials.c +33 -56
  420. data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -27
  421. data/src/core/lib/security/credentials/google_default/credentials_generic.c +10 -25
  422. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +12 -27
  423. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +10 -25
  424. data/src/core/lib/security/credentials/iam/iam_credentials.c +40 -40
  425. data/src/core/lib/security/credentials/iam/iam_credentials.h +11 -26
  426. data/src/core/lib/security/credentials/jwt/json_token.c +10 -25
  427. data/src/core/lib/security/credentials/jwt/json_token.h +10 -25
  428. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +45 -48
  429. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -26
  430. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +53 -33
  431. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +10 -25
  432. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +155 -87
  433. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +24 -28
  434. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +118 -82
  435. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +24 -27
  436. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +13 -32
  437. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -25
  438. data/src/core/lib/security/transport/auth_filters.h +10 -25
  439. data/src/core/lib/security/transport/client_auth_filter.c +217 -112
  440. data/src/core/lib/security/transport/lb_targets_info.c +16 -32
  441. data/src/core/lib/security/transport/lb_targets_info.h +10 -25
  442. data/src/core/lib/security/transport/secure_endpoint.c +29 -43
  443. data/src/core/lib/security/transport/secure_endpoint.h +10 -25
  444. data/src/core/lib/security/transport/security_connector.c +80 -61
  445. data/src/core/lib/security/transport/security_connector.h +35 -35
  446. data/src/core/lib/security/transport/security_handshaker.c +18 -33
  447. data/src/core/lib/security/transport/security_handshaker.h +10 -25
  448. data/src/core/lib/security/transport/server_auth_filter.c +62 -116
  449. data/src/core/lib/security/transport/tsi_error.c +10 -25
  450. data/src/core/lib/security/transport/tsi_error.h +10 -25
  451. data/src/core/lib/security/util/json_util.c +10 -25
  452. data/src/core/lib/security/util/json_util.h +10 -25
  453. data/src/core/lib/slice/b64.c +10 -25
  454. data/src/core/lib/slice/b64.h +10 -25
  455. data/src/core/lib/slice/percent_encoding.c +10 -25
  456. data/src/core/lib/slice/percent_encoding.h +10 -25
  457. data/src/core/lib/slice/slice.c +10 -25
  458. data/src/core/lib/slice/slice_buffer.c +10 -25
  459. data/src/core/lib/slice/slice_hash_table.c +48 -26
  460. data/src/core/lib/slice/slice_hash_table.h +26 -28
  461. data/src/core/lib/slice/slice_intern.c +10 -25
  462. data/src/core/lib/slice/slice_internal.h +10 -25
  463. data/src/core/lib/slice/slice_string_helpers.c +10 -25
  464. data/src/core/lib/slice/slice_string_helpers.h +10 -25
  465. data/src/core/lib/support/alloc.c +10 -25
  466. data/src/core/lib/support/arena.c +12 -27
  467. data/src/core/lib/support/arena.h +10 -25
  468. data/src/core/lib/support/atm.c +17 -32
  469. data/src/core/lib/support/atomic.h +10 -25
  470. data/src/core/lib/support/atomic_with_atm.h +10 -25
  471. data/src/core/lib/support/atomic_with_std.h +10 -25
  472. data/src/core/lib/support/avl.c +101 -101
  473. data/src/core/lib/support/backoff.c +10 -25
  474. data/src/core/lib/support/backoff.h +10 -25
  475. data/src/core/lib/support/block_annotate.h +10 -25
  476. data/src/core/lib/support/cmdline.c +10 -25
  477. data/src/core/lib/support/cpu_iphone.c +10 -25
  478. data/src/core/lib/support/cpu_linux.c +10 -25
  479. data/src/core/lib/support/cpu_posix.c +10 -25
  480. data/src/core/lib/support/cpu_windows.c +10 -25
  481. data/src/core/lib/support/env.h +16 -25
  482. data/src/core/lib/support/env_linux.c +30 -37
  483. data/src/core/lib/support/env_posix.c +15 -25
  484. data/src/core/lib/support/env_windows.c +15 -25
  485. data/src/core/lib/support/histogram.c +10 -25
  486. data/src/core/lib/support/host_port.c +10 -25
  487. data/src/core/lib/support/log.c +20 -29
  488. data/src/core/lib/support/log_android.c +10 -25
  489. data/src/core/lib/support/log_linux.c +13 -26
  490. data/src/core/lib/support/log_posix.c +10 -25
  491. data/src/core/lib/support/log_windows.c +10 -25
  492. data/src/core/lib/support/memory.h +10 -25
  493. data/src/core/lib/support/mpscq.c +11 -49
  494. data/src/core/lib/support/mpscq.h +11 -50
  495. data/src/core/lib/support/murmur_hash.c +12 -25
  496. data/src/core/lib/support/murmur_hash.h +10 -25
  497. data/src/core/lib/support/spinlock.h +10 -25
  498. data/src/core/lib/support/stack_lockfree.c +10 -25
  499. data/src/core/lib/support/stack_lockfree.h +10 -25
  500. data/src/core/lib/support/string.c +10 -25
  501. data/src/core/lib/support/string.h +10 -25
  502. data/src/core/lib/support/string_posix.c +10 -25
  503. data/src/core/lib/support/string_util_windows.c +10 -25
  504. data/src/core/lib/support/string_windows.c +10 -25
  505. data/src/core/lib/support/string_windows.h +10 -25
  506. data/src/core/lib/support/subprocess_posix.c +10 -25
  507. data/src/core/lib/support/subprocess_windows.c +10 -25
  508. data/src/core/lib/support/sync.c +10 -25
  509. data/src/core/lib/support/sync_posix.c +10 -25
  510. data/src/core/lib/support/sync_windows.c +10 -25
  511. data/src/core/lib/support/thd.c +10 -25
  512. data/src/core/lib/support/thd_internal.h +10 -25
  513. data/src/core/lib/support/thd_posix.c +10 -25
  514. data/src/core/lib/support/thd_windows.c +10 -25
  515. data/src/core/lib/support/time.c +10 -25
  516. data/src/core/lib/support/time_posix.c +10 -25
  517. data/src/core/lib/support/time_precise.c +18 -33
  518. data/src/core/lib/support/time_precise.h +10 -25
  519. data/src/core/lib/support/time_windows.c +10 -25
  520. data/src/core/lib/support/tls_pthread.c +10 -25
  521. data/src/core/lib/support/tmpfile.h +10 -25
  522. data/src/core/lib/support/tmpfile_msys.c +10 -25
  523. data/src/core/lib/support/tmpfile_posix.c +10 -25
  524. data/src/core/lib/support/tmpfile_windows.c +10 -25
  525. data/src/core/lib/support/wrap_memcpy.c +10 -25
  526. data/src/core/lib/surface/alarm.c +78 -35
  527. data/src/core/lib/surface/alarm_internal.h +40 -0
  528. data/src/core/lib/surface/api_trace.c +11 -26
  529. data/src/core/lib/surface/api_trace.h +10 -25
  530. data/src/core/lib/surface/byte_buffer.c +10 -25
  531. data/src/core/lib/surface/byte_buffer_reader.c +10 -25
  532. data/src/core/lib/surface/call.c +64 -84
  533. data/src/core/lib/surface/call.h +11 -26
  534. data/src/core/lib/surface/call_details.c +10 -25
  535. data/src/core/lib/surface/call_log_batch.c +10 -25
  536. data/src/core/lib/surface/call_test_only.h +10 -25
  537. data/src/core/lib/surface/channel.c +11 -26
  538. data/src/core/lib/surface/channel.h +11 -26
  539. data/src/core/lib/surface/channel_init.c +10 -25
  540. data/src/core/lib/surface/channel_init.h +10 -25
  541. data/src/core/lib/surface/channel_ping.c +12 -27
  542. data/src/core/lib/surface/channel_stack_type.c +10 -25
  543. data/src/core/lib/surface/channel_stack_type.h +10 -25
  544. data/src/core/lib/surface/completion_queue.c +442 -331
  545. data/src/core/lib/surface/completion_queue.h +16 -33
  546. data/src/core/lib/surface/completion_queue_factory.c +10 -25
  547. data/src/core/lib/surface/completion_queue_factory.h +10 -25
  548. data/src/core/lib/surface/event_string.c +10 -25
  549. data/src/core/lib/surface/event_string.h +10 -25
  550. data/src/core/lib/surface/init.c +38 -47
  551. data/src/core/lib/surface/init.h +10 -25
  552. data/src/core/lib/surface/init_secure.c +20 -27
  553. data/src/core/lib/surface/lame_client.cc +14 -29
  554. data/src/core/lib/surface/lame_client.h +10 -25
  555. data/src/core/lib/surface/metadata_array.c +10 -25
  556. data/src/core/lib/surface/server.c +128 -81
  557. data/src/core/lib/surface/server.h +10 -25
  558. data/src/core/lib/surface/validate_metadata.c +10 -25
  559. data/src/core/lib/surface/validate_metadata.h +10 -25
  560. data/src/core/lib/surface/version.c +11 -26
  561. data/src/core/lib/transport/bdp_estimator.c +19 -29
  562. data/src/core/lib/transport/bdp_estimator.h +16 -29
  563. data/src/core/lib/transport/byte_stream.c +127 -36
  564. data/src/core/lib/transport/byte_stream.h +88 -46
  565. data/src/core/lib/transport/connectivity_state.c +17 -31
  566. data/src/core/lib/transport/connectivity_state.h +10 -25
  567. data/src/core/lib/transport/error_utils.c +10 -25
  568. data/src/core/lib/transport/error_utils.h +10 -25
  569. data/src/core/lib/transport/http2_errors.h +10 -25
  570. data/src/core/lib/transport/metadata.c +87 -85
  571. data/src/core/lib/transport/metadata.h +15 -28
  572. data/src/core/lib/transport/metadata_batch.c +10 -25
  573. data/src/core/lib/transport/metadata_batch.h +10 -25
  574. data/src/core/lib/transport/pid_controller.c +10 -25
  575. data/src/core/lib/transport/pid_controller.h +10 -25
  576. data/src/core/lib/transport/service_config.c +11 -26
  577. data/src/core/lib/transport/service_config.h +10 -25
  578. data/src/core/lib/transport/static_metadata.c +12 -26
  579. data/src/core/lib/transport/static_metadata.h +10 -25
  580. data/src/core/lib/transport/status_conversion.c +10 -25
  581. data/src/core/lib/transport/status_conversion.h +10 -25
  582. data/src/core/lib/transport/timeout_encoding.c +10 -25
  583. data/src/core/lib/transport/timeout_encoding.h +10 -25
  584. data/src/core/lib/transport/transport.c +60 -53
  585. data/src/core/lib/transport/transport.h +36 -34
  586. data/src/core/lib/transport/transport_impl.h +10 -25
  587. data/src/core/lib/transport/transport_op_string.c +10 -28
  588. data/src/core/plugin_registry/grpc_plugin_registry.c +22 -25
  589. data/src/core/tsi/fake_transport_security.c +199 -94
  590. data/src/core/tsi/fake_transport_security.h +11 -26
  591. data/src/core/tsi/gts_transport_security.c +40 -0
  592. data/src/core/tsi/gts_transport_security.h +37 -0
  593. data/src/core/tsi/ssl_transport_security.c +13 -32
  594. data/src/core/tsi/ssl_transport_security.h +10 -25
  595. data/src/core/tsi/ssl_types.h +10 -25
  596. data/src/core/tsi/transport_security.c +48 -78
  597. data/src/core/tsi/transport_security.h +18 -27
  598. data/src/core/tsi/transport_security_adapter.c +17 -29
  599. data/src/core/tsi/transport_security_adapter.h +10 -25
  600. data/src/core/tsi/transport_security_grpc.c +64 -0
  601. data/src/core/tsi/transport_security_grpc.h +80 -0
  602. data/src/core/tsi/transport_security_interface.h +21 -27
  603. data/src/ruby/bin/apis/google/protobuf/empty.rb +10 -25
  604. data/src/ruby/bin/apis/pubsub_demo.rb +10 -25
  605. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +10 -25
  606. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +10 -25
  607. data/src/ruby/bin/math_client.rb +10 -25
  608. data/src/ruby/bin/math_server.rb +10 -25
  609. data/src/ruby/bin/math_services_pb.rb +10 -25
  610. data/src/ruby/bin/noproto_client.rb +10 -25
  611. data/src/ruby/bin/noproto_server.rb +10 -25
  612. data/src/ruby/ext/grpc/extconf.rb +10 -25
  613. data/src/ruby/ext/grpc/rb_byte_buffer.c +10 -25
  614. data/src/ruby/ext/grpc/rb_byte_buffer.h +10 -25
  615. data/src/ruby/ext/grpc/rb_call.c +44 -25
  616. data/src/ruby/ext/grpc/rb_call.h +10 -25
  617. data/src/ruby/ext/grpc/rb_call_credentials.c +10 -25
  618. data/src/ruby/ext/grpc/rb_call_credentials.h +10 -25
  619. data/src/ruby/ext/grpc/rb_channel.c +10 -25
  620. data/src/ruby/ext/grpc/rb_channel.h +10 -25
  621. data/src/ruby/ext/grpc/rb_channel_args.c +10 -25
  622. data/src/ruby/ext/grpc/rb_channel_args.h +10 -25
  623. data/src/ruby/ext/grpc/rb_channel_credentials.c +10 -25
  624. data/src/ruby/ext/grpc/rb_channel_credentials.h +10 -25
  625. data/src/ruby/ext/grpc/rb_completion_queue.c +10 -25
  626. data/src/ruby/ext/grpc/rb_completion_queue.h +10 -25
  627. data/src/ruby/ext/grpc/rb_compression_options.c +10 -25
  628. data/src/ruby/ext/grpc/rb_compression_options.h +10 -25
  629. data/src/ruby/ext/grpc/rb_event_thread.c +10 -25
  630. data/src/ruby/ext/grpc/rb_event_thread.h +10 -25
  631. data/src/ruby/ext/grpc/rb_grpc.c +10 -25
  632. data/src/ruby/ext/grpc/rb_grpc.h +10 -25
  633. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -25
  634. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +16 -31
  635. data/src/ruby/ext/grpc/rb_loader.c +10 -25
  636. data/src/ruby/ext/grpc/rb_loader.h +10 -25
  637. data/src/ruby/ext/grpc/rb_server.c +10 -25
  638. data/src/ruby/ext/grpc/rb_server.h +10 -25
  639. data/src/ruby/ext/grpc/rb_server_credentials.c +10 -25
  640. data/src/ruby/ext/grpc/rb_server_credentials.h +10 -25
  641. data/src/ruby/lib/grpc.rb +10 -25
  642. data/src/ruby/lib/grpc/core/time_consts.rb +10 -25
  643. data/src/ruby/lib/grpc/errors.rb +16 -30
  644. data/src/ruby/lib/grpc/generic/active_call.rb +25 -27
  645. data/src/ruby/lib/grpc/generic/bidi_call.rb +17 -27
  646. data/src/ruby/lib/grpc/generic/client_stub.rb +10 -25
  647. data/src/ruby/lib/grpc/generic/rpc_desc.rb +10 -25
  648. data/src/ruby/lib/grpc/generic/rpc_server.rb +10 -25
  649. data/src/ruby/lib/grpc/generic/service.rb +10 -25
  650. data/src/ruby/lib/grpc/grpc.rb +10 -25
  651. data/src/ruby/lib/grpc/logconfig.rb +10 -25
  652. data/src/ruby/lib/grpc/notifier.rb +10 -25
  653. data/src/ruby/lib/grpc/version.rb +11 -26
  654. data/src/ruby/pb/generate_proto_ruby.sh +10 -25
  655. data/src/ruby/pb/grpc/health/checker.rb +10 -25
  656. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +10 -25
  657. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +10 -25
  658. data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +10 -25
  659. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +10 -25
  660. data/src/ruby/pb/test/client.rb +10 -25
  661. data/src/ruby/pb/test/server.rb +10 -25
  662. data/src/ruby/spec/call_credentials_spec.rb +10 -25
  663. data/src/ruby/spec/call_spec.rb +43 -25
  664. data/src/ruby/spec/channel_connection_spec.rb +10 -25
  665. data/src/ruby/spec/channel_credentials_spec.rb +11 -26
  666. data/src/ruby/spec/channel_spec.rb +10 -25
  667. data/src/ruby/spec/client_auth_spec.rb +10 -25
  668. data/src/ruby/spec/client_server_spec.rb +66 -25
  669. data/src/ruby/spec/compression_options_spec.rb +10 -25
  670. data/src/ruby/spec/error_sanity_spec.rb +10 -25
  671. data/src/ruby/spec/generic/active_call_spec.rb +10 -25
  672. data/src/ruby/spec/generic/client_stub_spec.rb +146 -35
  673. data/src/ruby/spec/generic/rpc_desc_spec.rb +10 -25
  674. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +10 -25
  675. data/src/ruby/spec/generic/rpc_server_spec.rb +124 -34
  676. data/src/ruby/spec/generic/service_spec.rb +10 -25
  677. data/src/ruby/spec/pb/duplicate/codegen_spec.rb +10 -25
  678. data/src/ruby/spec/pb/health/checker_spec.rb +10 -25
  679. data/src/ruby/spec/server_credentials_spec.rb +10 -25
  680. data/src/ruby/spec/server_spec.rb +10 -25
  681. data/src/ruby/spec/spec_helper.rb +10 -25
  682. data/src/ruby/spec/time_consts_spec.rb +10 -25
  683. data/third_party/boringssl/crypto/aes/key_wrap.c +138 -0
  684. data/third_party/boringssl/crypto/asn1/a_bitstr.c +6 -3
  685. data/third_party/boringssl/crypto/asn1/a_enum.c +4 -1
  686. data/third_party/boringssl/crypto/asn1/a_gentm.c +20 -15
  687. data/third_party/boringssl/crypto/asn1/a_int.c +7 -4
  688. data/third_party/boringssl/crypto/asn1/a_object.c +5 -2
  689. data/third_party/boringssl/crypto/asn1/a_time.c +0 -1
  690. data/third_party/boringssl/crypto/asn1/a_utctm.c +1 -2
  691. data/third_party/boringssl/crypto/asn1/asn1_lib.c +5 -2
  692. data/third_party/boringssl/crypto/asn1/asn1_locl.h +35 -0
  693. data/third_party/boringssl/crypto/asn1/tasn_dec.c +3 -1
  694. data/third_party/boringssl/crypto/asn1/tasn_enc.c +6 -3
  695. data/third_party/boringssl/crypto/asn1/tasn_new.c +12 -7
  696. data/third_party/boringssl/crypto/asn1/tasn_utl.c +22 -8
  697. data/third_party/boringssl/crypto/{time_support.c → asn1/time_support.c} +1 -1
  698. data/third_party/boringssl/crypto/asn1/x_long.c +5 -2
  699. data/third_party/boringssl/crypto/base64/base64.c +7 -5
  700. data/third_party/boringssl/crypto/bio/bio.c +24 -10
  701. data/third_party/boringssl/crypto/bio/bio_mem.c +12 -10
  702. data/third_party/boringssl/crypto/bio/connect.c +7 -18
  703. data/third_party/boringssl/crypto/bio/fd.c +3 -6
  704. data/third_party/boringssl/crypto/bio/file.c +6 -6
  705. data/third_party/boringssl/crypto/bio/hexdump.c +4 -2
  706. data/third_party/boringssl/crypto/bio/pair.c +30 -344
  707. data/third_party/boringssl/crypto/bio/socket.c +6 -7
  708. data/third_party/boringssl/crypto/bio/socket_helper.c +4 -3
  709. data/third_party/boringssl/crypto/bn/add.c +1 -1
  710. data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +11 -10
  711. data/third_party/boringssl/crypto/bn/bn.c +6 -20
  712. data/third_party/boringssl/crypto/bn/cmp.c +14 -0
  713. data/third_party/boringssl/crypto/bn/convert.c +73 -2
  714. data/third_party/boringssl/crypto/bn/ctx.c +3 -1
  715. data/third_party/boringssl/crypto/bn/div.c +108 -51
  716. data/third_party/boringssl/crypto/bn/exponentiation.c +15 -33
  717. data/third_party/boringssl/crypto/bn/gcd.c +29 -22
  718. data/third_party/boringssl/crypto/bn/generic.c +71 -67
  719. data/third_party/boringssl/crypto/bn/internal.h +19 -6
  720. data/third_party/boringssl/crypto/bn/kronecker.c +1 -0
  721. data/third_party/boringssl/crypto/bn/montgomery.c +9 -10
  722. data/third_party/boringssl/crypto/bn/montgomery_inv.c +47 -0
  723. data/third_party/boringssl/crypto/bn/mul.c +11 -9
  724. data/third_party/boringssl/crypto/bn/random.c +6 -3
  725. data/third_party/boringssl/crypto/bn/rsaz_exp.c +0 -65
  726. data/third_party/boringssl/crypto/bn/rsaz_exp.h +0 -3
  727. data/third_party/boringssl/crypto/bn/shift.c +9 -1
  728. data/third_party/boringssl/crypto/bn/sqrt.c +3 -1
  729. data/third_party/boringssl/crypto/buf/buf.c +6 -4
  730. data/third_party/boringssl/crypto/bytestring/asn1_compat.c +2 -1
  731. data/third_party/boringssl/crypto/bytestring/ber.c +2 -1
  732. data/third_party/boringssl/crypto/bytestring/cbb.c +9 -7
  733. data/third_party/boringssl/crypto/bytestring/cbs.c +54 -2
  734. data/third_party/boringssl/crypto/chacha/chacha.c +1 -1
  735. data/third_party/boringssl/crypto/cipher/aead.c +3 -3
  736. data/third_party/boringssl/crypto/cipher/cipher.c +18 -13
  737. data/third_party/boringssl/crypto/cipher/e_aes.c +335 -281
  738. data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +113 -137
  739. data/third_party/boringssl/crypto/cipher/e_null.c +2 -1
  740. data/third_party/boringssl/crypto/cipher/e_rc2.c +54 -49
  741. data/third_party/boringssl/crypto/cipher/e_ssl3.c +4 -3
  742. data/third_party/boringssl/crypto/cipher/e_tls.c +5 -5
  743. data/third_party/boringssl/crypto/cipher/tls_cbc.c +41 -112
  744. data/third_party/boringssl/crypto/cmac/cmac.c +6 -4
  745. data/third_party/boringssl/crypto/conf/conf.c +6 -3
  746. data/third_party/boringssl/crypto/cpu-arm-linux.c +2 -2
  747. data/third_party/boringssl/crypto/curve25519/curve25519.c +28 -34
  748. data/third_party/boringssl/crypto/curve25519/spake25519.c +7 -6
  749. data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +2 -1
  750. data/third_party/boringssl/crypto/des/des.c +1 -1
  751. data/third_party/boringssl/crypto/des/internal.h +58 -46
  752. data/third_party/boringssl/crypto/dh/dh.c +4 -8
  753. data/third_party/boringssl/crypto/digest/digest.c +5 -2
  754. data/third_party/boringssl/crypto/digest/digests.c +70 -33
  755. data/third_party/boringssl/crypto/digest/md32_common.h +39 -27
  756. data/third_party/boringssl/crypto/dsa/dsa.c +11 -19
  757. data/third_party/boringssl/crypto/ec/ec.c +1 -1
  758. data/third_party/boringssl/crypto/ec/ec_asn1.c +3 -2
  759. data/third_party/boringssl/crypto/ec/ec_key.c +1 -1
  760. data/third_party/boringssl/crypto/ec/ec_montgomery.c +6 -11
  761. data/third_party/boringssl/crypto/ec/oct.c +2 -14
  762. data/third_party/boringssl/crypto/ec/p224-64.c +78 -122
  763. data/third_party/boringssl/crypto/ec/p256-64.c +93 -133
  764. data/third_party/boringssl/crypto/ec/p256-x86_64.c +48 -61
  765. data/third_party/boringssl/crypto/ec/p256-x86_64.h +113 -0
  766. data/third_party/boringssl/crypto/ec/simple.c +2 -1
  767. data/third_party/boringssl/crypto/ec/wnaf.c +52 -43
  768. data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -2
  769. data/third_party/boringssl/crypto/ecdsa/ecdsa.c +17 -16
  770. data/third_party/boringssl/crypto/engine/engine.c +3 -1
  771. data/third_party/boringssl/crypto/err/err.c +5 -5
  772. data/third_party/boringssl/crypto/evp/evp.c +1 -1
  773. data/third_party/boringssl/crypto/evp/evp_asn1.c +1 -1
  774. data/third_party/boringssl/crypto/evp/evp_ctx.c +23 -29
  775. data/third_party/boringssl/crypto/evp/p_ec.c +2 -1
  776. data/third_party/boringssl/crypto/evp/p_rsa.c +9 -3
  777. data/third_party/boringssl/crypto/evp/pbkdf.c +3 -1
  778. data/third_party/boringssl/crypto/hkdf/hkdf.c +3 -1
  779. data/third_party/boringssl/crypto/hmac/hmac.c +4 -2
  780. data/third_party/boringssl/crypto/internal.h +81 -0
  781. data/third_party/boringssl/crypto/lhash/lhash.c +7 -13
  782. data/third_party/boringssl/crypto/md4/md4.c +20 -18
  783. data/third_party/boringssl/crypto/md5/md5.c +31 -21
  784. data/third_party/boringssl/crypto/mem.c +4 -10
  785. data/third_party/boringssl/crypto/modes/cbc.c +2 -6
  786. data/third_party/boringssl/crypto/modes/cfb.c +2 -2
  787. data/third_party/boringssl/crypto/modes/ctr.c +1 -1
  788. data/third_party/boringssl/crypto/modes/gcm.c +117 -334
  789. data/third_party/boringssl/crypto/modes/internal.h +107 -84
  790. data/third_party/boringssl/crypto/modes/ofb.c +3 -3
  791. data/third_party/boringssl/crypto/modes/polyval.c +94 -0
  792. data/third_party/boringssl/crypto/obj/obj.c +13 -8
  793. data/third_party/boringssl/crypto/obj/obj_dat.h +6109 -5187
  794. data/third_party/boringssl/crypto/obj/obj_xref.c +55 -57
  795. data/third_party/boringssl/crypto/pem/pem_lib.c +6 -3
  796. data/third_party/boringssl/crypto/pkcs8/internal.h +27 -8
  797. data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +137 -352
  798. data/third_party/boringssl/crypto/pkcs8/pkcs8.c +371 -364
  799. data/third_party/boringssl/crypto/poly1305/poly1305.c +12 -18
  800. data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +2 -2
  801. data/third_party/boringssl/crypto/{newhope/reduce.c → pool/internal.h} +24 -21
  802. data/third_party/boringssl/crypto/pool/pool.c +200 -0
  803. data/third_party/boringssl/crypto/rand/deterministic.c +6 -5
  804. data/third_party/boringssl/crypto/rand/fuchsia.c +43 -0
  805. data/third_party/boringssl/crypto/rand/rand.c +7 -7
  806. data/third_party/boringssl/crypto/rand/urandom.c +136 -22
  807. data/third_party/boringssl/crypto/rand/windows.c +2 -2
  808. data/third_party/boringssl/crypto/rsa/blinding.c +2 -1
  809. data/third_party/boringssl/crypto/rsa/padding.c +11 -11
  810. data/third_party/boringssl/crypto/rsa/rsa.c +4 -4
  811. data/third_party/boringssl/crypto/rsa/rsa_asn1.c +7 -1
  812. data/third_party/boringssl/crypto/rsa/rsa_impl.c +41 -80
  813. data/third_party/boringssl/crypto/sha/sha1-altivec.c +346 -0
  814. data/third_party/boringssl/crypto/sha/sha1.c +60 -42
  815. data/third_party/boringssl/crypto/sha/sha256.c +4 -2
  816. data/third_party/boringssl/crypto/sha/sha512.c +9 -7
  817. data/third_party/boringssl/crypto/stack/stack.c +10 -7
  818. data/third_party/boringssl/crypto/thread_pthread.c +2 -2
  819. data/third_party/boringssl/crypto/thread_win.c +2 -2
  820. data/third_party/boringssl/crypto/x509/a_verify.c +1 -1
  821. data/third_party/boringssl/crypto/x509/asn1_gen.c +1 -1
  822. data/third_party/boringssl/crypto/x509/by_dir.c +1 -1
  823. data/third_party/boringssl/crypto/x509/t_x509.c +78 -38
  824. data/third_party/boringssl/crypto/x509/x509_cmp.c +8 -5
  825. data/third_party/boringssl/crypto/x509/x509_lu.c +6 -1
  826. data/third_party/boringssl/crypto/x509/x509_obj.c +4 -1
  827. data/third_party/boringssl/crypto/x509/x509_vfy.c +42 -8
  828. data/third_party/boringssl/crypto/x509/x509_vpm.c +8 -6
  829. data/third_party/boringssl/crypto/x509/x509name.c +4 -1
  830. data/third_party/boringssl/crypto/x509/x_crl.c +4 -2
  831. data/third_party/boringssl/crypto/x509/x_name.c +23 -13
  832. data/third_party/boringssl/crypto/x509/x_pkey.c +4 -1
  833. data/third_party/boringssl/crypto/x509/x_x509.c +42 -3
  834. data/third_party/boringssl/crypto/x509v3/pcy_int.h +2 -2
  835. data/third_party/boringssl/crypto/x509v3/pcy_tree.c +2 -1
  836. data/third_party/boringssl/crypto/x509v3/v3_cpols.c +1 -1
  837. data/third_party/boringssl/crypto/x509v3/v3_ia5.c +4 -1
  838. data/third_party/boringssl/crypto/x509v3/v3_ncons.c +4 -1
  839. data/third_party/boringssl/crypto/x509v3/v3_pci.c +6 -3
  840. data/third_party/boringssl/crypto/x509v3/v3_purp.c +13 -21
  841. data/third_party/boringssl/crypto/x509v3/v3_utl.c +19 -33
  842. data/third_party/boringssl/include/openssl/aead.h +9 -20
  843. data/third_party/boringssl/include/openssl/aes.h +21 -9
  844. data/third_party/boringssl/include/openssl/asn1.h +9 -1
  845. data/third_party/boringssl/include/openssl/base.h +33 -6
  846. data/third_party/boringssl/include/openssl/bio.h +10 -103
  847. data/third_party/boringssl/include/openssl/bn.h +58 -42
  848. data/third_party/boringssl/include/openssl/bytestring.h +17 -0
  849. data/third_party/boringssl/include/openssl/cipher.h +4 -3
  850. data/third_party/boringssl/include/openssl/conf.h +4 -1
  851. data/third_party/boringssl/include/openssl/curve25519.h +13 -0
  852. data/third_party/boringssl/include/openssl/digest.h +5 -3
  853. data/third_party/boringssl/include/openssl/dsa.h +5 -5
  854. data/third_party/boringssl/include/openssl/ec.h +2 -2
  855. data/third_party/boringssl/include/openssl/ecdh.h +3 -4
  856. data/third_party/boringssl/include/openssl/ecdsa.h +10 -10
  857. data/third_party/boringssl/include/openssl/err.h +5 -5
  858. data/third_party/boringssl/include/openssl/evp.h +11 -7
  859. data/third_party/boringssl/include/openssl/lhash.h +2 -3
  860. data/third_party/boringssl/include/openssl/lhash_macros.h +56 -14
  861. data/third_party/boringssl/include/openssl/nid.h +2949 -2916
  862. data/third_party/boringssl/include/openssl/obj.h +1 -1
  863. data/third_party/boringssl/include/openssl/pkcs8.h +21 -42
  864. data/third_party/boringssl/include/openssl/pool.h +87 -0
  865. data/third_party/boringssl/include/openssl/rand.h +1 -1
  866. data/third_party/boringssl/include/openssl/rsa.h +4 -2
  867. data/third_party/boringssl/include/openssl/sha.h +0 -4
  868. data/third_party/boringssl/include/openssl/ssl.h +327 -662
  869. data/third_party/boringssl/include/openssl/ssl3.h +1 -21
  870. data/third_party/boringssl/include/openssl/stack.h +1 -0
  871. data/third_party/boringssl/include/openssl/stack_macros.h +85 -0
  872. data/third_party/boringssl/include/openssl/tls1.h +23 -52
  873. data/third_party/boringssl/include/openssl/type_check.h +4 -0
  874. data/third_party/boringssl/include/openssl/x509.h +10 -59
  875. data/third_party/boringssl/include/openssl/x509_vfy.h +7 -1
  876. data/third_party/boringssl/include/openssl/x509v3.h +4 -4
  877. data/third_party/boringssl/ssl/bio_ssl.c +175 -0
  878. data/third_party/boringssl/ssl/custom_extensions.c +24 -21
  879. data/third_party/boringssl/ssl/d1_both.c +259 -289
  880. data/third_party/boringssl/ssl/d1_lib.c +8 -20
  881. data/third_party/boringssl/ssl/d1_pkt.c +6 -15
  882. data/third_party/boringssl/ssl/dtls_method.c +22 -8
  883. data/third_party/boringssl/ssl/dtls_record.c +27 -2
  884. data/third_party/boringssl/ssl/handshake_client.c +460 -579
  885. data/third_party/boringssl/ssl/handshake_server.c +662 -644
  886. data/third_party/boringssl/ssl/internal.h +1009 -375
  887. data/third_party/boringssl/ssl/s3_both.c +312 -162
  888. data/third_party/boringssl/ssl/s3_lib.c +12 -128
  889. data/third_party/boringssl/ssl/s3_pkt.c +22 -30
  890. data/third_party/boringssl/ssl/ssl_aead_ctx.c +28 -22
  891. data/third_party/boringssl/ssl/ssl_asn1.c +210 -114
  892. data/third_party/boringssl/ssl/ssl_buffer.c +2 -1
  893. data/third_party/boringssl/ssl/ssl_cert.c +417 -219
  894. data/third_party/boringssl/ssl/ssl_cipher.c +191 -393
  895. data/third_party/boringssl/ssl/ssl_ecdh.c +19 -164
  896. data/third_party/boringssl/ssl/ssl_file.c +0 -11
  897. data/third_party/boringssl/ssl/ssl_lib.c +325 -652
  898. data/third_party/boringssl/ssl/{ssl_rsa.c → ssl_privkey.c} +21 -131
  899. data/third_party/boringssl/ssl/ssl_privkey_cc.cc +76 -0
  900. data/third_party/boringssl/ssl/ssl_session.c +206 -95
  901. data/third_party/boringssl/ssl/ssl_stat.c +18 -84
  902. data/third_party/boringssl/ssl/{s3_enc.c → ssl_transcript.c} +150 -157
  903. data/third_party/boringssl/ssl/ssl_x509.c +815 -0
  904. data/third_party/boringssl/ssl/t1_enc.c +188 -174
  905. data/third_party/boringssl/ssl/t1_lib.c +1064 -764
  906. data/third_party/boringssl/ssl/tls13_both.c +290 -96
  907. data/third_party/boringssl/ssl/tls13_client.c +344 -314
  908. data/third_party/boringssl/ssl/tls13_enc.c +239 -200
  909. data/third_party/boringssl/ssl/tls13_server.c +374 -366
  910. data/third_party/boringssl/ssl/tls_method.c +40 -5
  911. data/third_party/boringssl/ssl/tls_record.c +166 -71
  912. metadata +39 -25
  913. data/src/core/lib/iomgr/workqueue.h +0 -87
  914. data/src/core/lib/iomgr/workqueue_uv.c +0 -65
  915. data/src/core/lib/iomgr/workqueue_uv.h +0 -37
  916. data/src/core/lib/iomgr/workqueue_windows.c +0 -63
  917. data/src/core/lib/iomgr/workqueue_windows.h +0 -37
  918. data/third_party/boringssl/crypto/bio/buffer.c +0 -496
  919. data/third_party/boringssl/crypto/newhope/error_correction.c +0 -131
  920. data/third_party/boringssl/crypto/newhope/internal.h +0 -71
  921. data/third_party/boringssl/crypto/newhope/newhope.c +0 -174
  922. data/third_party/boringssl/crypto/newhope/ntt.c +0 -148
  923. data/third_party/boringssl/crypto/newhope/poly.c +0 -183
  924. data/third_party/boringssl/crypto/newhope/precomp.c +0 -306
  925. data/third_party/boringssl/crypto/obj/obj_xref.h +0 -96
  926. data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +0 -151
  927. data/third_party/boringssl/include/openssl/newhope.h +0 -158
  928. data/third_party/boringssl/include/openssl/time_support.h +0 -91
@@ -135,7 +135,7 @@ OPENSSL_EXPORT int OBJ_nid2cbb(CBB *out, int nid);
135
135
 
136
136
  /* Dealing with textual representations of object identifiers. */
137
137
 
138
- /* OBJ_txt2obj returns an ASN1_OBJECT for the textual respresentation in |s|.
138
+ /* OBJ_txt2obj returns an ASN1_OBJECT for the textual representation in |s|.
139
139
  * If |dont_search_names| is zero, then |s| will be matched against the long
140
140
  * and short names of a known objects to find a match. Otherwise |s| must
141
141
  * contain an ASCII string with a dotted sequence of numbers. The resulting
@@ -66,45 +66,42 @@ extern "C" {
66
66
  #endif
67
67
 
68
68
 
69
- /* PKCS8_encrypt_pbe serializes and encrypts a PKCS8_PRIV_KEY_INFO with PBES1 or
69
+ /* PKCS8_encrypt serializes and encrypts a PKCS8_PRIV_KEY_INFO with PBES1 or
70
70
  * PBES2 as defined in PKCS #5. Only pbeWithSHAAnd128BitRC4,
71
71
  * pbeWithSHAAnd3-KeyTripleDES-CBC and pbeWithSHA1And40BitRC2, defined in PKCS
72
72
  * #12, and PBES2, are supported. PBES2 is selected by setting |cipher| and
73
73
  * passing -1 for |pbe_nid|. Otherwise, PBES1 is used and |cipher| is ignored.
74
74
  *
75
- * The |pass_raw_len| bytes pointed to by |pass_raw| are used as the password.
76
- * Note that any conversions from the password as supplied in a text string
77
- * (such as those specified in B.1 of PKCS #12) must be performed by the caller.
75
+ * |pass| is used as the password. If a PBES1 scheme from PKCS #12 is used, this
76
+ * will be converted to a raw byte string as specified in B.1 of PKCS #12. If
77
+ * |pass| is NULL, it will be encoded as the empty byte string rather than two
78
+ * zero bytes, the PKCS #12 encoding of the empty string.
78
79
  *
79
80
  * If |salt| is NULL, a random salt of |salt_len| bytes is generated. If
80
81
  * |salt_len| is zero, a default salt length is used instead.
81
82
  *
82
- * The resulting structure is stored in an X509_SIG which must be freed by the
83
- * caller.
84
- *
85
- * TODO(davidben): Really? An X509_SIG? OpenSSL probably did that because it has
86
- * the same structure as EncryptedPrivateKeyInfo. */
87
- OPENSSL_EXPORT X509_SIG *PKCS8_encrypt_pbe(int pbe_nid,
88
- const EVP_CIPHER *cipher,
89
- const uint8_t *pass_raw,
90
- size_t pass_raw_len,
91
- uint8_t *salt, size_t salt_len,
92
- int iterations,
93
- PKCS8_PRIV_KEY_INFO *p8inf);
83
+ * The resulting structure is stored in an |X509_SIG| which must be freed by the
84
+ * caller. */
85
+ OPENSSL_EXPORT X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
86
+ const char *pass, int pass_len,
87
+ const uint8_t *salt, size_t salt_len,
88
+ int iterations,
89
+ PKCS8_PRIV_KEY_INFO *p8inf);
94
90
 
95
- /* PKCS8_decrypt_pbe decrypts and decodes a PKCS8_PRIV_KEY_INFO with PBES1 or
96
- * PBES2 as defined in PKCS #5. Only pbeWithSHAAnd128BitRC4,
91
+ /* PKCS8_decrypt decrypts and decodes a PKCS8_PRIV_KEY_INFO with PBES1 or PBES2
92
+ * as defined in PKCS #5. Only pbeWithSHAAnd128BitRC4,
97
93
  * pbeWithSHAAnd3-KeyTripleDES-CBC and pbeWithSHA1And40BitRC2, and PBES2,
98
94
  * defined in PKCS #12, are supported.
99
95
  *
100
- * The |pass_raw_len| bytes pointed to by |pass_raw| are used as the password.
101
- * Note that any conversions from the password as supplied in a text string
102
- * (such as those specified in B.1 of PKCS #12) must be performed by the caller.
96
+ * |pass| is used as the password. If a PBES1 scheme from PKCS #12 is used, this
97
+ * will be converted to a raw byte string as specified in B.1 of PKCS #12. If
98
+ * |pass| is NULL, it will be encoded as the empty byte string rather than two
99
+ * zero bytes, the PKCS #12 encoding of the empty string.
103
100
  *
104
101
  * The resulting structure must be freed by the caller. */
105
- OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *PKCS8_decrypt_pbe(X509_SIG *pkcs8,
106
- const uint8_t *pass_raw,
107
- size_t pass_raw_len);
102
+ OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *pkcs8,
103
+ const char *pass,
104
+ int pass_len);
108
105
 
109
106
  /* PKCS12_get_key_and_certs parses a PKCS#12 structure from |in|, authenticates
110
107
  * and decrypts it using |password|, sets |*out_key| to the included private
@@ -117,24 +114,6 @@ OPENSSL_EXPORT int PKCS12_get_key_and_certs(EVP_PKEY **out_key,
117
114
 
118
115
  /* Deprecated functions. */
119
116
 
120
- /* PKCS8_encrypt calls |PKCS8_encrypt_pbe| after (in the PKCS#12 case) treating
121
- * |pass| as an ASCII string, appending U+0000, and converting to UCS-2. (So the
122
- * empty password encodes as two NUL bytes.) In the PBES2 case, the password is
123
- * unchanged. */
124
- OPENSSL_EXPORT X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
125
- const char *pass, int pass_len,
126
- uint8_t *salt, size_t salt_len,
127
- int iterations,
128
- PKCS8_PRIV_KEY_INFO *p8inf);
129
-
130
- /* PKCS8_decrypt calls PKCS8_decrypt_pbe after (in the PKCS#12 case) treating
131
- * |pass| as an ASCII string, appending U+0000, and converting to UCS-2. (So the
132
- * empty password encodes as two NUL bytes.) In the PBES2 case, the password is
133
- * unchanged. */
134
- OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *pkcs8,
135
- const char *pass,
136
- int pass_len);
137
-
138
117
  /* PKCS12_PBE_add does nothing. It exists for compatibility with OpenSSL. */
139
118
  OPENSSL_EXPORT void PKCS12_PBE_add(void);
140
119
 
@@ -0,0 +1,87 @@
1
+ /* Copyright (c) 2016, Google Inc.
2
+ *
3
+ * Permission to use, copy, modify, and/or distribute this software for any
4
+ * purpose with or without fee is hereby granted, provided that the above
5
+ * copyright notice and this permission notice appear in all copies.
6
+ *
7
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
+
15
+ #ifndef OPENSSL_HEADER_POOL_H
16
+ #define OPENSSL_HEADER_POOL_H
17
+
18
+ #include <openssl/base.h>
19
+
20
+ #if defined(__cplusplus)
21
+ extern "C" {
22
+ #endif
23
+
24
+
25
+ /* Buffers and buffer pools.
26
+ *
27
+ * |CRYPTO_BUFFER|s are simply reference-counted blobs. A |CRYPTO_BUFFER_POOL|
28
+ * is an intern table for |CRYPTO_BUFFER|s. This allows for a single copy of a
29
+ * given blob to be kept in memory and referenced from multiple places. */
30
+
31
+
32
+ /* CRYPTO_BUFFER_POOL_new returns a freshly allocated |CRYPTO_BUFFER_POOL| or
33
+ * NULL on error. */
34
+ OPENSSL_EXPORT CRYPTO_BUFFER_POOL* CRYPTO_BUFFER_POOL_new(void);
35
+
36
+ /* CRYPTO_BUFFER_POOL_free frees |pool|, which must be empty. */
37
+ OPENSSL_EXPORT void CRYPTO_BUFFER_POOL_free(CRYPTO_BUFFER_POOL *pool);
38
+
39
+ /* CRYPTO_BUFFER_new returns a |CRYPTO_BUFFER| containing a copy of |data|, or
40
+ * else NULL on error. If |pool| is not NULL then the returned value may be a
41
+ * reference to a previously existing |CRYPTO_BUFFER| that contained the same
42
+ * data. Otherwise, the returned, fresh |CRYPTO_BUFFER| will be added to the
43
+ * pool. */
44
+ OPENSSL_EXPORT CRYPTO_BUFFER *CRYPTO_BUFFER_new(const uint8_t *data, size_t len,
45
+ CRYPTO_BUFFER_POOL *pool);
46
+
47
+ /* CRYPTO_BUFFER_new_from_CBS acts the same as |CRYPTO_BUFFER_new|. */
48
+ OPENSSL_EXPORT CRYPTO_BUFFER *CRYPTO_BUFFER_new_from_CBS(
49
+ CBS *cbs, CRYPTO_BUFFER_POOL *pool);
50
+
51
+ /* CRYPTO_BUFFER_free decrements the reference count of |buf|. If there are no
52
+ * other references, or if the only remaining reference is from a pool, then
53
+ * |buf| will be freed. */
54
+ OPENSSL_EXPORT void CRYPTO_BUFFER_free(CRYPTO_BUFFER *buf);
55
+
56
+ /* CRYPTO_BUFFER_up_ref increments the reference count of |buf| and returns
57
+ * one. */
58
+ OPENSSL_EXPORT int CRYPTO_BUFFER_up_ref(CRYPTO_BUFFER *buf);
59
+
60
+ /* CRYPTO_BUFFER_data returns a pointer to the data contained in |buf|. */
61
+ OPENSSL_EXPORT const uint8_t *CRYPTO_BUFFER_data(const CRYPTO_BUFFER *buf);
62
+
63
+ /* CRYPTO_BUFFER_len returns the length, in bytes, of the data contained in
64
+ * |buf|. */
65
+ OPENSSL_EXPORT size_t CRYPTO_BUFFER_len(const CRYPTO_BUFFER *buf);
66
+
67
+ /* CRYPTO_BUFFER_init_CBS initialises |out| to point at the data from |buf|. */
68
+ OPENSSL_EXPORT void CRYPTO_BUFFER_init_CBS(const CRYPTO_BUFFER *buf, CBS *out);
69
+
70
+
71
+ #if defined(__cplusplus)
72
+ } /* extern C */
73
+
74
+ extern "C++" {
75
+
76
+ namespace bssl {
77
+
78
+ BORINGSSL_MAKE_DELETER(CRYPTO_BUFFER_POOL, CRYPTO_BUFFER_POOL_free)
79
+ BORINGSSL_MAKE_DELETER(CRYPTO_BUFFER, CRYPTO_BUFFER_free)
80
+
81
+ } // namespace bssl
82
+
83
+ } /* extern C++ */
84
+
85
+ #endif
86
+
87
+ #endif // OPENSSL_HEADER_POOL_H
@@ -62,7 +62,7 @@ OPENSSL_EXPORT void RAND_set_urandom_fd(int fd);
62
62
  OPENSSL_EXPORT void RAND_enable_fork_unsafe_buffering(int fd);
63
63
  #endif
64
64
 
65
- #if defined(BORINGSSL_UNSAFE_FUZZER_MODE)
65
+ #if defined(BORINGSSL_UNSAFE_DETERMINISTIC_MODE)
66
66
  /* RAND_reset_for_fuzzing resets the fuzzer-only deterministic RNG. This
67
67
  * function is only defined in the fuzzer-only build configuration. */
68
68
  OPENSSL_EXPORT void RAND_reset_for_fuzzing(void);
@@ -322,7 +322,9 @@ OPENSSL_EXPORT int RSA_recover_crt_params(RSA *rsa);
322
322
  * hash function for generating the mask. If NULL, |Hash| is used. The |sLen|
323
323
  * argument specifies the expected salt length in bytes. If |sLen| is -1 then
324
324
  * the salt length is the same as the hash length. If -2, then the salt length
325
- * is maximal and is taken from the size of |EM|.
325
+ * is recovered and all values accepted.
326
+ *
327
+ * If unsure, use -1.
326
328
  *
327
329
  * It returns one on success or zero on error. */
328
330
  OPENSSL_EXPORT int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const uint8_t *mHash,
@@ -515,7 +517,7 @@ OPENSSL_EXPORT int RSA_verify_PKCS1_PSS(RSA *rsa, const uint8_t *mHash,
515
517
  int sLen);
516
518
 
517
519
  /* RSA_padding_add_PKCS1_OAEP acts like |RSA_padding_add_PKCS1_OAEP_mgf1| but
518
- * the |md| and |mgf1md| paramaters of the latter are implicitly set to NULL,
520
+ * the |md| and |mgf1md| parameters of the latter are implicitly set to NULL,
519
521
  * which means SHA-1. */
520
522
  OPENSSL_EXPORT int RSA_padding_add_PKCS1_OAEP(uint8_t *to, unsigned to_len,
521
523
  const uint8_t *from,
@@ -73,10 +73,6 @@ extern "C" {
73
73
  /* SHA_DIGEST_LENGTH is the length of a SHA-1 digest. */
74
74
  #define SHA_DIGEST_LENGTH 20
75
75
 
76
- /* TODO(fork): remove */
77
- #define SHA_LBLOCK 16
78
- #define SHA_LONG uint32_t
79
-
80
76
  /* SHA1_Init initialises |sha| and returns one. */
81
77
  OPENSSL_EXPORT int SHA1_Init(SHA_CTX *sha);
82
78
 
@@ -355,7 +355,7 @@ OPENSSL_EXPORT int SSL_pending(const SSL *ssl);
355
355
 
356
356
  /* SSL_write writes up to |num| bytes from |buf| into |ssl|. It implicitly runs
357
357
  * any pending handshakes, including renegotiations when enabled. On success, it
358
- * returns the number of bytes read. Otherwise, it returns <= 0. The caller
358
+ * returns the number of bytes written. Otherwise, it returns <= 0. The caller
359
359
  * should pass the value into |SSL_get_error| to determine how to proceed.
360
360
  *
361
361
  * In TLS, a non-blocking |SSL_write| differs from non-blocking |write| in that
@@ -562,7 +562,7 @@ OPENSSL_EXPORT int DTLSv1_handle_timeout(SSL *ssl);
562
562
  #define DTLS1_VERSION 0xfeff
563
563
  #define DTLS1_2_VERSION 0xfefd
564
564
 
565
- #define TLS1_3_DRAFT_VERSION 0x7f0e
565
+ #define TLS1_3_DRAFT_VERSION 0x7f12
566
566
 
567
567
  /* SSL_CTX_set_min_proto_version sets the minimum protocol version for |ctx| to
568
568
  * |version|. If |version| is zero, the default minimum version is used. It
@@ -608,11 +608,6 @@ OPENSSL_EXPORT int SSL_version(const SSL *ssl);
608
608
  * client's. */
609
609
  #define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L
610
610
 
611
- /* SSL_OP_DISABLE_NPN configures an individual |SSL| to not advertise NPN,
612
- * despite |SSL_CTX_set_next_proto_select_cb| being configured on the
613
- * |SSL_CTX|. */
614
- #define SSL_OP_DISABLE_NPN 0x00800000L
615
-
616
611
  /* The following flags toggle individual protocol versions. This is deprecated.
617
612
  * Use |SSL_CTX_set_min_proto_version| and |SSL_CTX_set_max_proto_version|
618
613
  * instead. */
@@ -670,8 +665,9 @@ OPENSSL_EXPORT uint32_t SSL_get_options(const SSL *ssl);
670
665
  #define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L
671
666
 
672
667
  /* SSL_MODE_NO_AUTO_CHAIN disables automatically building a certificate chain
673
- * before sending certificates to the peer.
674
- * TODO(davidben): Remove this behavior. https://crbug.com/486295. */
668
+ * before sending certificates to the peer. This flag is set (and the feature
669
+ * disabled) by default.
670
+ * TODO(davidben): Remove this behavior. https://crbug.com/boringssl/42. */
675
671
  #define SSL_MODE_NO_AUTO_CHAIN 0x00000008L
676
672
 
677
673
  /* SSL_MODE_ENABLE_FALSE_START allows clients to send application data before
@@ -733,6 +729,16 @@ OPENSSL_EXPORT uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode);
733
729
  * modes enabled for |ssl|. */
734
730
  OPENSSL_EXPORT uint32_t SSL_get_mode(const SSL *ssl);
735
731
 
732
+ /* SSL_CTX_set0_buffer_pool sets a |CRYPTO_BUFFER_POOL| that will be used to
733
+ * store certificates. This can allow multiple connections to share
734
+ * certificates and thus save memory.
735
+ *
736
+ * The SSL_CTX does not take ownership of |pool| and the caller must ensure
737
+ * that |pool| outlives |ctx| and all objects linked to it, including |SSL|,
738
+ * |X509| and |SSL_SESSION| objects. Basically, don't ever free |pool|. */
739
+ OPENSSL_EXPORT void SSL_CTX_set0_buffer_pool(SSL_CTX *ctx,
740
+ CRYPTO_BUFFER_POOL *pool);
741
+
736
742
 
737
743
  /* Configuring certificates and private keys.
738
744
  *
@@ -898,13 +904,28 @@ OPENSSL_EXPORT int SSL_CTX_set_signed_cert_timestamp_list(SSL_CTX *ctx,
898
904
  const uint8_t *list,
899
905
  size_t list_len);
900
906
 
901
- /* SSL_CTX_set_ocsp_response sets the OCSP reponse that is sent to clients
907
+ /* SSL_set_signed_cert_timestamp_list sets the list of signed certificate
908
+ * timestamps that is sent to clients that request is. The same format as the
909
+ * one used for |SSL_CTX_set_signed_cert_timestamp_list| applies. The caller
910
+ * retains ownership of |list|. */
911
+ OPENSSL_EXPORT int SSL_set_signed_cert_timestamp_list(SSL *ctx,
912
+ const uint8_t *list,
913
+ size_t list_len);
914
+
915
+ /* SSL_CTX_set_ocsp_response sets the OCSP response that is sent to clients
902
916
  * which request it. It returns one on success and zero on error. The caller
903
917
  * retains ownership of |response|. */
904
918
  OPENSSL_EXPORT int SSL_CTX_set_ocsp_response(SSL_CTX *ctx,
905
919
  const uint8_t *response,
906
920
  size_t response_len);
907
921
 
922
+ /* SSL_set_ocsp_response sets the OCSP response that is sent to clients which
923
+ * request it. It returns one on success and zero on error. The caller retains
924
+ * ownership of |response|. */
925
+ OPENSSL_EXPORT int SSL_set_ocsp_response(SSL *ssl,
926
+ const uint8_t *response,
927
+ size_t response_len);
928
+
908
929
  /* SSL_SIGN_* are signature algorithm values as defined in TLS 1.3. */
909
930
  #define SSL_SIGN_RSA_PKCS1_SHA1 0x0201
910
931
  #define SSL_SIGN_RSA_PKCS1_SHA256 0x0401
@@ -1139,15 +1160,15 @@ OPENSSL_EXPORT uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *cipher);
1139
1160
  * mode). */
1140
1161
  OPENSSL_EXPORT int SSL_CIPHER_is_AES(const SSL_CIPHER *cipher);
1141
1162
 
1142
- /* SSL_CIPHER_has_MD5_HMAC returns one if |cipher| uses HMAC-MD5. */
1143
- OPENSSL_EXPORT int SSL_CIPHER_has_MD5_HMAC(const SSL_CIPHER *cipher);
1144
-
1145
1163
  /* SSL_CIPHER_has_SHA1_HMAC returns one if |cipher| uses HMAC-SHA1. */
1146
1164
  OPENSSL_EXPORT int SSL_CIPHER_has_SHA1_HMAC(const SSL_CIPHER *cipher);
1147
1165
 
1148
1166
  /* SSL_CIPHER_has_SHA256_HMAC returns one if |cipher| uses HMAC-SHA256. */
1149
1167
  OPENSSL_EXPORT int SSL_CIPHER_has_SHA256_HMAC(const SSL_CIPHER *cipher);
1150
1168
 
1169
+ /* SSL_CIPHER_is_AEAD returns one if |cipher| uses an AEAD cipher. */
1170
+ OPENSSL_EXPORT int SSL_CIPHER_is_AEAD(const SSL_CIPHER *cipher);
1171
+
1151
1172
  /* SSL_CIPHER_is_AESGCM returns one if |cipher| uses AES-GCM. */
1152
1173
  OPENSSL_EXPORT int SSL_CIPHER_is_AESGCM(const SSL_CIPHER *cipher);
1153
1174
 
@@ -1182,8 +1203,9 @@ OPENSSL_EXPORT int SSL_CIPHER_is_DHE(const SSL_CIPHER *cipher);
1182
1203
  /* SSL_CIPHER_is_ECDHE returns one if |cipher| uses ECDHE. */
1183
1204
  OPENSSL_EXPORT int SSL_CIPHER_is_ECDHE(const SSL_CIPHER *cipher);
1184
1205
 
1185
- /* SSL_CIPHER_is_CECPQ1 returns one if |cipher| uses CECPQ1. */
1186
- OPENSSL_EXPORT int SSL_CIPHER_is_CECPQ1(const SSL_CIPHER *cipher);
1206
+ /* SSL_CIPHER_is_static_RSA returns one if |cipher| uses the static RSA key
1207
+ * exchange. */
1208
+ OPENSSL_EXPORT int SSL_CIPHER_is_static_RSA(const SSL_CIPHER *cipher);
1187
1209
 
1188
1210
  /* SSL_CIPHER_get_min_version returns the minimum protocol version required
1189
1211
  * for |cipher|. */
@@ -1197,7 +1219,8 @@ OPENSSL_EXPORT uint16_t SSL_CIPHER_get_max_version(const SSL_CIPHER *cipher);
1197
1219
  OPENSSL_EXPORT const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);
1198
1220
 
1199
1221
  /* SSL_CIPHER_get_kx_name returns a string that describes the key-exchange
1200
- * method used by |cipher|. For example, "ECDHE_ECDSA". */
1222
+ * method used by |cipher|. For example, "ECDHE_ECDSA". TLS 1.3 AEAD-only
1223
+ * ciphers return the string "GENERIC". */
1201
1224
  OPENSSL_EXPORT const char *SSL_CIPHER_get_kx_name(const SSL_CIPHER *cipher);
1202
1225
 
1203
1226
  /* SSL_CIPHER_get_rfc_name returns a newly-allocated string with the standard
@@ -1265,7 +1288,7 @@ OPENSSL_EXPORT int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher,
1265
1288
  * whose bulk cipher use the corresponding encryption scheme. Note that
1266
1289
  * |AES|, |AES128|, and |AES256| match both CBC and GCM ciphers.
1267
1290
  *
1268
- * |MD5|, |SHA1|, |SHA256|, and |SHA384| match legacy cipher suites using the
1291
+ * |SHA1|, |SHA256|, and |SHA384| match legacy cipher suites using the
1269
1292
  * corresponding hash function in their MAC. AEADs are matched by none of
1270
1293
  * these.
1271
1294
  *
@@ -1287,7 +1310,9 @@ OPENSSL_EXPORT int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher,
1287
1310
  * |TLSv1_2| matches ciphers new in TLS 1.2. This is confusing and should not
1288
1311
  * be used.
1289
1312
  *
1290
- * Unknown rules silently match nothing.
1313
+ * Unknown rules are silently ignored by legacy APIs, and rejected by APIs with
1314
+ * "strict" in the name, which should be preferred. Cipher lists can be long and
1315
+ * it's easy to commit typos.
1291
1316
  *
1292
1317
  * The special |@STRENGTH| directive will sort all enabled ciphers by strength.
1293
1318
  *
@@ -1305,35 +1330,43 @@ OPENSSL_EXPORT int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher,
1305
1330
  * [ECDHE-ECDSA-CHACHA20-POLY1305|ECDHE-ECDSA-AES128-GCM-SHA256]
1306
1331
  *
1307
1332
  * Once an equal-preference group is used, future directives must be
1308
- * opcode-less. */
1333
+ * opcode-less.
1334
+ *
1335
+ * TLS 1.3 ciphers do not participate in this mechanism and instead have a
1336
+ * built-in preference order. Functions to set cipher lists do not affect TLS
1337
+ * 1.3, and functions to query the cipher list do not include TLS 1.3
1338
+ * ciphers. */
1309
1339
 
1310
1340
  /* SSL_DEFAULT_CIPHER_LIST is the default cipher suite configuration. It is
1311
1341
  * substituted when a cipher string starts with 'DEFAULT'. */
1312
1342
  #define SSL_DEFAULT_CIPHER_LIST "ALL"
1313
1343
 
1344
+ /* SSL_CTX_set_strict_cipher_list configures the cipher list for |ctx|,
1345
+ * evaluating |str| as a cipher string and returning error if |str| contains
1346
+ * anything meaningless. It returns one on success and zero on failure. */
1347
+ OPENSSL_EXPORT int SSL_CTX_set_strict_cipher_list(SSL_CTX *ctx,
1348
+ const char *str);
1349
+
1314
1350
  /* SSL_CTX_set_cipher_list configures the cipher list for |ctx|, evaluating
1315
- * |str| as a cipher string. It returns one on success and zero on failure. */
1351
+ * |str| as a cipher string. It returns one on success and zero on failure.
1352
+ *
1353
+ * Prefer to use |SSL_CTX_set_strict_cipher_list|. This function tolerates
1354
+ * garbage inputs, unless an empty cipher list results. */
1316
1355
  OPENSSL_EXPORT int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
1317
1356
 
1318
- /* SSL_CTX_set_cipher_list_tls10 configures the TLS 1.0+ cipher list for |ctx|,
1319
- * evaluating |str| as a cipher string. It returns one on success and zero on
1320
- * failure. If set, servers will use this cipher suite list for TLS 1.0 or
1321
- * higher. */
1322
- OPENSSL_EXPORT int SSL_CTX_set_cipher_list_tls10(SSL_CTX *ctx, const char *str);
1323
-
1324
- /* SSL_CTX_set_cipher_list_tls11 configures the TLS 1.1+ cipher list for |ctx|,
1325
- * evaluating |str| as a cipher string. It returns one on success and zero on
1326
- * failure. If set, servers will use this cipher suite list for TLS 1.1 or
1327
- * higher. */
1328
- OPENSSL_EXPORT int SSL_CTX_set_cipher_list_tls11(SSL_CTX *ctx, const char *str);
1357
+ /* SSL_set_strict_cipher_list configures the cipher list for |ssl|, evaluating
1358
+ * |str| as a cipher string and returning error if |str| contains anything
1359
+ * meaningless. It returns one on success and zero on failure. */
1360
+ OPENSSL_EXPORT int SSL_set_strict_cipher_list(SSL *ssl, const char *str);
1329
1361
 
1330
1362
  /* SSL_set_cipher_list configures the cipher list for |ssl|, evaluating |str| as
1331
- * a cipher string. It returns one on success and zero on failure. */
1363
+ * a cipher string. It returns one on success and zero on failure.
1364
+ *
1365
+ * Prefer to use |SSL_set_strict_cipher_list|. This function tolerates garbage
1366
+ * inputs, unless an empty cipher list results. */
1332
1367
  OPENSSL_EXPORT int SSL_set_cipher_list(SSL *ssl, const char *str);
1333
1368
 
1334
- /* SSL_get_ciphers returns the cipher list for |ssl|, in order of preference. If
1335
- * |SSL_CTX_set_cipher_list_tls10| or |SSL_CTX_set_cipher_list_tls11| has been
1336
- * used, the corresponding list for the current version is returned. */
1369
+ /* SSL_get_ciphers returns the cipher list for |ssl|, in order of preference. */
1337
1370
  OPENSSL_EXPORT STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);
1338
1371
 
1339
1372
 
@@ -1372,6 +1405,20 @@ OPENSSL_EXPORT X509 *SSL_get_peer_certificate(const SSL *ssl);
1372
1405
  * If a client, it does. */
1373
1406
  OPENSSL_EXPORT STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl);
1374
1407
 
1408
+ /* SSL_get_peer_full_cert_chain returns the peer's certificate chain, or NULL if
1409
+ * unavailable or the peer did not use certificates. This is the unverified
1410
+ * list of certificates as sent by the peer, not the final chain built during
1411
+ * verification. For historical reasons, this value may not be available if
1412
+ * resuming a serialized |SSL_SESSION|. The caller does not take ownership of
1413
+ * the result.
1414
+ *
1415
+ * This is the same as |SSL_get_peer_cert_chain| except that this function
1416
+ * always returns the full chain, i.e. the first element of the return value
1417
+ * (if any) will be the leaf certificate. In constrast,
1418
+ * |SSL_get_peer_cert_chain| returns only the intermediate certificates if the
1419
+ * |ssl| is a server. */
1420
+ OPENSSL_EXPORT STACK_OF(X509) *SSL_get_peer_full_cert_chain(const SSL *ssl);
1421
+
1375
1422
  /* SSL_get0_signed_cert_timestamp_list sets |*out| and |*out_len| to point to
1376
1423
  * |*out_len| bytes of SCT information from the server. This is only valid if
1377
1424
  * |ssl| is a client. The SCT information is a SignedCertificateTimestampList
@@ -1412,8 +1459,8 @@ OPENSSL_EXPORT void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
1412
1459
  OPENSSL_EXPORT int SSL_get_tls_unique(const SSL *ssl, uint8_t *out,
1413
1460
  size_t *out_len, size_t max_out);
1414
1461
 
1415
- /* SSL_get_extms_support returns one if the Extended Master Secret
1416
- * extension was negotiated. Otherwise, it returns zero. */
1462
+ /* SSL_get_extms_support returns one if the Extended Master Secret extension or
1463
+ * TLS 1.3 was negotiated. Otherwise, it returns zero. */
1417
1464
  OPENSSL_EXPORT int SSL_get_extms_support(const SSL *ssl);
1418
1465
 
1419
1466
  /* SSL_get_current_cipher returns the cipher used in the current outgoing
@@ -1428,7 +1475,7 @@ OPENSSL_EXPORT const SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl);
1428
1475
  OPENSSL_EXPORT int SSL_session_reused(const SSL *ssl);
1429
1476
 
1430
1477
  /* SSL_get_secure_renegotiation_support returns one if the peer supports secure
1431
- * renegotiation (RFC 5746) and zero otherwise. */
1478
+ * renegotiation (RFC 5746) or TLS 1.3. Otherwise, it returns zero. */
1432
1479
  OPENSSL_EXPORT int SSL_get_secure_renegotiation_support(const SSL *ssl);
1433
1480
 
1434
1481
  /* SSL_export_keying_material exports a value derived from the master secret, as
@@ -1539,9 +1586,9 @@ DECLARE_LHASH_OF(SSL_SESSION)
1539
1586
  DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
1540
1587
 
1541
1588
  /* SSL_SESSION_new returns a newly-allocated blank |SSL_SESSION| or NULL on
1542
- * error. This may be useful in writing tests but otherwise should not be
1543
- * used outside the library. */
1544
- OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_new(void);
1589
+ * error. This may be useful when writing tests but should otherwise not be
1590
+ * used. */
1591
+ OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_new(const SSL_CTX *ctx);
1545
1592
 
1546
1593
  /* SSL_SESSION_up_ref increments the reference count of |session| and returns
1547
1594
  * one. */
@@ -1566,15 +1613,15 @@ OPENSSL_EXPORT int SSL_SESSION_to_bytes_for_ticket(const SSL_SESSION *in,
1566
1613
 
1567
1614
  /* SSL_SESSION_from_bytes parses |in_len| bytes from |in| as an SSL_SESSION. It
1568
1615
  * returns a newly-allocated |SSL_SESSION| on success or NULL on error. */
1569
- OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_from_bytes(const uint8_t *in,
1570
- size_t in_len);
1616
+ OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_from_bytes(
1617
+ const uint8_t *in, size_t in_len, const SSL_CTX *ctx);
1571
1618
 
1572
1619
  /* SSL_SESSION_get_version returns a string describing the TLS version |session|
1573
1620
  * was established at. For example, "TLSv1.2" or "SSLv3". */
1574
1621
  OPENSSL_EXPORT const char *SSL_SESSION_get_version(const SSL_SESSION *session);
1575
1622
 
1576
- /* SSL_SESSION_get_id returns a pointer to a buffer containg |session|'s session
1577
- * ID and sets |*out_len| to its length. */
1623
+ /* SSL_SESSION_get_id returns a pointer to a buffer containing |session|'s
1624
+ * session ID and sets |*out_len| to its length. */
1578
1625
  OPENSSL_EXPORT const uint8_t *SSL_SESSION_get_id(const SSL_SESSION *session,
1579
1626
  unsigned *out_len);
1580
1627
 
@@ -1585,7 +1632,7 @@ OPENSSL_EXPORT long SSL_SESSION_get_time(const SSL_SESSION *session);
1585
1632
  /* SSL_SESSION_get_timeout returns the lifetime of |session| in seconds. */
1586
1633
  OPENSSL_EXPORT long SSL_SESSION_get_timeout(const SSL_SESSION *session);
1587
1634
 
1588
- /* SSL_SESSION_get0_peer return's the peer leaf certificate stored in
1635
+ /* SSL_SESSION_get0_peer returns the peer leaf certificate stored in
1589
1636
  * |session|.
1590
1637
  *
1591
1638
  * TODO(davidben): This should return a const X509 *. */
@@ -1613,7 +1660,7 @@ OPENSSL_EXPORT long SSL_SESSION_set_timeout(SSL_SESSION *session, long timeout);
1613
1660
  * should not be used. */
1614
1661
  OPENSSL_EXPORT int SSL_SESSION_set1_id_context(SSL_SESSION *session,
1615
1662
  const uint8_t *sid_ctx,
1616
- unsigned sid_ctx_len);
1663
+ size_t sid_ctx_len);
1617
1664
 
1618
1665
 
1619
1666
  /* Session caching.
@@ -1635,7 +1682,7 @@ OPENSSL_EXPORT int SSL_SESSION_set1_id_context(SSL_SESSION *session,
1635
1682
  *
1636
1683
  * Note that offering or accepting a session short-circuits most parameter
1637
1684
  * negotiation. Resuming sessions across different configurations may result in
1638
- * surprising behavor. So, for instance, a client implementing a version
1685
+ * surprising behavior. So, for instance, a client implementing a version
1639
1686
  * fallback should shard its session cache by maximum protocol version. */
1640
1687
 
1641
1688
  /* SSL_SESS_CACHE_OFF disables all session caching. */
@@ -1703,15 +1750,31 @@ OPENSSL_EXPORT SSL_SESSION *SSL_get_session(const SSL *ssl);
1703
1750
  OPENSSL_EXPORT SSL_SESSION *SSL_get1_session(SSL *ssl);
1704
1751
 
1705
1752
  /* SSL_DEFAULT_SESSION_TIMEOUT is the default lifetime, in seconds, of a
1706
- * session. */
1753
+ * session in TLS 1.2 or earlier. This is how long we are willing to use the
1754
+ * secret to encrypt traffic without fresh key material. */
1707
1755
  #define SSL_DEFAULT_SESSION_TIMEOUT (2 * 60 * 60)
1708
1756
 
1709
- /* SSL_CTX_set_timeout sets the lifetime, in seconds, of sessions created in
1710
- * |ctx| to |timeout|. */
1757
+ /* SSL_DEFAULT_SESSION_PSK_DHE_TIMEOUT is the default lifetime, in seconds, of a
1758
+ * session for TLS 1.3 psk_dhe_ke. This is how long we are willing to use the
1759
+ * secret as an authenticator. */
1760
+ #define SSL_DEFAULT_SESSION_PSK_DHE_TIMEOUT (2 * 24 * 60 * 60)
1761
+
1762
+ /* SSL_DEFAULT_SESSION_AUTH_TIMEOUT is the default non-renewable lifetime, in
1763
+ * seconds, of a TLS 1.3 session. This is how long we are willing to trust the
1764
+ * signature in the initial handshake. */
1765
+ #define SSL_DEFAULT_SESSION_AUTH_TIMEOUT (7 * 24 * 60 * 60)
1766
+
1767
+ /* SSL_CTX_set_timeout sets the lifetime, in seconds, of TLS 1.2 (or earlier)
1768
+ * sessions created in |ctx| to |timeout|. */
1711
1769
  OPENSSL_EXPORT long SSL_CTX_set_timeout(SSL_CTX *ctx, long timeout);
1712
1770
 
1713
- /* SSL_CTX_get_timeout returns the lifetime, in seconds, of sessions created in
1714
- * |ctx|. */
1771
+ /* SSL_CTX_set_session_psk_dhe_timeout sets the lifetime, in seconds, of TLS 1.3
1772
+ * sessions created in |ctx| to |timeout|. */
1773
+ OPENSSL_EXPORT void SSL_CTX_set_session_psk_dhe_timeout(SSL_CTX *ctx,
1774
+ long timeout);
1775
+
1776
+ /* SSL_CTX_get_timeout returns the lifetime, in seconds, of TLS 1.2 (or earlier)
1777
+ * sessions created in |ctx|. */
1715
1778
  OPENSSL_EXPORT long SSL_CTX_get_timeout(const SSL_CTX *ctx);
1716
1779
 
1717
1780
  /* SSL_CTX_set_session_id_context sets |ctx|'s session ID context to |sid_ctx|.
@@ -1727,13 +1790,18 @@ OPENSSL_EXPORT long SSL_CTX_get_timeout(const SSL_CTX *ctx);
1727
1790
  * relevant if a server requires client auth. */
1728
1791
  OPENSSL_EXPORT int SSL_CTX_set_session_id_context(SSL_CTX *ctx,
1729
1792
  const uint8_t *sid_ctx,
1730
- unsigned sid_ctx_len);
1793
+ size_t sid_ctx_len);
1731
1794
 
1732
1795
  /* SSL_set_session_id_context sets |ssl|'s session ID context to |sid_ctx|. It
1733
1796
  * returns one on success and zero on error. See also
1734
1797
  * |SSL_CTX_set_session_id_context|. */
1735
1798
  OPENSSL_EXPORT int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
1736
- unsigned sid_ctx_len);
1799
+ size_t sid_ctx_len);
1800
+
1801
+ /* SSL_get0_session_id_context returns a pointer to |ssl|'s session ID context
1802
+ * and sets |*out_len| to its length. */
1803
+ OPENSSL_EXPORT const uint8_t *SSL_get0_session_id_context(const SSL *ssl,
1804
+ size_t *out_len);
1737
1805
 
1738
1806
  /* SSL_SESSION_CACHE_MAX_SIZE_DEFAULT is the default maximum size of a session
1739
1807
  * cache. */
@@ -1934,6 +2002,18 @@ OPENSSL_EXPORT int SSL_CTX_set1_curves(SSL_CTX *ctx, const int *curves,
1934
2002
  OPENSSL_EXPORT int SSL_set1_curves(SSL *ssl, const int *curves,
1935
2003
  size_t curves_len);
1936
2004
 
2005
+ /* SSL_CTX_set1_curves_list sets the preferred curves for |ctx| to be the
2006
+ * colon-separated list |curves|. Each element of |curves| should be a curve
2007
+ * name (e.g. P-256, X25519, ...). It returns one on success and zero on
2008
+ * failure. */
2009
+ OPENSSL_EXPORT int SSL_CTX_set1_curves_list(SSL_CTX *ctx, const char *curves);
2010
+
2011
+ /* SSL_set1_curves_list sets the preferred curves for |ssl| to be the
2012
+ * colon-separated list |curves|. Each element of |curves| should be a curve
2013
+ * name (e.g. P-256, X25519, ...). It returns one on success and zero on
2014
+ * failure. */
2015
+ OPENSSL_EXPORT int SSL_set1_curves_list(SSL *ssl, const char *curves);
2016
+
1937
2017
  /* SSL_CURVE_* define TLS curve IDs. */
1938
2018
  #define SSL_CURVE_SECP256R1 23
1939
2019
  #define SSL_CURVE_SECP384R1 24
@@ -1989,15 +2069,6 @@ OPENSSL_EXPORT void SSL_set_tmp_dh_callback(SSL *ssl,
1989
2069
  DH *(*dh)(SSL *ssl, int is_export,
1990
2070
  int keylength));
1991
2071
 
1992
- /* SSL_get_dhe_group_size returns the number of bits in the most recently
1993
- * completed handshake's selected group's prime, or zero if not
1994
- * applicable. Note, however, that validating this value does not ensure the
1995
- * server selected a secure group.
1996
- *
1997
- * TODO(davidben): This API currently does not work correctly if there is a
1998
- * renegotiation in progress. Fix this. */
1999
- OPENSSL_EXPORT unsigned SSL_get_dhe_group_size(const SSL *ssl);
2000
-
2001
2072
 
2002
2073
  /* Certificate verification.
2003
2074
  *
@@ -2178,20 +2249,19 @@ OPENSSL_EXPORT int SSL_get_ex_data_X509_STORE_CTX_idx(void);
2178
2249
  * zero on fatal error. It may use |X509_STORE_CTX_set_error| to set a
2179
2250
  * verification result.
2180
2251
  *
2181
- * The callback may use either the |arg| parameter or
2182
- * |SSL_get_ex_data_X509_STORE_CTX_idx| to recover the associated |SSL|
2183
- * object. */
2252
+ * The callback may use |SSL_get_ex_data_X509_STORE_CTX_idx| to recover the
2253
+ * |SSL| object from |store_ctx|. */
2184
2254
  OPENSSL_EXPORT void SSL_CTX_set_cert_verify_callback(
2185
2255
  SSL_CTX *ctx, int (*callback)(X509_STORE_CTX *store_ctx, void *arg),
2186
2256
  void *arg);
2187
2257
 
2188
2258
  /* SSL_enable_signed_cert_timestamps causes |ssl| (which must be the client end
2189
2259
  * of a connection) to request SCTs from the server. See
2190
- * https://tools.ietf.org/html/rfc6962. It returns one.
2260
+ * https://tools.ietf.org/html/rfc6962.
2191
2261
  *
2192
2262
  * Call |SSL_get0_signed_cert_timestamp_list| to recover the SCT after the
2193
2263
  * handshake. */
2194
- OPENSSL_EXPORT int SSL_enable_signed_cert_timestamps(SSL *ssl);
2264
+ OPENSSL_EXPORT void SSL_enable_signed_cert_timestamps(SSL *ssl);
2195
2265
 
2196
2266
  /* SSL_CTX_enable_signed_cert_timestamps enables SCT requests on all client SSL
2197
2267
  * objects created from |ctx|.
@@ -2201,12 +2271,11 @@ OPENSSL_EXPORT int SSL_enable_signed_cert_timestamps(SSL *ssl);
2201
2271
  OPENSSL_EXPORT void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx);
2202
2272
 
2203
2273
  /* SSL_enable_ocsp_stapling causes |ssl| (which must be the client end of a
2204
- * connection) to request a stapled OCSP response from the server. It returns
2205
- * one.
2274
+ * connection) to request a stapled OCSP response from the server.
2206
2275
  *
2207
2276
  * Call |SSL_get0_ocsp_response| to recover the OCSP response after the
2208
2277
  * handshake. */
2209
- OPENSSL_EXPORT int SSL_enable_ocsp_stapling(SSL *ssl);
2278
+ OPENSSL_EXPORT void SSL_enable_ocsp_stapling(SSL *ssl);
2210
2279
 
2211
2280
  /* SSL_CTX_enable_ocsp_stapling enables OCSP stapling on all client SSL objects
2212
2281
  * created from |ctx|.
@@ -2318,14 +2387,15 @@ OPENSSL_EXPORT int SSL_get_servername_type(const SSL *ssl);
2318
2387
 
2319
2388
  /* SSL_CTX_set_tlsext_servername_callback configures |callback| to be called on
2320
2389
  * the server after ClientHello extensions have been parsed and returns one.
2321
- * The callback may use |SSL_get_servername| to examine the server_name extension
2322
- * and returns a |SSL_TLSEXT_ERR_*| value. The value of |arg| may be set by
2323
- * calling |SSL_CTX_set_tlsext_servername_arg|.
2390
+ * The callback may use |SSL_get_servername| to examine the server_name
2391
+ * extension and returns a |SSL_TLSEXT_ERR_*| value. The value of |arg| may be
2392
+ * set by calling |SSL_CTX_set_tlsext_servername_arg|.
2324
2393
  *
2325
2394
  * If the callback returns |SSL_TLSEXT_ERR_NOACK|, the server_name extension is
2326
2395
  * not acknowledged in the ServerHello. If the return value is
2327
- * |SSL_TLSEXT_ERR_ALERT_FATAL| or |SSL_TLSEXT_ERR_ALERT_WARNING| then
2328
- * |*out_alert| must be set to the alert value to send. */
2396
+ * |SSL_TLSEXT_ERR_ALERT_FATAL|, then |*out_alert| is the alert to send,
2397
+ * defaulting to |SSL_AD_UNRECOGNIZED_NAME|. |SSL_TLSEXT_ERR_ALERT_WARNING| is
2398
+ * ignored and treated as |SSL_TLSEXT_ERR_OK|. */
2329
2399
  OPENSSL_EXPORT int SSL_CTX_set_tlsext_servername_callback(
2330
2400
  SSL_CTX *ctx, int (*callback)(SSL *ssl, int *out_alert, void *arg));
2331
2401
 
@@ -2340,7 +2410,7 @@ OPENSSL_EXPORT int SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);
2340
2410
  #define SSL_TLSEXT_ERR_NOACK 3
2341
2411
 
2342
2412
 
2343
- /* Application-layer protocol negotation.
2413
+ /* Application-layer protocol negotiation.
2344
2414
  *
2345
2415
  * The ALPN extension (RFC 7301) allows negotiating different application-layer
2346
2416
  * protocols over a single port. This is used, for example, to negotiate
@@ -2376,7 +2446,10 @@ OPENSSL_EXPORT int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos,
2376
2446
  * |*out_len| to the selected protocol and return |SSL_TLSEXT_ERR_OK| on
2377
2447
  * success. It does not pass ownership of the buffer. Otherwise, it should
2378
2448
  * return |SSL_TLSEXT_ERR_NOACK|. Other |SSL_TLSEXT_ERR_*| values are
2379
- * unimplemented and will be treated as |SSL_TLSEXT_ERR_NOACK|. */
2449
+ * unimplemented and will be treated as |SSL_TLSEXT_ERR_NOACK|.
2450
+ *
2451
+ * The cipher suite is selected before negotiating ALPN. The callback may use
2452
+ * |SSL_get_pending_cipher| to query the cipher suite. */
2380
2453
  OPENSSL_EXPORT void SSL_CTX_set_alpn_select_cb(
2381
2454
  SSL_CTX *ctx, int (*cb)(SSL *ssl, const uint8_t **out, uint8_t *out_len,
2382
2455
  const uint8_t *in, unsigned in_len, void *arg),
@@ -2452,7 +2525,7 @@ OPENSSL_EXPORT void SSL_get0_next_proto_negotiated(const SSL *ssl,
2452
2525
  * or have a default application level protocol.
2453
2526
  *
2454
2527
  * 2) If the server supports NPN, but advertises an empty list then the
2455
- * client selects the first protcol in its list, but indicates via the
2528
+ * client selects the first protocol in its list, but indicates via the
2456
2529
  * API that this fallback case was enacted.
2457
2530
  *
2458
2531
  * 3) Otherwise, the client finds the first protocol in the server's list
@@ -2480,15 +2553,14 @@ OPENSSL_EXPORT int SSL_select_next_proto(uint8_t **out, uint8_t *out_len,
2480
2553
  *
2481
2554
  * See draft-balfanz-tls-channelid-01. */
2482
2555
 
2483
- /* SSL_CTX_enable_tls_channel_id either configures a TLS server to accept TLS
2484
- * Channel IDs from clients, or configures a client to send TLS Channel IDs to
2485
- * a server. It returns one. */
2486
- OPENSSL_EXPORT int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx);
2556
+ /* SSL_CTX_set_tls_channel_id_enabled configures whether connections associated
2557
+ * with |ctx| should enable Channel ID. */
2558
+ OPENSSL_EXPORT void SSL_CTX_set_tls_channel_id_enabled(SSL_CTX *ctx,
2559
+ int enabled);
2487
2560
 
2488
- /* SSL_enable_tls_channel_id either configures a TLS server to accept TLS
2489
- * Channel IDs from clients, or configures a client to send TLS Channel IDs to
2490
- * server. It returns one. */
2491
- OPENSSL_EXPORT int SSL_enable_tls_channel_id(SSL *ssl);
2561
+ /* SSL_set_tls_channel_id_enabled configures whether |ssl| should enable Channel
2562
+ * ID. */
2563
+ OPENSSL_EXPORT void SSL_set_tls_channel_id_enabled(SSL *ssl, int enabled);
2492
2564
 
2493
2565
  /* SSL_CTX_set1_tls_channel_id configures a TLS client to send a TLS Channel ID
2494
2566
  * to compatible servers. |private_key| must be a P-256 EC key. It returns one
@@ -2695,6 +2767,7 @@ OPENSSL_EXPORT const char *SSL_get_psk_identity(const SSL *ssl);
2695
2767
  #define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION
2696
2768
  #define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY
2697
2769
  #define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR
2770
+ #define SSL_AD_INAPPROPRIATE_FALLBACK SSL3_AD_INAPPROPRIATE_FALLBACK
2698
2771
  #define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED
2699
2772
  #define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION
2700
2773
  #define SSL_AD_MISSING_EXTENSION TLS1_AD_MISSING_EXTENSION
@@ -2705,7 +2778,7 @@ OPENSSL_EXPORT const char *SSL_get_psk_identity(const SSL *ssl);
2705
2778
  TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE
2706
2779
  #define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE
2707
2780
  #define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY
2708
- #define SSL_AD_INAPPROPRIATE_FALLBACK SSL3_AD_INAPPROPRIATE_FALLBACK
2781
+ #define SSL_AD_CERTIFICATE_REQUIRED TLS1_AD_CERTIFICATE_REQUIRED
2709
2782
 
2710
2783
  /* SSL_alert_type_string_long returns a string description of |value| as an
2711
2784
  * alert type (warning or fatal). */
@@ -2879,12 +2952,17 @@ OPENSSL_EXPORT void SSL_set_renegotiate_mode(SSL *ssl,
2879
2952
  OPENSSL_EXPORT int SSL_renegotiate_pending(SSL *ssl);
2880
2953
 
2881
2954
  /* SSL_total_renegotiations returns the total number of renegotiation handshakes
2882
- * peformed by |ssl|. This includes the pending renegotiation, if any. */
2955
+ * performed by |ssl|. This includes the pending renegotiation, if any. */
2883
2956
  OPENSSL_EXPORT int SSL_total_renegotiations(const SSL *ssl);
2884
2957
 
2958
+ /* SSL_CTX_set_early_data_enabled sets whether early data is allowed to be used
2959
+ * with resumptions using |ctx|. WARNING: This is experimental and may cause
2960
+ * interoperability failures until fully implemented. */
2961
+ OPENSSL_EXPORT void SSL_CTX_set_early_data_enabled(SSL_CTX *ctx, int enabled);
2962
+
2885
2963
  /* SSL_MAX_CERT_LIST_DEFAULT is the default maximum length, in bytes, of a peer
2886
2964
  * certificate chain. */
2887
- #define SSL_MAX_CERT_LIST_DEFAULT 1024 * 100
2965
+ #define SSL_MAX_CERT_LIST_DEFAULT (1024 * 100)
2888
2966
 
2889
2967
  /* SSL_CTX_get_max_cert_list returns the maximum length, in bytes, of a peer
2890
2968
  * certificate chain accepted by |ctx|. */
@@ -2919,10 +2997,15 @@ OPENSSL_EXPORT int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx,
2919
2997
  OPENSSL_EXPORT int SSL_set_max_send_fragment(SSL *ssl,
2920
2998
  size_t max_send_fragment);
2921
2999
 
2922
- /* ssl_early_callback_ctx is passed to certain callbacks that are called very
2923
- * early on during the server handshake. At this point, much of the SSL* hasn't
2924
- * been filled out and only the ClientHello can be depended on. */
2925
- struct ssl_early_callback_ctx {
3000
+ /* SSL_get_v2clienthello_count returns the total number of V2ClientHellos that
3001
+ * are accepted. */
3002
+ OPENSSL_EXPORT uint64_t SSL_get_v2clienthello_count(void);
3003
+
3004
+ /* ssl_early_callback_ctx (aka |SSL_CLIENT_HELLO|) is passed to certain
3005
+ * callbacks that are called very early on during the server handshake. At this
3006
+ * point, much of the SSL* hasn't been filled out and only the ClientHello can
3007
+ * be depended on. */
3008
+ typedef struct ssl_early_callback_ctx {
2926
3009
  SSL *ssl;
2927
3010
  const uint8_t *client_hello;
2928
3011
  size_t client_hello_len;
@@ -2937,15 +3020,15 @@ struct ssl_early_callback_ctx {
2937
3020
  size_t compression_methods_len;
2938
3021
  const uint8_t *extensions;
2939
3022
  size_t extensions_len;
2940
- };
3023
+ } SSL_CLIENT_HELLO;
2941
3024
 
2942
- /* SSL_early_callback_ctx_extension_get searches the extensions in |ctx| for an
2943
- * extension of the given type. If not found, it returns zero. Otherwise it
2944
- * sets |out_data| to point to the extension contents (not including the type
2945
- * and length bytes), sets |out_len| to the length of the extension contents
2946
- * and returns one. */
3025
+ /* SSL_early_callback_ctx_extension_get searches the extensions in
3026
+ * |client_hello| for an extension of the given type. If not found, it returns
3027
+ * zero. Otherwise it sets |out_data| to point to the extension contents (not
3028
+ * including the type and length bytes), sets |out_len| to the length of the
3029
+ * extension contents and returns one. */
2947
3030
  OPENSSL_EXPORT int SSL_early_callback_ctx_extension_get(
2948
- const struct ssl_early_callback_ctx *ctx, uint16_t extension_type,
3031
+ const SSL_CLIENT_HELLO *client_hello, uint16_t extension_type,
2949
3032
  const uint8_t **out_data, size_t *out_len);
2950
3033
 
2951
3034
  /* SSL_CTX_set_select_certificate_cb sets a callback that is called before most
@@ -2955,19 +3038,16 @@ OPENSSL_EXPORT int SSL_early_callback_ctx_extension_get(
2955
3038
  * pause the handshake to perform an asynchronous operation. If paused,
2956
3039
  * |SSL_get_error| will return |SSL_ERROR_PENDING_CERTIFICATE|.
2957
3040
  *
2958
- * Note: The |ssl_early_callback_ctx| is only valid for the duration of the
2959
- * callback and is not valid while the handshake is paused. Further, unlike with
2960
- * most callbacks, when the handshake loop is resumed, it will not call the
2961
- * callback a second time. The caller must finish reconfiguring the connection
2962
- * before resuming the handshake. */
3041
+ * Note: The |SSL_CLIENT_HELLO| is only valid for the duration of the callback
3042
+ * and is not valid while the handshake is paused. */
2963
3043
  OPENSSL_EXPORT void SSL_CTX_set_select_certificate_cb(
2964
- SSL_CTX *ctx, int (*cb)(const struct ssl_early_callback_ctx *));
3044
+ SSL_CTX *ctx, int (*cb)(const SSL_CLIENT_HELLO *));
2965
3045
 
2966
3046
  /* SSL_CTX_set_dos_protection_cb sets a callback that is called once the
2967
3047
  * resumption decision for a ClientHello has been made. It can return one to
2968
3048
  * allow the handshake to continue or zero to cause the handshake to abort. */
2969
3049
  OPENSSL_EXPORT void SSL_CTX_set_dos_protection_cb(
2970
- SSL_CTX *ctx, int (*cb)(const struct ssl_early_callback_ctx *));
3050
+ SSL_CTX *ctx, int (*cb)(const SSL_CLIENT_HELLO *));
2971
3051
 
2972
3052
  /* SSL_ST_* are possible values for |SSL_state| and the bitmasks that make them
2973
3053
  * up. */
@@ -2978,7 +3058,6 @@ OPENSSL_EXPORT void SSL_CTX_set_dos_protection_cb(
2978
3058
  #define SSL_ST_OK 0x03
2979
3059
  #define SSL_ST_RENEGOTIATE (0x04 | SSL_ST_INIT)
2980
3060
  #define SSL_ST_TLS13 (0x05 | SSL_ST_INIT)
2981
- #define SSL_ST_ERROR (0x06| SSL_ST_INIT)
2982
3061
 
2983
3062
  /* SSL_CB_* are possible values for the |type| parameter in the info
2984
3063
  * callback and the bitmasks that make them up. */
@@ -2997,14 +3076,14 @@ OPENSSL_EXPORT void SSL_CTX_set_dos_protection_cb(
2997
3076
  #define SSL_CB_HANDSHAKE_DONE 0x20
2998
3077
 
2999
3078
  /* SSL_CTX_set_info_callback configures a callback to be run when various
3000
- * events occur during a connection's lifetime. The |type| argumentj determines
3079
+ * events occur during a connection's lifetime. The |type| argument determines
3001
3080
  * the type of event and the meaning of the |value| argument. Callbacks must
3002
3081
  * ignore unexpected |type| values.
3003
3082
  *
3004
3083
  * |SSL_CB_READ_ALERT| is signaled for each alert received, warning or fatal.
3005
3084
  * The |value| argument is a 16-bit value where the alert level (either
3006
- * |SSL3_AL_WARNING| or |SSL3_AL_FATAL|) is in the most-significant eight bits and
3007
- * the alert type (one of |SSL_AD_*|) is in the least-significant eight.
3085
+ * |SSL3_AL_WARNING| or |SSL3_AL_FATAL|) is in the most-significant eight bits
3086
+ * and the alert type (one of |SSL_AD_*|) is in the least-significant eight.
3008
3087
  *
3009
3088
  * |SSL_CB_WRITE_ALERT| is signaled for each alert sent. The |value| argument
3010
3089
  * is constructed as with |SSL_CB_READ_ALERT|.
@@ -3021,8 +3100,7 @@ OPENSSL_EXPORT void SSL_CTX_set_dos_protection_cb(
3021
3100
  *
3022
3101
  * |SSL_CB_ACCEPT_LOOP| (respectively, |SSL_CB_CONNECT_LOOP|) is signaled when
3023
3102
  * a server (respectively, client) handshake progresses. The |value| argument
3024
- * is always one. For the duration of the callback, |SSL_state| will return the
3025
- * previous state.
3103
+ * is always one.
3026
3104
  *
3027
3105
  * |SSL_CB_ACCEPT_EXIT| (respectively, |SSL_CB_CONNECT_EXIT|) is signaled when
3028
3106
  * a server (respectively, client) handshake completes, fails, or is paused.
@@ -3093,6 +3171,14 @@ OPENSSL_EXPORT size_t SSL_get_server_random(const SSL *ssl, uint8_t *out,
3093
3171
  * NULL if one has not been negotiated yet or there is no pending handshake. */
3094
3172
  OPENSSL_EXPORT const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl);
3095
3173
 
3174
+ /* SSL_set_retain_only_sha256_of_client_certs, on a server, sets whether only
3175
+ * the SHA-256 hash of peer's certificate should be saved in memory and in the
3176
+ * session. This can save memory, ticket size and session cache space. If
3177
+ * enabled, |SSL_get_peer_certificate| will return NULL after the handshake
3178
+ * completes. See the |peer_sha256| field of |SSL_SESSION| for the hash. */
3179
+ OPENSSL_EXPORT void SSL_set_retain_only_sha256_of_client_certs(SSL *ssl,
3180
+ int enable);
3181
+
3096
3182
  /* SSL_CTX_set_retain_only_sha256_of_client_certs, on a server, sets whether
3097
3183
  * only the SHA-256 hash of peer's certificate should be saved in memory and in
3098
3184
  * the session. This can save memory, ticket size and session cache space. If
@@ -3101,21 +3187,25 @@ OPENSSL_EXPORT const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl);
3101
3187
  OPENSSL_EXPORT void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx,
3102
3188
  int enable);
3103
3189
 
3104
- /* SSL_CTX_set_grease_enabled configures whether client sockets on |ctx| should
3105
- * enable GREASE. See draft-davidben-tls-grease-01. */
3190
+ /* SSL_CTX_set_grease_enabled configures whether sockets on |ctx| should enable
3191
+ * GREASE. See draft-davidben-tls-grease-01. */
3106
3192
  OPENSSL_EXPORT void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled);
3107
3193
 
3194
+ /* SSL_max_seal_overhead returns the maximum overhead, in bytes, of sealing a
3195
+ * record with |ssl|. */
3196
+ OPENSSL_EXPORT size_t SSL_max_seal_overhead(const SSL *ssl);
3197
+
3198
+ /* SSL_CTX_set_short_header_enabled configures whether a short record header in
3199
+ * TLS 1.3 may be negotiated. This allows client and server to negotiate
3200
+ * https://github.com/tlswg/tls13-spec/pull/762 for testing. */
3201
+ OPENSSL_EXPORT void SSL_CTX_set_short_header_enabled(SSL_CTX *ctx, int enabled);
3202
+
3108
3203
 
3109
3204
  /* Deprecated functions. */
3110
3205
 
3111
3206
  /* SSL_library_init calls |CRYPTO_library_init| and returns one. */
3112
3207
  OPENSSL_EXPORT int SSL_library_init(void);
3113
3208
 
3114
- /* SSL_set_reject_peer_renegotiations calls |SSL_set_renegotiate_mode| with
3115
- * |ssl_never_renegotiate| if |reject| is one and |ssl_renegotiate_freely| if
3116
- * zero. */
3117
- OPENSSL_EXPORT void SSL_set_reject_peer_renegotiations(SSL *ssl, int reject);
3118
-
3119
3209
  /* SSL_CIPHER_description writes a description of |cipher| into |buf| and
3120
3210
  * returns |buf|. If |buf| is NULL, it returns a newly allocated string, to be
3121
3211
  * freed with |OPENSSL_free|, or NULL on error.
@@ -3141,6 +3231,9 @@ OPENSSL_EXPORT int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);
3141
3231
  /* SSL_COMP_get_name returns NULL. */
3142
3232
  OPENSSL_EXPORT const char *SSL_COMP_get_name(const COMP_METHOD *comp);
3143
3233
 
3234
+ /* SSL_COMP_free_compression_methods does nothing. */
3235
+ OPENSSL_EXPORT void SSL_COMP_free_compression_methods(void);
3236
+
3144
3237
  /* SSLv23_method calls |TLS_method|. */
3145
3238
  OPENSSL_EXPORT const SSL_METHOD *SSLv23_method(void);
3146
3239
 
@@ -3326,14 +3419,14 @@ OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_expansion(SSL *s);
3326
3419
  /* SSL_get_server_tmp_key returns zero. */
3327
3420
  OPENSSL_EXPORT int *SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key);
3328
3421
 
3329
- #define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char *)arg))
3422
+ #define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char *)(arg)))
3330
3423
  #define SSL_get_app_data(s) (SSL_get_ex_data(s, 0))
3331
3424
  #define SSL_SESSION_set_app_data(s, a) \
3332
- (SSL_SESSION_set_ex_data(s, 0, (char *)a))
3425
+ (SSL_SESSION_set_ex_data(s, 0, (char *)(a)))
3333
3426
  #define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s, 0))
3334
3427
  #define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx, 0))
3335
3428
  #define SSL_CTX_set_app_data(ctx, arg) \
3336
- (SSL_CTX_set_ex_data(ctx, 0, (char *)arg))
3429
+ (SSL_CTX_set_ex_data(ctx, 0, (char *)(arg)))
3337
3430
 
3338
3431
  #define OpenSSL_add_ssl_algorithms() SSL_library_init()
3339
3432
  #define SSLeay_add_ssl_algorithms() SSL_library_init()
@@ -3404,7 +3497,7 @@ OPENSSL_EXPORT long SSL_get_default_timeout(const SSL *ssl);
3404
3497
  OPENSSL_EXPORT const char *SSL_get_version(const SSL *ssl);
3405
3498
 
3406
3499
  /* SSL_get_cipher_list returns the name of the |n|th cipher in the output of
3407
- * |SSL_get_ciphers| or NULL if out of range. Use |SSL_get_ciphers| insteads. */
3500
+ * |SSL_get_ciphers| or NULL if out of range. Use |SSL_get_ciphers| instead. */
3408
3501
  OPENSSL_EXPORT const char *SSL_get_cipher_list(const SSL *ssl, int n);
3409
3502
 
3410
3503
  /* SSL_CTX_set_client_cert_cb sets a callback which is called on the client if
@@ -3419,16 +3512,12 @@ OPENSSL_EXPORT const char *SSL_get_cipher_list(const SSL *ssl, int n);
3419
3512
  * |SSL_get_client_CA_list| for information on the server's certificate request.
3420
3513
  *
3421
3514
  * Use |SSL_CTX_set_cert_cb| instead. Configuring intermediate certificates with
3422
- * this function is confusing. */
3515
+ * this function is confusing. This callback may not be registered concurrently
3516
+ * with |SSL_CTX_set_cert_cb| or |SSL_set_cert_cb|. */
3423
3517
  OPENSSL_EXPORT void SSL_CTX_set_client_cert_cb(
3424
3518
  SSL_CTX *ctx,
3425
3519
  int (*client_cert_cb)(SSL *ssl, X509 **out_x509, EVP_PKEY **out_pkey));
3426
3520
 
3427
- /* SSL_CTX_get_client_cert_cb returns the callback set by
3428
- * |SSL_CTX_set_client_cert_cb|. */
3429
- OPENSSL_EXPORT int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(
3430
- SSL *ssl, X509 **out_x509, EVP_PKEY **out_pkey);
3431
-
3432
3521
  #define SSL_NOTHING 1
3433
3522
  #define SSL_WRITING 2
3434
3523
  #define SSL_READING 3
@@ -3442,27 +3531,20 @@ OPENSSL_EXPORT int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(
3442
3531
  * operation on |ssl| was blocked on. Use |SSL_get_error| instead. */
3443
3532
  OPENSSL_EXPORT int SSL_want(const SSL *ssl);
3444
3533
 
3445
- #define SSL_want_nothing(ssl) (SSL_want(ssl) == SSL_NOTHING)
3446
3534
  #define SSL_want_read(ssl) (SSL_want(ssl) == SSL_READING)
3447
3535
  #define SSL_want_write(ssl) (SSL_want(ssl) == SSL_WRITING)
3448
- #define SSL_want_x509_lookup(ssl) (SSL_want(ssl) == SSL_X509_LOOKUP)
3449
- #define SSL_want_channel_id_lookup(ssl) (SSL_want(ssl) == SSL_CHANNEL_ID_LOOKUP)
3450
- #define SSL_want_session(ssl) (SSL_want(ssl) == SSL_PENDING_SESSION)
3451
- #define SSL_want_certificate(ssl) \
3452
- (SSL_want(ssl) == SSL_CERTIFICATE_SELECTION_PENDING)
3453
- #define SSL_want_private_key_operation(ssl) \
3454
- (SSL_want(ssl) == SSL_PRIVATE_KEY_OPERATION)
3455
3536
 
3456
3537
  /* SSL_get_finished writes up to |count| bytes of the Finished message sent by
3457
3538
  * |ssl| to |buf|. It returns the total untruncated length or zero if none has
3458
- * been sent yet.
3539
+ * been sent yet. At SSL 3.0 or TLS 1.3 and later, it returns zero.
3459
3540
  *
3460
3541
  * Use |SSL_get_tls_unique| instead. */
3461
3542
  OPENSSL_EXPORT size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count);
3462
3543
 
3463
3544
  /* SSL_get_peer_finished writes up to |count| bytes of the Finished message
3464
3545
  * received from |ssl|'s peer to |buf|. It returns the total untruncated length
3465
- * or zero if none has been received yet.
3546
+ * or zero if none has been received yet. At SSL 3.0 or TLS 1.3 and later, it
3547
+ * returns zero.
3466
3548
  *
3467
3549
  * Use |SSL_get_tls_unique| instead. */
3468
3550
  OPENSSL_EXPORT size_t SSL_get_peer_finished(const SSL *ssl, void *buf,
@@ -3484,7 +3566,6 @@ OPENSSL_EXPORT const char *SSL_alert_desc_string(int value);
3484
3566
  #define SSL_TXT_kDHE "kDHE"
3485
3567
  #define SSL_TXT_kEDH "kEDH"
3486
3568
  #define SSL_TXT_kECDHE "kECDHE"
3487
- #define SSL_TXT_kCECPQ1 "kCECPQ1"
3488
3569
  #define SSL_TXT_kEECDH "kEECDH"
3489
3570
  #define SSL_TXT_kPSK "kPSK"
3490
3571
  #define SSL_TXT_aRSA "aRSA"
@@ -3521,7 +3602,10 @@ OPENSSL_EXPORT const char *SSL_alert_desc_string(int value);
3521
3602
 
3522
3603
  typedef struct ssl_conf_ctx_st SSL_CONF_CTX;
3523
3604
 
3524
- /* SSL_state returns the current state of the handshake state machine. */
3605
+ /* SSL_state returns |SSL_ST_INIT| if a handshake is in progress and |SSL_ST_OK|
3606
+ * otherwise.
3607
+ *
3608
+ * Use |SSL_is_init| instead. */
3525
3609
  OPENSSL_EXPORT int SSL_state(const SSL *ssl);
3526
3610
 
3527
3611
  #define SSL_get_state(ssl) SSL_state(ssl)
@@ -3588,6 +3672,25 @@ OPENSSL_EXPORT int SSL_set_min_version(SSL *ssl, uint16_t version);
3588
3672
  /* SSL_set_max_version calls |SSL_set_max_proto_version|. */
3589
3673
  OPENSSL_EXPORT int SSL_set_max_version(SSL *ssl, uint16_t version);
3590
3674
 
3675
+ /* SSL_CTX_enable_tls_channel_id calls |SSL_CTX_set_tls_channel_id_enabled|. */
3676
+ OPENSSL_EXPORT int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx);
3677
+
3678
+ /* SSL_enable_tls_channel_id calls |SSL_set_tls_channel_id_enabled|. */
3679
+ OPENSSL_EXPORT int SSL_enable_tls_channel_id(SSL *ssl);
3680
+
3681
+ /* BIO_f_ssl returns a |BIO_METHOD| that can wrap an |SSL*| in a |BIO*|. Note
3682
+ * that this has quite different behaviour from the version in OpenSSL (notably
3683
+ * that it doesn't try to auto renegotiate).
3684
+ *
3685
+ * IMPORTANT: if you are not curl, don't use this. */
3686
+ OPENSSL_EXPORT const BIO_METHOD *BIO_f_ssl(void);
3687
+
3688
+ /* BIO_set_ssl sets |ssl| as the underlying connection for |bio|, which must
3689
+ * have been created using |BIO_f_ssl|. If |take_owership| is true, |bio| will
3690
+ * call |SSL_free| on |ssl| when closed. It returns one on success or something
3691
+ * other than one on error. */
3692
+ OPENSSL_EXPORT long BIO_set_ssl(BIO *bio, SSL *ssl, int take_owership);
3693
+
3591
3694
 
3592
3695
  /* Private structures.
3593
3696
  *
@@ -3595,9 +3698,7 @@ OPENSSL_EXPORT int SSL_set_max_version(SSL *ssl, uint16_t version);
3595
3698
  * deprecated. */
3596
3699
 
3597
3700
  typedef struct ssl_protocol_method_st SSL_PROTOCOL_METHOD;
3598
- typedef struct ssl3_enc_method SSL3_ENC_METHOD;
3599
- typedef struct ssl_aead_ctx_st SSL_AEAD_CTX;
3600
- typedef struct ssl_handshake_st SSL_HANDSHAKE;
3701
+ typedef struct ssl_x509_method_st SSL_X509_METHOD;
3601
3702
 
3602
3703
  struct ssl_cipher_st {
3603
3704
  /* name is the OpenSSL name for the cipher. */
@@ -3613,12 +3714,6 @@ struct ssl_cipher_st {
3613
3714
  uint32_t algorithm_prf;
3614
3715
  };
3615
3716
 
3616
- typedef struct ssl_ecdh_method_st SSL_ECDH_METHOD;
3617
- typedef struct ssl_ecdh_ctx_st {
3618
- const SSL_ECDH_METHOD *method;
3619
- void *data;
3620
- } SSL_ECDH_CTX;
3621
-
3622
3717
  #define SSL_MAX_SSL_SESSION_ID_LENGTH 32
3623
3718
  #define SSL_MAX_SID_CTX_LENGTH 32
3624
3719
  #define SSL_MAX_MASTER_KEY_LENGTH 48
@@ -3627,16 +3722,13 @@ struct ssl_session_st {
3627
3722
  CRYPTO_refcount_t references;
3628
3723
  int ssl_version; /* what ssl version session info is being kept in here? */
3629
3724
 
3630
- /* key_exchange_info contains an indication of the size of the asymmetric
3631
- * primitive used in the handshake that created this session. In the event
3632
- * that two asymmetric operations are used, this value applies to the one
3633
- * that controls the confidentiality of the connection. Its interpretation
3634
- * depends on the primitive that was used; as specified by the cipher suite:
3635
- * DHE: the size, in bits, of the multiplicative group.
3636
- * ECDHE: the TLS id for the curve.
3637
- *
3638
- * A zero indicates that the value is unknown. */
3639
- uint32_t key_exchange_info;
3725
+ /* group_id is the ID of the ECDH group used to establish this session or zero
3726
+ * if not applicable or unknown. */
3727
+ uint16_t group_id;
3728
+
3729
+ /* peer_signature_algorithm is the signature algorithm used to authenticate
3730
+ * the peer, or zero if not applicable or unknown. */
3731
+ uint16_t peer_signature_algorithm;
3640
3732
 
3641
3733
  /* master_key, in TLS 1.2 and below, is the master secret associated with the
3642
3734
  * session. In TLS 1.3 and up, it is the resumption secret. */
@@ -3649,23 +3741,46 @@ struct ssl_session_st {
3649
3741
  /* this is used to determine whether the session is being reused in
3650
3742
  * the appropriate context. It is up to the application to set this,
3651
3743
  * via SSL_new */
3652
- unsigned int sid_ctx_length;
3744
+ uint8_t sid_ctx_length;
3653
3745
  uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH];
3654
3746
 
3655
3747
  char *psk_identity;
3656
- /* peer is the peer's certificate. */
3657
- X509 *peer;
3658
3748
 
3659
- /* cert_chain is the certificate chain sent by the peer. NOTE: for historical
3749
+ /* certs contains the certificate chain from the peer, starting with the leaf
3750
+ * certificate. */
3751
+ STACK_OF(CRYPTO_BUFFER) *certs;
3752
+
3753
+ const SSL_X509_METHOD *x509_method;
3754
+
3755
+ /* x509_peer is the peer's certificate. */
3756
+ X509 *x509_peer;
3757
+
3758
+ /* x509_chain is the certificate chain sent by the peer. NOTE: for historical
3660
3759
  * reasons, when a client (so the peer is a server), the chain includes
3661
3760
  * |peer|, but when a server it does not. */
3662
- STACK_OF(X509) *cert_chain;
3761
+ STACK_OF(X509) *x509_chain;
3762
+
3763
+ /* x509_chain_without_leaf is a lazily constructed copy of |x509_chain| that
3764
+ * omits the leaf certificate. This exists because OpenSSL, historically,
3765
+ * didn't include the leaf certificate in the chain for a server, but did for
3766
+ * a client. The |x509_chain| always includes it and, if an API call requires
3767
+ * a chain without, it is stored here. */
3768
+ STACK_OF(X509) *x509_chain_without_leaf;
3663
3769
 
3664
3770
  /* verify_result is the result of certificate verification in the case of
3665
3771
  * non-fatal certificate errors. */
3666
3772
  long verify_result;
3667
3773
 
3774
+ /* timeout is the lifetime of the session in seconds, measured from |time|.
3775
+ * This is renewable up to |auth_timeout|. */
3668
3776
  long timeout;
3777
+
3778
+ /* auth_timeout is the non-renewable lifetime of the session in seconds,
3779
+ * measured from |time|. */
3780
+ long auth_timeout;
3781
+
3782
+ /* time is the time the session was issued, measured in seconds from the UNIX
3783
+ * epoch. */
3669
3784
  long time;
3670
3785
 
3671
3786
  const SSL_CIPHER *cipher;
@@ -3696,13 +3811,22 @@ struct ssl_session_st {
3696
3811
  * SHA-2, depending on TLS version) for the original, full handshake that
3697
3812
  * created a session. This is used by Channel IDs during resumption. */
3698
3813
  uint8_t original_handshake_hash[EVP_MAX_MD_SIZE];
3699
- unsigned original_handshake_hash_len;
3814
+ uint8_t original_handshake_hash_len;
3700
3815
 
3701
3816
  uint32_t tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */
3702
3817
 
3703
- uint32_t ticket_flags;
3704
3818
  uint32_t ticket_age_add;
3705
3819
 
3820
+ /* ticket_max_early_data is the maximum amount of data allowed to be sent as
3821
+ * early data. If zero, 0-RTT is disallowed. */
3822
+ uint32_t ticket_max_early_data;
3823
+
3824
+ /* early_alpn is the ALPN protocol from the initial handshake. This is only
3825
+ * stored for TLS 1.3 and above in order to enforce ALPN matching for 0-RTT
3826
+ * resumptions. */
3827
+ uint8_t *early_alpn;
3828
+ size_t early_alpn_len;
3829
+
3706
3830
  /* extended_master_secret is true if the master secret in this session was
3707
3831
  * generated using EMS and thus isn't vulnerable to the Triple Handshake
3708
3832
  * attack. */
@@ -3716,6 +3840,9 @@ struct ssl_session_st {
3716
3840
 
3717
3841
  /* ticket_age_add_valid is non-zero if |ticket_age_add| is valid. */
3718
3842
  unsigned ticket_age_add_valid:1;
3843
+
3844
+ /* is_server is true if this session was created by a server. */
3845
+ unsigned is_server:1;
3719
3846
  };
3720
3847
 
3721
3848
  /* ssl_cipher_preference_list_st contains a list of SSL_CIPHERs with
@@ -3758,6 +3885,7 @@ struct ssl_cipher_preference_list_st {
3758
3885
  * connections. */
3759
3886
  struct ssl_ctx_st {
3760
3887
  const SSL_PROTOCOL_METHOD *method;
3888
+ const SSL_X509_METHOD *x509_method;
3761
3889
 
3762
3890
  /* lock is used to protect various operations on this object. */
3763
3891
  CRYPTO_MUTEX lock;
@@ -3771,23 +3899,6 @@ struct ssl_ctx_st {
3771
3899
  uint16_t min_version;
3772
3900
 
3773
3901
  struct ssl_cipher_preference_list_st *cipher_list;
3774
- /* same as above but sorted for lookup */
3775
- STACK_OF(SSL_CIPHER) *cipher_list_by_id;
3776
-
3777
- /* cipher_list_tls10 is the list of ciphers when TLS 1.0 or greater is in
3778
- * use. This only applies to server connections as, for clients, the version
3779
- * number is known at connect time and so the cipher list can be set then. If
3780
- * |cipher_list_tls11| is non-NULL then this applies only to TLS 1.0
3781
- * connections.
3782
- *
3783
- * TODO(agl): this exists to assist in the death of SSLv3. It can hopefully
3784
- * be removed after that. */
3785
- struct ssl_cipher_preference_list_st *cipher_list_tls10;
3786
-
3787
- /* cipher_list_tls11 is the list of ciphers when TLS 1.1 or greater is in
3788
- * use. This only applies to server connections as, for clients, the version
3789
- * number is known at connect time and so the cipher list can be set then. */
3790
- struct ssl_cipher_preference_list_st *cipher_list_tls11;
3791
3902
 
3792
3903
  X509_STORE *cert_store;
3793
3904
  LHASH_OF(SSL_SESSION) *sessions;
@@ -3808,10 +3919,14 @@ struct ssl_ctx_st {
3808
3919
  * SSL_accept which cache SSL_SESSIONS. */
3809
3920
  int session_cache_mode;
3810
3921
 
3811
- /* If timeout is not 0, it is the default timeout value set when SSL_new() is
3812
- * called. This has been put in to make life easier to set things up */
3922
+ /* session_timeout is the default lifetime for new sessions in TLS 1.2 and
3923
+ * earlier, in seconds. */
3813
3924
  long session_timeout;
3814
3925
 
3926
+ /* session_psk_dhe_timeout is the default lifetime for new sessions in TLS
3927
+ * 1.3, in seconds. */
3928
+ long session_psk_dhe_timeout;
3929
+
3815
3930
  /* If this callback is not null, it will be called each time a session id is
3816
3931
  * added to the cache. If this function returns 1, it means that the
3817
3932
  * callback will do a SSL_SESSION_free() when it has finished using it.
@@ -3872,8 +3987,6 @@ struct ssl_ctx_st {
3872
3987
  void *msg_callback_arg;
3873
3988
 
3874
3989
  int verify_mode;
3875
- unsigned int sid_ctx_length;
3876
- uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH];
3877
3990
  int (*default_verify_callback)(
3878
3991
  int ok, X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */
3879
3992
 
@@ -3885,12 +3998,12 @@ struct ssl_ctx_st {
3885
3998
  * with an error and cause SSL_get_error to return
3886
3999
  * SSL_ERROR_PENDING_CERTIFICATE. Note: when the handshake loop is resumed, it
3887
4000
  * will not call the callback a second time. */
3888
- int (*select_certificate_cb)(const struct ssl_early_callback_ctx *);
4001
+ int (*select_certificate_cb)(const SSL_CLIENT_HELLO *);
3889
4002
 
3890
4003
  /* dos_protection_cb is called once the resumption decision for a ClientHello
3891
4004
  * has been made. It returns one to continue the handshake or zero to
3892
4005
  * abort. */
3893
- int (*dos_protection_cb) (const struct ssl_early_callback_ctx *);
4006
+ int (*dos_protection_cb) (const SSL_CLIENT_HELLO *);
3894
4007
 
3895
4008
  /* Maximum amount of data to send in one fragment. actual record size can be
3896
4009
  * more than this due to padding and MAC overheads. */
@@ -3968,14 +4081,6 @@ struct ssl_ctx_st {
3968
4081
  /* The client's Channel ID private key. */
3969
4082
  EVP_PKEY *tlsext_channel_id_private;
3970
4083
 
3971
- /* Signed certificate timestamp list to be sent to the client, if requested */
3972
- uint8_t *signed_cert_timestamp_list;
3973
- size_t signed_cert_timestamp_list_length;
3974
-
3975
- /* OCSP response to be sent to the client, if requested. */
3976
- uint8_t *ocsp_response;
3977
- size_t ocsp_response_length;
3978
-
3979
4084
  /* keylog_callback, if not NULL, is the key logging callback. See
3980
4085
  * |SSL_CTX_set_keylog_callback|. */
3981
4086
  void (*keylog_callback)(const SSL *ssl, const char *line);
@@ -3985,10 +4090,18 @@ struct ssl_ctx_st {
3985
4090
  * |SSL_CTX_set_current_time_cb|. */
3986
4091
  void (*current_time_cb)(const SSL *ssl, struct timeval *out_clock);
3987
4092
 
4093
+ /* pool is used for all |CRYPTO_BUFFER|s in case we wish to share certificate
4094
+ * memory. */
4095
+ CRYPTO_BUFFER_POOL *pool;
4096
+
3988
4097
  /* quiet_shutdown is true if the connection should not send a close_notify on
3989
4098
  * shutdown. */
3990
4099
  unsigned quiet_shutdown:1;
3991
4100
 
4101
+ /* If enable_early_data is non-zero, early data can be sent and accepted over
4102
+ * new connections. */
4103
+ unsigned enable_early_data:1;
4104
+
3992
4105
  /* ocsp_stapling_enabled is only used by client connections and indicates
3993
4106
  * whether OCSP stapling will be requested. */
3994
4107
  unsigned ocsp_stapling_enabled:1;
@@ -4005,463 +4118,11 @@ struct ssl_ctx_st {
4005
4118
  * otherwise. */
4006
4119
  unsigned grease_enabled:1;
4007
4120
 
4008
- /* extra_certs is a dummy value included for compatibility.
4009
- * TODO(agl): remove once node.js no longer references this. */
4010
- STACK_OF(X509)* extra_certs;
4011
- int freelist_max_len;
4121
+ /* short_header_enabled is one if a short record header in TLS 1.3 may
4122
+ * be negotiated and zero otherwise. */
4123
+ unsigned short_header_enabled:1;
4012
4124
  };
4013
4125
 
4014
- struct ssl_st {
4015
- /* method is the method table corresponding to the current protocol (DTLS or
4016
- * TLS). */
4017
- const SSL_PROTOCOL_METHOD *method;
4018
-
4019
- /* version is the protocol version. */
4020
- int version;
4021
-
4022
- /* state contains one of the SSL3_ST_* values. */
4023
- int state;
4024
-
4025
- /* max_version is the maximum acceptable protocol version. Note this version
4026
- * is normalized in DTLS. */
4027
- uint16_t max_version;
4028
-
4029
- /* min_version is the minimum acceptable protocol version. Note this version
4030
- * is normalized in DTLS. */
4031
- uint16_t min_version;
4032
-
4033
- uint16_t max_send_fragment;
4034
-
4035
- /* There are 2 BIO's even though they are normally both the same. This is so
4036
- * data can be read and written to different handlers */
4037
-
4038
- BIO *rbio; /* used by SSL_read */
4039
- BIO *wbio; /* used by SSL_write */
4040
-
4041
- /* bbio, if non-NULL, is a buffer placed in front of |wbio| to pack handshake
4042
- * messages within one flight into a single |BIO_write|. In this case, |wbio|
4043
- * and |bbio| are equal and the true caller-configured BIO is
4044
- * |bbio->next_bio|.
4045
- *
4046
- * TODO(davidben): This does not work right for DTLS. It assumes the MTU is
4047
- * smaller than the buffer size so that the buffer's internal flushing never
4048
- * kicks in. It also doesn't kick in for DTLS retransmission. Replace this
4049
- * with a better mechanism. */
4050
- BIO *bbio;
4051
-
4052
- int (*handshake_func)(SSL *);
4053
-
4054
- BUF_MEM *init_buf; /* buffer used during init */
4055
-
4056
- /* init_msg is a pointer to the current handshake message body. */
4057
- const uint8_t *init_msg;
4058
- /* init_num is the length of the current handshake message body. */
4059
- uint32_t init_num;
4060
-
4061
- /* init_off, in DTLS, is the number of bytes of the current message that have
4062
- * been written. */
4063
- uint32_t init_off;
4064
-
4065
- struct ssl3_state_st *s3; /* SSLv3 variables */
4066
- struct dtls1_state_st *d1; /* DTLSv1 variables */
4067
-
4068
- /* callback that allows applications to peek at protocol messages */
4069
- void (*msg_callback)(int write_p, int version, int content_type,
4070
- const void *buf, size_t len, SSL *ssl, void *arg);
4071
- void *msg_callback_arg;
4072
-
4073
- X509_VERIFY_PARAM *param;
4074
-
4075
- /* crypto */
4076
- struct ssl_cipher_preference_list_st *cipher_list;
4077
- STACK_OF(SSL_CIPHER) *cipher_list_by_id;
4078
-
4079
- /* session info */
4080
-
4081
- /* client cert? */
4082
- /* This is used to hold the server certificate used */
4083
- struct cert_st /* CERT */ *cert;
4084
-
4085
- /* This holds a variable that indicates what we were doing when a 0 or -1 is
4086
- * returned. This is needed for non-blocking IO so we know what request
4087
- * needs re-doing when in SSL_accept or SSL_connect */
4088
- int rwstate;
4089
-
4090
- /* initial_timeout_duration_ms is the default DTLS timeout duration in
4091
- * milliseconds. It's used to initialize the timer any time it's restarted. */
4092
- unsigned initial_timeout_duration_ms;
4093
-
4094
- /* the session_id_context is used to ensure sessions are only reused
4095
- * in the appropriate context */
4096
- unsigned int sid_ctx_length;
4097
- uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH];
4098
-
4099
- /* session is the configured session to be offered by the client. This session
4100
- * is immutable. */
4101
- SSL_SESSION *session;
4102
-
4103
- int (*verify_callback)(int ok,
4104
- X509_STORE_CTX *ctx); /* fail if callback returns 0 */
4105
-
4106
- void (*info_callback)(const SSL *ssl, int type, int value);
4107
-
4108
- /* Server-only: psk_identity_hint is the identity hint to send in
4109
- * PSK-based key exchanges. */
4110
- char *psk_identity_hint;
4111
-
4112
- unsigned int (*psk_client_callback)(SSL *ssl, const char *hint,
4113
- char *identity,
4114
- unsigned int max_identity_len,
4115
- uint8_t *psk, unsigned int max_psk_len);
4116
- unsigned int (*psk_server_callback)(SSL *ssl, const char *identity,
4117
- uint8_t *psk, unsigned int max_psk_len);
4118
-
4119
- SSL_CTX *ctx;
4120
-
4121
- /* extra application data */
4122
- CRYPTO_EX_DATA ex_data;
4123
-
4124
- /* for server side, keep the list of CA_dn we can use */
4125
- STACK_OF(X509_NAME) *client_CA;
4126
-
4127
- uint32_t options; /* protocol behaviour */
4128
- uint32_t mode; /* API behaviour */
4129
- uint32_t max_cert_list;
4130
- int client_version; /* what was passed, used for
4131
- * SSLv3/TLS rollback check */
4132
- char *tlsext_hostname;
4133
- size_t supported_group_list_len;
4134
- uint16_t *supported_group_list; /* our list */
4135
-
4136
- SSL_CTX *initial_ctx; /* initial ctx, used to store sessions */
4137
-
4138
- /* srtp_profiles is the list of configured SRTP protection profiles for
4139
- * DTLS-SRTP. */
4140
- STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
4141
-
4142
- /* srtp_profile is the selected SRTP protection profile for
4143
- * DTLS-SRTP. */
4144
- const SRTP_PROTECTION_PROFILE *srtp_profile;
4145
-
4146
- /* The client's Channel ID private key. */
4147
- EVP_PKEY *tlsext_channel_id_private;
4148
-
4149
- /* For a client, this contains the list of supported protocols in wire
4150
- * format. */
4151
- uint8_t *alpn_client_proto_list;
4152
- unsigned alpn_client_proto_list_len;
4153
-
4154
- /* renegotiate_mode controls how peer renegotiation attempts are handled. */
4155
- enum ssl_renegotiate_mode_t renegotiate_mode;
4156
-
4157
- /* verify_mode is a bitmask of |SSL_VERIFY_*| values. */
4158
- uint8_t verify_mode;
4159
-
4160
- /* server is true iff the this SSL* is the server half. Note: before the SSL*
4161
- * is initialized by either SSL_set_accept_state or SSL_set_connect_state,
4162
- * the side is not determined. In this state, server is always false. */
4163
- unsigned server:1;
4164
-
4165
- /* quiet_shutdown is true if the connection should not send a close_notify on
4166
- * shutdown. */
4167
- unsigned quiet_shutdown:1;
4168
-
4169
- /* Enable signed certificate time stamps. Currently client only. */
4170
- unsigned signed_cert_timestamps_enabled:1;
4171
-
4172
- /* ocsp_stapling_enabled is only used by client connections and indicates
4173
- * whether OCSP stapling will be requested. */
4174
- unsigned ocsp_stapling_enabled:1;
4175
-
4176
- /* tlsext_channel_id_enabled is copied from the |SSL_CTX|. For a server,
4177
- * means that we'll accept Channel IDs from clients. For a client, means that
4178
- * we'll advertise support. */
4179
- unsigned tlsext_channel_id_enabled:1;
4180
-
4181
- /* RFC4507 session ticket expected to be received or sent */
4182
- unsigned tlsext_ticket_expected:1;
4183
-
4184
- /* TODO(agl): remove once node.js not longer references this. */
4185
- int tlsext_status_type;
4186
- };
4187
-
4188
- typedef struct ssl3_record_st {
4189
- /* type is the record type. */
4190
- uint8_t type;
4191
- /* length is the number of unconsumed bytes in the record. */
4192
- uint16_t length;
4193
- /* data is a non-owning pointer to the first unconsumed byte of the record. */
4194
- uint8_t *data;
4195
- } SSL3_RECORD;
4196
-
4197
- typedef struct ssl3_buffer_st {
4198
- /* buf is the memory allocated for this buffer. */
4199
- uint8_t *buf;
4200
- /* offset is the offset into |buf| which the buffer contents start at. */
4201
- uint16_t offset;
4202
- /* len is the length of the buffer contents from |buf| + |offset|. */
4203
- uint16_t len;
4204
- /* cap is how much memory beyond |buf| + |offset| is available. */
4205
- uint16_t cap;
4206
- } SSL3_BUFFER;
4207
-
4208
- /* An ssl_shutdown_t describes the shutdown state of one end of the connection,
4209
- * whether it is alive or has been shutdown via close_notify or fatal alert. */
4210
- enum ssl_shutdown_t {
4211
- ssl_shutdown_none = 0,
4212
- ssl_shutdown_close_notify = 1,
4213
- ssl_shutdown_fatal_alert = 2,
4214
- };
4215
-
4216
- typedef struct ssl3_state_st {
4217
- uint8_t read_sequence[8];
4218
- uint8_t write_sequence[8];
4219
-
4220
- uint8_t server_random[SSL3_RANDOM_SIZE];
4221
- uint8_t client_random[SSL3_RANDOM_SIZE];
4222
-
4223
- /* have_version is true if the connection's final version is known. Otherwise
4224
- * the version has not been negotiated yet. */
4225
- unsigned have_version:1;
4226
-
4227
- /* v2_hello_done is true if the peer's V2ClientHello, if any, has been handled
4228
- * and future messages should use the record layer. */
4229
- unsigned v2_hello_done:1;
4230
-
4231
- /* initial_handshake_complete is true if the initial handshake has
4232
- * completed. */
4233
- unsigned initial_handshake_complete:1;
4234
-
4235
- /* read_buffer holds data from the transport to be processed. */
4236
- SSL3_BUFFER read_buffer;
4237
- /* write_buffer holds data to be written to the transport. */
4238
- SSL3_BUFFER write_buffer;
4239
-
4240
- SSL3_RECORD rrec; /* each decoded record goes in here */
4241
-
4242
- /* partial write - check the numbers match */
4243
- unsigned int wnum; /* number of bytes sent so far */
4244
- int wpend_tot; /* number bytes written */
4245
- int wpend_type;
4246
- int wpend_ret; /* number of bytes submitted */
4247
- const uint8_t *wpend_buf;
4248
-
4249
- /* handshake_buffer, if non-NULL, contains the handshake transcript. */
4250
- BUF_MEM *handshake_buffer;
4251
- /* handshake_hash, if initialized with an |EVP_MD|, maintains the handshake
4252
- * hash. For TLS 1.1 and below, it is the SHA-1 half. */
4253
- EVP_MD_CTX handshake_hash;
4254
- /* handshake_md5, if initialized with an |EVP_MD|, maintains the MD5 half of
4255
- * the handshake hash for TLS 1.1 and below. */
4256
- EVP_MD_CTX handshake_md5;
4257
-
4258
- /* recv_shutdown is the shutdown state for the receive half of the
4259
- * connection. */
4260
- enum ssl_shutdown_t recv_shutdown;
4261
-
4262
- /* recv_shutdown is the shutdown state for the send half of the connection. */
4263
- enum ssl_shutdown_t send_shutdown;
4264
-
4265
- int alert_dispatch;
4266
- uint8_t send_alert[2];
4267
-
4268
- int total_renegotiations;
4269
-
4270
- /* empty_record_count is the number of consecutive empty records received. */
4271
- uint8_t empty_record_count;
4272
-
4273
- /* warning_alert_count is the number of consecutive warning alerts
4274
- * received. */
4275
- uint8_t warning_alert_count;
4276
-
4277
- /* key_update_count is the number of consecutive KeyUpdates received. */
4278
- uint8_t key_update_count;
4279
-
4280
- /* aead_read_ctx is the current read cipher state. */
4281
- SSL_AEAD_CTX *aead_read_ctx;
4282
-
4283
- /* aead_write_ctx is the current write cipher state. */
4284
- SSL_AEAD_CTX *aead_write_ctx;
4285
-
4286
- /* enc_method is the method table corresponding to the current protocol
4287
- * version. */
4288
- const SSL3_ENC_METHOD *enc_method;
4289
-
4290
- /* pending_message is the current outgoing handshake message. */
4291
- uint8_t *pending_message;
4292
- uint32_t pending_message_len;
4293
-
4294
- /* hs is the handshake state for the current handshake or NULL if there isn't
4295
- * one. */
4296
- SSL_HANDSHAKE *hs;
4297
-
4298
- uint8_t write_traffic_secret[EVP_MAX_MD_SIZE];
4299
- uint8_t write_traffic_secret_len;
4300
- uint8_t read_traffic_secret[EVP_MAX_MD_SIZE];
4301
- uint8_t read_traffic_secret_len;
4302
- uint8_t exporter_secret[EVP_MAX_MD_SIZE];
4303
- uint8_t exporter_secret_len;
4304
-
4305
- /* State pertaining to the pending handshake.
4306
- *
4307
- * TODO(davidben): Move everything not needed after the handshake completes to
4308
- * |hs| and remove this. */
4309
- struct {
4310
- uint8_t finish_md[EVP_MAX_MD_SIZE];
4311
- uint8_t finish_md_len;
4312
- uint8_t peer_finish_md[EVP_MAX_MD_SIZE];
4313
- uint8_t peer_finish_md_len;
4314
-
4315
- int message_type;
4316
-
4317
- /* used to hold the new cipher we are going to use */
4318
- const SSL_CIPHER *new_cipher;
4319
-
4320
- /* used when SSL_ST_FLUSH_DATA is entered */
4321
- int next_state;
4322
-
4323
- int reuse_message;
4324
-
4325
- union {
4326
- /* sent is a bitset where the bits correspond to elements of kExtensions
4327
- * in t1_lib.c. Each bit is set if that extension was sent in a
4328
- * ClientHello. It's not used by servers. */
4329
- uint32_t sent;
4330
- /* received is a bitset, like |sent|, but is used by servers to record
4331
- * which extensions were received from a client. */
4332
- uint32_t received;
4333
- } extensions;
4334
-
4335
- union {
4336
- /* sent is a bitset where the bits correspond to elements of
4337
- * |client_custom_extensions| in the |SSL_CTX|. Each bit is set if that
4338
- * extension was sent in a ClientHello. It's not used by servers. */
4339
- uint16_t sent;
4340
- /* received is a bitset, like |sent|, but is used by servers to record
4341
- * which custom extensions were received from a client. The bits here
4342
- * correspond to |server_custom_extensions|. */
4343
- uint16_t received;
4344
- } custom_extensions;
4345
-
4346
- /* should_ack_sni is used by a server and indicates that the SNI extension
4347
- * should be echoed in the ServerHello. */
4348
- unsigned should_ack_sni:1;
4349
-
4350
- /* Client-only: ca_names contains the list of CAs received in a
4351
- * CertificateRequest message. */
4352
- STACK_OF(X509_NAME) *ca_names;
4353
-
4354
- /* Client-only: certificate_types contains the set of certificate types
4355
- * received in a CertificateRequest message. */
4356
- uint8_t *certificate_types;
4357
- size_t num_certificate_types;
4358
-
4359
- uint8_t *key_block;
4360
- uint8_t key_block_length;
4361
-
4362
- uint8_t new_mac_secret_len;
4363
- uint8_t new_key_len;
4364
- uint8_t new_fixed_iv_len;
4365
-
4366
- /* cert_request is true if a client certificate was requested and false
4367
- * otherwise. */
4368
- unsigned cert_request:1;
4369
-
4370
- /* certificate_status_expected is true if OCSP stapling was negotiated and
4371
- * the server is expected to send a CertificateStatus message. (This is
4372
- * used on both the client and server sides.) */
4373
- unsigned certificate_status_expected:1;
4374
-
4375
- /* ocsp_stapling_requested is true if a client requested OCSP stapling. */
4376
- unsigned ocsp_stapling_requested:1;
4377
-
4378
- /* Server-only: peer_supported_group_list contains the supported group IDs
4379
- * advertised by the peer. This is only set on the server's end. The server
4380
- * does not advertise this extension to the client. */
4381
- uint16_t *peer_supported_group_list;
4382
- size_t peer_supported_group_list_len;
4383
-
4384
- /* extended_master_secret indicates whether the extended master secret
4385
- * computation is used in this handshake. Note that this is different from
4386
- * whether it was used for the current session. If this is a resumption
4387
- * handshake then EMS might be negotiated in the client and server hello
4388
- * messages, but it doesn't matter if the session that's being resumed
4389
- * didn't use it to create the master secret initially. */
4390
- char extended_master_secret;
4391
-
4392
- /* Client-only: in_false_start is one if there is a pending handshake in
4393
- * False Start. The client may write data at this point. */
4394
- char in_false_start;
4395
-
4396
- /* peer_signature_algorithm is the signature algorithm used to authenticate
4397
- * the peer, or zero if not applicable. */
4398
- uint16_t peer_signature_algorithm;
4399
-
4400
- /* ecdh_ctx is the current ECDH instance. */
4401
- SSL_ECDH_CTX ecdh_ctx;
4402
-
4403
- /* peer_key is the peer's ECDH key. */
4404
- uint8_t *peer_key;
4405
- uint16_t peer_key_len;
4406
-
4407
- /* server_params stores the ServerKeyExchange parameters to be signed while
4408
- * the signature is being computed. */
4409
- uint8_t *server_params;
4410
- uint32_t server_params_len;
4411
- } tmp;
4412
-
4413
- /* new_session is the new mutable session being established by the current
4414
- * handshake. It should not be cached. */
4415
- SSL_SESSION *new_session;
4416
-
4417
- /* established_session is the session established by the connection. This
4418
- * session is only filled upon the completion of the handshake and is
4419
- * immutable. */
4420
- SSL_SESSION *established_session;
4421
-
4422
- /* session_reused indicates whether a session was resumed. */
4423
- unsigned session_reused:1;
4424
-
4425
- /* Connection binding to prevent renegotiation attacks */
4426
- uint8_t previous_client_finished[EVP_MAX_MD_SIZE];
4427
- uint8_t previous_client_finished_len;
4428
- uint8_t previous_server_finished[EVP_MAX_MD_SIZE];
4429
- uint8_t previous_server_finished_len;
4430
- int send_connection_binding;
4431
-
4432
- /* Set if we saw the Next Protocol Negotiation extension from our peer. */
4433
- int next_proto_neg_seen;
4434
-
4435
- /* Next protocol negotiation. For the client, this is the protocol that we
4436
- * sent in NextProtocol and is set when handling ServerHello extensions.
4437
- *
4438
- * For a server, this is the client's selected_protocol from NextProtocol and
4439
- * is set when handling the NextProtocol message, before the Finished
4440
- * message. */
4441
- uint8_t *next_proto_negotiated;
4442
- size_t next_proto_negotiated_len;
4443
-
4444
- /* ALPN information
4445
- * (we are in the process of transitioning from NPN to ALPN.) */
4446
-
4447
- /* In a server these point to the selected ALPN protocol after the
4448
- * ClientHello has been processed. In a client these contain the protocol
4449
- * that the server selected once the ServerHello has been processed. */
4450
- uint8_t *alpn_selected;
4451
- size_t alpn_selected_len;
4452
-
4453
- /* In a client, this means that the server supported Channel ID and that a
4454
- * Channel ID was sent. In a server it means that we echoed support for
4455
- * Channel IDs and that tlsext_channel_id will be valid after the
4456
- * handshake. */
4457
- char tlsext_channel_id_valid;
4458
- /* For a server:
4459
- * If |tlsext_channel_id_valid| is true, then this contains the
4460
- * verified Channel ID from the client: a P256 point, (x,y), where
4461
- * each are big-endian values. */
4462
- uint8_t tlsext_channel_id[64];
4463
- } SSL3_STATE;
4464
-
4465
4126
 
4466
4127
  /* Nodejs compatibility section (hidden).
4467
4128
  *
@@ -4512,8 +4173,8 @@ typedef struct ssl3_state_st {
4512
4173
  #define SSL_CTRL_NEED_TMP_RSA doesnt_exist
4513
4174
  #define SSL_CTRL_OPTIONS doesnt_exist
4514
4175
  #define SSL_CTRL_SESS_NUMBER doesnt_exist
4515
- #define SSL_CTRL_SET_CHANNEL_ID doesnt_exist
4516
4176
  #define SSL_CTRL_SET_CURVES doesnt_exist
4177
+ #define SSL_CTRL_SET_CURVES_LIST doesnt_exist
4517
4178
  #define SSL_CTRL_SET_MAX_CERT_LIST doesnt_exist
4518
4179
  #define SSL_CTRL_SET_MAX_SEND_FRAGMENT doesnt_exist
4519
4180
  #define SSL_CTRL_SET_MSG_CALLBACK doesnt_exist
@@ -4543,7 +4204,6 @@ typedef struct ssl3_state_st {
4543
4204
  #define SSL_CTX_clear_chain_certs SSL_CTX_clear_chain_certs
4544
4205
  #define SSL_CTX_clear_mode SSL_CTX_clear_mode
4545
4206
  #define SSL_CTX_clear_options SSL_CTX_clear_options
4546
- #define SSL_CTX_enable_tls_channel_id SSL_CTX_enable_tls_channel_id
4547
4207
  #define SSL_CTX_get0_chain_certs SSL_CTX_get0_chain_certs
4548
4208
  #define SSL_CTX_get_extra_chain_certs SSL_CTX_get_extra_chain_certs
4549
4209
  #define SSL_CTX_get_max_cert_list SSL_CTX_get_max_cert_list
@@ -4559,7 +4219,6 @@ typedef struct ssl3_state_st {
4559
4219
  #define SSL_CTX_set0_chain SSL_CTX_set0_chain
4560
4220
  #define SSL_CTX_set1_chain SSL_CTX_set1_chain
4561
4221
  #define SSL_CTX_set1_curves SSL_CTX_set1_curves
4562
- #define SSL_CTX_set1_tls_channel_id SSL_CTX_set1_tls_channel_id
4563
4222
  #define SSL_CTX_set_max_cert_list SSL_CTX_set_max_cert_list
4564
4223
  #define SSL_CTX_set_max_send_fragment SSL_CTX_set_max_send_fragment
4565
4224
  #define SSL_CTX_set_mode SSL_CTX_set_mode
@@ -4580,7 +4239,6 @@ typedef struct ssl3_state_st {
4580
4239
  #define SSL_clear_chain_certs SSL_clear_chain_certs
4581
4240
  #define SSL_clear_mode SSL_clear_mode
4582
4241
  #define SSL_clear_options SSL_clear_options
4583
- #define SSL_enable_tls_channel_id SSL_enable_tls_channel_id
4584
4242
  #define SSL_get0_certificate_types SSL_get0_certificate_types
4585
4243
  #define SSL_get0_chain_certs SSL_get0_chain_certs
4586
4244
  #define SSL_get_max_cert_list SSL_get_max_cert_list
@@ -4588,14 +4246,12 @@ typedef struct ssl3_state_st {
4588
4246
  #define SSL_get_options SSL_get_options
4589
4247
  #define SSL_get_secure_renegotiation_support \
4590
4248
  SSL_get_secure_renegotiation_support
4591
- #define SSL_get_tls_channel_id SSL_get_tls_channel_id
4592
4249
  #define SSL_need_tmp_RSA SSL_need_tmp_RSA
4593
4250
  #define SSL_num_renegotiations SSL_num_renegotiations
4594
4251
  #define SSL_session_reused SSL_session_reused
4595
4252
  #define SSL_set0_chain SSL_set0_chain
4596
4253
  #define SSL_set1_chain SSL_set1_chain
4597
4254
  #define SSL_set1_curves SSL_set1_curves
4598
- #define SSL_set1_tls_channel_id SSL_set1_tls_channel_id
4599
4255
  #define SSL_set_max_cert_list SSL_set_max_cert_list
4600
4256
  #define SSL_set_max_send_fragment SSL_set_max_send_fragment
4601
4257
  #define SSL_set_mode SSL_set_mode
@@ -4792,6 +4448,13 @@ BORINGSSL_MAKE_DELETER(SSL_SESSION, SSL_SESSION_free)
4792
4448
  #define SSL_R_RENEGOTIATION_EMS_MISMATCH 263
4793
4449
  #define SSL_R_DUPLICATE_KEY_SHARE 264
4794
4450
  #define SSL_R_NO_GROUPS_SPECIFIED 265
4451
+ #define SSL_R_NO_SHARED_GROUP 266
4452
+ #define SSL_R_PRE_SHARED_KEY_MUST_BE_LAST 267
4453
+ #define SSL_R_OLD_SESSION_PRF_HASH_MISMATCH 268
4454
+ #define SSL_R_INVALID_SCT_LIST 269
4455
+ #define SSL_R_TOO_MUCH_SKIPPED_EARLY_DATA 270
4456
+ #define SSL_R_PSK_IDENTITY_BINDER_COUNT_MISMATCH 271
4457
+ #define SSL_R_CANNOT_PARSE_LEAF_CERT 272
4795
4458
  #define SSL_R_SSLV3_ALERT_CLOSE_NOTIFY 1000
4796
4459
  #define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010
4797
4460
  #define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020
@@ -4822,5 +4485,7 @@ BORINGSSL_MAKE_DELETER(SSL_SESSION, SSL_SESSION_free)
4822
4485
  #define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112
4823
4486
  #define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113
4824
4487
  #define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114
4488
+ #define SSL_R_TLSV1_UNKNOWN_PSK_IDENTITY 1115
4489
+ #define SSL_R_TLSV1_CERTIFICATE_REQUIRED 1116
4825
4490
 
4826
4491
  #endif /* OPENSSL_HEADER_SSL_H */