grpc 1.0.1 → 1.1.2

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 (705) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +3696 -867
  3. data/etc/roots.pem +39 -111
  4. data/include/grpc/byte_buffer.h +64 -1
  5. data/include/grpc/census.h +40 -96
  6. data/include/grpc/compression.h +2 -1
  7. data/include/grpc/grpc.h +42 -7
  8. data/include/grpc/grpc_posix.h +8 -5
  9. data/include/grpc/impl/codegen/atm.h +3 -0
  10. data/include/grpc/impl/codegen/atm_gcc_atomic.h +2 -0
  11. data/include/grpc/impl/codegen/atm_gcc_sync.h +8 -0
  12. data/include/grpc/impl/codegen/atm_windows.h +4 -0
  13. data/include/grpc/impl/codegen/byte_buffer_reader.h +4 -4
  14. data/include/grpc/impl/codegen/compression_types.h +1 -1
  15. data/include/grpc/impl/codegen/connectivity_state.h +2 -0
  16. data/include/grpc/impl/codegen/exec_ctx_fwd.h +41 -0
  17. data/include/grpc/impl/codegen/gpr_slice.h +84 -0
  18. data/include/grpc/impl/codegen/{alloc.h → gpr_types.h} +30 -29
  19. data/include/grpc/impl/codegen/grpc_types.h +91 -9
  20. data/include/grpc/impl/codegen/port_platform.h +25 -92
  21. data/include/grpc/impl/codegen/slice.h +54 -97
  22. data/include/grpc/impl/codegen/sync.h +0 -253
  23. data/include/grpc/module.modulemap +0 -2
  24. data/include/grpc/slice.h +132 -0
  25. data/include/grpc/{impl/codegen/slice_buffer.h → slice_buffer.h} +22 -39
  26. data/include/grpc/support/alloc.h +40 -1
  27. data/include/grpc/support/log.h +80 -1
  28. data/include/grpc/support/log_windows.h +2 -0
  29. data/include/grpc/support/string_util.h +1 -1
  30. data/include/grpc/support/sync.h +252 -0
  31. data/include/grpc/support/time.h +67 -1
  32. data/src/boringssl/err_data.c +639 -627
  33. data/src/core/ext/census/base_resources.c +71 -0
  34. data/src/core/ext/census/base_resources.h +39 -0
  35. data/src/core/ext/census/gen/census.pb.c +26 -29
  36. data/src/core/ext/census/gen/census.pb.h +68 -67
  37. data/src/core/ext/census/gen/trace_context.pb.c +81 -0
  38. data/src/core/ext/census/gen/trace_context.pb.h +99 -0
  39. data/src/core/ext/census/grpc_filter.c +22 -16
  40. data/src/core/ext/census/grpc_plugin.c +2 -1
  41. data/src/core/ext/census/initialize.c +16 -4
  42. data/src/core/ext/census/mlog.h +1 -1
  43. data/src/core/ext/census/placeholders.c +0 -45
  44. data/src/core/ext/census/resource.c +312 -0
  45. data/src/core/ext/census/resource.h +63 -0
  46. data/src/core/ext/census/trace_context.c +86 -0
  47. data/src/core/ext/census/trace_context.h +68 -0
  48. data/src/core/ext/census/tracing.c +8 -2
  49. data/src/core/ext/{client_config → client_channel}/channel_connectivity.c +8 -4
  50. data/src/core/ext/client_channel/client_channel.c +1218 -0
  51. data/src/core/ext/{client_config → client_channel}/client_channel.h +8 -11
  52. data/src/core/ext/{client_config → client_channel}/client_channel_factory.c +33 -3
  53. data/src/core/ext/{client_config → client_channel}/client_channel_factory.h +15 -8
  54. data/src/core/ext/{client_config/client_config_plugin.c → client_channel/client_channel_plugin.c} +16 -15
  55. data/src/core/ext/{client_config → client_channel}/connector.c +1 -1
  56. data/src/core/ext/{client_config → client_channel}/connector.h +5 -8
  57. data/{include/grpc/support/slice_buffer.h → src/core/ext/client_channel/default_initial_connect_string.c} +4 -5
  58. data/src/core/ext/client_channel/http_connect_handshaker.c +399 -0
  59. data/src/core/ext/client_channel/http_connect_handshaker.h +52 -0
  60. data/src/core/ext/{client_config → client_channel}/initial_connect_string.c +6 -7
  61. data/src/core/ext/{client_config → client_channel}/initial_connect_string.h +10 -10
  62. data/src/core/ext/{client_config → client_channel}/lb_policy.c +11 -11
  63. data/src/core/ext/{client_config → client_channel}/lb_policy.h +68 -27
  64. data/src/core/ext/client_channel/lb_policy_factory.c +163 -0
  65. data/src/core/ext/{client_config → client_channel}/lb_policy_factory.h +64 -9
  66. data/src/core/ext/{client_config → client_channel}/lb_policy_registry.c +6 -4
  67. data/src/core/ext/{client_config → client_channel}/lb_policy_registry.h +4 -4
  68. data/src/core/ext/{client_config → client_channel}/parse_address.c +21 -14
  69. data/src/core/ext/{client_config → client_channel}/parse_address.h +8 -10
  70. data/src/core/ext/{client_config → client_channel}/resolver.c +3 -4
  71. data/src/core/ext/{client_config → client_channel}/resolver.h +11 -15
  72. data/src/core/ext/{client_config → client_channel}/resolver_factory.c +4 -3
  73. data/src/core/ext/{client_config → client_channel}/resolver_factory.h +13 -11
  74. data/src/core/ext/{client_config → client_channel}/resolver_registry.c +54 -34
  75. data/src/core/ext/{client_config → client_channel}/resolver_registry.h +21 -8
  76. data/src/core/ext/{client_config → client_channel}/subchannel.c +208 -119
  77. data/src/core/ext/{client_config → client_channel}/subchannel.h +21 -11
  78. data/src/core/ext/{client_config → client_channel}/subchannel_index.c +6 -17
  79. data/src/core/ext/{client_config → client_channel}/subchannel_index.h +7 -7
  80. data/src/core/ext/{client_config → client_channel}/uri_parser.c +21 -28
  81. data/src/core/ext/{client_config → client_channel}/uri_parser.h +3 -3
  82. data/src/core/ext/lb_policy/grpclb/grpclb.c +1406 -0
  83. data/src/core/ext/lb_policy/grpclb/grpclb.h +44 -0
  84. data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +117 -37
  85. data/src/core/ext/lb_policy/grpclb/load_balancer_api.h +31 -12
  86. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +6 -36
  87. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +22 -42
  88. data/src/core/ext/lb_policy/pick_first/pick_first.c +64 -46
  89. data/src/core/ext/lb_policy/round_robin/round_robin.c +324 -160
  90. data/src/core/ext/load_reporting/load_reporting.c +7 -56
  91. data/src/core/ext/load_reporting/load_reporting.h +41 -28
  92. data/src/core/ext/load_reporting/load_reporting_filter.c +132 -42
  93. data/src/core/ext/load_reporting/load_reporting_filter.h +1 -0
  94. data/src/core/ext/resolver/dns/native/dns_resolver.c +88 -80
  95. data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +57 -102
  96. data/src/core/ext/transport/chttp2/alpn/alpn.c +1 -1
  97. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +253 -0
  98. data/src/core/{lib/iomgr/ev_poll_and_epoll_posix.h → ext/transport/chttp2/client/chttp2_connector.h} +5 -5
  99. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +31 -160
  100. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +5 -5
  101. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +44 -243
  102. data/src/core/ext/transport/chttp2/server/chttp2_server.c +342 -0
  103. data/src/core/ext/transport/chttp2/server/chttp2_server.h +47 -0
  104. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +11 -124
  105. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +20 -9
  106. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +28 -236
  107. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +31 -27
  108. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +5 -4
  109. data/src/core/ext/transport/chttp2/transport/bin_encoder.c +25 -22
  110. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +8 -7
  111. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +0 -3
  112. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +1345 -1521
  113. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -1
  114. data/src/core/ext/transport/chttp2/transport/frame.h +3 -5
  115. data/src/core/ext/transport/chttp2/transport/frame_data.c +50 -47
  116. data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -9
  117. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +19 -21
  118. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +9 -8
  119. data/src/core/ext/transport/chttp2/transport/frame_ping.c +13 -12
  120. data/src/core/ext/transport/chttp2/transport/frame_ping.h +6 -6
  121. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +31 -19
  122. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +8 -7
  123. data/src/core/ext/transport/chttp2/transport/frame_settings.c +22 -25
  124. data/src/core/ext/transport/chttp2/transport/frame_settings.h +9 -8
  125. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +26 -18
  126. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +5 -6
  127. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +68 -58
  128. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +8 -5
  129. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +327 -214
  130. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +14 -9
  131. data/src/core/ext/transport/chttp2/transport/hpack_table.c +24 -19
  132. data/src/core/ext/transport/chttp2/transport/hpack_table.h +9 -6
  133. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +2 -2
  134. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +1 -1
  135. data/src/core/ext/transport/chttp2/transport/internal.h +284 -436
  136. data/src/core/ext/transport/chttp2/transport/parsing.c +355 -590
  137. data/src/core/ext/transport/chttp2/transport/stream_lists.c +36 -309
  138. data/src/core/ext/transport/chttp2/transport/stream_map.c +13 -34
  139. data/src/core/ext/transport/chttp2/transport/stream_map.h +3 -4
  140. data/src/core/ext/transport/chttp2/transport/writing.c +174 -286
  141. data/src/core/lib/channel/channel_args.c +70 -13
  142. data/src/core/lib/channel/channel_args.h +28 -2
  143. data/src/core/lib/channel/channel_stack.c +77 -28
  144. data/src/core/lib/channel/channel_stack.h +61 -23
  145. data/src/core/lib/channel/channel_stack_builder.c +33 -25
  146. data/src/core/lib/channel/channel_stack_builder.h +17 -8
  147. data/src/core/lib/channel/compress_filter.c +52 -36
  148. data/src/core/lib/channel/connected_channel.c +20 -12
  149. data/src/core/lib/channel/connected_channel.h +2 -1
  150. data/src/core/lib/channel/context.h +13 -1
  151. data/src/core/lib/channel/deadline_filter.c +344 -0
  152. data/src/core/lib/channel/deadline_filter.h +99 -0
  153. data/src/core/lib/channel/handshaker.c +240 -0
  154. data/src/core/lib/channel/handshaker.h +164 -0
  155. data/src/core/lib/{security/credentials/google_default/credentials_windows.c → channel/handshaker_factory.c} +16 -23
  156. data/src/core/lib/channel/handshaker_factory.h +66 -0
  157. data/src/core/lib/channel/handshaker_registry.c +113 -0
  158. data/src/core/{ext/client_config/client_config.h → lib/channel/handshaker_registry.h} +26 -16
  159. data/src/core/lib/channel/http_client_filter.c +248 -46
  160. data/src/core/lib/channel/http_client_filter.h +3 -0
  161. data/src/core/lib/channel/http_server_filter.c +136 -24
  162. data/src/core/lib/channel/message_size_filter.c +261 -0
  163. data/src/core/lib/channel/message_size_filter.h +39 -0
  164. data/src/core/lib/compression/message_compress.c +43 -37
  165. data/src/core/lib/compression/message_compress.h +7 -5
  166. data/src/core/lib/http/format_request.c +26 -11
  167. data/src/core/lib/http/format_request.h +7 -5
  168. data/src/core/lib/http/httpcli.c +45 -27
  169. data/src/core/lib/http/httpcli.h +4 -4
  170. data/src/core/lib/http/httpcli_security_connector.c +56 -46
  171. data/src/core/lib/http/parser.c +17 -14
  172. data/src/core/lib/http/parser.h +4 -2
  173. data/src/core/lib/iomgr/closure.c +49 -7
  174. data/src/core/lib/iomgr/closure.h +56 -14
  175. data/src/core/lib/iomgr/combiner.c +422 -0
  176. data/src/core/lib/iomgr/combiner.h +64 -0
  177. data/src/core/lib/iomgr/endpoint.c +8 -2
  178. data/src/core/lib/iomgr/endpoint.h +17 -7
  179. data/src/core/lib/iomgr/endpoint_pair.h +3 -2
  180. data/src/core/lib/iomgr/endpoint_pair_posix.c +9 -8
  181. data/src/core/{ext/client_config/lb_policy_factory.c → lib/iomgr/endpoint_pair_uv.c} +18 -13
  182. data/src/core/lib/iomgr/endpoint_pair_windows.c +7 -6
  183. data/src/core/lib/iomgr/error.c +72 -6
  184. data/src/core/lib/iomgr/error.h +30 -3
  185. data/src/core/lib/iomgr/ev_epoll_linux.c +500 -382
  186. data/src/core/lib/iomgr/ev_epoll_linux.h +3 -2
  187. data/src/core/lib/iomgr/ev_poll_posix.c +317 -30
  188. data/src/core/lib/iomgr/ev_poll_posix.h +1 -0
  189. data/src/core/lib/iomgr/ev_posix.c +26 -5
  190. data/src/core/lib/iomgr/ev_posix.h +12 -1
  191. data/src/core/lib/iomgr/exec_ctx.c +27 -94
  192. data/src/core/lib/iomgr/exec_ctx.h +19 -22
  193. data/src/core/lib/iomgr/executor.c +29 -8
  194. data/src/core/lib/iomgr/executor.h +2 -4
  195. data/src/core/lib/iomgr/iocp_windows.c +3 -4
  196. data/src/core/lib/iomgr/iomgr.c +14 -10
  197. data/src/core/lib/iomgr/iomgr.h +6 -2
  198. data/src/core/lib/iomgr/iomgr_posix.c +2 -2
  199. data/src/core/lib/iomgr/iomgr_uv.c +49 -0
  200. data/src/core/lib/iomgr/iomgr_windows.c +2 -2
  201. data/src/core/lib/iomgr/load_file.c +3 -3
  202. data/src/core/lib/iomgr/load_file.h +2 -2
  203. data/src/core/lib/iomgr/network_status_tracker.c +1 -1
  204. data/src/core/lib/iomgr/pollset_set_uv.c +62 -0
  205. data/src/core/lib/iomgr/pollset_set_windows.c +3 -3
  206. data/src/core/lib/iomgr/pollset_uv.c +142 -0
  207. data/src/core/lib/iomgr/pollset_uv.h +42 -0
  208. data/src/core/lib/iomgr/pollset_windows.c +5 -6
  209. data/src/core/lib/iomgr/port.h +129 -0
  210. data/src/core/lib/iomgr/resolve_address.h +2 -1
  211. data/src/core/lib/iomgr/resolve_address_posix.c +14 -13
  212. data/src/core/lib/iomgr/resolve_address_uv.c +233 -0
  213. data/src/core/lib/iomgr/resolve_address_windows.c +14 -12
  214. data/src/core/lib/iomgr/resource_quota.c +832 -0
  215. data/src/core/lib/iomgr/resource_quota.h +159 -0
  216. data/src/core/lib/iomgr/sockaddr.h +10 -2
  217. data/src/core/lib/iomgr/sockaddr_utils.c +63 -36
  218. data/src/core/lib/iomgr/sockaddr_utils.h +14 -14
  219. data/src/core/lib/iomgr/socket_mutator.c +98 -0
  220. data/src/core/lib/iomgr/socket_mutator.h +80 -0
  221. data/src/core/lib/iomgr/socket_utils.h +42 -0
  222. data/src/core/lib/iomgr/socket_utils_common_posix.c +28 -13
  223. data/src/core/lib/iomgr/socket_utils_linux.c +11 -5
  224. data/src/core/lib/iomgr/socket_utils_posix.c +10 -7
  225. data/src/core/lib/iomgr/socket_utils_posix.h +11 -4
  226. data/src/core/lib/iomgr/socket_utils_uv.c +49 -0
  227. data/src/core/lib/iomgr/socket_utils_windows.c +52 -0
  228. data/src/core/lib/iomgr/socket_windows.c +14 -6
  229. data/src/core/lib/iomgr/socket_windows.h +1 -0
  230. data/src/core/lib/iomgr/tcp_client.h +8 -2
  231. data/src/core/lib/iomgr/tcp_client_posix.c +131 -82
  232. data/src/core/lib/iomgr/tcp_client_posix.h +45 -0
  233. data/src/core/lib/iomgr/tcp_client_uv.c +190 -0
  234. data/src/core/lib/iomgr/tcp_client_windows.c +54 -30
  235. data/src/core/lib/iomgr/tcp_posix.c +135 -56
  236. data/src/core/lib/iomgr/tcp_posix.h +2 -2
  237. data/src/core/lib/iomgr/tcp_server.h +14 -6
  238. data/src/core/lib/iomgr/tcp_server_posix.c +154 -118
  239. data/src/core/lib/iomgr/tcp_server_uv.c +388 -0
  240. data/src/core/lib/iomgr/tcp_server_windows.c +127 -100
  241. data/src/core/lib/iomgr/tcp_uv.c +367 -0
  242. data/src/core/lib/iomgr/tcp_uv.h +59 -0
  243. data/src/core/lib/iomgr/tcp_windows.c +65 -48
  244. data/src/core/lib/iomgr/tcp_windows.h +3 -1
  245. data/src/core/lib/iomgr/timer.h +21 -21
  246. data/src/core/lib/iomgr/{timer.c → timer_generic.c} +15 -10
  247. data/src/core/lib/iomgr/timer_generic.h +49 -0
  248. data/src/core/lib/iomgr/timer_heap.c +6 -0
  249. data/src/core/lib/iomgr/timer_uv.c +99 -0
  250. data/src/core/lib/iomgr/timer_uv.h +47 -0
  251. data/src/core/lib/iomgr/udp_server.c +116 -98
  252. data/src/core/lib/iomgr/udp_server.h +5 -3
  253. data/src/core/lib/iomgr/unix_sockets_posix.c +14 -6
  254. data/src/core/lib/iomgr/unix_sockets_posix.h +6 -5
  255. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +4 -4
  256. data/src/core/lib/iomgr/wakeup_fd_cv.c +118 -0
  257. data/src/core/lib/iomgr/wakeup_fd_cv.h +80 -0
  258. data/src/core/lib/iomgr/wakeup_fd_eventfd.c +3 -3
  259. data/src/core/lib/iomgr/wakeup_fd_nospecial.c +3 -3
  260. data/src/core/lib/iomgr/wakeup_fd_pipe.c +12 -6
  261. data/src/core/lib/iomgr/wakeup_fd_posix.c +34 -5
  262. data/src/core/lib/iomgr/wakeup_fd_posix.h +5 -0
  263. data/src/core/lib/iomgr/workqueue.h +12 -20
  264. data/src/core/{ext/client_config/client_config.c → lib/iomgr/workqueue_uv.c} +24 -33
  265. data/{include/grpc/support/slice.h → src/core/lib/iomgr/workqueue_uv.h} +4 -6
  266. data/src/core/lib/iomgr/workqueue_windows.c +9 -8
  267. data/src/core/lib/json/json.c +3 -3
  268. data/src/core/lib/json/json.h +11 -11
  269. data/src/core/lib/json/json_reader.c +9 -5
  270. data/src/core/lib/profiling/basic_timers.c +10 -1
  271. data/src/core/lib/profiling/timers.h +2 -0
  272. data/src/core/lib/security/context/security_context.c +13 -3
  273. data/src/core/lib/security/context/security_context.h +20 -0
  274. data/src/core/lib/security/credentials/composite/composite_credentials.c +28 -14
  275. data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -2
  276. data/src/core/lib/security/credentials/credentials.c +48 -19
  277. data/src/core/lib/security/credentials/credentials.h +36 -19
  278. data/src/core/lib/security/credentials/credentials_metadata.c +11 -8
  279. data/src/core/lib/security/credentials/fake/fake_credentials.c +15 -11
  280. data/src/core/lib/security/credentials/google_default/{credentials_posix.c → credentials_generic.c} +7 -14
  281. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +33 -21
  282. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +14 -0
  283. data/src/core/lib/security/credentials/iam/iam_credentials.c +3 -2
  284. data/src/core/lib/security/credentials/jwt/json_token.c +1 -0
  285. data/src/core/lib/security/credentials/jwt/json_token.h +1 -1
  286. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +54 -19
  287. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -1
  288. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +129 -79
  289. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +9 -6
  290. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +63 -28
  291. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -1
  292. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +32 -11
  293. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +13 -9
  294. data/src/core/lib/security/transport/client_auth_filter.c +33 -27
  295. data/src/core/lib/security/transport/secure_endpoint.c +93 -68
  296. data/src/core/lib/security/transport/secure_endpoint.h +2 -2
  297. data/src/core/lib/security/transport/security_connector.c +133 -168
  298. data/src/core/lib/security/transport/security_connector.h +31 -46
  299. data/src/core/lib/security/transport/security_handshaker.c +501 -0
  300. data/src/core/lib/security/transport/{handshake.h → security_handshaker.h} +10 -10
  301. data/src/core/lib/security/transport/server_auth_filter.c +50 -38
  302. data/src/core/lib/security/util/b64.c +11 -8
  303. data/src/core/lib/security/util/b64.h +5 -4
  304. data/src/core/lib/slice/percent_encoding.c +182 -0
  305. data/src/core/lib/slice/percent_encoding.h +78 -0
  306. data/src/core/lib/{support → slice}/slice.c +81 -50
  307. data/src/core/lib/{support → slice}/slice_buffer.c +78 -60
  308. data/src/core/lib/slice/slice_internal.h +49 -0
  309. data/src/core/lib/slice/slice_string_helpers.c +90 -0
  310. data/src/core/lib/{iomgr/workqueue_posix.h → slice/slice_string_helpers.h} +18 -18
  311. data/src/core/lib/support/backoff.c +24 -13
  312. data/src/core/lib/support/backoff.h +5 -2
  313. data/src/core/lib/support/env.h +0 -2
  314. data/src/core/lib/support/log.c +5 -4
  315. data/src/core/lib/support/log_linux.c +0 -1
  316. data/src/core/lib/support/log_posix.c +1 -1
  317. data/src/core/lib/support/mpscq.c +83 -0
  318. data/src/core/lib/support/mpscq.h +65 -0
  319. data/src/core/lib/support/string.c +58 -49
  320. data/src/core/lib/support/string.h +11 -8
  321. data/src/core/lib/support/subprocess_posix.c +5 -2
  322. data/src/core/lib/support/thd.c +1 -1
  323. data/src/core/lib/support/time.c +43 -79
  324. data/src/core/lib/support/time_posix.c +1 -1
  325. data/src/core/lib/support/tmpfile.h +0 -2
  326. data/src/core/lib/surface/alarm.c +4 -1
  327. data/src/core/lib/surface/byte_buffer.c +17 -11
  328. data/src/core/lib/surface/byte_buffer_reader.c +23 -15
  329. data/src/core/lib/surface/call.c +294 -276
  330. data/src/core/lib/surface/call.h +24 -9
  331. data/src/core/lib/surface/call_log_batch.c +5 -3
  332. data/src/core/lib/surface/channel.c +127 -111
  333. data/src/core/lib/surface/channel.h +14 -5
  334. data/src/core/lib/surface/channel_init.c +1 -1
  335. data/src/core/lib/surface/channel_init.h +10 -1
  336. data/src/core/lib/surface/channel_ping.c +7 -6
  337. data/src/core/lib/surface/completion_queue.c +154 -18
  338. data/src/core/lib/surface/completion_queue.h +5 -0
  339. data/src/core/lib/surface/init.c +40 -6
  340. data/src/core/lib/surface/init.h +1 -0
  341. data/src/core/lib/surface/init_secure.c +5 -2
  342. data/src/core/lib/surface/lame_client.c +28 -18
  343. data/src/core/lib/surface/server.c +134 -87
  344. data/src/core/lib/surface/server.h +8 -0
  345. data/src/core/lib/surface/validate_metadata.c +1 -1
  346. data/src/core/lib/surface/version.c +3 -1
  347. data/src/core/lib/transport/byte_stream.c +7 -4
  348. data/src/core/lib/transport/byte_stream.h +6 -10
  349. data/src/core/lib/transport/connectivity_state.c +21 -12
  350. data/src/core/lib/transport/connectivity_state.h +4 -1
  351. data/src/core/lib/transport/mdstr_hash_table.c +118 -0
  352. data/src/core/lib/transport/mdstr_hash_table.h +77 -0
  353. data/src/core/lib/transport/metadata.c +83 -60
  354. data/src/core/lib/transport/metadata.h +41 -23
  355. data/src/core/lib/transport/metadata_batch.c +17 -11
  356. data/src/core/lib/transport/metadata_batch.h +20 -6
  357. data/src/core/lib/transport/pid_controller.c +57 -0
  358. data/src/core/lib/transport/pid_controller.h +64 -0
  359. data/src/core/lib/transport/service_config.c +251 -0
  360. data/src/core/lib/transport/service_config.h +71 -0
  361. data/src/core/lib/transport/static_metadata.c +18 -16
  362. data/src/core/lib/transport/static_metadata.h +113 -107
  363. data/src/core/{ext/transport/chttp2 → lib}/transport/timeout_encoding.c +3 -3
  364. data/src/core/{ext/transport/chttp2 → lib}/transport/timeout_encoding.h +7 -7
  365. data/src/core/lib/transport/transport.c +84 -23
  366. data/src/core/lib/transport/transport.h +53 -8
  367. data/src/core/lib/transport/transport_impl.h +3 -0
  368. data/src/core/lib/transport/transport_op_string.c +92 -20
  369. data/src/core/lib/tsi/ssl_transport_security.c +3 -1
  370. data/src/core/plugin_registry/grpc_plugin_registry.c +8 -4
  371. data/src/ruby/ext/grpc/extconf.rb +0 -1
  372. data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -7
  373. data/src/ruby/ext/grpc/rb_call.c +15 -5
  374. data/src/ruby/ext/grpc/rb_channel.c +1 -1
  375. data/src/ruby/ext/grpc/rb_compression_options.c +466 -0
  376. data/src/{core/ext/client_config/default_initial_connect_string.c → ruby/ext/grpc/rb_compression_options.h} +10 -5
  377. data/src/ruby/ext/grpc/rb_grpc.c +3 -1
  378. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +198 -190
  379. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +306 -294
  380. data/src/ruby/ext/grpc/rb_server.c +18 -12
  381. data/src/ruby/lib/grpc/errors.rb +154 -2
  382. data/src/ruby/lib/grpc/generic/active_call.rb +144 -63
  383. data/src/ruby/lib/grpc/generic/bidi_call.rb +18 -2
  384. data/src/ruby/lib/grpc/generic/client_stub.rb +7 -5
  385. data/src/ruby/lib/grpc/generic/rpc_desc.rb +39 -13
  386. data/src/ruby/lib/grpc/generic/rpc_server.rb +51 -24
  387. data/src/ruby/lib/grpc/generic/service.rb +3 -2
  388. data/src/ruby/lib/grpc/version.rb +1 -1
  389. data/src/ruby/pb/grpc/health/checker.rb +3 -1
  390. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +7 -0
  391. data/src/ruby/pb/test/client.rb +307 -7
  392. data/src/ruby/pb/test/server.rb +26 -1
  393. data/src/ruby/spec/compression_options_spec.rb +164 -0
  394. data/src/ruby/spec/error_sanity_spec.rb +64 -0
  395. data/src/ruby/spec/generic/active_call_spec.rb +290 -12
  396. data/src/ruby/spec/generic/client_stub_spec.rb +91 -41
  397. data/src/ruby/spec/generic/rpc_desc_spec.rb +36 -16
  398. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +22 -28
  399. data/src/ruby/spec/generic/rpc_server_spec.rb +6 -6
  400. data/src/ruby/spec/pb/health/checker_spec.rb +27 -19
  401. data/src/ruby/spec/spec_helper.rb +2 -0
  402. data/third_party/boringssl/crypto/aes/aes.c +12 -12
  403. data/third_party/boringssl/crypto/aes/mode_wrappers.c +6 -2
  404. data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +28 -13
  405. data/third_party/boringssl/crypto/asn1/a_gentm.c +2 -0
  406. data/third_party/boringssl/crypto/asn1/a_object.c +7 -3
  407. data/third_party/boringssl/crypto/asn1/a_strnid.c +1 -0
  408. data/third_party/boringssl/crypto/asn1/a_time.c +0 -11
  409. data/third_party/boringssl/crypto/asn1/a_type.c +0 -2
  410. data/third_party/boringssl/crypto/asn1/a_utctm.c +1 -30
  411. data/third_party/boringssl/crypto/asn1/asn1_lib.c +56 -76
  412. data/third_party/boringssl/crypto/asn1/asn1_locl.h +0 -10
  413. data/third_party/boringssl/crypto/asn1/asn1_par.c +0 -322
  414. data/third_party/boringssl/crypto/asn1/f_enum.c +1 -108
  415. data/third_party/boringssl/crypto/asn1/f_int.c +1 -106
  416. data/third_party/boringssl/crypto/asn1/f_string.c +1 -106
  417. data/third_party/boringssl/crypto/asn1/tasn_dec.c +10 -14
  418. data/third_party/boringssl/crypto/asn1/tasn_enc.c +17 -11
  419. data/third_party/boringssl/crypto/asn1/tasn_typ.c +29 -42
  420. data/third_party/boringssl/crypto/asn1/tasn_utl.c +1 -1
  421. data/third_party/boringssl/crypto/base64/base64.c +249 -285
  422. data/third_party/boringssl/crypto/bio/bio.c +13 -23
  423. data/third_party/boringssl/crypto/bio/bio_mem.c +3 -2
  424. data/third_party/boringssl/crypto/bio/connect.c +12 -3
  425. data/third_party/boringssl/crypto/bio/fd.c +22 -15
  426. data/third_party/boringssl/crypto/bio/file.c +2 -38
  427. data/third_party/boringssl/crypto/bio/hexdump.c +1 -2
  428. data/third_party/boringssl/crypto/bio/internal.h +3 -0
  429. data/third_party/boringssl/crypto/bio/pair.c +1 -1
  430. data/third_party/boringssl/crypto/bio/socket.c +10 -2
  431. data/third_party/boringssl/crypto/bio/socket_helper.c +2 -2
  432. data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +0 -8
  433. data/third_party/boringssl/crypto/bn/bn.c +38 -0
  434. data/third_party/boringssl/crypto/bn/cmp.c +25 -0
  435. data/third_party/boringssl/crypto/bn/convert.c +73 -76
  436. data/third_party/boringssl/crypto/bn/div.c +136 -70
  437. data/third_party/boringssl/crypto/bn/exponentiation.c +86 -381
  438. data/third_party/boringssl/crypto/bn/gcd.c +213 -296
  439. data/third_party/boringssl/crypto/bn/generic.c +0 -80
  440. data/third_party/boringssl/crypto/bn/internal.h +15 -3
  441. data/third_party/boringssl/crypto/bn/montgomery.c +57 -207
  442. data/third_party/boringssl/crypto/bn/montgomery_inv.c +160 -0
  443. data/third_party/boringssl/crypto/bn/mul.c +2 -1
  444. data/third_party/boringssl/crypto/bn/prime.c +24 -8
  445. data/third_party/boringssl/crypto/bn/random.c +47 -33
  446. data/third_party/boringssl/crypto/bn/sqrt.c +4 -5
  447. data/third_party/boringssl/crypto/buf/buf.c +25 -21
  448. data/third_party/boringssl/crypto/bytestring/ber.c +1 -0
  449. data/third_party/boringssl/crypto/bytestring/cbb.c +50 -22
  450. data/third_party/boringssl/crypto/bytestring/cbs.c +28 -4
  451. data/third_party/boringssl/crypto/chacha/{chacha_generic.c → chacha.c} +56 -29
  452. data/third_party/boringssl/crypto/cipher/aead.c +11 -22
  453. data/third_party/boringssl/crypto/cipher/cipher.c +2 -2
  454. data/third_party/boringssl/crypto/cipher/e_aes.c +53 -103
  455. data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +2 -8
  456. data/third_party/boringssl/crypto/cipher/e_des.c +3 -5
  457. data/third_party/boringssl/crypto/cipher/e_null.c +1 -1
  458. data/third_party/boringssl/crypto/cipher/e_rc2.c +1 -1
  459. data/third_party/boringssl/crypto/cipher/e_rc4.c +1 -1
  460. data/third_party/boringssl/crypto/cipher/e_ssl3.c +3 -63
  461. data/third_party/boringssl/crypto/cipher/e_tls.c +12 -83
  462. data/third_party/boringssl/crypto/cipher/internal.h +8 -10
  463. data/third_party/boringssl/crypto/cipher/tls_cbc.c +69 -40
  464. data/third_party/boringssl/crypto/conf/conf.c +2 -1
  465. data/third_party/boringssl/crypto/cpu-aarch64-linux.c +61 -0
  466. data/third_party/boringssl/crypto/cpu-arm-linux.c +360 -0
  467. data/third_party/boringssl/crypto/cpu-arm.c +0 -161
  468. data/third_party/boringssl/crypto/cpu-intel.c +5 -3
  469. data/third_party/boringssl/{ssl/test/scoped_types.h → crypto/cpu-ppc64le.c} +21 -9
  470. data/third_party/boringssl/crypto/crypto.c +29 -7
  471. data/third_party/boringssl/crypto/curve25519/curve25519.c +284 -242
  472. data/third_party/boringssl/crypto/curve25519/internal.h +64 -0
  473. data/third_party/boringssl/crypto/curve25519/spake25519.c +464 -0
  474. data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +21 -0
  475. data/third_party/boringssl/crypto/dh/check.c +22 -6
  476. data/third_party/boringssl/crypto/dh/dh.c +45 -21
  477. data/third_party/boringssl/crypto/dh/dh_asn1.c +96 -20
  478. data/third_party/boringssl/crypto/dh/params.c +30 -78
  479. data/third_party/boringssl/crypto/digest/digest.c +3 -3
  480. data/third_party/boringssl/crypto/dsa/dsa.c +59 -29
  481. data/third_party/boringssl/crypto/dsa/dsa_asn1.c +4 -0
  482. data/third_party/boringssl/crypto/ec/ec.c +84 -140
  483. data/third_party/boringssl/crypto/ec/ec_asn1.c +82 -52
  484. data/third_party/boringssl/crypto/ec/ec_key.c +15 -15
  485. data/third_party/boringssl/crypto/ec/ec_montgomery.c +87 -50
  486. data/third_party/boringssl/crypto/ec/internal.h +12 -36
  487. data/third_party/boringssl/crypto/ec/oct.c +11 -11
  488. data/third_party/boringssl/crypto/ec/p224-64.c +59 -116
  489. data/third_party/boringssl/crypto/ec/p256-64.c +88 -163
  490. data/third_party/boringssl/crypto/ec/p256-x86_64.c +46 -58
  491. data/third_party/boringssl/crypto/ec/simple.c +81 -201
  492. data/third_party/boringssl/crypto/ec/util-64.c +0 -74
  493. data/third_party/boringssl/crypto/ecdh/ecdh.c +7 -1
  494. data/third_party/boringssl/crypto/ecdsa/ecdsa.c +28 -46
  495. data/third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c +1 -0
  496. data/third_party/boringssl/crypto/engine/engine.c +1 -1
  497. data/third_party/boringssl/crypto/err/err.c +3 -3
  498. data/third_party/boringssl/crypto/evp/evp.c +14 -59
  499. data/third_party/boringssl/crypto/evp/evp_asn1.c +144 -87
  500. data/third_party/boringssl/crypto/evp/evp_ctx.c +7 -7
  501. data/third_party/boringssl/crypto/evp/internal.h +4 -46
  502. data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +8 -157
  503. data/third_party/boringssl/crypto/evp/p_ec.c +1 -1
  504. data/third_party/boringssl/crypto/evp/p_ec_asn1.c +22 -170
  505. data/third_party/boringssl/crypto/evp/p_rsa.c +1 -1
  506. data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +10 -548
  507. data/third_party/boringssl/crypto/evp/print.c +520 -0
  508. data/third_party/boringssl/crypto/ex_data.c +4 -6
  509. data/third_party/boringssl/crypto/hkdf/hkdf.c +38 -17
  510. data/third_party/boringssl/crypto/hmac/hmac.c +6 -6
  511. data/third_party/boringssl/crypto/internal.h +57 -77
  512. data/third_party/boringssl/crypto/lhash/lhash.c +6 -10
  513. data/third_party/boringssl/crypto/md4/md4.c +9 -0
  514. data/third_party/boringssl/crypto/mem.c +19 -19
  515. data/third_party/boringssl/crypto/modes/cfb.c +5 -6
  516. data/third_party/boringssl/crypto/modes/ctr.c +10 -18
  517. data/third_party/boringssl/crypto/modes/gcm.c +100 -66
  518. data/third_party/boringssl/crypto/modes/internal.h +15 -27
  519. data/third_party/boringssl/crypto/modes/ofb.c +9 -22
  520. data/third_party/boringssl/crypto/newhope/error_correction.c +131 -0
  521. data/third_party/boringssl/crypto/newhope/internal.h +71 -0
  522. data/third_party/boringssl/crypto/newhope/newhope.c +174 -0
  523. data/third_party/boringssl/crypto/newhope/ntt.c +148 -0
  524. data/third_party/boringssl/crypto/newhope/poly.c +183 -0
  525. data/third_party/boringssl/crypto/newhope/precomp.c +306 -0
  526. data/third_party/boringssl/crypto/newhope/reduce.c +42 -0
  527. data/third_party/boringssl/crypto/obj/obj.c +111 -135
  528. data/third_party/boringssl/crypto/obj/obj_dat.h +4 -10
  529. data/third_party/boringssl/crypto/pem/pem_lib.c +6 -43
  530. data/third_party/boringssl/crypto/pem/pem_pkey.c +10 -19
  531. data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +1 -0
  532. data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +2 -1
  533. data/third_party/boringssl/crypto/pkcs8/p8_pkey.c +2 -2
  534. data/third_party/boringssl/crypto/pkcs8/pkcs8.c +95 -87
  535. data/third_party/boringssl/crypto/{test/test_util.h → poly1305/internal.h} +15 -10
  536. data/third_party/boringssl/crypto/poly1305/poly1305.c +8 -15
  537. data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +1 -0
  538. data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +3 -3
  539. data/third_party/boringssl/crypto/rand/deterministic.c +47 -0
  540. data/third_party/boringssl/crypto/rand/rand.c +4 -1
  541. data/third_party/boringssl/crypto/rand/urandom.c +5 -7
  542. data/third_party/boringssl/crypto/rand/windows.c +5 -8
  543. data/third_party/boringssl/crypto/rc4/rc4.c +24 -209
  544. data/third_party/boringssl/crypto/refcount_lock.c +2 -2
  545. data/third_party/boringssl/crypto/rsa/blinding.c +74 -232
  546. data/third_party/boringssl/crypto/rsa/internal.h +5 -13
  547. data/third_party/boringssl/crypto/rsa/padding.c +64 -63
  548. data/third_party/boringssl/crypto/rsa/rsa.c +50 -28
  549. data/third_party/boringssl/crypto/rsa/rsa_asn1.c +8 -16
  550. data/third_party/boringssl/crypto/rsa/rsa_impl.c +134 -122
  551. data/third_party/boringssl/crypto/sha/sha256.c +2 -2
  552. data/third_party/boringssl/crypto/sha/sha512.c +7 -7
  553. data/third_party/boringssl/crypto/stack/stack.c +13 -22
  554. data/third_party/boringssl/crypto/thread.c +21 -12
  555. data/third_party/boringssl/crypto/thread_none.c +6 -2
  556. data/third_party/boringssl/crypto/thread_pthread.c +16 -7
  557. data/third_party/boringssl/crypto/thread_win.c +38 -85
  558. data/third_party/boringssl/crypto/x509/a_sign.c +3 -3
  559. data/third_party/boringssl/crypto/x509/a_strex.c +1 -1
  560. data/third_party/boringssl/crypto/x509/a_verify.c +2 -2
  561. data/third_party/boringssl/crypto/{evp → x509}/algorithm.c +37 -53
  562. data/third_party/boringssl/crypto/x509/asn1_gen.c +1 -2
  563. data/third_party/boringssl/crypto/x509/by_dir.c +6 -6
  564. data/third_party/boringssl/crypto/x509/internal.h +66 -0
  565. data/third_party/boringssl/crypto/x509/rsa_pss.c +385 -0
  566. data/third_party/boringssl/crypto/x509/t_x509.c +10 -12
  567. data/third_party/boringssl/crypto/x509/x509.c +5 -0
  568. data/third_party/boringssl/crypto/x509/x509_att.c +9 -3
  569. data/third_party/boringssl/crypto/x509/x509_lu.c +34 -44
  570. data/third_party/boringssl/crypto/x509/x509_obj.c +19 -2
  571. data/third_party/boringssl/crypto/x509/x509_r2x.c +9 -5
  572. data/third_party/boringssl/crypto/x509/x509_set.c +5 -0
  573. data/third_party/boringssl/crypto/x509/x509_txt.c +5 -0
  574. data/third_party/boringssl/crypto/x509/x509_vfy.c +63 -32
  575. data/third_party/boringssl/crypto/x509/x509_vpm.c +29 -18
  576. data/third_party/boringssl/crypto/x509/x509cset.c +2 -1
  577. data/third_party/boringssl/crypto/x509/x_crl.c +2 -2
  578. data/third_party/boringssl/crypto/x509/x_name.c +14 -17
  579. data/third_party/boringssl/crypto/x509/x_pubkey.c +10 -7
  580. data/third_party/boringssl/crypto/x509/x_x509.c +67 -6
  581. data/third_party/boringssl/crypto/x509v3/pcy_cache.c +2 -2
  582. data/third_party/boringssl/crypto/x509v3/pcy_tree.c +2 -1
  583. data/third_party/boringssl/crypto/x509v3/v3_conf.c +4 -3
  584. data/third_party/boringssl/crypto/x509v3/v3_cpols.c +5 -0
  585. data/third_party/boringssl/crypto/x509v3/v3_prn.c +0 -3
  586. data/third_party/boringssl/crypto/x509v3/v3_purp.c +2 -2
  587. data/third_party/boringssl/crypto/x509v3/v3_utl.c +2 -1
  588. data/third_party/boringssl/include/openssl/aead.h +72 -73
  589. data/third_party/boringssl/include/openssl/arm_arch.h +0 -6
  590. data/third_party/boringssl/include/openssl/asn1.h +103 -235
  591. data/third_party/boringssl/include/openssl/asn1_mac.h +17 -74
  592. data/third_party/boringssl/include/openssl/asn1t.h +1 -11
  593. data/third_party/boringssl/include/openssl/base.h +145 -3
  594. data/third_party/boringssl/include/openssl/base64.h +20 -17
  595. data/third_party/boringssl/include/openssl/bio.h +59 -34
  596. data/third_party/boringssl/include/openssl/bn.h +118 -51
  597. data/third_party/boringssl/include/openssl/buf.h +15 -0
  598. data/third_party/boringssl/include/openssl/bytestring.h +52 -4
  599. data/third_party/boringssl/include/openssl/chacha.h +2 -2
  600. data/third_party/boringssl/include/openssl/cipher.h +18 -1
  601. data/third_party/boringssl/include/openssl/cmac.h +11 -0
  602. data/third_party/boringssl/include/openssl/conf.h +13 -2
  603. data/third_party/boringssl/include/openssl/cpu.h +20 -23
  604. data/third_party/boringssl/include/openssl/crypto.h +22 -1
  605. data/third_party/boringssl/include/openssl/curve25519.h +96 -4
  606. data/third_party/boringssl/include/openssl/dh.h +71 -16
  607. data/third_party/boringssl/include/openssl/digest.h +38 -11
  608. data/third_party/boringssl/include/openssl/dsa.h +40 -4
  609. data/third_party/boringssl/include/openssl/ec.h +44 -18
  610. data/third_party/boringssl/include/openssl/ec_key.h +27 -6
  611. data/third_party/boringssl/include/openssl/ecdsa.h +11 -0
  612. data/third_party/boringssl/include/openssl/engine.h +11 -0
  613. data/third_party/boringssl/include/openssl/evp.h +52 -88
  614. data/third_party/boringssl/include/openssl/hkdf.h +24 -4
  615. data/third_party/boringssl/include/openssl/hmac.h +20 -6
  616. data/third_party/boringssl/include/openssl/md4.h +4 -0
  617. data/third_party/boringssl/include/openssl/mem.h +19 -0
  618. data/third_party/boringssl/include/openssl/newhope.h +158 -0
  619. data/third_party/boringssl/include/openssl/nid.h +4166 -0
  620. data/third_party/boringssl/include/openssl/obj.h +31 -3
  621. data/third_party/boringssl/include/openssl/obj_mac.h +17 -4143
  622. data/third_party/boringssl/include/openssl/{opensslfeatures.h → opensslconf.h} +3 -3
  623. data/third_party/boringssl/include/openssl/pem.h +5 -0
  624. data/third_party/boringssl/include/openssl/pkcs8.h +12 -0
  625. data/third_party/boringssl/include/openssl/rand.h +6 -0
  626. data/third_party/boringssl/include/openssl/rc4.h +6 -0
  627. data/third_party/boringssl/{crypto/dh/internal.h → include/openssl/ripemd.h} +38 -11
  628. data/third_party/boringssl/include/openssl/rsa.h +127 -65
  629. data/third_party/boringssl/include/openssl/sha.h +14 -10
  630. data/third_party/boringssl/include/openssl/ssl.h +561 -275
  631. data/third_party/boringssl/include/openssl/ssl3.h +18 -25
  632. data/third_party/boringssl/include/openssl/stack.h +2 -4
  633. data/third_party/boringssl/include/openssl/stack_macros.h +321 -353
  634. data/third_party/boringssl/include/openssl/thread.h +31 -13
  635. data/third_party/boringssl/include/openssl/time_support.h +1 -0
  636. data/third_party/boringssl/include/openssl/tls1.h +37 -33
  637. data/third_party/boringssl/include/openssl/x509.h +69 -26
  638. data/third_party/boringssl/include/openssl/x509_vfy.h +12 -10
  639. data/third_party/boringssl/include/openssl/x509v3.h +23 -2
  640. data/third_party/boringssl/ssl/custom_extensions.c +3 -5
  641. data/third_party/boringssl/ssl/d1_both.c +463 -499
  642. data/third_party/boringssl/ssl/d1_lib.c +38 -109
  643. data/third_party/boringssl/ssl/d1_pkt.c +173 -334
  644. data/third_party/boringssl/ssl/d1_srtp.c +20 -18
  645. data/third_party/boringssl/ssl/{d1_meth.c → dtls_method.c} +88 -15
  646. data/third_party/boringssl/ssl/dtls_record.c +27 -26
  647. data/third_party/boringssl/ssl/{s3_clnt.c → handshake_client.c} +816 -904
  648. data/third_party/boringssl/ssl/handshake_server.c +1932 -0
  649. data/third_party/boringssl/ssl/internal.h +712 -439
  650. data/third_party/boringssl/ssl/s3_both.c +445 -257
  651. data/third_party/boringssl/ssl/s3_enc.c +53 -36
  652. data/third_party/boringssl/ssl/s3_lib.c +23 -268
  653. data/third_party/boringssl/ssl/s3_pkt.c +168 -364
  654. data/third_party/boringssl/ssl/ssl_aead_ctx.c +46 -17
  655. data/third_party/boringssl/ssl/ssl_asn1.c +56 -26
  656. data/third_party/boringssl/ssl/ssl_buffer.c +16 -24
  657. data/third_party/boringssl/ssl/ssl_cert.c +324 -49
  658. data/third_party/boringssl/ssl/ssl_cipher.c +205 -150
  659. data/third_party/boringssl/ssl/ssl_ecdh.c +287 -51
  660. data/third_party/boringssl/ssl/ssl_file.c +21 -68
  661. data/third_party/boringssl/ssl/ssl_lib.c +881 -510
  662. data/third_party/boringssl/ssl/ssl_rsa.c +404 -34
  663. data/third_party/boringssl/ssl/ssl_session.c +324 -103
  664. data/third_party/boringssl/ssl/ssl_stat.c +6 -88
  665. data/third_party/boringssl/ssl/t1_enc.c +23 -39
  666. data/third_party/boringssl/ssl/t1_lib.c +1120 -622
  667. data/third_party/boringssl/ssl/tls13_both.c +440 -0
  668. data/third_party/boringssl/ssl/tls13_client.c +682 -0
  669. data/third_party/boringssl/ssl/tls13_enc.c +391 -0
  670. data/third_party/boringssl/ssl/tls13_server.c +672 -0
  671. data/third_party/boringssl/ssl/{s3_meth.c → tls_method.c} +100 -21
  672. data/third_party/boringssl/ssl/tls_record.c +159 -77
  673. data/third_party/nanopb/pb.h +60 -28
  674. data/third_party/nanopb/pb_decode.c +120 -92
  675. data/third_party/nanopb/pb_decode.h +3 -3
  676. data/third_party/nanopb/pb_encode.c +73 -67
  677. data/third_party/nanopb/pb_encode.h +4 -4
  678. metadata +155 -89
  679. data/include/grpc/impl/codegen/byte_buffer.h +0 -122
  680. data/include/grpc/impl/codegen/log.h +0 -118
  681. data/include/grpc/impl/codegen/time.h +0 -130
  682. data/src/core/ext/client_config/client_channel.c +0 -593
  683. data/src/core/ext/client_config/subchannel_call_holder.c +0 -272
  684. data/src/core/ext/client_config/subchannel_call_holder.h +0 -99
  685. data/src/core/lib/iomgr/ev_poll_and_epoll_posix.c +0 -2046
  686. data/src/core/lib/iomgr/workqueue_posix.c +0 -151
  687. data/src/core/lib/security/transport/handshake.c +0 -368
  688. data/third_party/boringssl/crypto/asn1/a_bytes.c +0 -308
  689. data/third_party/boringssl/crypto/asn1/bio_asn1.c +0 -477
  690. data/third_party/boringssl/crypto/asn1/bio_ndef.c +0 -251
  691. data/third_party/boringssl/crypto/asn1/t_pkey.c +0 -110
  692. data/third_party/boringssl/crypto/asn1/tasn_prn.c +0 -596
  693. data/third_party/boringssl/crypto/chacha/chacha_vec.c +0 -328
  694. data/third_party/boringssl/crypto/directory.h +0 -66
  695. data/third_party/boringssl/crypto/directory_posix.c +0 -108
  696. data/third_party/boringssl/crypto/directory_win.c +0 -144
  697. data/third_party/boringssl/crypto/test/scoped_types.h +0 -140
  698. data/third_party/boringssl/include/openssl/pqueue.h +0 -146
  699. data/third_party/boringssl/ssl/d1_clnt.c +0 -561
  700. data/third_party/boringssl/ssl/d1_srvr.c +0 -476
  701. data/third_party/boringssl/ssl/pqueue/pqueue.c +0 -197
  702. data/third_party/boringssl/ssl/s3_srvr.c +0 -2272
  703. data/third_party/boringssl/ssl/test/async_bio.h +0 -45
  704. data/third_party/boringssl/ssl/test/packeted_bio.h +0 -44
  705. data/third_party/boringssl/ssl/test/test_config.h +0 -110
@@ -158,9 +158,6 @@
158
158
  #include <sys/time.h>
159
159
  #endif
160
160
 
161
- /* wpa_supplicant expects to get the version functions from ssl.h */
162
- #include <openssl/crypto.h>
163
-
164
161
  /* Forward-declare struct timeval. On Windows, it is defined in winsock2.h and
165
162
  * Windows headers define too many macros to be included in public headers.
166
163
  * However, only a forward declaration is needed. */
@@ -194,6 +191,9 @@ OPENSSL_EXPORT const SSL_METHOD *DTLS_method(void);
194
191
  * on error. */
195
192
  OPENSSL_EXPORT SSL_CTX *SSL_CTX_new(const SSL_METHOD *method);
196
193
 
194
+ /* SSL_CTX_up_ref increments the reference count of |ctx|. It returns one. */
195
+ OPENSSL_EXPORT int SSL_CTX_up_ref(SSL_CTX *ctx);
196
+
197
197
  /* SSL_CTX_free releases memory associated with |ctx|. */
198
198
  OPENSSL_EXPORT void SSL_CTX_free(SSL_CTX *ctx);
199
199
 
@@ -228,7 +228,10 @@ OPENSSL_EXPORT void SSL_set_accept_state(SSL *ssl);
228
228
 
229
229
  /* SSL_is_server returns one if |ssl| is configured as a server and zero
230
230
  * otherwise. */
231
- OPENSSL_EXPORT int SSL_is_server(SSL *ssl);
231
+ OPENSSL_EXPORT int SSL_is_server(const SSL *ssl);
232
+
233
+ /* SSL_is_dtls returns one if |ssl| is a DTLS connection and zero otherwise. */
234
+ OPENSSL_EXPORT int SSL_is_dtls(const SSL *ssl);
232
235
 
233
236
  /* SSL_set_bio configures |ssl| to read from |rbio| and write to |wbio|. |ssl|
234
237
  * takes ownership of the two |BIO|s. If |rbio| and |wbio| are the same, |ssl|
@@ -237,9 +240,33 @@ OPENSSL_EXPORT int SSL_is_server(SSL *ssl);
237
240
  * In DTLS, if |rbio| is blocking, it must handle
238
241
  * |BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT| control requests to set read timeouts.
239
242
  *
240
- * Calling this function on an already-configured |ssl| is deprecated. */
243
+ * If |rbio| is the same as the currently configured |BIO| for reading, that
244
+ * side is left untouched and is not freed.
245
+ *
246
+ * If |wbio| is the same as the currently configured |BIO| for writing AND |ssl|
247
+ * is not currently configured to read from and write to the same |BIO|, that
248
+ * side is left untouched and is not freed. This asymmetry is present for
249
+ * historical reasons.
250
+ *
251
+ * Due to the very complex historical behavior of this function, calling this
252
+ * function if |ssl| already has |BIO|s configured is deprecated. Prefer
253
+ * |SSL_set0_rbio| and |SSL_set0_wbio| instead. */
241
254
  OPENSSL_EXPORT void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);
242
255
 
256
+ /* SSL_set0_rbio configures |ssl| to write to |rbio|. It takes ownership of
257
+ * |rbio|.
258
+ *
259
+ * Note that, although this function and |SSL_set0_wbio| may be called on the
260
+ * same |BIO|, each call takes a reference. Use |BIO_up_ref| to balance this. */
261
+ OPENSSL_EXPORT void SSL_set0_rbio(SSL *ssl, BIO *rbio);
262
+
263
+ /* SSL_set0_wbio configures |ssl| to write to |wbio|. It takes ownership of
264
+ * |wbio|.
265
+ *
266
+ * Note that, although this function and |SSL_set0_rbio| may be called on the
267
+ * same |BIO|, each call takes a reference. Use |BIO_up_ref| to balance this. */
268
+ OPENSSL_EXPORT void SSL_set0_wbio(SSL *ssl, BIO *wbio);
269
+
243
270
  /* SSL_get_rbio returns the |BIO| that |ssl| reads from. */
244
271
  OPENSSL_EXPORT BIO *SSL_get_rbio(const SSL *ssl);
245
272
 
@@ -251,25 +278,39 @@ OPENSSL_EXPORT int SSL_get_fd(const SSL *ssl);
251
278
 
252
279
  /* SSL_get_rfd returns the file descriptor that |ssl| is configured to read
253
280
  * from. If |ssl|'s read |BIO| is not configured or doesn't wrap a file
254
- * descriptor then it returns -1. */
281
+ * descriptor then it returns -1.
282
+ *
283
+ * Note: On Windows, this may return either a file descriptor or a socket (cast
284
+ * to int), depending on whether |ssl| was configured with a file descriptor or
285
+ * socket |BIO|. */
255
286
  OPENSSL_EXPORT int SSL_get_rfd(const SSL *ssl);
256
287
 
257
288
  /* SSL_get_wfd returns the file descriptor that |ssl| is configured to write
258
289
  * to. If |ssl|'s write |BIO| is not configured or doesn't wrap a file
259
- * descriptor then it returns -1. */
290
+ * descriptor then it returns -1.
291
+ *
292
+ * Note: On Windows, this may return either a file descriptor or a socket (cast
293
+ * to int), depending on whether |ssl| was configured with a file descriptor or
294
+ * socket |BIO|. */
260
295
  OPENSSL_EXPORT int SSL_get_wfd(const SSL *ssl);
261
296
 
262
297
  /* SSL_set_fd configures |ssl| to read from and write to |fd|. It returns one
263
298
  * on success and zero on allocation error. The caller retains ownership of
264
- * |fd|. */
299
+ * |fd|.
300
+ *
301
+ * On Windows, |fd| is cast to a |SOCKET| and used with Winsock APIs. */
265
302
  OPENSSL_EXPORT int SSL_set_fd(SSL *ssl, int fd);
266
303
 
267
304
  /* SSL_set_rfd configures |ssl| to read from |fd|. It returns one on success and
268
- * zero on allocation error. The caller retains ownership of |fd|. */
305
+ * zero on allocation error. The caller retains ownership of |fd|.
306
+ *
307
+ * On Windows, |fd| is cast to a |SOCKET| and used with Winsock APIs. */
269
308
  OPENSSL_EXPORT int SSL_set_rfd(SSL *ssl, int fd);
270
309
 
271
310
  /* SSL_set_wfd configures |ssl| to write to |fd|. It returns one on success and
272
- * zero on allocation error. The caller retains ownership of |fd|. */
311
+ * zero on allocation error. The caller retains ownership of |fd|.
312
+ *
313
+ * On Windows, |fd| is cast to a |SOCKET| and used with Winsock APIs. */
273
314
  OPENSSL_EXPORT int SSL_set_wfd(SSL *ssl, int fd);
274
315
 
275
316
  /* SSL_do_handshake continues the current handshake. If there is none or the
@@ -353,14 +394,7 @@ OPENSSL_EXPORT int SSL_write(SSL *ssl, const void *buf, int num);
353
394
  *
354
395
  * |SSL_shutdown| returns -1 on failure. The caller should pass the return value
355
396
  * into |SSL_get_error| to determine how to proceed. If the underlying |BIO| is
356
- * non-blocking, both stages may require retry.
357
- *
358
- * |SSL_shutdown| must be called to retain |ssl|'s session in the session
359
- * cache. Use |SSL_CTX_set_quiet_shutdown| to configure |SSL_shutdown| to
360
- * neither send nor wait for close_notify but still retain the session.
361
- *
362
- * TODO(davidben): Is there any point in the session cache interaction? Remove
363
- * it? */
397
+ * non-blocking, both stages may require retry. */
364
398
  OPENSSL_EXPORT int SSL_shutdown(SSL *ssl);
365
399
 
366
400
  /* SSL_CTX_set_quiet_shutdown sets quiet shutdown on |ctx| to |mode|. If
@@ -415,9 +449,9 @@ OPENSSL_EXPORT int SSL_get_error(const SSL *ssl, int ret_code);
415
449
  * See also |SSL_CTX_set_cert_cb| and |SSL_CTX_set_client_cert_cb|. */
416
450
  #define SSL_ERROR_WANT_X509_LOOKUP 4
417
451
 
418
- /* SSL_ERROR_WANT_SYSCALL indicates the operation failed externally to the
419
- * library. The caller should consult the system-specific error mechanism. This
420
- * is typically |errno| but may be something custom if using a custom |BIO|. It
452
+ /* SSL_ERROR_SYSCALL indicates the operation failed externally to the library.
453
+ * The caller should consult the system-specific error mechanism. This is
454
+ * typically |errno| but may be something custom if using a custom |BIO|. It
421
455
  * may also be signaled if the transport returned EOF, in which case the
422
456
  * operation's return value will be zero. */
423
457
  #define SSL_ERROR_SYSCALL 5
@@ -465,13 +499,24 @@ OPENSSL_EXPORT int SSL_get_error(const SSL *ssl, int ret_code);
465
499
  * a private key operation was unfinished. The caller may retry the operation
466
500
  * when the private key operation is complete.
467
501
  *
468
- * See also |SSL_set_private_key_method|. */
502
+ * See also |SSL_set_private_key_method| and
503
+ * |SSL_CTX_set_private_key_method|. */
469
504
  #define SSL_ERROR_WANT_PRIVATE_KEY_OPERATION 13
470
505
 
471
506
  /* SSL_set_mtu sets the |ssl|'s MTU in DTLS to |mtu|. It returns one on success
472
507
  * and zero on failure. */
473
508
  OPENSSL_EXPORT int SSL_set_mtu(SSL *ssl, unsigned mtu);
474
509
 
510
+ /* DTLSv1_set_initial_timeout_duration sets the initial duration for a DTLS
511
+ * handshake timeout.
512
+ *
513
+ * This duration overrides the default of 1 second, which is the strong
514
+ * recommendation of RFC 6347 (see section 4.2.4.1). However, there may exist
515
+ * situations where a shorter timeout would be beneficial, such as for
516
+ * time-sensitive applications. */
517
+ OPENSSL_EXPORT void DTLSv1_set_initial_timeout_duration(SSL *ssl,
518
+ unsigned duration_ms);
519
+
475
520
  /* DTLSv1_get_timeout queries the next DTLS handshake timeout. If there is a
476
521
  * timeout in progress, it sets |*out| to the time remaining and returns one.
477
522
  * Otherwise, it returns zero.
@@ -512,25 +557,34 @@ OPENSSL_EXPORT int DTLSv1_handle_timeout(SSL *ssl);
512
557
  #define TLS1_VERSION 0x0301
513
558
  #define TLS1_1_VERSION 0x0302
514
559
  #define TLS1_2_VERSION 0x0303
560
+ #define TLS1_3_VERSION 0x0304
515
561
 
516
562
  #define DTLS1_VERSION 0xfeff
517
563
  #define DTLS1_2_VERSION 0xfefd
518
564
 
519
- /* SSL_CTX_set_min_version sets the minimum protocol version for |ctx| to
520
- * |version|. */
521
- OPENSSL_EXPORT void SSL_CTX_set_min_version(SSL_CTX *ctx, uint16_t version);
565
+ #define TLS1_3_DRAFT_VERSION 0x7f0e
522
566
 
523
- /* SSL_CTX_set_max_version sets the maximum protocol version for |ctx| to
524
- * |version|. */
525
- OPENSSL_EXPORT void SSL_CTX_set_max_version(SSL_CTX *ctx, uint16_t version);
567
+ /* SSL_CTX_set_min_proto_version sets the minimum protocol version for |ctx| to
568
+ * |version|. If |version| is zero, the default minimum version is used. It
569
+ * returns one on success and zero if |version| is invalid. */
570
+ OPENSSL_EXPORT int SSL_CTX_set_min_proto_version(SSL_CTX *ctx,
571
+ uint16_t version);
526
572
 
527
- /* SSL_set_min_version sets the minimum protocol version for |ssl| to
528
- * |version|. */
529
- OPENSSL_EXPORT void SSL_set_min_version(SSL *ssl, uint16_t version);
573
+ /* SSL_CTX_set_max_proto_version sets the maximum protocol version for |ctx| to
574
+ * |version|. If |version| is zero, the default maximum version is used. It
575
+ * returns one on success and zero if |version| is invalid. */
576
+ OPENSSL_EXPORT int SSL_CTX_set_max_proto_version(SSL_CTX *ctx,
577
+ uint16_t version);
530
578
 
531
- /* SSL_set_max_version sets the maximum protocol version for |ssl| to
532
- * |version|. */
533
- OPENSSL_EXPORT void SSL_set_max_version(SSL *ssl, uint16_t version);
579
+ /* SSL_set_min_proto_version sets the minimum protocol version for |ssl| to
580
+ * |version|. If |version| is zero, the default minimum version is used. It
581
+ * returns one on success and zero if |version| is invalid. */
582
+ OPENSSL_EXPORT int SSL_set_min_proto_version(SSL *ssl, uint16_t version);
583
+
584
+ /* SSL_set_max_proto_version sets the maximum protocol version for |ssl| to
585
+ * |version|. If |version| is zero, the default maximum version is used. It
586
+ * returns one on success and zero if |version| is invalid. */
587
+ OPENSSL_EXPORT int SSL_set_max_proto_version(SSL *ssl, uint16_t version);
534
588
 
535
589
  /* SSL_version returns the TLS or DTLS protocol version used by |ssl|, which is
536
590
  * one of the |*_VERSION| values. (E.g. |TLS1_2_VERSION|.) Before the version
@@ -559,6 +613,17 @@ OPENSSL_EXPORT int SSL_version(const SSL *ssl);
559
613
  * |SSL_CTX|. */
560
614
  #define SSL_OP_DISABLE_NPN 0x00800000L
561
615
 
616
+ /* The following flags toggle individual protocol versions. This is deprecated.
617
+ * Use |SSL_CTX_set_min_proto_version| and |SSL_CTX_set_max_proto_version|
618
+ * instead. */
619
+ #define SSL_OP_NO_SSLv3 0x02000000L
620
+ #define SSL_OP_NO_TLSv1 0x04000000L
621
+ #define SSL_OP_NO_TLSv1_2 0x08000000L
622
+ #define SSL_OP_NO_TLSv1_1 0x10000000L
623
+ #define SSL_OP_NO_TLSv1_3 0x20000000L
624
+ #define SSL_OP_NO_DTLSv1 SSL_OP_NO_TLSv1
625
+ #define SSL_OP_NO_DTLSv1_2 SSL_OP_NO_TLSv1_2
626
+
562
627
  /* SSL_CTX_set_options enables all options set in |options| (which should be one
563
628
  * or more of the |SSL_OP_*| values, ORed together) in |ctx|. It returns a
564
629
  * bitmask representing the resulting enabled options. */
@@ -610,8 +675,8 @@ OPENSSL_EXPORT uint32_t SSL_get_options(const SSL *ssl);
610
675
  #define SSL_MODE_NO_AUTO_CHAIN 0x00000008L
611
676
 
612
677
  /* SSL_MODE_ENABLE_FALSE_START allows clients to send application data before
613
- * receipt of ChangeCipherSpec and Finished. This mode enables full-handshakes
614
- * to 'complete' in one RTT. See draft-bmoeller-tls-falsestart-01.
678
+ * receipt of ChangeCipherSpec and Finished. This mode enables full handshakes
679
+ * to 'complete' in one RTT. See RFC 7918.
615
680
  *
616
681
  * When False Start is enabled, |SSL_do_handshake| may succeed before the
617
682
  * handshake has completely finished. |SSL_write| will function at this point,
@@ -754,7 +819,10 @@ OPENSSL_EXPORT int SSL_clear_chain_certs(SSL *ssl);
754
819
  *
755
820
  * On the client, the callback may call |SSL_get0_certificate_types| and
756
821
  * |SSL_get_client_CA_list| for information on the server's certificate
757
- * request. */
822
+ * request.
823
+ *
824
+ * On the server, the callback will be called on non-resumption handshakes,
825
+ * after extensions have been processed. */
758
826
  OPENSSL_EXPORT void SSL_CTX_set_cert_cb(SSL_CTX *ctx,
759
827
  int (*cb)(SSL *ssl, void *arg),
760
828
  void *arg);
@@ -837,13 +905,39 @@ OPENSSL_EXPORT int SSL_CTX_set_ocsp_response(SSL_CTX *ctx,
837
905
  const uint8_t *response,
838
906
  size_t response_len);
839
907
 
840
- /* SSL_set_private_key_digest_prefs copies |num_digests| NIDs from |digest_nids|
841
- * into |ssl|. These digests will be used, in decreasing order of preference,
842
- * when signing with |ssl|'s private key. It returns one on success and zero on
843
- * error. */
844
- OPENSSL_EXPORT int SSL_set_private_key_digest_prefs(SSL *ssl,
845
- const int *digest_nids,
846
- size_t num_digests);
908
+ /* SSL_SIGN_* are signature algorithm values as defined in TLS 1.3. */
909
+ #define SSL_SIGN_RSA_PKCS1_SHA1 0x0201
910
+ #define SSL_SIGN_RSA_PKCS1_SHA256 0x0401
911
+ #define SSL_SIGN_RSA_PKCS1_SHA384 0x0501
912
+ #define SSL_SIGN_RSA_PKCS1_SHA512 0x0601
913
+ #define SSL_SIGN_ECDSA_SHA1 0x0203
914
+ #define SSL_SIGN_ECDSA_SECP256R1_SHA256 0x0403
915
+ #define SSL_SIGN_ECDSA_SECP384R1_SHA384 0x0503
916
+ #define SSL_SIGN_ECDSA_SECP521R1_SHA512 0x0603
917
+ #define SSL_SIGN_RSA_PSS_SHA256 0x0804
918
+ #define SSL_SIGN_RSA_PSS_SHA384 0x0805
919
+ #define SSL_SIGN_RSA_PSS_SHA512 0x0806
920
+
921
+ /* SSL_SIGN_RSA_PKCS1_MD5_SHA1 is an internal signature algorithm used to
922
+ * specify raw RSASSA-PKCS1-v1_5 with an MD5/SHA-1 concatenation, as used in TLS
923
+ * before TLS 1.2. */
924
+ #define SSL_SIGN_RSA_PKCS1_MD5_SHA1 0xff01
925
+
926
+ /* SSL_CTX_set_signing_algorithm_prefs configures |ctx| to use |prefs| as the
927
+ * preference list when signing with |ctx|'s private key. It returns one on
928
+ * success and zero on error. |prefs| should not include the internal-only value
929
+ * |SSL_SIGN_RSA_PKCS1_MD5_SHA1|. */
930
+ OPENSSL_EXPORT int SSL_CTX_set_signing_algorithm_prefs(SSL_CTX *ctx,
931
+ const uint16_t *prefs,
932
+ size_t num_prefs);
933
+
934
+ /* SSL_set_signing_algorithm_prefs configures |ssl| to use |prefs| as the
935
+ * preference list when signing with |ssl|'s private key. It returns one on
936
+ * success and zero on error. |prefs| should not include the internal-only value
937
+ * |SSL_SIGN_RSA_PKCS1_MD5_SHA1|. */
938
+ OPENSSL_EXPORT int SSL_set_signing_algorithm_prefs(SSL *ssl,
939
+ const uint16_t *prefs,
940
+ size_t num_prefs);
847
941
 
848
942
 
849
943
  /* Certificate and private key convenience functions. */
@@ -930,43 +1024,62 @@ enum ssl_private_key_result_t {
930
1024
  /* SSL_PRIVATE_KEY_METHOD describes private key hooks. This is used to off-load
931
1025
  * signing operations to a custom, potentially asynchronous, backend. */
932
1026
  typedef struct ssl_private_key_method_st {
933
- /* type returns either |EVP_PKEY_RSA| or |EVP_PKEY_EC| to denote the type of
934
- * key used by |ssl|. */
1027
+ /* type returns the type of the key used by |ssl|. For RSA keys, return
1028
+ * |NID_rsaEncryption|. For ECDSA keys, return |NID_X9_62_prime256v1|,
1029
+ * |NID_secp384r1|, or |NID_secp521r1|, depending on the curve.
1030
+ *
1031
+ * Returning |EVP_PKEY_EC| for ECDSA keys is deprecated and may result in
1032
+ * connection failures in TLS 1.3. */
935
1033
  int (*type)(SSL *ssl);
936
1034
 
937
1035
  /* max_signature_len returns the maximum length of a signature signed by the
938
1036
  * key used by |ssl|. This must be a constant value for a given |ssl|. */
939
1037
  size_t (*max_signature_len)(SSL *ssl);
940
1038
 
941
- /* sign signs |in_len| bytes of digest from |in|. |md| is the hash function
942
- * used to calculate |in|. On success, it returns |ssl_private_key_success|
943
- * and writes at most |max_out| bytes of signature data to |out|. On failure,
944
- * it returns |ssl_private_key_failure|. If the operation has not completed,
945
- * it returns |ssl_private_key_retry|. |sign| should arrange for the
946
- * high-level operation on |ssl| to be retried when the operation is
947
- * completed. This will result in a call to |sign_complete|.
1039
+ /* sign signs the message |in| in using the specified signature algorithm. On
1040
+ * success, it returns |ssl_private_key_success| and writes at most |max_out|
1041
+ * bytes of signature data to |out| and sets |*out_len| to the number of bytes
1042
+ * written. On failure, it returns |ssl_private_key_failure|. If the operation
1043
+ * has not completed, it returns |ssl_private_key_retry|. |sign| should
1044
+ * arrange for the high-level operation on |ssl| to be retried when the
1045
+ * operation is completed. This will result in a call to |complete|.
948
1046
  *
949
- * If the key is an RSA key, implementations must use PKCS#1 padding. |in| is
950
- * the digest itself, so the DigestInfo prefix, if any, must be prepended by
951
- * |sign|. If |md| is |EVP_md5_sha1|, there is no prefix.
1047
+ * |signature_algorithm| is one of the |SSL_SIGN_*| values, as defined in TLS
1048
+ * 1.3. Note that, in TLS 1.2, ECDSA algorithms do not require that curve
1049
+ * sizes match hash sizes, so the curve portion of |SSL_SIGN_ECDSA_*| values
1050
+ * must be ignored. BoringSSL will internally handle the curve matching logic
1051
+ * where appropriate.
952
1052
  *
953
1053
  * It is an error to call |sign| while another private key operation is in
954
1054
  * progress on |ssl|. */
955
1055
  enum ssl_private_key_result_t (*sign)(SSL *ssl, uint8_t *out, size_t *out_len,
956
- size_t max_out, const EVP_MD *md,
1056
+ size_t max_out,
1057
+ uint16_t signature_algorithm,
957
1058
  const uint8_t *in, size_t in_len);
958
1059
 
959
- /* sign_complete completes a pending |sign| operation. If the operation has
960
- * completed, it returns |ssl_private_key_success| and writes the result to
961
- * |out| as in |sign|. Otherwise, it returns |ssl_private_key_failure| on
962
- * failure and |ssl_private_key_retry| if the operation is still in progress.
1060
+ /* sign_digest signs |in_len| bytes of digest from |in|. |md| is the hash
1061
+ * function used to calculate |in|. On success, it returns
1062
+ * |ssl_private_key_success| and writes at most |max_out| bytes of signature
1063
+ * data to |out|. On failure, it returns |ssl_private_key_failure|. If the
1064
+ * operation has not completed, it returns |ssl_private_key_retry|. |sign|
1065
+ * should arrange for the high-level operation on |ssl| to be retried when the
1066
+ * operation is completed. This will result in a call to |complete|.
963
1067
  *
964
- * |sign_complete| may be called arbitrarily many times before completion, but
965
- * it is an error to call |sign_complete| if there is no pending |sign|
966
- * operation in progress on |ssl|. */
967
- enum ssl_private_key_result_t (*sign_complete)(SSL *ssl, uint8_t *out,
968
- size_t *out_len,
969
- size_t max_out);
1068
+ * If the key is an RSA key, implementations must use PKCS#1 padding. |in| is
1069
+ * the digest itself, so the DigestInfo prefix, if any, must be prepended by
1070
+ * |sign|. If |md| is |EVP_md5_sha1|, there is no prefix.
1071
+ *
1072
+ * It is an error to call |sign_digest| while another private key operation is
1073
+ * in progress on |ssl|.
1074
+ *
1075
+ * This function is deprecated. Implement |sign| instead.
1076
+ *
1077
+ * TODO(davidben): Remove this function. */
1078
+ enum ssl_private_key_result_t (*sign_digest)(SSL *ssl, uint8_t *out,
1079
+ size_t *out_len, size_t max_out,
1080
+ const EVP_MD *md,
1081
+ const uint8_t *in,
1082
+ size_t in_len);
970
1083
 
971
1084
  /* decrypt decrypts |in_len| bytes of encrypted data from |in|. On success it
972
1085
  * returns |ssl_private_key_success|, writes at most |max_out| bytes of
@@ -974,9 +1087,9 @@ typedef struct ssl_private_key_method_st {
974
1087
  * written. On failure it returns |ssl_private_key_failure|. If the operation
975
1088
  * has not completed, it returns |ssl_private_key_retry|. The caller should
976
1089
  * arrange for the high-level operation on |ssl| to be retried when the
977
- * operation is completed, which will result in a call to |decrypt_complete|.
978
- * This function only works with RSA keys and should perform a raw RSA
979
- * decryption operation with no padding.
1090
+ * operation is completed, which will result in a call to |complete|. This
1091
+ * function only works with RSA keys and should perform a raw RSA decryption
1092
+ * operation with no padding.
980
1093
  *
981
1094
  * It is an error to call |decrypt| while another private key operation is in
982
1095
  * progress on |ssl|. */
@@ -984,18 +1097,16 @@ typedef struct ssl_private_key_method_st {
984
1097
  size_t *out_len, size_t max_out,
985
1098
  const uint8_t *in, size_t in_len);
986
1099
 
987
- /* decrypt_complete completes a pending |decrypt| operation. If the operation
988
- * has completed, it returns |ssl_private_key_success| and writes the result
989
- * to |out| as in |decrypt|. Otherwise, it returns |ssl_private_key_failure|
990
- * on failure and |ssl_private_key_retry| if the operation is still in
991
- * progress.
1100
+ /* complete completes a pending operation. If the operation has completed, it
1101
+ * returns |ssl_private_key_success| and writes the result to |out| as in
1102
+ * |sign|. Otherwise, it returns |ssl_private_key_failure| on failure and
1103
+ * |ssl_private_key_retry| if the operation is still in progress.
992
1104
  *
993
- * |decrypt_complete| may be called arbitrarily many times before completion,
994
- * but it is an error to call |decrypt_complete| if there is no pending
995
- * |decrypt| operation in progress on |ssl|. */
996
- enum ssl_private_key_result_t (*decrypt_complete)(SSL *ssl, uint8_t *out,
997
- size_t *out_len,
998
- size_t max_out);
1105
+ * |complete| may be called arbitrarily many times before completion, but it
1106
+ * is an error to call |complete| if there is no pending operation in progress
1107
+ * on |ssl|. */
1108
+ enum ssl_private_key_result_t (*complete)(SSL *ssl, uint8_t *out,
1109
+ size_t *out_len, size_t max_out);
999
1110
  } SSL_PRIVATE_KEY_METHOD;
1000
1111
 
1001
1112
  /* SSL_set_private_key_method configures a custom private key on |ssl|.
@@ -1003,6 +1114,11 @@ typedef struct ssl_private_key_method_st {
1003
1114
  OPENSSL_EXPORT void SSL_set_private_key_method(
1004
1115
  SSL *ssl, const SSL_PRIVATE_KEY_METHOD *key_method);
1005
1116
 
1117
+ /* SSL_CTX_set_private_key_method configures a custom private key on |ctx|.
1118
+ * |key_method| must remain valid for the lifetime of |ctx|. */
1119
+ OPENSSL_EXPORT void SSL_CTX_set_private_key_method(
1120
+ SSL_CTX *ctx, const SSL_PRIVATE_KEY_METHOD *key_method);
1121
+
1006
1122
 
1007
1123
  /* Cipher suites.
1008
1124
  *
@@ -1029,6 +1145,9 @@ OPENSSL_EXPORT int SSL_CIPHER_has_MD5_HMAC(const SSL_CIPHER *cipher);
1029
1145
  /* SSL_CIPHER_has_SHA1_HMAC returns one if |cipher| uses HMAC-SHA1. */
1030
1146
  OPENSSL_EXPORT int SSL_CIPHER_has_SHA1_HMAC(const SSL_CIPHER *cipher);
1031
1147
 
1148
+ /* SSL_CIPHER_has_SHA256_HMAC returns one if |cipher| uses HMAC-SHA256. */
1149
+ OPENSSL_EXPORT int SSL_CIPHER_has_SHA256_HMAC(const SSL_CIPHER *cipher);
1150
+
1032
1151
  /* SSL_CIPHER_is_AESGCM returns one if |cipher| uses AES-GCM. */
1033
1152
  OPENSSL_EXPORT int SSL_CIPHER_is_AESGCM(const SSL_CIPHER *cipher);
1034
1153
 
@@ -1044,30 +1163,36 @@ OPENSSL_EXPORT int SSL_CIPHER_is_AES128CBC(const SSL_CIPHER *cipher);
1044
1163
  OPENSSL_EXPORT int SSL_CIPHER_is_AES256CBC(const SSL_CIPHER *cipher);
1045
1164
 
1046
1165
  /* SSL_CIPHER_is_CHACHA20POLY1305 returns one if |cipher| uses
1047
- * CHACHA20_POLY1305. Note this includes both the
1048
- * draft-ietf-tls-chacha20-poly1305-04 and draft-agl-tls-chacha20poly1305-04
1049
- * versions. */
1166
+ * CHACHA20_POLY1305. Note this includes both the RFC 7905 and
1167
+ * draft-agl-tls-chacha20poly1305-04 versions. */
1050
1168
  OPENSSL_EXPORT int SSL_CIPHER_is_CHACHA20POLY1305(const SSL_CIPHER *cipher);
1051
1169
 
1052
1170
  /* SSL_CIPHER_is_NULL returns one if |cipher| does not encrypt. */
1053
1171
  OPENSSL_EXPORT int SSL_CIPHER_is_NULL(const SSL_CIPHER *cipher);
1054
1172
 
1055
- /* SSL_CIPHER_is_RC4 returns one if |cipher| uses RC4. */
1056
- OPENSSL_EXPORT int SSL_CIPHER_is_RC4(const SSL_CIPHER *cipher);
1057
-
1058
1173
  /* SSL_CIPHER_is_block_cipher returns one if |cipher| is a block cipher. */
1059
1174
  OPENSSL_EXPORT int SSL_CIPHER_is_block_cipher(const SSL_CIPHER *cipher);
1060
1175
 
1061
1176
  /* SSL_CIPHER_is_ECDSA returns one if |cipher| uses ECDSA. */
1062
1177
  OPENSSL_EXPORT int SSL_CIPHER_is_ECDSA(const SSL_CIPHER *cipher);
1063
1178
 
1179
+ /* SSL_CIPHER_is_DHE returns one if |cipher| uses DHE. */
1180
+ OPENSSL_EXPORT int SSL_CIPHER_is_DHE(const SSL_CIPHER *cipher);
1181
+
1064
1182
  /* SSL_CIPHER_is_ECDHE returns one if |cipher| uses ECDHE. */
1065
1183
  OPENSSL_EXPORT int SSL_CIPHER_is_ECDHE(const SSL_CIPHER *cipher);
1066
1184
 
1185
+ /* SSL_CIPHER_is_CECPQ1 returns one if |cipher| uses CECPQ1. */
1186
+ OPENSSL_EXPORT int SSL_CIPHER_is_CECPQ1(const SSL_CIPHER *cipher);
1187
+
1067
1188
  /* SSL_CIPHER_get_min_version returns the minimum protocol version required
1068
1189
  * for |cipher|. */
1069
1190
  OPENSSL_EXPORT uint16_t SSL_CIPHER_get_min_version(const SSL_CIPHER *cipher);
1070
1191
 
1192
+ /* SSL_CIPHER_get_max_version returns the maximum protocol version that
1193
+ * supports |cipher|. */
1194
+ OPENSSL_EXPORT uint16_t SSL_CIPHER_get_max_version(const SSL_CIPHER *cipher);
1195
+
1071
1196
  /* SSL_CIPHER_get_name returns the OpenSSL name of |cipher|. */
1072
1197
  OPENSSL_EXPORT const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);
1073
1198
 
@@ -1136,9 +1261,9 @@ OPENSSL_EXPORT int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher,
1136
1261
  * corresponding |k*| or |a*| cipher rule. |RSA| is an alias for |kRSA|, not
1137
1262
  * |aRSA|.
1138
1263
  *
1139
- * |3DES|, |RC4|, |AES128|, |AES256|, |AES|, |AESGCM|, |CHACHA20| match
1140
- * ciphers whose bulk cipher use the corresponding encryption scheme. Note
1141
- * that |AES|, |AES128|, and |AES256| match both CBC and GCM ciphers.
1264
+ * |3DES|, |AES128|, |AES256|, |AES|, |AESGCM|, |CHACHA20| match ciphers
1265
+ * whose bulk cipher use the corresponding encryption scheme. Note that
1266
+ * |AES|, |AES128|, and |AES256| match both CBC and GCM ciphers.
1142
1267
  *
1143
1268
  * |MD5|, |SHA1|, |SHA256|, and |SHA384| match legacy cipher suites using the
1144
1269
  * corresponding hash function in their MAC. AEADs are matched by none of
@@ -1154,7 +1279,7 @@ OPENSSL_EXPORT int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher,
1154
1279
  * |kEDH|, |EDH|, |kEECDH|, and |EECDH| are legacy aliases for |kDHE|, |DHE|,
1155
1280
  * |kECDHE|, and |ECDHE|, respectively.
1156
1281
  *
1157
- * |MEDIUM| and |HIGH| match RC4-based ciphers and all others, respectively.
1282
+ * |HIGH| is an alias for |ALL|.
1158
1283
  *
1159
1284
  * |FIPS| is an alias for |HIGH|.
1160
1285
  *
@@ -1418,9 +1543,9 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
1418
1543
  * used outside the library. */
1419
1544
  OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_new(void);
1420
1545
 
1421
- /* SSL_SESSION_up_ref, if |session| is not NULL, increments the reference count
1422
- * of |session|. It then returns |session|. */
1423
- OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_up_ref(SSL_SESSION *session);
1546
+ /* SSL_SESSION_up_ref increments the reference count of |session| and returns
1547
+ * one. */
1548
+ OPENSSL_EXPORT int SSL_SESSION_up_ref(SSL_SESSION *session);
1424
1549
 
1425
1550
  /* SSL_SESSION_free decrements the reference count of |session|. If it reaches
1426
1551
  * zero, all data referenced by |session| and |session| itself are released. */
@@ -1460,19 +1585,18 @@ OPENSSL_EXPORT long SSL_SESSION_get_time(const SSL_SESSION *session);
1460
1585
  /* SSL_SESSION_get_timeout returns the lifetime of |session| in seconds. */
1461
1586
  OPENSSL_EXPORT long SSL_SESSION_get_timeout(const SSL_SESSION *session);
1462
1587
 
1463
- /* SSL_SESSION_get_key_exchange_info returns a value that describes the
1464
- * strength of the asymmetric operation that provides confidentiality to
1465
- * |session|. Its interpretation depends on the operation used. See the
1466
- * documentation for this value in the |SSL_SESSION| structure. */
1467
- OPENSSL_EXPORT uint32_t SSL_SESSION_get_key_exchange_info(
1468
- const SSL_SESSION *session);
1469
-
1470
1588
  /* SSL_SESSION_get0_peer return's the peer leaf certificate stored in
1471
1589
  * |session|.
1472
1590
  *
1473
1591
  * TODO(davidben): This should return a const X509 *. */
1474
1592
  OPENSSL_EXPORT X509 *SSL_SESSION_get0_peer(const SSL_SESSION *session);
1475
1593
 
1594
+ /* SSL_SESSION_get_master_key writes up to |max_out| bytes of |session|'s master
1595
+ * secret to |out| and returns the number of bytes written. If |max_out| is
1596
+ * zero, it returns the size of the master secret. */
1597
+ OPENSSL_EXPORT size_t SSL_SESSION_get_master_key(const SSL_SESSION *session,
1598
+ uint8_t *out, size_t max_out);
1599
+
1476
1600
  /* SSL_SESSION_set_time sets |session|'s creation time to |time| and returns
1477
1601
  * |time|. This function may be useful in writing tests but otherwise should not
1478
1602
  * be used. */
@@ -1524,7 +1648,7 @@ OPENSSL_EXPORT int SSL_SESSION_set1_id_context(SSL_SESSION *session,
1524
1648
  /* SSL_SESS_CACHE_SERVER enables session caching for a server. */
1525
1649
  #define SSL_SESS_CACHE_SERVER 0x0002
1526
1650
 
1527
- /* SSL_SESS_CACHE_SERVER enables session caching for both client and server. */
1651
+ /* SSL_SESS_CACHE_BOTH enables session caching for both client and server. */
1528
1652
  #define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT | SSL_SESS_CACHE_SERVER)
1529
1653
 
1530
1654
  /* SSL_SESS_CACHE_NO_AUTO_CLEAR disables automatically calling
@@ -1554,13 +1678,21 @@ OPENSSL_EXPORT int SSL_CTX_get_session_cache_mode(const SSL_CTX *ctx);
1554
1678
 
1555
1679
  /* SSL_set_session, for a client, configures |ssl| to offer to resume |session|
1556
1680
  * in the initial handshake and returns one. The caller retains ownership of
1557
- * |session|. */
1681
+ * |session|.
1682
+ *
1683
+ * It is an error to call this function after the handshake has begun. */
1558
1684
  OPENSSL_EXPORT int SSL_set_session(SSL *ssl, SSL_SESSION *session);
1559
1685
 
1560
- /* SSL_get_session returns a non-owning pointer to |ssl|'s session. Prior to the
1561
- * initial handshake beginning, this is the session to be offered, set by
1562
- * |SSL_set_session|. After a handshake has finished, this is the currently
1563
- * active session. Its behavior is undefined while a handshake is progress. */
1686
+ /* SSL_get_session returns a non-owning pointer to |ssl|'s session. For
1687
+ * historical reasons, which session it returns depends on |ssl|'s state.
1688
+ *
1689
+ * Prior to the start of the initial handshake, it returns the session the
1690
+ * caller set with |SSL_set_session|. After the initial handshake has finished
1691
+ * and if no additional handshakes are in progress, it returns the currently
1692
+ * active session. Its behavior is undefined while a handshake is in progress.
1693
+ *
1694
+ * Using this function to add new sessions to an external session cache is
1695
+ * deprecated. Use |SSL_CTX_sess_set_new_cb| instead. */
1564
1696
  OPENSSL_EXPORT SSL_SESSION *SSL_get_session(const SSL *ssl);
1565
1697
 
1566
1698
  /* SSL_get0_session is an alias for |SSL_get_session|. */
@@ -1781,23 +1913,42 @@ OPENSSL_EXPORT int SSL_CTX_set_tlsext_ticket_key_cb(
1781
1913
  * are supported. ECDHE is always enabled, but the curve preferences may be
1782
1914
  * configured with these functions.
1783
1915
  *
1784
- * A client may use |SSL_SESSION_get_key_exchange_info| to determine the curve
1785
- * selected. */
1916
+ * Note that TLS 1.3 renames these from curves to groups. For consistency, we
1917
+ * currently use the TLS 1.2 name in the API. */
1786
1918
 
1787
1919
  /* SSL_CTX_set1_curves sets the preferred curves for |ctx| to be |curves|. Each
1788
1920
  * element of |curves| should be a curve nid. It returns one on success and
1789
- * zero on failure. */
1921
+ * zero on failure.
1922
+ *
1923
+ * Note that this API uses nid values from nid.h and not the |SSL_CURVE_*|
1924
+ * values defined below. */
1790
1925
  OPENSSL_EXPORT int SSL_CTX_set1_curves(SSL_CTX *ctx, const int *curves,
1791
1926
  size_t curves_len);
1792
1927
 
1793
1928
  /* SSL_set1_curves sets the preferred curves for |ssl| to be |curves|. Each
1794
1929
  * element of |curves| should be a curve nid. It returns one on success and
1795
- * zero on failure. */
1930
+ * zero on failure.
1931
+ *
1932
+ * Note that this API uses nid values from nid.h and not the |SSL_CURVE_*|
1933
+ * values defined below. */
1796
1934
  OPENSSL_EXPORT int SSL_set1_curves(SSL *ssl, const int *curves,
1797
1935
  size_t curves_len);
1798
1936
 
1799
- /* SSL_get_curve_name returns a human-readable name for the elliptic curve
1800
- * specified by the given TLS curve id, or NULL if the curve if unknown. */
1937
+ /* SSL_CURVE_* define TLS curve IDs. */
1938
+ #define SSL_CURVE_SECP256R1 23
1939
+ #define SSL_CURVE_SECP384R1 24
1940
+ #define SSL_CURVE_SECP521R1 25
1941
+ #define SSL_CURVE_X25519 29
1942
+
1943
+ /* SSL_get_curve_id returns the ID of the curve used by |ssl|'s most recently
1944
+ * completed handshake or 0 if not applicable.
1945
+ *
1946
+ * TODO(davidben): This API currently does not work correctly if there is a
1947
+ * renegotiation in progress. Fix this. */
1948
+ OPENSSL_EXPORT uint16_t SSL_get_curve_id(const SSL *ssl);
1949
+
1950
+ /* SSL_get_curve_name returns a human-readable name for the curve specified by
1951
+ * the given TLS curve id, or NULL if the curve is unknown. */
1801
1952
  OPENSSL_EXPORT const char *SSL_get_curve_name(uint16_t curve_id);
1802
1953
 
1803
1954
 
@@ -1805,11 +1956,7 @@ OPENSSL_EXPORT const char *SSL_get_curve_name(uint16_t curve_id);
1805
1956
  *
1806
1957
  * Cipher suites using a DHE key exchange perform Diffie-Hellman over a
1807
1958
  * multiplicative group selected by the server. These ciphers are disabled for a
1808
- * server unless a group is chosen with one of these functions.
1809
- *
1810
- * A client may use |SSL_SESSION_get_key_exchange_info| to determine the size of
1811
- * the selected group's prime, but note that servers may select degenerate
1812
- * groups. */
1959
+ * server unless a group is chosen with one of these functions. */
1813
1960
 
1814
1961
  /* SSL_CTX_set_tmp_dh configures |ctx| to use the group from |dh| as the group
1815
1962
  * for DHE. Only the group is used, so |dh| needn't have a keypair. It returns
@@ -1842,6 +1989,15 @@ OPENSSL_EXPORT void SSL_set_tmp_dh_callback(SSL *ssl,
1842
1989
  DH *(*dh)(SSL *ssl, int is_export,
1843
1990
  int keylength));
1844
1991
 
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
+
1845
2001
 
1846
2002
  /* Certificate verification.
1847
2003
  *
@@ -2012,9 +2168,6 @@ OPENSSL_EXPORT int SSL_CTX_load_verify_locations(SSL_CTX *ctx,
2012
2168
  * either |X509_V_OK| or a |X509_V_ERR_*| value. */
2013
2169
  OPENSSL_EXPORT long SSL_get_verify_result(const SSL *ssl);
2014
2170
 
2015
- /* SSL_set_verify_result overrides the result of certificate verification. */
2016
- OPENSSL_EXPORT void SSL_set_verify_result(SSL *ssl, long result);
2017
-
2018
2171
  /* SSL_get_ex_data_X509_STORE_CTX_idx returns the ex_data index used to look up
2019
2172
  * the |SSL| associated with an |X509_STORE_CTX| in the verify callback. */
2020
2173
  OPENSSL_EXPORT int SSL_get_ex_data_X509_STORE_CTX_idx(void);
@@ -2062,6 +2215,28 @@ OPENSSL_EXPORT int SSL_enable_ocsp_stapling(SSL *ssl);
2062
2215
  * handshake. */
2063
2216
  OPENSSL_EXPORT void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx);
2064
2217
 
2218
+ /* SSL_CTX_set0_verify_cert_store sets an |X509_STORE| that will be used
2219
+ * exclusively for certificate verification and returns one. Ownership of
2220
+ * |store| is transferred to the |SSL_CTX|. */
2221
+ OPENSSL_EXPORT int SSL_CTX_set0_verify_cert_store(SSL_CTX *ctx,
2222
+ X509_STORE *store);
2223
+
2224
+ /* SSL_CTX_set1_verify_cert_store sets an |X509_STORE| that will be used
2225
+ * exclusively for certificate verification and returns one. An additional
2226
+ * reference to |store| will be taken. */
2227
+ OPENSSL_EXPORT int SSL_CTX_set1_verify_cert_store(SSL_CTX *ctx,
2228
+ X509_STORE *store);
2229
+
2230
+ /* SSL_set0_verify_cert_store sets an |X509_STORE| that will be used
2231
+ * exclusively for certificate verification and returns one. Ownership of
2232
+ * |store| is transferred to the |SSL|. */
2233
+ OPENSSL_EXPORT int SSL_set0_verify_cert_store(SSL *ssl, X509_STORE *store);
2234
+
2235
+ /* SSL_set1_verify_cert_store sets an |X509_STORE| that will be used
2236
+ * exclusively for certificate verification and returns one. An additional
2237
+ * reference to |store| will be taken. */
2238
+ OPENSSL_EXPORT int SSL_set1_verify_cert_store(SSL *ssl, X509_STORE *store);
2239
+
2065
2240
 
2066
2241
  /* Client certificate CA list.
2067
2242
  *
@@ -2118,12 +2293,6 @@ OPENSSL_EXPORT STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *list);
2118
2293
  OPENSSL_EXPORT int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *out,
2119
2294
  const char *file);
2120
2295
 
2121
- /* SSL_add_dir_cert_subjects_to_stack lists files in directory |dir|. It calls
2122
- * |SSL_add_file_cert_subjects_to_stack| on each file and returns one on success
2123
- * or zero on error. */
2124
- OPENSSL_EXPORT int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *out,
2125
- const char *dir);
2126
-
2127
2296
 
2128
2297
  /* Server name indication.
2129
2298
  *
@@ -2528,6 +2697,7 @@ OPENSSL_EXPORT const char *SSL_get_psk_identity(const SSL *ssl);
2528
2697
  #define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR
2529
2698
  #define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED
2530
2699
  #define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION
2700
+ #define SSL_AD_MISSING_EXTENSION TLS1_AD_MISSING_EXTENSION
2531
2701
  #define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION
2532
2702
  #define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE
2533
2703
  #define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME
@@ -2545,6 +2715,16 @@ OPENSSL_EXPORT const char *SSL_alert_type_string_long(int value);
2545
2715
  * alert description or "unknown" if unknown. */
2546
2716
  OPENSSL_EXPORT const char *SSL_alert_desc_string_long(int value);
2547
2717
 
2718
+ /* SSL_send_fatal_alert sends a fatal alert over |ssl| of the specified type,
2719
+ * which should be one of the |SSL_AD_*| constants. It returns one on success
2720
+ * and <= 0 on error. The caller should pass the return value into
2721
+ * |SSL_get_error| to determine how to proceed. Once this function has been
2722
+ * called, future calls to |SSL_write| will fail.
2723
+ *
2724
+ * If retrying a failed operation due to |SSL_ERROR_WANT_WRITE|, subsequent
2725
+ * calls must use the same |alert| parameter. */
2726
+ OPENSSL_EXPORT int SSL_send_fatal_alert(SSL *ssl, uint8_t alert);
2727
+
2548
2728
 
2549
2729
  /* ex_data functions.
2550
2730
  *
@@ -2576,12 +2756,6 @@ OPENSSL_EXPORT int SSL_CTX_get_ex_new_index(long argl, void *argp,
2576
2756
 
2577
2757
  /* Low-level record-layer state. */
2578
2758
 
2579
- /* SSL_get_rc4_state sets |*read_key| and |*write_key| to the RC4 states for
2580
- * the read and write directions. It returns one on success or zero if |ssl|
2581
- * isn't using an RC4-based cipher suite. */
2582
- OPENSSL_EXPORT int SSL_get_rc4_state(const SSL *ssl, const RC4_KEY **read_key,
2583
- const RC4_KEY **write_key);
2584
-
2585
2759
  /* SSL_get_ivs sets |*out_iv_len| to the length of the IVs for the ciphers
2586
2760
  * underlying |ssl| and sets |*out_read_iv| and |*out_write_iv| to point to the
2587
2761
  * current IVs for the read and write directions. This is only meaningful for
@@ -2634,7 +2808,10 @@ OPENSSL_EXPORT void SSL_get_structure_sizes(size_t *ssl_size,
2634
2808
  * For each handshake message, ChangeCipherSpec, and alert, |version| is the
2635
2809
  * protocol version and |content_type| is the corresponding record type. The
2636
2810
  * |len| bytes from |buf| contain the handshake message, one-byte
2637
- * ChangeCipherSpec body, and two-byte alert, respectively. */
2811
+ * ChangeCipherSpec body, and two-byte alert, respectively.
2812
+ *
2813
+ * For a V2ClientHello, |version| is |SSL2_VERSION|, |content_type| is zero, and
2814
+ * the |len| bytes from |buf| contain the V2ClientHello structure. */
2638
2815
  OPENSSL_EXPORT void SSL_CTX_set_msg_callback(
2639
2816
  SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type,
2640
2817
  const void *buf, size_t len, SSL *ssl, void *arg));
@@ -2662,6 +2839,18 @@ OPENSSL_EXPORT void SSL_set_msg_callback_arg(SSL *ssl, void *arg);
2662
2839
  OPENSSL_EXPORT void SSL_CTX_set_keylog_callback(
2663
2840
  SSL_CTX *ctx, void (*cb)(const SSL *ssl, const char *line));
2664
2841
 
2842
+ /* SSL_CTX_get_keylog_callback returns the callback configured by
2843
+ * |SSL_CTX_set_keylog_callback|. */
2844
+ OPENSSL_EXPORT void (*SSL_CTX_get_keylog_callback(const SSL_CTX *ctx))(
2845
+ const SSL *ssl, const char *line);
2846
+
2847
+ /* SSL_CTX_set_current_time_cb configures a callback to retrieve the current
2848
+ * time, which should be set in |*out_clock|. This can be used for testing
2849
+ * purposes; for example, a callback can be configured that returns a time
2850
+ * set explicitly by the test. */
2851
+ OPENSSL_EXPORT void SSL_CTX_set_current_time_cb(
2852
+ SSL_CTX *ctx, void (*cb)(const SSL *ssl, struct timeval *out_clock));
2853
+
2665
2854
  enum ssl_renegotiate_mode_t {
2666
2855
  ssl_renegotiate_never = 0,
2667
2856
  ssl_renegotiate_once,
@@ -2737,6 +2926,9 @@ struct ssl_early_callback_ctx {
2737
2926
  SSL *ssl;
2738
2927
  const uint8_t *client_hello;
2739
2928
  size_t client_hello_len;
2929
+ uint16_t version;
2930
+ const uint8_t *random;
2931
+ size_t random_len;
2740
2932
  const uint8_t *session_id;
2741
2933
  size_t session_id_len;
2742
2934
  const uint8_t *cipher_suites;
@@ -2785,6 +2977,8 @@ OPENSSL_EXPORT void SSL_CTX_set_dos_protection_cb(
2785
2977
  #define SSL_ST_INIT (SSL_ST_CONNECT | SSL_ST_ACCEPT)
2786
2978
  #define SSL_ST_OK 0x03
2787
2979
  #define SSL_ST_RENEGOTIATE (0x04 | SSL_ST_INIT)
2980
+ #define SSL_ST_TLS13 (0x05 | SSL_ST_INIT)
2981
+ #define SSL_ST_ERROR (0x06| SSL_ST_INIT)
2788
2982
 
2789
2983
  /* SSL_CB_* are possible values for the |type| parameter in the info
2790
2984
  * callback and the bitmasks that make them up. */
@@ -2879,10 +3073,9 @@ OPENSSL_EXPORT SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx);
2879
3073
  * respectively. */
2880
3074
  OPENSSL_EXPORT int SSL_get_shutdown(const SSL *ssl);
2881
3075
 
2882
- /* SSL_get_server_key_exchange_hash, on a client, returns the hash the server
2883
- * used to sign the ServerKeyExchange in TLS 1.2. If not applicable, it returns
2884
- * |TLSEXT_hash_none|. */
2885
- OPENSSL_EXPORT uint8_t SSL_get_server_key_exchange_hash(const SSL *ssl);
3076
+ /* SSL_get_peer_signature_algorithm returns the signature algorithm used by the
3077
+ * peer. If not applicable, it returns zero. */
3078
+ OPENSSL_EXPORT uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl);
2886
3079
 
2887
3080
  /* SSL_get_client_random writes up to |max_out| bytes of the most recent
2888
3081
  * handshake's client_random to |out| and returns the number of bytes written.
@@ -2908,6 +3101,10 @@ OPENSSL_EXPORT const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl);
2908
3101
  OPENSSL_EXPORT void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx,
2909
3102
  int enable);
2910
3103
 
3104
+ /* SSL_CTX_set_grease_enabled configures whether client sockets on |ctx| should
3105
+ * enable GREASE. See draft-davidben-tls-grease-01. */
3106
+ OPENSSL_EXPORT void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled);
3107
+
2911
3108
 
2912
3109
  /* Deprecated functions. */
2913
3110
 
@@ -2948,8 +3145,9 @@ OPENSSL_EXPORT const char *SSL_COMP_get_name(const COMP_METHOD *comp);
2948
3145
  OPENSSL_EXPORT const SSL_METHOD *SSLv23_method(void);
2949
3146
 
2950
3147
  /* These version-specific methods behave exactly like |TLS_method| and
2951
- * |DTLS_method| except they also call |SSL_CTX_set_min_version| and
2952
- * |SSL_CTX_set_max_version| to lock connections to that protocol version. */
3148
+ * |DTLS_method| except they also call |SSL_CTX_set_min_proto_version| and
3149
+ * |SSL_CTX_set_max_proto_version| to lock connections to that protocol
3150
+ * version. */
2953
3151
  OPENSSL_EXPORT const SSL_METHOD *SSLv3_method(void);
2954
3152
  OPENSSL_EXPORT const SSL_METHOD *TLSv1_method(void);
2955
3153
  OPENSSL_EXPORT const SSL_METHOD *TLSv1_1_method(void);
@@ -2959,6 +3157,8 @@ OPENSSL_EXPORT const SSL_METHOD *DTLSv1_2_method(void);
2959
3157
 
2960
3158
  /* These client- and server-specific methods call their corresponding generic
2961
3159
  * methods. */
3160
+ OPENSSL_EXPORT const SSL_METHOD *TLS_server_method(void);
3161
+ OPENSSL_EXPORT const SSL_METHOD *TLS_client_method(void);
2962
3162
  OPENSSL_EXPORT const SSL_METHOD *SSLv23_server_method(void);
2963
3163
  OPENSSL_EXPORT const SSL_METHOD *SSLv23_client_method(void);
2964
3164
  OPENSSL_EXPORT const SSL_METHOD *SSLv3_server_method(void);
@@ -3061,6 +3261,10 @@ OPENSSL_EXPORT int SSL_renegotiate(SSL *ssl);
3061
3261
  /* SSL_set_state does nothing. */
3062
3262
  OPENSSL_EXPORT void SSL_set_state(SSL *ssl, int state);
3063
3263
 
3264
+ /* SSL_get_shared_ciphers writes an empty string to |buf| and returns a
3265
+ * pointer to |buf|, or NULL if |len| is less than or equal to zero. */
3266
+ OPENSSL_EXPORT char *SSL_get_shared_ciphers(const SSL *ssl, char *buf, int len);
3267
+
3064
3268
  /* SSL_MODE_HANDSHAKE_CUTTHROUGH is the same as SSL_MODE_ENABLE_FALSE_START. */
3065
3269
  #define SSL_MODE_HANDSHAKE_CUTTHROUGH SSL_MODE_ENABLE_FALSE_START
3066
3270
 
@@ -3119,6 +3323,9 @@ OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_compression(SSL *s);
3119
3323
  /* SSL_get_current_expansion returns NULL. */
3120
3324
  OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_expansion(SSL *s);
3121
3325
 
3326
+ /* SSL_get_server_tmp_key returns zero. */
3327
+ OPENSSL_EXPORT int *SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key);
3328
+
3122
3329
  #define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char *)arg))
3123
3330
  #define SSL_get_app_data(s) (SSL_get_ex_data(s, 0))
3124
3331
  #define SSL_SESSION_set_app_data(s, a) \
@@ -3133,16 +3340,16 @@ OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_expansion(SSL *s);
3133
3340
 
3134
3341
  #define SSL_get_cipher(ssl) SSL_CIPHER_get_name(SSL_get_current_cipher(ssl))
3135
3342
  #define SSL_get_cipher_bits(ssl, out_alg_bits) \
3136
- SSL_CIPHER_get_bits(SSL_get_current_cipher(ssl), out_alg_bits)
3343
+ SSL_CIPHER_get_bits(SSL_get_current_cipher(ssl), out_alg_bits)
3137
3344
  #define SSL_get_cipher_version(ssl) \
3138
- SSL_CIPHER_get_version(SSL_get_current_cipher(ssl))
3345
+ SSL_CIPHER_get_version(SSL_get_current_cipher(ssl))
3139
3346
  #define SSL_get_cipher_name(ssl) \
3140
- SSL_CIPHER_get_name(SSL_get_current_cipher(ssl))
3347
+ SSL_CIPHER_get_name(SSL_get_current_cipher(ssl))
3141
3348
  #define SSL_get_time(session) SSL_SESSION_get_time(session)
3142
3349
  #define SSL_set_time(session, time) SSL_SESSION_set_time((session), (time))
3143
3350
  #define SSL_get_timeout(session) SSL_SESSION_get_timeout(session)
3144
3351
  #define SSL_set_timeout(session, timeout) \
3145
- SSL_SESSION_set_timeout((session), (timeout))
3352
+ SSL_SESSION_set_timeout((session), (timeout))
3146
3353
 
3147
3354
  typedef struct ssl_comp_st SSL_COMP;
3148
3355
 
@@ -3154,15 +3361,6 @@ struct ssl_comp_st {
3154
3361
 
3155
3362
  DECLARE_STACK_OF(SSL_COMP)
3156
3363
 
3157
- /* The following flags toggle individual protocol versions. This is deprecated.
3158
- * Use |SSL_CTX_set_min_version| and |SSL_CTX_set_max_version| instead. */
3159
- #define SSL_OP_NO_SSLv3 0x02000000L
3160
- #define SSL_OP_NO_TLSv1 0x04000000L
3161
- #define SSL_OP_NO_TLSv1_2 0x08000000L
3162
- #define SSL_OP_NO_TLSv1_1 0x10000000L
3163
- #define SSL_OP_NO_DTLSv1 SSL_OP_NO_TLSv1
3164
- #define SSL_OP_NO_DTLSv1_2 SSL_OP_NO_TLSv1_2
3165
-
3166
3364
  /* The following flags do nothing and are included only to make it easier to
3167
3365
  * compile code with BoringSSL. */
3168
3366
  #define SSL_MODE_AUTO_RETRY 0
@@ -3195,7 +3393,7 @@ DECLARE_STACK_OF(SSL_COMP)
3195
3393
  #define SSL_OP_TLS_ROLLBACK_BUG 0
3196
3394
  #define SSL_VERIFY_CLIENT_ONCE 0
3197
3395
 
3198
- /* SSL_cache_hit calls |SSL_session_resumed|. */
3396
+ /* SSL_cache_hit calls |SSL_session_reused|. */
3199
3397
  OPENSSL_EXPORT int SSL_cache_hit(SSL *ssl);
3200
3398
 
3201
3399
  /* SSL_get_default_timeout returns |SSL_DEFAULT_SESSION_TIMEOUT|. */
@@ -3286,6 +3484,7 @@ OPENSSL_EXPORT const char *SSL_alert_desc_string(int value);
3286
3484
  #define SSL_TXT_kDHE "kDHE"
3287
3485
  #define SSL_TXT_kEDH "kEDH"
3288
3486
  #define SSL_TXT_kECDHE "kECDHE"
3487
+ #define SSL_TXT_kCECPQ1 "kCECPQ1"
3289
3488
  #define SSL_TXT_kEECDH "kEECDH"
3290
3489
  #define SSL_TXT_kPSK "kPSK"
3291
3490
  #define SSL_TXT_aRSA "aRSA"
@@ -3316,6 +3515,7 @@ OPENSSL_EXPORT const char *SSL_alert_desc_string(int value);
3316
3515
  #define SSL_TXT_TLSV1 "TLSv1"
3317
3516
  #define SSL_TXT_TLSV1_1 "TLSv1.1"
3318
3517
  #define SSL_TXT_TLSV1_2 "TLSv1.2"
3518
+ #define SSL_TXT_TLSV1_3 "TLSv1.3"
3319
3519
  #define SSL_TXT_ALL "ALL"
3320
3520
  #define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT"
3321
3521
 
@@ -3351,6 +3551,43 @@ OPENSSL_EXPORT int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key);
3351
3551
  * |ec_key|'s curve. */
3352
3552
  OPENSSL_EXPORT int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key);
3353
3553
 
3554
+ /* SSL_add_dir_cert_subjects_to_stack lists files in directory |dir|. It calls
3555
+ * |SSL_add_file_cert_subjects_to_stack| on each file and returns one on success
3556
+ * or zero on error. This function is only available from the libdecrepit
3557
+ * library. */
3558
+ OPENSSL_EXPORT int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *out,
3559
+ const char *dir);
3560
+
3561
+ /* SSL_set_private_key_digest_prefs copies |num_digests| NIDs from |digest_nids|
3562
+ * into |ssl|. These digests will be used, in decreasing order of preference,
3563
+ * when signing with |ssl|'s private key. It returns one on success and zero on
3564
+ * error.
3565
+ *
3566
+ * Use |SSL_set_signing_algorithm_prefs| instead.
3567
+ *
3568
+ * TODO(davidben): Remove this API when callers have been updated. */
3569
+ OPENSSL_EXPORT int SSL_set_private_key_digest_prefs(SSL *ssl,
3570
+ const int *digest_nids,
3571
+ size_t num_digests);
3572
+
3573
+ /* SSL_set_verify_result calls |abort| unless |result| is |X509_V_OK|.
3574
+ *
3575
+ * TODO(davidben): Remove this function once it has been removed from
3576
+ * netty-tcnative. */
3577
+ OPENSSL_EXPORT void SSL_set_verify_result(SSL *ssl, long result);
3578
+
3579
+ /* SSL_CTX_set_min_version calls |SSL_CTX_set_min_proto_version|. */
3580
+ OPENSSL_EXPORT int SSL_CTX_set_min_version(SSL_CTX *ctx, uint16_t version);
3581
+
3582
+ /* SSL_CTX_set_max_version calls |SSL_CTX_set_max_proto_version|. */
3583
+ OPENSSL_EXPORT int SSL_CTX_set_max_version(SSL_CTX *ctx, uint16_t version);
3584
+
3585
+ /* SSL_set_min_version calls |SSL_set_min_proto_version|. */
3586
+ OPENSSL_EXPORT int SSL_set_min_version(SSL *ssl, uint16_t version);
3587
+
3588
+ /* SSL_set_max_version calls |SSL_set_max_proto_version|. */
3589
+ OPENSSL_EXPORT int SSL_set_max_version(SSL *ssl, uint16_t version);
3590
+
3354
3591
 
3355
3592
  /* Private structures.
3356
3593
  *
@@ -3360,6 +3597,7 @@ OPENSSL_EXPORT int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key);
3360
3597
  typedef struct ssl_protocol_method_st SSL_PROTOCOL_METHOD;
3361
3598
  typedef struct ssl3_enc_method SSL3_ENC_METHOD;
3362
3599
  typedef struct ssl_aead_ctx_st SSL_AEAD_CTX;
3600
+ typedef struct ssl_handshake_st SSL_HANDSHAKE;
3363
3601
 
3364
3602
  struct ssl_cipher_st {
3365
3603
  /* name is the OpenSSL name for the cipher. */
@@ -3395,12 +3633,13 @@ struct ssl_session_st {
3395
3633
  * that controls the confidentiality of the connection. Its interpretation
3396
3634
  * depends on the primitive that was used; as specified by the cipher suite:
3397
3635
  * DHE: the size, in bits, of the multiplicative group.
3398
- * RSA: the size, in bits, of the modulus.
3399
3636
  * ECDHE: the TLS id for the curve.
3400
3637
  *
3401
3638
  * A zero indicates that the value is unknown. */
3402
3639
  uint32_t key_exchange_info;
3403
3640
 
3641
+ /* master_key, in TLS 1.2 and below, is the master secret associated with the
3642
+ * session. In TLS 1.3 and up, it is the resumption secret. */
3404
3643
  int master_key_length;
3405
3644
  uint8_t master_key[SSL_MAX_MASTER_KEY_LENGTH];
3406
3645
 
@@ -3422,9 +3661,9 @@ struct ssl_session_st {
3422
3661
  * |peer|, but when a server it does not. */
3423
3662
  STACK_OF(X509) *cert_chain;
3424
3663
 
3425
- /* when app_verify_callback accepts a session where the peer's certificate is
3426
- * not ok, we must remember the error for session reuse: */
3427
- long verify_result; /* only for servers */
3664
+ /* verify_result is the result of certificate verification in the case of
3665
+ * non-fatal certificate errors. */
3666
+ long verify_result;
3428
3667
 
3429
3668
  long timeout;
3430
3669
  long time;
@@ -3461,6 +3700,9 @@ struct ssl_session_st {
3461
3700
 
3462
3701
  uint32_t tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */
3463
3702
 
3703
+ uint32_t ticket_flags;
3704
+ uint32_t ticket_age_add;
3705
+
3464
3706
  /* extended_master_secret is true if the master secret in this session was
3465
3707
  * generated using EMS and thus isn't vulnerable to the Triple Handshake
3466
3708
  * attack. */
@@ -3469,10 +3711,11 @@ struct ssl_session_st {
3469
3711
  /* peer_sha256_valid is non-zero if |peer_sha256| is valid. */
3470
3712
  unsigned peer_sha256_valid:1; /* Non-zero if peer_sha256 is valid */
3471
3713
 
3472
- /* not_resumable is used to indicate that session resumption is not allowed.
3473
- * Applications can also set this bit for a new session via
3474
- * not_resumable_session_cb to disable session caching and tickets. */
3714
+ /* not_resumable is used to indicate that session resumption is disallowed. */
3475
3715
  unsigned not_resumable:1;
3716
+
3717
+ /* ticket_age_add_valid is non-zero if |ticket_age_add| is valid. */
3718
+ unsigned ticket_age_add_valid:1;
3476
3719
  };
3477
3720
 
3478
3721
  /* ssl_cipher_preference_list_st contains a list of SSL_CIPHERs with
@@ -3519,12 +3762,12 @@ struct ssl_ctx_st {
3519
3762
  /* lock is used to protect various operations on this object. */
3520
3763
  CRYPTO_MUTEX lock;
3521
3764
 
3522
- /* max_version is the maximum acceptable protocol version. If zero, the
3523
- * maximum supported version, currently (D)TLS 1.2, is used. */
3765
+ /* max_version is the maximum acceptable protocol version. Note this version
3766
+ * is normalized in DTLS. */
3524
3767
  uint16_t max_version;
3525
3768
 
3526
- /* min_version is the minimum acceptable protocl version. If zero, the
3527
- * minimum supported version, currently SSL 3.0 and DTLS 1.0, is used */
3769
+ /* min_version is the minimum acceptable protocol version. Note this version
3770
+ * is normalized in DTLS. */
3528
3771
  uint16_t min_version;
3529
3772
 
3530
3773
  struct ssl_cipher_preference_list_st *cipher_list;
@@ -3718,9 +3961,9 @@ struct ssl_ctx_st {
3718
3961
  /* SRTP profiles we are willing to do from RFC 5764 */
3719
3962
  STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
3720
3963
 
3721
- /* EC extension values inherited by SSL structure */
3722
- size_t tlsext_ellipticcurvelist_length;
3723
- uint16_t *tlsext_ellipticcurvelist;
3964
+ /* Supported group values inherited by SSL structure */
3965
+ size_t supported_group_list_len;
3966
+ uint16_t *supported_group_list;
3724
3967
 
3725
3968
  /* The client's Channel ID private key. */
3726
3969
  EVP_PKEY *tlsext_channel_id_private;
@@ -3738,7 +3981,8 @@ struct ssl_ctx_st {
3738
3981
  void (*keylog_callback)(const SSL *ssl, const char *line);
3739
3982
 
3740
3983
  /* current_time_cb, if not NULL, is the function to use to get the current
3741
- * time. It sets |*out_clock| to the current time. */
3984
+ * time. It sets |*out_clock| to the current time. See
3985
+ * |SSL_CTX_set_current_time_cb|. */
3742
3986
  void (*current_time_cb)(const SSL *ssl, struct timeval *out_clock);
3743
3987
 
3744
3988
  /* quiet_shutdown is true if the connection should not send a close_notify on
@@ -3752,11 +3996,15 @@ struct ssl_ctx_st {
3752
3996
  /* If true, a client will request certificate timestamps. */
3753
3997
  unsigned signed_cert_timestamps_enabled:1;
3754
3998
 
3755
- /* tlsext_channel_id_enabled is copied from the |SSL_CTX|. For a server,
3756
- * means that we'll accept Channel IDs from clients. For a client, means that
3757
- * we'll advertise support. */
3999
+ /* tlsext_channel_id_enabled is one if Channel ID is enabled and zero
4000
+ * otherwise. For a server, means that we'll accept Channel IDs from clients.
4001
+ * For a client, means that we'll advertise support. */
3758
4002
  unsigned tlsext_channel_id_enabled:1;
3759
4003
 
4004
+ /* grease_enabled is one if draft-davidben-tls-grease-01 is enabled and zero
4005
+ * otherwise. */
4006
+ unsigned grease_enabled:1;
4007
+
3760
4008
  /* extra_certs is a dummy value included for compatibility.
3761
4009
  * TODO(agl): remove once node.js no longer references this. */
3762
4010
  STACK_OF(X509)* extra_certs;
@@ -3764,20 +4012,25 @@ struct ssl_ctx_st {
3764
4012
  };
3765
4013
 
3766
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
+
3767
4019
  /* version is the protocol version. */
3768
4020
  int version;
3769
4021
 
3770
- /* max_version is the maximum acceptable protocol version. If zero, the
3771
- * maximum supported version, currently (D)TLS 1.2, is used. */
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. */
3772
4027
  uint16_t max_version;
3773
4028
 
3774
- /* min_version is the minimum acceptable protocl version. If zero, the
3775
- * minimum supported version, currently SSL 3.0 and DTLS 1.0, is used */
4029
+ /* min_version is the minimum acceptable protocol version. Note this version
4030
+ * is normalized in DTLS. */
3776
4031
  uint16_t min_version;
3777
4032
 
3778
- /* method is the method table corresponding to the current protocol (DTLS or
3779
- * TLS). */
3780
- const SSL_PROTOCOL_METHOD *method;
4033
+ uint16_t max_send_fragment;
3781
4034
 
3782
4035
  /* There are 2 BIO's even though they are normally both the same. This is so
3783
4036
  * data can be read and written to different handlers */
@@ -3786,7 +4039,9 @@ struct ssl_st {
3786
4039
  BIO *wbio; /* used by SSL_write */
3787
4040
 
3788
4041
  /* bbio, if non-NULL, is a buffer placed in front of |wbio| to pack handshake
3789
- * messages within one flight into a single |BIO_write|.
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|.
3790
4045
  *
3791
4046
  * TODO(davidben): This does not work right for DTLS. It assumes the MTU is
3792
4047
  * smaller than the buffer size so that the buffer's internal flushing never
@@ -3796,21 +4051,16 @@ struct ssl_st {
3796
4051
 
3797
4052
  int (*handshake_func)(SSL *);
3798
4053
 
3799
- /* Imagine that here's a boolean member "init" that is switched as soon as
3800
- * SSL_set_{accept/connect}_state is called for the first time, so that
3801
- * "state" and "handshake_func" are properly initialized. But as
3802
- * handshake_func is == 0 until then, we use this test instead of an "init"
3803
- * member. */
4054
+ BUF_MEM *init_buf; /* buffer used during init */
3804
4055
 
3805
- int shutdown; /* we have shut things down, 0x01 sent, 0x02
3806
- * for received */
3807
- int state; /* where we are */
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;
3808
4060
 
3809
- BUF_MEM *init_buf; /* buffer used during init */
3810
- uint8_t *init_msg; /* pointer to handshake message body, set by
3811
- ssl3_get_message() */
3812
- int init_num; /* amount read/written */
3813
- int init_off; /* amount read/written */
4061
+ /* init_off, in DTLS, is the number of bytes of the current message that have
4062
+ * been written. */
4063
+ uint32_t init_off;
3814
4064
 
3815
4065
  struct ssl3_state_st *s3; /* SSLv3 variables */
3816
4066
  struct dtls1_state_st *d1; /* DTLSv1 variables */
@@ -3837,12 +4087,17 @@ struct ssl_st {
3837
4087
  * needs re-doing when in SSL_accept or SSL_connect */
3838
4088
  int rwstate;
3839
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
+
3840
4094
  /* the session_id_context is used to ensure sessions are only reused
3841
4095
  * in the appropriate context */
3842
4096
  unsigned int sid_ctx_length;
3843
4097
  uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH];
3844
4098
 
3845
- /* This can also be in the session once a session is established */
4099
+ /* session is the configured session to be offered by the client. This session
4100
+ * is immutable. */
3846
4101
  SSL_SESSION *session;
3847
4102
 
3848
4103
  int (*verify_callback)(int ok,
@@ -3864,7 +4119,6 @@ struct ssl_st {
3864
4119
  SSL_CTX *ctx;
3865
4120
 
3866
4121
  /* extra application data */
3867
- long verify_result;
3868
4122
  CRYPTO_EX_DATA ex_data;
3869
4123
 
3870
4124
  /* for server side, keep the list of CA_dn we can use */
@@ -3875,12 +4129,9 @@ struct ssl_st {
3875
4129
  uint32_t max_cert_list;
3876
4130
  int client_version; /* what was passed, used for
3877
4131
  * SSLv3/TLS rollback check */
3878
- uint16_t max_send_fragment;
3879
4132
  char *tlsext_hostname;
3880
- /* RFC4507 session ticket expected to be received or sent */
3881
- int tlsext_ticket_expected;
3882
- size_t tlsext_ellipticcurvelist_length;
3883
- uint16_t *tlsext_ellipticcurvelist; /* our list */
4133
+ size_t supported_group_list_len;
4134
+ uint16_t *supported_group_list; /* our list */
3884
4135
 
3885
4136
  SSL_CTX *initial_ctx; /* initial ctx, used to store sessions */
3886
4137
 
@@ -3903,22 +4154,9 @@ struct ssl_st {
3903
4154
  /* renegotiate_mode controls how peer renegotiation attempts are handled. */
3904
4155
  enum ssl_renegotiate_mode_t renegotiate_mode;
3905
4156
 
3906
- /* These fields are always NULL and exist only to keep wpa_supplicant happy
3907
- * about the change to EVP_AEAD. They are only needed for EAP-FAST, which we
3908
- * don't support. */
3909
- EVP_CIPHER_CTX *enc_read_ctx;
3910
- EVP_MD_CTX *read_hash;
3911
-
3912
- /* in_handshake is non-zero when we are actually in SSL_accept() or
3913
- * SSL_connect() */
3914
- int in_handshake;
3915
-
3916
4157
  /* verify_mode is a bitmask of |SSL_VERIFY_*| values. */
3917
4158
  uint8_t verify_mode;
3918
4159
 
3919
- /* hit is true if this connection is resuming a previous session. */
3920
- unsigned hit:1;
3921
-
3922
4160
  /* server is true iff the this SSL* is the server half. Note: before the SSL*
3923
4161
  * is initialized by either SSL_set_accept_state or SSL_set_connect_state,
3924
4162
  * the side is not determined. In this state, server is always false. */
@@ -3940,6 +4178,9 @@ struct ssl_st {
3940
4178
  * we'll advertise support. */
3941
4179
  unsigned tlsext_channel_id_enabled:1;
3942
4180
 
4181
+ /* RFC4507 session ticket expected to be received or sent */
4182
+ unsigned tlsext_ticket_expected:1;
4183
+
3943
4184
  /* TODO(agl): remove once node.js not longer references this. */
3944
4185
  int tlsext_status_type;
3945
4186
  };
@@ -3964,6 +4205,14 @@ typedef struct ssl3_buffer_st {
3964
4205
  uint16_t cap;
3965
4206
  } SSL3_BUFFER;
3966
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
+
3967
4216
  typedef struct ssl3_state_st {
3968
4217
  uint8_t read_sequence[8];
3969
4218
  uint8_t write_sequence[8];
@@ -3973,11 +4222,15 @@ typedef struct ssl3_state_st {
3973
4222
 
3974
4223
  /* have_version is true if the connection's final version is known. Otherwise
3975
4224
  * the version has not been negotiated yet. */
3976
- char have_version;
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;
3977
4230
 
3978
4231
  /* initial_handshake_complete is true if the initial handshake has
3979
4232
  * completed. */
3980
- char initial_handshake_complete;
4233
+ unsigned initial_handshake_complete:1;
3981
4234
 
3982
4235
  /* read_buffer holds data from the transport to be processed. */
3983
4236
  SSL3_BUFFER read_buffer;
@@ -3986,10 +4239,6 @@ typedef struct ssl3_state_st {
3986
4239
 
3987
4240
  SSL3_RECORD rrec; /* each decoded record goes in here */
3988
4241
 
3989
- /* hello_request_len is the number of bytes of HelloRequest received, possibly
3990
- * split over multiple records. */
3991
- uint8_t hello_request_len;
3992
-
3993
4242
  /* partial write - check the numbers match */
3994
4243
  unsigned int wnum; /* number of bytes sent so far */
3995
4244
  int wpend_tot; /* number bytes written */
@@ -4006,10 +4255,13 @@ typedef struct ssl3_state_st {
4006
4255
  * the handshake hash for TLS 1.1 and below. */
4007
4256
  EVP_MD_CTX handshake_md5;
4008
4257
 
4009
- int warn_alert;
4010
- int fatal_alert;
4011
- /* we allow one fatal and one warning alert to be outstanding, send close
4012
- * alert via the warning alert */
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
+
4013
4265
  int alert_dispatch;
4014
4266
  uint8_t send_alert[2];
4015
4267
 
@@ -4022,6 +4274,9 @@ typedef struct ssl3_state_st {
4022
4274
  * received. */
4023
4275
  uint8_t warning_alert_count;
4024
4276
 
4277
+ /* key_update_count is the number of consecutive KeyUpdates received. */
4278
+ uint8_t key_update_count;
4279
+
4025
4280
  /* aead_read_ctx is the current read cipher state. */
4026
4281
  SSL_AEAD_CTX *aead_read_ctx;
4027
4282
 
@@ -4032,18 +4287,31 @@ typedef struct ssl3_state_st {
4032
4287
  * version. */
4033
4288
  const SSL3_ENC_METHOD *enc_method;
4034
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
+
4035
4305
  /* State pertaining to the pending handshake.
4036
4306
  *
4037
- * TODO(davidben): State is current spread all over the place. Move
4038
- * pending handshake state here so it can be managed separately from
4039
- * established connection state in case of renegotiations. */
4307
+ * TODO(davidben): Move everything not needed after the handshake completes to
4308
+ * |hs| and remove this. */
4040
4309
  struct {
4041
4310
  uint8_t finish_md[EVP_MAX_MD_SIZE];
4042
- int finish_md_len;
4311
+ uint8_t finish_md_len;
4043
4312
  uint8_t peer_finish_md[EVP_MAX_MD_SIZE];
4044
- int peer_finish_md_len;
4313
+ uint8_t peer_finish_md_len;
4045
4314
 
4046
- unsigned long message_size;
4047
4315
  int message_type;
4048
4316
 
4049
4317
  /* used to hold the new cipher we are going to use */
@@ -4075,19 +4343,10 @@ typedef struct ssl3_state_st {
4075
4343
  uint16_t received;
4076
4344
  } custom_extensions;
4077
4345
 
4078
- /* SNI extension */
4079
-
4080
4346
  /* should_ack_sni is used by a server and indicates that the SNI extension
4081
4347
  * should be echoed in the ServerHello. */
4082
4348
  unsigned should_ack_sni:1;
4083
4349
 
4084
-
4085
- /* Client-only: cert_req determines if a client certificate is to be sent.
4086
- * This is 0 if no client Certificate message is to be sent, 1 if there is
4087
- * a client certificate, and 2 to send an empty client Certificate
4088
- * message. */
4089
- int cert_req;
4090
-
4091
4350
  /* Client-only: ca_names contains the list of CAs received in a
4092
4351
  * CertificateRequest message. */
4093
4352
  STACK_OF(X509_NAME) *ca_names;
@@ -4104,9 +4363,9 @@ typedef struct ssl3_state_st {
4104
4363
  uint8_t new_key_len;
4105
4364
  uint8_t new_fixed_iv_len;
4106
4365
 
4107
- /* Server-only: cert_request is true if a client certificate was
4108
- * requested. */
4109
- int cert_request;
4366
+ /* cert_request is true if a client certificate was requested and false
4367
+ * otherwise. */
4368
+ unsigned cert_request:1;
4110
4369
 
4111
4370
  /* certificate_status_expected is true if OCSP stapling was negotiated and
4112
4371
  * the server is expected to send a CertificateStatus message. (This is
@@ -4116,11 +4375,11 @@ typedef struct ssl3_state_st {
4116
4375
  /* ocsp_stapling_requested is true if a client requested OCSP stapling. */
4117
4376
  unsigned ocsp_stapling_requested:1;
4118
4377
 
4119
- /* Server-only: peer_ellipticcurvelist contains the EC curve IDs advertised
4120
- * by the peer. This is only set on the server's end. The server does not
4121
- * advertise this extension to the client. */
4122
- uint16_t *peer_ellipticcurvelist;
4123
- size_t peer_ellipticcurvelist_length;
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;
4124
4383
 
4125
4384
  /* extended_master_secret indicates whether the extended master secret
4126
4385
  * computation is used in this handshake. Note that this is different from
@@ -4130,22 +4389,13 @@ typedef struct ssl3_state_st {
4130
4389
  * didn't use it to create the master secret initially. */
4131
4390
  char extended_master_secret;
4132
4391
 
4133
- /* Client-only: peer_psk_identity_hint is the psk_identity_hint sent by the
4134
- * server when using a PSK key exchange. */
4135
- char *peer_psk_identity_hint;
4136
-
4137
- /* new_mac_secret_size is unused and exists only until wpa_supplicant can
4138
- * be updated. It is only needed for EAP-FAST, which we don't support. */
4139
- uint8_t new_mac_secret_size;
4140
-
4141
4392
  /* Client-only: in_false_start is one if there is a pending handshake in
4142
4393
  * False Start. The client may write data at this point. */
4143
4394
  char in_false_start;
4144
4395
 
4145
- /* server_key_exchange_hash, on a client, is the hash the server used to
4146
- * sign the ServerKeyExchange in TLS 1.2. If not applicable, it is
4147
- * |TLSEXT_hash_none|. */
4148
- uint8_t server_key_exchange_hash;
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;
4149
4399
 
4150
4400
  /* ecdh_ctx is the current ECDH instance. */
4151
4401
  SSL_ECDH_CTX ecdh_ctx;
@@ -4153,14 +4403,31 @@ typedef struct ssl3_state_st {
4153
4403
  /* peer_key is the peer's ECDH key. */
4154
4404
  uint8_t *peer_key;
4155
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;
4156
4411
  } tmp;
4157
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
+
4158
4425
  /* Connection binding to prevent renegotiation attacks */
4159
4426
  uint8_t previous_client_finished[EVP_MAX_MD_SIZE];
4160
4427
  uint8_t previous_client_finished_len;
4161
4428
  uint8_t previous_server_finished[EVP_MAX_MD_SIZE];
4162
4429
  uint8_t previous_server_finished_len;
4163
- int send_connection_binding; /* TODOEKR */
4430
+ int send_connection_binding;
4164
4431
 
4165
4432
  /* Set if we saw the Next Protocol Negotiation extension from our peer. */
4166
4433
  int next_proto_neg_seen;
@@ -4196,21 +4463,6 @@ typedef struct ssl3_state_st {
4196
4463
  } SSL3_STATE;
4197
4464
 
4198
4465
 
4199
- /* Android compatibility section (hidden).
4200
- *
4201
- * These functions are declared, temporarily, for Android because
4202
- * wpa_supplicant will take a little time to sync with upstream. Outside of
4203
- * Android they'll have no definition. */
4204
-
4205
- #define SSL_F_SSL_SET_SESSION_TICKET_EXT doesnt_exist
4206
-
4207
- OPENSSL_EXPORT int SSL_set_session_ticket_ext(SSL *s, void *ext_data,
4208
- int ext_len);
4209
- OPENSSL_EXPORT int SSL_set_session_secret_cb(SSL *s, void *cb, void *arg);
4210
- OPENSSL_EXPORT int SSL_set_session_ticket_ext_cb(SSL *s, void *cb, void *arg);
4211
- OPENSSL_EXPORT int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
4212
-
4213
-
4214
4466
  /* Nodejs compatibility section (hidden).
4215
4467
  *
4216
4468
  * These defines exist for node.js, with the hope that we can eliminate the
@@ -4227,7 +4479,12 @@ OPENSSL_EXPORT int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
4227
4479
  *
4228
4480
  * Although using either the CTRL values or their wrapper macros in #ifdefs is
4229
4481
  * still supported, the CTRL values may not be passed to |SSL_ctrl| and
4230
- * |SSL_CTX_ctrl|. Call the functions (previously wrapper macros) instead. */
4482
+ * |SSL_CTX_ctrl|. Call the functions (previously wrapper macros) instead.
4483
+ *
4484
+ * See PORTING.md in the BoringSSL source tree for a table of corresponding
4485
+ * functions.
4486
+ * https://boringssl.googlesource.com/boringssl/+/master/PORTING.md#Replacements-for-values
4487
+ */
4231
4488
 
4232
4489
  #define DTLS_CTRL_GET_TIMEOUT doesnt_exist
4233
4490
  #define DTLS_CTRL_HANDLE_TIMEOUT doesnt_exist
@@ -4354,6 +4611,19 @@ OPENSSL_EXPORT int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
4354
4611
 
4355
4612
  #if defined(__cplusplus)
4356
4613
  } /* extern C */
4614
+
4615
+ extern "C++" {
4616
+
4617
+ namespace bssl {
4618
+
4619
+ BORINGSSL_MAKE_DELETER(SSL, SSL_free)
4620
+ BORINGSSL_MAKE_DELETER(SSL_CTX, SSL_CTX_free)
4621
+ BORINGSSL_MAKE_DELETER(SSL_SESSION, SSL_SESSION_free)
4622
+
4623
+ } // namespace bssl
4624
+
4625
+ } /* extern C++ */
4626
+
4357
4627
  #endif
4358
4628
 
4359
4629
  #define SSL_R_APP_DATA_IN_HANDSHAKE 100
@@ -4506,6 +4776,22 @@ OPENSSL_EXPORT int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
4506
4776
  #define SSL_R_WRONG_VERSION_NUMBER 247
4507
4777
  #define SSL_R_X509_LIB 248
4508
4778
  #define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 249
4779
+ #define SSL_R_SHUTDOWN_WHILE_IN_INIT 250
4780
+ #define SSL_R_INVALID_OUTER_RECORD_TYPE 251
4781
+ #define SSL_R_UNSUPPORTED_PROTOCOL_FOR_CUSTOM_KEY 252
4782
+ #define SSL_R_NO_COMMON_SIGNATURE_ALGORITHMS 253
4783
+ #define SSL_R_DOWNGRADE_DETECTED 254
4784
+ #define SSL_R_BUFFERED_MESSAGES_ON_CIPHER_CHANGE 255
4785
+ #define SSL_R_INVALID_COMPRESSION_LIST 256
4786
+ #define SSL_R_DUPLICATE_EXTENSION 257
4787
+ #define SSL_R_MISSING_KEY_SHARE 258
4788
+ #define SSL_R_INVALID_ALPN_PROTOCOL 259
4789
+ #define SSL_R_TOO_MANY_KEY_UPDATES 260
4790
+ #define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 261
4791
+ #define SSL_R_NO_CIPHERS_SPECIFIED 262
4792
+ #define SSL_R_RENEGOTIATION_EMS_MISMATCH 263
4793
+ #define SSL_R_DUPLICATE_KEY_SHARE 264
4794
+ #define SSL_R_NO_GROUPS_SPECIFIED 265
4509
4795
  #define SSL_R_SSLV3_ALERT_CLOSE_NOTIFY 1000
4510
4796
  #define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010
4511
4797
  #define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020