grpc-z 1.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1318) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +1 -0
  3. data/Makefile +23896 -0
  4. data/etc/roots.pem +4475 -0
  5. data/include/grpc/byte_buffer.h +27 -0
  6. data/include/grpc/byte_buffer_reader.h +26 -0
  7. data/include/grpc/census.h +40 -0
  8. data/include/grpc/compression.h +75 -0
  9. data/include/grpc/fork.h +26 -0
  10. data/include/grpc/grpc.h +469 -0
  11. data/include/grpc/grpc_cronet.h +38 -0
  12. data/include/grpc/grpc_posix.h +67 -0
  13. data/include/grpc/grpc_security.h +495 -0
  14. data/include/grpc/grpc_security_constants.h +107 -0
  15. data/include/grpc/impl/codegen/atm.h +95 -0
  16. data/include/grpc/impl/codegen/atm_gcc_atomic.h +91 -0
  17. data/include/grpc/impl/codegen/atm_gcc_sync.h +83 -0
  18. data/include/grpc/impl/codegen/atm_windows.h +126 -0
  19. data/include/grpc/impl/codegen/byte_buffer.h +88 -0
  20. data/include/grpc/impl/codegen/byte_buffer_reader.h +42 -0
  21. data/include/grpc/impl/codegen/compression_types.h +107 -0
  22. data/include/grpc/impl/codegen/connectivity_state.h +44 -0
  23. data/include/grpc/impl/codegen/fork.h +48 -0
  24. data/include/grpc/impl/codegen/gpr_slice.h +69 -0
  25. data/include/grpc/impl/codegen/gpr_types.h +59 -0
  26. data/include/grpc/impl/codegen/grpc_types.h +669 -0
  27. data/include/grpc/impl/codegen/port_platform.h +507 -0
  28. data/include/grpc/impl/codegen/propagation_bits.h +52 -0
  29. data/include/grpc/impl/codegen/slice.h +147 -0
  30. data/include/grpc/impl/codegen/status.h +153 -0
  31. data/include/grpc/impl/codegen/sync.h +63 -0
  32. data/include/grpc/impl/codegen/sync_custom.h +38 -0
  33. data/include/grpc/impl/codegen/sync_generic.h +48 -0
  34. data/include/grpc/impl/codegen/sync_posix.h +34 -0
  35. data/include/grpc/impl/codegen/sync_windows.h +36 -0
  36. data/include/grpc/load_reporting.h +48 -0
  37. data/include/grpc/module.modulemap +74 -0
  38. data/include/grpc/slice.h +172 -0
  39. data/include/grpc/slice_buffer.h +84 -0
  40. data/include/grpc/status.h +26 -0
  41. data/include/grpc/support/alloc.h +68 -0
  42. data/include/grpc/support/atm.h +26 -0
  43. data/include/grpc/support/atm_gcc_atomic.h +26 -0
  44. data/include/grpc/support/atm_gcc_sync.h +26 -0
  45. data/include/grpc/support/atm_windows.h +26 -0
  46. data/include/grpc/support/cpu.h +44 -0
  47. data/include/grpc/support/log.h +104 -0
  48. data/include/grpc/support/log_windows.h +38 -0
  49. data/include/grpc/support/port_platform.h +24 -0
  50. data/include/grpc/support/string_util.h +49 -0
  51. data/include/grpc/support/sync.h +298 -0
  52. data/include/grpc/support/sync_custom.h +26 -0
  53. data/include/grpc/support/sync_generic.h +26 -0
  54. data/include/grpc/support/sync_posix.h +26 -0
  55. data/include/grpc/support/sync_windows.h +26 -0
  56. data/include/grpc/support/thd_id.h +44 -0
  57. data/include/grpc/support/time.h +92 -0
  58. data/include/grpc/support/workaround_list.h +31 -0
  59. data/src/boringssl/err_data.c +1348 -0
  60. data/src/core/ext/census/grpc_context.cc +38 -0
  61. data/src/core/ext/filters/client_channel/backup_poller.cc +174 -0
  62. data/src/core/ext/filters/client_channel/backup_poller.h +35 -0
  63. data/src/core/ext/filters/client_channel/channel_connectivity.cc +248 -0
  64. data/src/core/ext/filters/client_channel/client_channel.cc +3209 -0
  65. data/src/core/ext/filters/client_channel/client_channel.h +57 -0
  66. data/src/core/ext/filters/client_channel/client_channel_factory.cc +67 -0
  67. data/src/core/ext/filters/client_channel/client_channel_factory.h +74 -0
  68. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +62 -0
  69. data/src/core/ext/filters/client_channel/connector.cc +41 -0
  70. data/src/core/ext/filters/client_channel/connector.h +73 -0
  71. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +370 -0
  72. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +34 -0
  73. data/src/core/ext/filters/client_channel/http_proxy.cc +195 -0
  74. data/src/core/ext/filters/client_channel/http_proxy.h +24 -0
  75. data/src/core/ext/filters/client_channel/lb_policy.cc +59 -0
  76. data/src/core/ext/filters/client_channel/lb_policy.h +201 -0
  77. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +138 -0
  78. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +29 -0
  79. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1906 -0
  80. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +36 -0
  81. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +108 -0
  82. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +152 -0
  83. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +67 -0
  84. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +304 -0
  85. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +88 -0
  86. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +102 -0
  87. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +190 -0
  88. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +591 -0
  89. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +687 -0
  90. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +253 -0
  91. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +136 -0
  92. data/src/core/ext/filters/client_channel/lb_policy_factory.cc +155 -0
  93. data/src/core/ext/filters/client_channel/lb_policy_factory.h +127 -0
  94. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +97 -0
  95. data/src/core/ext/filters/client_channel/lb_policy_registry.h +54 -0
  96. data/src/core/ext/filters/client_channel/method_params.cc +178 -0
  97. data/src/core/ext/filters/client_channel/method_params.h +74 -0
  98. data/src/core/ext/filters/client_channel/parse_address.cc +192 -0
  99. data/src/core/ext/filters/client_channel/parse_address.h +50 -0
  100. data/src/core/ext/filters/client_channel/proxy_mapper.cc +48 -0
  101. data/src/core/ext/filters/client_channel/proxy_mapper.h +74 -0
  102. data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +122 -0
  103. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +44 -0
  104. data/src/core/ext/filters/client_channel/resolver.cc +35 -0
  105. data/src/core/ext/filters/client_channel/resolver.h +134 -0
  106. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +493 -0
  107. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +53 -0
  108. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +351 -0
  109. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +593 -0
  110. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +74 -0
  111. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +59 -0
  112. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +340 -0
  113. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +297 -0
  114. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +83 -0
  115. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +214 -0
  116. data/src/core/ext/filters/client_channel/resolver_factory.h +71 -0
  117. data/src/core/ext/filters/client_channel/resolver_registry.cc +178 -0
  118. data/src/core/ext/filters/client_channel/resolver_registry.h +83 -0
  119. data/src/core/ext/filters/client_channel/retry_throttle.cc +191 -0
  120. data/src/core/ext/filters/client_channel/retry_throttle.h +77 -0
  121. data/src/core/ext/filters/client_channel/subchannel.cc +815 -0
  122. data/src/core/ext/filters/client_channel/subchannel.h +183 -0
  123. data/src/core/ext/filters/client_channel/subchannel_index.cc +254 -0
  124. data/src/core/ext/filters/client_channel/subchannel_index.h +79 -0
  125. data/src/core/ext/filters/client_channel/uri_parser.cc +314 -0
  126. data/src/core/ext/filters/client_channel/uri_parser.h +50 -0
  127. data/src/core/ext/filters/deadline/deadline_filter.cc +386 -0
  128. data/src/core/ext/filters/deadline/deadline_filter.h +93 -0
  129. data/src/core/ext/filters/http/client/http_client_filter.cc +558 -0
  130. data/src/core/ext/filters/http/client/http_client_filter.h +31 -0
  131. data/src/core/ext/filters/http/client_authority_filter.cc +156 -0
  132. data/src/core/ext/filters/http/client_authority_filter.h +34 -0
  133. data/src/core/ext/filters/http/http_filters_plugin.cc +89 -0
  134. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +499 -0
  135. data/src/core/ext/filters/http/message_compress/message_compress_filter.h +53 -0
  136. data/src/core/ext/filters/http/server/http_server_filter.cc +434 -0
  137. data/src/core/ext/filters/http/server/http_server_filter.h +29 -0
  138. data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +222 -0
  139. data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +30 -0
  140. data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +71 -0
  141. data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +61 -0
  142. data/src/core/ext/filters/max_age/max_age_filter.cc +543 -0
  143. data/src/core/ext/filters/max_age/max_age_filter.h +26 -0
  144. data/src/core/ext/filters/message_size/message_size_filter.cc +324 -0
  145. data/src/core/ext/filters/message_size/message_size_filter.h +26 -0
  146. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +208 -0
  147. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +27 -0
  148. data/src/core/ext/filters/workarounds/workaround_utils.cc +53 -0
  149. data/src/core/ext/filters/workarounds/workaround_utils.h +39 -0
  150. data/src/core/ext/transport/chttp2/alpn/alpn.cc +44 -0
  151. data/src/core/ext/transport/chttp2/alpn/alpn.h +36 -0
  152. data/src/core/ext/transport/chttp2/client/authority.cc +42 -0
  153. data/src/core/ext/transport/chttp2/client/authority.h +36 -0
  154. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +229 -0
  155. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +28 -0
  156. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +110 -0
  157. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +79 -0
  158. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +230 -0
  159. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +353 -0
  160. data/src/core/ext/transport/chttp2/server/chttp2_server.h +33 -0
  161. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +45 -0
  162. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +74 -0
  163. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +89 -0
  164. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +249 -0
  165. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +56 -0
  166. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +231 -0
  167. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +41 -0
  168. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +35 -0
  169. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +3102 -0
  170. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +45 -0
  171. data/src/core/ext/transport/chttp2/transport/flow_control.cc +405 -0
  172. data/src/core/ext/transport/chttp2/transport/flow_control.h +482 -0
  173. data/src/core/ext/transport/chttp2/transport/frame.h +47 -0
  174. data/src/core/ext/transport/chttp2/transport/frame_data.cc +314 -0
  175. data/src/core/ext/transport/chttp2/transport/frame_data.h +84 -0
  176. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +186 -0
  177. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +62 -0
  178. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +131 -0
  179. data/src/core/ext/transport/chttp2/transport/frame_ping.h +45 -0
  180. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +112 -0
  181. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +43 -0
  182. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +238 -0
  183. data/src/core/ext/transport/chttp2/transport/frame_settings.h +60 -0
  184. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +122 -0
  185. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +45 -0
  186. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +699 -0
  187. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +95 -0
  188. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +1680 -0
  189. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +109 -0
  190. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +368 -0
  191. data/src/core/ext/transport/chttp2/transport/hpack_table.h +95 -0
  192. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +62 -0
  193. data/src/core/ext/transport/chttp2/transport/http2_settings.h +62 -0
  194. data/src/core/ext/transport/chttp2/transport/huffsyms.cc +92 -0
  195. data/src/core/ext/transport/chttp2/transport/huffsyms.h +33 -0
  196. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +73 -0
  197. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +49 -0
  198. data/src/core/ext/transport/chttp2/transport/internal.h +799 -0
  199. data/src/core/ext/transport/chttp2/transport/parsing.cc +745 -0
  200. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +216 -0
  201. data/src/core/ext/transport/chttp2/transport/stream_map.cc +167 -0
  202. data/src/core/ext/transport/chttp2/transport/stream_map.h +68 -0
  203. data/src/core/ext/transport/chttp2/transport/varint.cc +56 -0
  204. data/src/core/ext/transport/chttp2/transport/varint.h +60 -0
  205. data/src/core/ext/transport/chttp2/transport/writing.cc +641 -0
  206. data/src/core/ext/transport/inproc/inproc_plugin.cc +28 -0
  207. data/src/core/ext/transport/inproc/inproc_transport.cc +1240 -0
  208. data/src/core/ext/transport/inproc/inproc_transport.h +35 -0
  209. data/src/core/lib/avl/avl.cc +306 -0
  210. data/src/core/lib/avl/avl.h +94 -0
  211. data/src/core/lib/backoff/backoff.cc +78 -0
  212. data/src/core/lib/backoff/backoff.h +89 -0
  213. data/src/core/lib/channel/channel_args.cc +413 -0
  214. data/src/core/lib/channel/channel_args.h +127 -0
  215. data/src/core/lib/channel/channel_stack.cc +258 -0
  216. data/src/core/lib/channel/channel_stack.h +280 -0
  217. data/src/core/lib/channel/channel_stack_builder.cc +314 -0
  218. data/src/core/lib/channel/channel_stack_builder.h +160 -0
  219. data/src/core/lib/channel/channel_trace.cc +239 -0
  220. data/src/core/lib/channel/channel_trace.h +133 -0
  221. data/src/core/lib/channel/channel_trace_registry.cc +80 -0
  222. data/src/core/lib/channel/channel_trace_registry.h +43 -0
  223. data/src/core/lib/channel/connected_channel.cc +236 -0
  224. data/src/core/lib/channel/connected_channel.h +34 -0
  225. data/src/core/lib/channel/context.h +49 -0
  226. data/src/core/lib/channel/handshaker.cc +259 -0
  227. data/src/core/lib/channel/handshaker.h +166 -0
  228. data/src/core/lib/channel/handshaker_factory.cc +41 -0
  229. data/src/core/lib/channel/handshaker_factory.h +50 -0
  230. data/src/core/lib/channel/handshaker_registry.cc +97 -0
  231. data/src/core/lib/channel/handshaker_registry.h +48 -0
  232. data/src/core/lib/channel/status_util.cc +100 -0
  233. data/src/core/lib/channel/status_util.h +58 -0
  234. data/src/core/lib/compression/algorithm_metadata.h +61 -0
  235. data/src/core/lib/compression/compression.cc +174 -0
  236. data/src/core/lib/compression/compression_internal.cc +276 -0
  237. data/src/core/lib/compression/compression_internal.h +88 -0
  238. data/src/core/lib/compression/message_compress.cc +187 -0
  239. data/src/core/lib/compression/message_compress.h +40 -0
  240. data/src/core/lib/compression/stream_compression.cc +79 -0
  241. data/src/core/lib/compression/stream_compression.h +116 -0
  242. data/src/core/lib/compression/stream_compression_gzip.cc +230 -0
  243. data/src/core/lib/compression/stream_compression_gzip.h +28 -0
  244. data/src/core/lib/compression/stream_compression_identity.cc +94 -0
  245. data/src/core/lib/compression/stream_compression_identity.h +29 -0
  246. data/src/core/lib/debug/stats.cc +178 -0
  247. data/src/core/lib/debug/stats.h +61 -0
  248. data/src/core/lib/debug/stats_data.cc +682 -0
  249. data/src/core/lib/debug/stats_data.h +435 -0
  250. data/src/core/lib/debug/trace.cc +144 -0
  251. data/src/core/lib/debug/trace.h +104 -0
  252. data/src/core/lib/gpr/alloc.cc +99 -0
  253. data/src/core/lib/gpr/arena.cc +152 -0
  254. data/src/core/lib/gpr/arena.h +41 -0
  255. data/src/core/lib/gpr/atm.cc +35 -0
  256. data/src/core/lib/gpr/cpu_iphone.cc +36 -0
  257. data/src/core/lib/gpr/cpu_linux.cc +82 -0
  258. data/src/core/lib/gpr/cpu_posix.cc +81 -0
  259. data/src/core/lib/gpr/cpu_windows.cc +33 -0
  260. data/src/core/lib/gpr/env.h +43 -0
  261. data/src/core/lib/gpr/env_linux.cc +82 -0
  262. data/src/core/lib/gpr/env_posix.cc +47 -0
  263. data/src/core/lib/gpr/env_windows.cc +72 -0
  264. data/src/core/lib/gpr/fork.cc +78 -0
  265. data/src/core/lib/gpr/fork.h +35 -0
  266. data/src/core/lib/gpr/host_port.cc +98 -0
  267. data/src/core/lib/gpr/host_port.h +43 -0
  268. data/src/core/lib/gpr/log.cc +96 -0
  269. data/src/core/lib/gpr/log_android.cc +72 -0
  270. data/src/core/lib/gpr/log_linux.cc +93 -0
  271. data/src/core/lib/gpr/log_posix.cc +90 -0
  272. data/src/core/lib/gpr/log_windows.cc +97 -0
  273. data/src/core/lib/gpr/mpscq.cc +117 -0
  274. data/src/core/lib/gpr/mpscq.h +86 -0
  275. data/src/core/lib/gpr/murmur_hash.cc +80 -0
  276. data/src/core/lib/gpr/murmur_hash.h +29 -0
  277. data/src/core/lib/gpr/spinlock.h +46 -0
  278. data/src/core/lib/gpr/string.cc +319 -0
  279. data/src/core/lib/gpr/string.h +109 -0
  280. data/src/core/lib/gpr/string_posix.cc +72 -0
  281. data/src/core/lib/gpr/string_util_windows.cc +82 -0
  282. data/src/core/lib/gpr/string_windows.cc +69 -0
  283. data/src/core/lib/gpr/string_windows.h +32 -0
  284. data/src/core/lib/gpr/sync.cc +124 -0
  285. data/src/core/lib/gpr/sync_posix.cc +107 -0
  286. data/src/core/lib/gpr/sync_windows.cc +118 -0
  287. data/src/core/lib/gpr/time.cc +251 -0
  288. data/src/core/lib/gpr/time_posix.cc +167 -0
  289. data/src/core/lib/gpr/time_precise.cc +78 -0
  290. data/src/core/lib/gpr/time_precise.h +29 -0
  291. data/src/core/lib/gpr/time_windows.cc +98 -0
  292. data/src/core/lib/gpr/tls.h +68 -0
  293. data/src/core/lib/gpr/tls_gcc.h +52 -0
  294. data/src/core/lib/gpr/tls_msvc.h +52 -0
  295. data/src/core/lib/gpr/tls_pthread.cc +30 -0
  296. data/src/core/lib/gpr/tls_pthread.h +56 -0
  297. data/src/core/lib/gpr/tmpfile.h +32 -0
  298. data/src/core/lib/gpr/tmpfile_msys.cc +58 -0
  299. data/src/core/lib/gpr/tmpfile_posix.cc +70 -0
  300. data/src/core/lib/gpr/tmpfile_windows.cc +69 -0
  301. data/src/core/lib/gpr/useful.h +65 -0
  302. data/src/core/lib/gpr/wrap_memcpy.cc +42 -0
  303. data/src/core/lib/gprpp/abstract.h +34 -0
  304. data/src/core/lib/gprpp/atomic.h +30 -0
  305. data/src/core/lib/gprpp/atomic_with_atm.h +57 -0
  306. data/src/core/lib/gprpp/atomic_with_std.h +35 -0
  307. data/src/core/lib/gprpp/debug_location.h +52 -0
  308. data/src/core/lib/gprpp/inlined_vector.h +136 -0
  309. data/src/core/lib/gprpp/manual_constructor.h +213 -0
  310. data/src/core/lib/gprpp/memory.h +111 -0
  311. data/src/core/lib/gprpp/orphanable.h +199 -0
  312. data/src/core/lib/gprpp/ref_counted.h +169 -0
  313. data/src/core/lib/gprpp/ref_counted_ptr.h +112 -0
  314. data/src/core/lib/gprpp/thd.h +135 -0
  315. data/src/core/lib/gprpp/thd_posix.cc +209 -0
  316. data/src/core/lib/gprpp/thd_windows.cc +162 -0
  317. data/src/core/lib/http/format_request.cc +122 -0
  318. data/src/core/lib/http/format_request.h +34 -0
  319. data/src/core/lib/http/httpcli.cc +303 -0
  320. data/src/core/lib/http/httpcli.h +127 -0
  321. data/src/core/lib/http/httpcli_security_connector.cc +202 -0
  322. data/src/core/lib/http/parser.cc +371 -0
  323. data/src/core/lib/http/parser.h +113 -0
  324. data/src/core/lib/iomgr/block_annotate.h +57 -0
  325. data/src/core/lib/iomgr/call_combiner.cc +212 -0
  326. data/src/core/lib/iomgr/call_combiner.h +112 -0
  327. data/src/core/lib/iomgr/closure.h +351 -0
  328. data/src/core/lib/iomgr/combiner.cc +358 -0
  329. data/src/core/lib/iomgr/combiner.h +66 -0
  330. data/src/core/lib/iomgr/endpoint.cc +63 -0
  331. data/src/core/lib/iomgr/endpoint.h +98 -0
  332. data/src/core/lib/iomgr/endpoint_pair.h +34 -0
  333. data/src/core/lib/iomgr/endpoint_pair_posix.cc +73 -0
  334. data/src/core/lib/iomgr/endpoint_pair_uv.cc +40 -0
  335. data/src/core/lib/iomgr/endpoint_pair_windows.cc +87 -0
  336. data/src/core/lib/iomgr/error.cc +793 -0
  337. data/src/core/lib/iomgr/error.h +207 -0
  338. data/src/core/lib/iomgr/error_internal.h +63 -0
  339. data/src/core/lib/iomgr/ev_epoll1_linux.cc +1248 -0
  340. data/src/core/lib/iomgr/ev_epoll1_linux.h +31 -0
  341. data/src/core/lib/iomgr/ev_epollex_linux.cc +1494 -0
  342. data/src/core/lib/iomgr/ev_epollex_linux.h +30 -0
  343. data/src/core/lib/iomgr/ev_epollsig_linux.cc +1735 -0
  344. data/src/core/lib/iomgr/ev_epollsig_linux.h +35 -0
  345. data/src/core/lib/iomgr/ev_poll_posix.cc +1758 -0
  346. data/src/core/lib/iomgr/ev_poll_posix.h +29 -0
  347. data/src/core/lib/iomgr/ev_posix.cc +330 -0
  348. data/src/core/lib/iomgr/ev_posix.h +145 -0
  349. data/src/core/lib/iomgr/ev_windows.cc +30 -0
  350. data/src/core/lib/iomgr/exec_ctx.cc +147 -0
  351. data/src/core/lib/iomgr/exec_ctx.h +210 -0
  352. data/src/core/lib/iomgr/executor.cc +301 -0
  353. data/src/core/lib/iomgr/executor.h +50 -0
  354. data/src/core/lib/iomgr/fork_posix.cc +89 -0
  355. data/src/core/lib/iomgr/fork_windows.cc +41 -0
  356. data/src/core/lib/iomgr/gethostname.h +26 -0
  357. data/src/core/lib/iomgr/gethostname_fallback.cc +30 -0
  358. data/src/core/lib/iomgr/gethostname_host_name_max.cc +40 -0
  359. data/src/core/lib/iomgr/gethostname_sysconf.cc +40 -0
  360. data/src/core/lib/iomgr/iocp_windows.cc +152 -0
  361. data/src/core/lib/iomgr/iocp_windows.h +48 -0
  362. data/src/core/lib/iomgr/iomgr.cc +178 -0
  363. data/src/core/lib/iomgr/iomgr.h +36 -0
  364. data/src/core/lib/iomgr/iomgr_custom.cc +63 -0
  365. data/src/core/lib/iomgr/iomgr_custom.h +47 -0
  366. data/src/core/lib/iomgr/iomgr_internal.cc +43 -0
  367. data/src/core/lib/iomgr/iomgr_internal.h +57 -0
  368. data/src/core/lib/iomgr/iomgr_posix.cc +67 -0
  369. data/src/core/lib/iomgr/iomgr_posix.h +26 -0
  370. data/src/core/lib/iomgr/iomgr_uv.cc +40 -0
  371. data/src/core/lib/iomgr/iomgr_windows.cc +87 -0
  372. data/src/core/lib/iomgr/is_epollexclusive_available.cc +104 -0
  373. data/src/core/lib/iomgr/is_epollexclusive_available.h +36 -0
  374. data/src/core/lib/iomgr/load_file.cc +80 -0
  375. data/src/core/lib/iomgr/load_file.h +35 -0
  376. data/src/core/lib/iomgr/lockfree_event.cc +250 -0
  377. data/src/core/lib/iomgr/lockfree_event.h +72 -0
  378. data/src/core/lib/iomgr/nameser.h +106 -0
  379. data/src/core/lib/iomgr/network_status_tracker.cc +36 -0
  380. data/src/core/lib/iomgr/network_status_tracker.h +32 -0
  381. data/src/core/lib/iomgr/polling_entity.cc +87 -0
  382. data/src/core/lib/iomgr/polling_entity.h +68 -0
  383. data/src/core/lib/iomgr/pollset.cc +56 -0
  384. data/src/core/lib/iomgr/pollset.h +99 -0
  385. data/src/core/lib/iomgr/pollset_custom.cc +106 -0
  386. data/src/core/lib/iomgr/pollset_custom.h +35 -0
  387. data/src/core/lib/iomgr/pollset_set.cc +55 -0
  388. data/src/core/lib/iomgr/pollset_set.h +55 -0
  389. data/src/core/lib/iomgr/pollset_set_custom.cc +48 -0
  390. data/src/core/lib/iomgr/pollset_set_custom.h +26 -0
  391. data/src/core/lib/iomgr/pollset_set_windows.cc +51 -0
  392. data/src/core/lib/iomgr/pollset_set_windows.h +26 -0
  393. data/src/core/lib/iomgr/pollset_uv.cc +93 -0
  394. data/src/core/lib/iomgr/pollset_windows.cc +229 -0
  395. data/src/core/lib/iomgr/pollset_windows.h +70 -0
  396. data/src/core/lib/iomgr/port.h +147 -0
  397. data/src/core/lib/iomgr/resolve_address.cc +50 -0
  398. data/src/core/lib/iomgr/resolve_address.h +83 -0
  399. data/src/core/lib/iomgr/resolve_address_custom.cc +187 -0
  400. data/src/core/lib/iomgr/resolve_address_custom.h +43 -0
  401. data/src/core/lib/iomgr/resolve_address_posix.cc +180 -0
  402. data/src/core/lib/iomgr/resolve_address_windows.cc +165 -0
  403. data/src/core/lib/iomgr/resource_quota.cc +871 -0
  404. data/src/core/lib/iomgr/resource_quota.h +142 -0
  405. data/src/core/lib/iomgr/sockaddr.h +32 -0
  406. data/src/core/lib/iomgr/sockaddr_custom.h +54 -0
  407. data/src/core/lib/iomgr/sockaddr_posix.h +55 -0
  408. data/src/core/lib/iomgr/sockaddr_utils.cc +298 -0
  409. data/src/core/lib/iomgr/sockaddr_utils.h +84 -0
  410. data/src/core/lib/iomgr/sockaddr_windows.h +55 -0
  411. data/src/core/lib/iomgr/socket_factory_posix.cc +94 -0
  412. data/src/core/lib/iomgr/socket_factory_posix.h +69 -0
  413. data/src/core/lib/iomgr/socket_mutator.cc +83 -0
  414. data/src/core/lib/iomgr/socket_mutator.h +61 -0
  415. data/src/core/lib/iomgr/socket_utils.h +38 -0
  416. data/src/core/lib/iomgr/socket_utils_common_posix.cc +327 -0
  417. data/src/core/lib/iomgr/socket_utils_linux.cc +43 -0
  418. data/src/core/lib/iomgr/socket_utils_posix.cc +59 -0
  419. data/src/core/lib/iomgr/socket_utils_posix.h +134 -0
  420. data/src/core/lib/iomgr/socket_utils_uv.cc +45 -0
  421. data/src/core/lib/iomgr/socket_utils_windows.cc +43 -0
  422. data/src/core/lib/iomgr/socket_windows.cc +151 -0
  423. data/src/core/lib/iomgr/socket_windows.h +113 -0
  424. data/src/core/lib/iomgr/sys_epoll_wrapper.h +30 -0
  425. data/src/core/lib/iomgr/tcp_client.cc +36 -0
  426. data/src/core/lib/iomgr/tcp_client.h +52 -0
  427. data/src/core/lib/iomgr/tcp_client_custom.cc +151 -0
  428. data/src/core/lib/iomgr/tcp_client_posix.cc +359 -0
  429. data/src/core/lib/iomgr/tcp_client_posix.h +68 -0
  430. data/src/core/lib/iomgr/tcp_client_windows.cc +231 -0
  431. data/src/core/lib/iomgr/tcp_custom.cc +365 -0
  432. data/src/core/lib/iomgr/tcp_custom.h +81 -0
  433. data/src/core/lib/iomgr/tcp_posix.cc +814 -0
  434. data/src/core/lib/iomgr/tcp_posix.h +57 -0
  435. data/src/core/lib/iomgr/tcp_server.cc +73 -0
  436. data/src/core/lib/iomgr/tcp_server.h +122 -0
  437. data/src/core/lib/iomgr/tcp_server_custom.cc +472 -0
  438. data/src/core/lib/iomgr/tcp_server_posix.cc +582 -0
  439. data/src/core/lib/iomgr/tcp_server_utils_posix.h +122 -0
  440. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +208 -0
  441. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +184 -0
  442. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +36 -0
  443. data/src/core/lib/iomgr/tcp_server_windows.cc +559 -0
  444. data/src/core/lib/iomgr/tcp_uv.cc +417 -0
  445. data/src/core/lib/iomgr/tcp_windows.cc +455 -0
  446. data/src/core/lib/iomgr/tcp_windows.h +51 -0
  447. data/src/core/lib/iomgr/time_averaged_stats.cc +64 -0
  448. data/src/core/lib/iomgr/time_averaged_stats.h +73 -0
  449. data/src/core/lib/iomgr/timer.cc +45 -0
  450. data/src/core/lib/iomgr/timer.h +125 -0
  451. data/src/core/lib/iomgr/timer_custom.cc +93 -0
  452. data/src/core/lib/iomgr/timer_custom.h +43 -0
  453. data/src/core/lib/iomgr/timer_generic.cc +663 -0
  454. data/src/core/lib/iomgr/timer_heap.cc +135 -0
  455. data/src/core/lib/iomgr/timer_heap.h +44 -0
  456. data/src/core/lib/iomgr/timer_manager.cc +347 -0
  457. data/src/core/lib/iomgr/timer_manager.h +39 -0
  458. data/src/core/lib/iomgr/timer_uv.cc +63 -0
  459. data/src/core/lib/iomgr/udp_server.cc +692 -0
  460. data/src/core/lib/iomgr/udp_server.h +103 -0
  461. data/src/core/lib/iomgr/unix_sockets_posix.cc +104 -0
  462. data/src/core/lib/iomgr/unix_sockets_posix.h +43 -0
  463. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +49 -0
  464. data/src/core/lib/iomgr/wakeup_fd_cv.cc +107 -0
  465. data/src/core/lib/iomgr/wakeup_fd_cv.h +69 -0
  466. data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +83 -0
  467. data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +38 -0
  468. data/src/core/lib/iomgr/wakeup_fd_pipe.cc +100 -0
  469. data/src/core/lib/iomgr/wakeup_fd_pipe.h +28 -0
  470. data/src/core/lib/iomgr/wakeup_fd_posix.cc +87 -0
  471. data/src/core/lib/iomgr/wakeup_fd_posix.h +96 -0
  472. data/src/core/lib/json/json.cc +86 -0
  473. data/src/core/lib/json/json.h +94 -0
  474. data/src/core/lib/json/json_common.h +34 -0
  475. data/src/core/lib/json/json_reader.cc +663 -0
  476. data/src/core/lib/json/json_reader.h +146 -0
  477. data/src/core/lib/json/json_string.cc +367 -0
  478. data/src/core/lib/json/json_writer.cc +245 -0
  479. data/src/core/lib/json/json_writer.h +84 -0
  480. data/src/core/lib/profiling/basic_timers.cc +286 -0
  481. data/src/core/lib/profiling/stap_timers.cc +50 -0
  482. data/src/core/lib/profiling/timers.h +94 -0
  483. data/src/core/lib/security/context/security_context.cc +348 -0
  484. data/src/core/lib/security/context/security_context.h +115 -0
  485. data/src/core/lib/security/credentials/alts/alts_credentials.cc +119 -0
  486. data/src/core/lib/security/credentials/alts/alts_credentials.h +102 -0
  487. data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +72 -0
  488. data/src/core/lib/security/credentials/alts/check_gcp_environment.h +57 -0
  489. data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +67 -0
  490. data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +33 -0
  491. data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +114 -0
  492. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +126 -0
  493. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc +46 -0
  494. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +112 -0
  495. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +58 -0
  496. data/src/core/lib/security/credentials/composite/composite_credentials.cc +269 -0
  497. data/src/core/lib/security/credentials/composite/composite_credentials.h +59 -0
  498. data/src/core/lib/security/credentials/credentials.cc +286 -0
  499. data/src/core/lib/security/credentials/credentials.h +246 -0
  500. data/src/core/lib/security/credentials/credentials_metadata.cc +62 -0
  501. data/src/core/lib/security/credentials/fake/fake_credentials.cc +136 -0
  502. data/src/core/lib/security/credentials/fake/fake_credentials.h +64 -0
  503. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +41 -0
  504. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +322 -0
  505. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +45 -0
  506. data/src/core/lib/security/credentials/iam/iam_credentials.cc +86 -0
  507. data/src/core/lib/security/credentials/iam/iam_credentials.h +31 -0
  508. data/src/core/lib/security/credentials/jwt/json_token.cc +314 -0
  509. data/src/core/lib/security/credentials/jwt/json_token.h +75 -0
  510. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +190 -0
  511. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +49 -0
  512. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +934 -0
  513. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +123 -0
  514. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +532 -0
  515. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +106 -0
  516. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +271 -0
  517. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +46 -0
  518. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +349 -0
  519. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +54 -0
  520. data/src/core/lib/security/security_connector/alts_security_connector.cc +287 -0
  521. data/src/core/lib/security/security_connector/alts_security_connector.h +69 -0
  522. data/src/core/lib/security/security_connector/security_connector.cc +1200 -0
  523. data/src/core/lib/security/security_connector/security_connector.h +283 -0
  524. data/src/core/lib/security/transport/auth_filters.h +37 -0
  525. data/src/core/lib/security/transport/client_auth_filter.cc +418 -0
  526. data/src/core/lib/security/transport/secure_endpoint.cc +429 -0
  527. data/src/core/lib/security/transport/secure_endpoint.h +41 -0
  528. data/src/core/lib/security/transport/security_handshaker.cc +526 -0
  529. data/src/core/lib/security/transport/security_handshaker.h +34 -0
  530. data/src/core/lib/security/transport/server_auth_filter.cc +269 -0
  531. data/src/core/lib/security/transport/target_authority_table.cc +75 -0
  532. data/src/core/lib/security/transport/target_authority_table.h +40 -0
  533. data/src/core/lib/security/transport/tsi_error.cc +29 -0
  534. data/src/core/lib/security/transport/tsi_error.h +29 -0
  535. data/src/core/lib/security/util/json_util.cc +48 -0
  536. data/src/core/lib/security/util/json_util.h +42 -0
  537. data/src/core/lib/slice/b64.cc +240 -0
  538. data/src/core/lib/slice/b64.h +51 -0
  539. data/src/core/lib/slice/percent_encoding.cc +169 -0
  540. data/src/core/lib/slice/percent_encoding.h +65 -0
  541. data/src/core/lib/slice/slice.cc +489 -0
  542. data/src/core/lib/slice/slice_buffer.cc +359 -0
  543. data/src/core/lib/slice/slice_hash_table.h +201 -0
  544. data/src/core/lib/slice/slice_intern.cc +332 -0
  545. data/src/core/lib/slice/slice_internal.h +49 -0
  546. data/src/core/lib/slice/slice_string_helpers.cc +118 -0
  547. data/src/core/lib/slice/slice_string_helpers.h +47 -0
  548. data/src/core/lib/slice/slice_weak_hash_table.h +105 -0
  549. data/src/core/lib/surface/api_trace.cc +24 -0
  550. data/src/core/lib/surface/api_trace.h +52 -0
  551. data/src/core/lib/surface/byte_buffer.cc +92 -0
  552. data/src/core/lib/surface/byte_buffer_reader.cc +129 -0
  553. data/src/core/lib/surface/call.cc +2002 -0
  554. data/src/core/lib/surface/call.h +109 -0
  555. data/src/core/lib/surface/call_details.cc +42 -0
  556. data/src/core/lib/surface/call_log_batch.cc +120 -0
  557. data/src/core/lib/surface/call_test_only.h +43 -0
  558. data/src/core/lib/surface/channel.cc +450 -0
  559. data/src/core/lib/surface/channel.h +83 -0
  560. data/src/core/lib/surface/channel_init.cc +109 -0
  561. data/src/core/lib/surface/channel_init.h +73 -0
  562. data/src/core/lib/surface/channel_ping.cc +65 -0
  563. data/src/core/lib/surface/channel_stack_type.cc +58 -0
  564. data/src/core/lib/surface/channel_stack_type.h +47 -0
  565. data/src/core/lib/surface/completion_queue.cc +1262 -0
  566. data/src/core/lib/surface/completion_queue.h +93 -0
  567. data/src/core/lib/surface/completion_queue_factory.cc +79 -0
  568. data/src/core/lib/surface/completion_queue_factory.h +38 -0
  569. data/src/core/lib/surface/event_string.cc +68 -0
  570. data/src/core/lib/surface/event_string.h +29 -0
  571. data/src/core/lib/surface/init.cc +196 -0
  572. data/src/core/lib/surface/init.h +27 -0
  573. data/src/core/lib/surface/init_secure.cc +81 -0
  574. data/src/core/lib/surface/lame_client.cc +180 -0
  575. data/src/core/lib/surface/lame_client.h +28 -0
  576. data/src/core/lib/surface/metadata_array.cc +36 -0
  577. data/src/core/lib/surface/server.cc +1445 -0
  578. data/src/core/lib/surface/server.h +58 -0
  579. data/src/core/lib/surface/validate_metadata.cc +95 -0
  580. data/src/core/lib/surface/validate_metadata.h +30 -0
  581. data/src/core/lib/surface/version.cc +28 -0
  582. data/src/core/lib/transport/bdp_estimator.cc +87 -0
  583. data/src/core/lib/transport/bdp_estimator.h +94 -0
  584. data/src/core/lib/transport/byte_stream.cc +160 -0
  585. data/src/core/lib/transport/byte_stream.h +164 -0
  586. data/src/core/lib/transport/connectivity_state.cc +196 -0
  587. data/src/core/lib/transport/connectivity_state.h +87 -0
  588. data/src/core/lib/transport/error_utils.cc +118 -0
  589. data/src/core/lib/transport/error_utils.h +46 -0
  590. data/src/core/lib/transport/http2_errors.h +41 -0
  591. data/src/core/lib/transport/metadata.cc +539 -0
  592. data/src/core/lib/transport/metadata.h +165 -0
  593. data/src/core/lib/transport/metadata_batch.cc +329 -0
  594. data/src/core/lib/transport/metadata_batch.h +150 -0
  595. data/src/core/lib/transport/pid_controller.cc +51 -0
  596. data/src/core/lib/transport/pid_controller.h +116 -0
  597. data/src/core/lib/transport/service_config.cc +106 -0
  598. data/src/core/lib/transport/service_config.h +249 -0
  599. data/src/core/lib/transport/static_metadata.cc +601 -0
  600. data/src/core/lib/transport/static_metadata.h +603 -0
  601. data/src/core/lib/transport/status_conversion.cc +100 -0
  602. data/src/core/lib/transport/status_conversion.h +38 -0
  603. data/src/core/lib/transport/status_metadata.cc +54 -0
  604. data/src/core/lib/transport/status_metadata.h +30 -0
  605. data/src/core/lib/transport/timeout_encoding.cc +144 -0
  606. data/src/core/lib/transport/timeout_encoding.h +37 -0
  607. data/src/core/lib/transport/transport.cc +278 -0
  608. data/src/core/lib/transport/transport.h +378 -0
  609. data/src/core/lib/transport/transport_impl.h +71 -0
  610. data/src/core/lib/transport/transport_op_string.cc +214 -0
  611. data/src/core/plugin_registry/grpc_plugin_registry.cc +97 -0
  612. data/src/core/tsi/alts/crypt/aes_gcm.cc +687 -0
  613. data/src/core/tsi/alts/crypt/gsec.cc +189 -0
  614. data/src/core/tsi/alts/crypt/gsec.h +454 -0
  615. data/src/core/tsi/alts/frame_protector/alts_counter.cc +118 -0
  616. data/src/core/tsi/alts/frame_protector/alts_counter.h +98 -0
  617. data/src/core/tsi/alts/frame_protector/alts_crypter.cc +66 -0
  618. data/src/core/tsi/alts/frame_protector/alts_crypter.h +255 -0
  619. data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +407 -0
  620. data/src/core/tsi/alts/frame_protector/alts_frame_protector.h +55 -0
  621. data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.cc +114 -0
  622. data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h +114 -0
  623. data/src/core/tsi/alts/frame_protector/alts_seal_privacy_integrity_crypter.cc +105 -0
  624. data/src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc +103 -0
  625. data/src/core/tsi/alts/frame_protector/frame_handler.cc +218 -0
  626. data/src/core/tsi/alts/frame_protector/frame_handler.h +236 -0
  627. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +316 -0
  628. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +137 -0
  629. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +520 -0
  630. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +323 -0
  631. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +143 -0
  632. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +149 -0
  633. data/src/core/tsi/alts/handshaker/alts_tsi_event.cc +73 -0
  634. data/src/core/tsi/alts/handshaker/alts_tsi_event.h +93 -0
  635. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +483 -0
  636. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +83 -0
  637. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +52 -0
  638. data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +58 -0
  639. data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +52 -0
  640. data/src/core/tsi/alts/handshaker/altscontext.pb.c +48 -0
  641. data/src/core/tsi/alts/handshaker/altscontext.pb.h +64 -0
  642. data/src/core/tsi/alts/handshaker/handshaker.pb.c +123 -0
  643. data/src/core/tsi/alts/handshaker/handshaker.pb.h +255 -0
  644. data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +50 -0
  645. data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +78 -0
  646. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +196 -0
  647. data/src/core/tsi/alts/handshaker/transport_security_common_api.h +163 -0
  648. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +180 -0
  649. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +52 -0
  650. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +144 -0
  651. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h +49 -0
  652. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h +91 -0
  653. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +174 -0
  654. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +100 -0
  655. data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +476 -0
  656. data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h +199 -0
  657. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +296 -0
  658. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +52 -0
  659. data/src/core/tsi/alts_transport_security.cc +63 -0
  660. data/src/core/tsi/alts_transport_security.h +47 -0
  661. data/src/core/tsi/fake_transport_security.cc +787 -0
  662. data/src/core/tsi/fake_transport_security.h +45 -0
  663. data/src/core/tsi/ssl/session_cache/ssl_session.h +73 -0
  664. data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +58 -0
  665. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +211 -0
  666. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +93 -0
  667. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +76 -0
  668. data/src/core/tsi/ssl_transport_security.cc +1831 -0
  669. data/src/core/tsi/ssl_transport_security.h +314 -0
  670. data/src/core/tsi/ssl_types.h +42 -0
  671. data/src/core/tsi/transport_security.cc +326 -0
  672. data/src/core/tsi/transport_security.h +127 -0
  673. data/src/core/tsi/transport_security_adapter.cc +235 -0
  674. data/src/core/tsi/transport_security_adapter.h +41 -0
  675. data/src/core/tsi/transport_security_grpc.cc +66 -0
  676. data/src/core/tsi/transport_security_grpc.h +74 -0
  677. data/src/core/tsi/transport_security_interface.h +454 -0
  678. data/src/ruby/bin/apis/google/protobuf/empty.rb +29 -0
  679. data/src/ruby/bin/apis/pubsub_demo.rb +241 -0
  680. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +159 -0
  681. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +88 -0
  682. data/src/ruby/bin/math_client.rb +132 -0
  683. data/src/ruby/bin/math_pb.rb +32 -0
  684. data/src/ruby/bin/math_server.rb +191 -0
  685. data/src/ruby/bin/math_services_pb.rb +51 -0
  686. data/src/ruby/bin/noproto_client.rb +93 -0
  687. data/src/ruby/bin/noproto_server.rb +97 -0
  688. data/src/ruby/ext/grpc/extconf.rb +118 -0
  689. data/src/ruby/ext/grpc/rb_byte_buffer.c +64 -0
  690. data/src/ruby/ext/grpc/rb_byte_buffer.h +35 -0
  691. data/src/ruby/ext/grpc/rb_call.c +1041 -0
  692. data/src/ruby/ext/grpc/rb_call.h +53 -0
  693. data/src/ruby/ext/grpc/rb_call_credentials.c +290 -0
  694. data/src/ruby/ext/grpc/rb_call_credentials.h +31 -0
  695. data/src/ruby/ext/grpc/rb_channel.c +828 -0
  696. data/src/ruby/ext/grpc/rb_channel.h +34 -0
  697. data/src/ruby/ext/grpc/rb_channel_args.c +155 -0
  698. data/src/ruby/ext/grpc/rb_channel_args.h +38 -0
  699. data/src/ruby/ext/grpc/rb_channel_credentials.c +263 -0
  700. data/src/ruby/ext/grpc/rb_channel_credentials.h +32 -0
  701. data/src/ruby/ext/grpc/rb_completion_queue.c +100 -0
  702. data/src/ruby/ext/grpc/rb_completion_queue.h +36 -0
  703. data/src/ruby/ext/grpc/rb_compression_options.c +468 -0
  704. data/src/ruby/ext/grpc/rb_compression_options.h +29 -0
  705. data/src/ruby/ext/grpc/rb_event_thread.c +141 -0
  706. data/src/ruby/ext/grpc/rb_event_thread.h +21 -0
  707. data/src/ruby/ext/grpc/rb_grpc.c +340 -0
  708. data/src/ruby/ext/grpc/rb_grpc.h +72 -0
  709. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +507 -0
  710. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +766 -0
  711. data/src/ruby/ext/grpc/rb_loader.c +57 -0
  712. data/src/ruby/ext/grpc/rb_loader.h +25 -0
  713. data/src/ruby/ext/grpc/rb_server.c +366 -0
  714. data/src/ruby/ext/grpc/rb_server.h +32 -0
  715. data/src/ruby/ext/grpc/rb_server_credentials.c +243 -0
  716. data/src/ruby/ext/grpc/rb_server_credentials.h +32 -0
  717. data/src/ruby/lib/grpc.rb +35 -0
  718. data/src/ruby/lib/grpc/core/time_consts.rb +56 -0
  719. data/src/ruby/lib/grpc/errors.rb +201 -0
  720. data/src/ruby/lib/grpc/generic/active_call.rb +674 -0
  721. data/src/ruby/lib/grpc/generic/bidi_call.rb +233 -0
  722. data/src/ruby/lib/grpc/generic/client_stub.rb +501 -0
  723. data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
  724. data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
  725. data/src/ruby/lib/grpc/generic/rpc_desc.rb +204 -0
  726. data/src/ruby/lib/grpc/generic/rpc_server.rb +490 -0
  727. data/src/ruby/lib/grpc/generic/service.rb +210 -0
  728. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +35 -0
  729. data/src/ruby/lib/grpc/grpc.rb +24 -0
  730. data/src/ruby/lib/grpc/logconfig.rb +44 -0
  731. data/src/ruby/lib/grpc/notifier.rb +45 -0
  732. data/src/ruby/lib/grpc/version.rb +18 -0
  733. data/src/ruby/pb/README.md +42 -0
  734. data/src/ruby/pb/generate_proto_ruby.sh +43 -0
  735. data/src/ruby/pb/grpc/health/checker.rb +76 -0
  736. data/src/ruby/pb/grpc/health/v1/health_pb.rb +28 -0
  737. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +41 -0
  738. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +44 -0
  739. data/src/ruby/pb/grpc/testing/metrics_pb.rb +28 -0
  740. data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +49 -0
  741. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +15 -0
  742. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +82 -0
  743. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +14 -0
  744. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +102 -0
  745. data/src/ruby/pb/test/client.rb +764 -0
  746. data/src/ruby/pb/test/server.rb +252 -0
  747. data/src/ruby/spec/call_credentials_spec.rb +42 -0
  748. data/src/ruby/spec/call_spec.rb +180 -0
  749. data/src/ruby/spec/channel_connection_spec.rb +126 -0
  750. data/src/ruby/spec/channel_credentials_spec.rb +82 -0
  751. data/src/ruby/spec/channel_spec.rb +190 -0
  752. data/src/ruby/spec/client_auth_spec.rb +137 -0
  753. data/src/ruby/spec/client_server_spec.rb +664 -0
  754. data/src/ruby/spec/compression_options_spec.rb +149 -0
  755. data/src/ruby/spec/error_sanity_spec.rb +49 -0
  756. data/src/ruby/spec/generic/active_call_spec.rb +672 -0
  757. data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
  758. data/src/ruby/spec/generic/client_stub_spec.rb +1067 -0
  759. data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
  760. data/src/ruby/spec/generic/rpc_desc_spec.rb +374 -0
  761. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +127 -0
  762. data/src/ruby/spec/generic/rpc_server_spec.rb +726 -0
  763. data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
  764. data/src/ruby/spec/generic/service_spec.rb +261 -0
  765. data/src/ruby/spec/google_rpc_status_utils_spec.rb +293 -0
  766. data/src/ruby/spec/pb/duplicate/codegen_spec.rb +56 -0
  767. data/src/ruby/spec/pb/health/checker_spec.rb +236 -0
  768. data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +54 -0
  769. data/src/ruby/spec/pb/package_with_underscore/data.proto +23 -0
  770. data/src/ruby/spec/pb/package_with_underscore/service.proto +23 -0
  771. data/src/ruby/spec/server_credentials_spec.rb +79 -0
  772. data/src/ruby/spec/server_spec.rb +209 -0
  773. data/src/ruby/spec/spec_helper.rb +60 -0
  774. data/src/ruby/spec/support/helpers.rb +107 -0
  775. data/src/ruby/spec/support/services.rb +147 -0
  776. data/src/ruby/spec/testdata/README +1 -0
  777. data/src/ruby/spec/testdata/ca.pem +15 -0
  778. data/src/ruby/spec/testdata/client.key +16 -0
  779. data/src/ruby/spec/testdata/client.pem +14 -0
  780. data/src/ruby/spec/testdata/server1.key +16 -0
  781. data/src/ruby/spec/testdata/server1.pem +16 -0
  782. data/src/ruby/spec/time_consts_spec.rb +74 -0
  783. data/third_party/address_sorting/address_sorting.c +369 -0
  784. data/third_party/address_sorting/address_sorting_internal.h +70 -0
  785. data/third_party/address_sorting/address_sorting_posix.c +97 -0
  786. data/third_party/address_sorting/address_sorting_windows.c +55 -0
  787. data/third_party/address_sorting/include/address_sorting/address_sorting.h +110 -0
  788. data/third_party/boringssl/crypto/asn1/a_bitstr.c +271 -0
  789. data/third_party/boringssl/crypto/asn1/a_bool.c +110 -0
  790. data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +297 -0
  791. data/third_party/boringssl/crypto/asn1/a_dup.c +111 -0
  792. data/third_party/boringssl/crypto/asn1/a_enum.c +195 -0
  793. data/third_party/boringssl/crypto/asn1/a_gentm.c +261 -0
  794. data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +150 -0
  795. data/third_party/boringssl/crypto/asn1/a_int.c +474 -0
  796. data/third_party/boringssl/crypto/asn1/a_mbstr.c +409 -0
  797. data/third_party/boringssl/crypto/asn1/a_object.c +275 -0
  798. data/third_party/boringssl/crypto/asn1/a_octet.c +77 -0
  799. data/third_party/boringssl/crypto/asn1/a_print.c +93 -0
  800. data/third_party/boringssl/crypto/asn1/a_strnid.c +312 -0
  801. data/third_party/boringssl/crypto/asn1/a_time.c +213 -0
  802. data/third_party/boringssl/crypto/asn1/a_type.c +151 -0
  803. data/third_party/boringssl/crypto/asn1/a_utctm.c +303 -0
  804. data/third_party/boringssl/crypto/asn1/a_utf8.c +234 -0
  805. data/third_party/boringssl/crypto/asn1/asn1_lib.c +442 -0
  806. data/third_party/boringssl/crypto/asn1/asn1_locl.h +101 -0
  807. data/third_party/boringssl/crypto/asn1/asn1_par.c +80 -0
  808. data/third_party/boringssl/crypto/asn1/asn_pack.c +105 -0
  809. data/third_party/boringssl/crypto/asn1/f_enum.c +93 -0
  810. data/third_party/boringssl/crypto/asn1/f_int.c +97 -0
  811. data/third_party/boringssl/crypto/asn1/f_string.c +91 -0
  812. data/third_party/boringssl/crypto/asn1/tasn_dec.c +1223 -0
  813. data/third_party/boringssl/crypto/asn1/tasn_enc.c +662 -0
  814. data/third_party/boringssl/crypto/asn1/tasn_fre.c +244 -0
  815. data/third_party/boringssl/crypto/asn1/tasn_new.c +387 -0
  816. data/third_party/boringssl/crypto/asn1/tasn_typ.c +131 -0
  817. data/third_party/boringssl/crypto/asn1/tasn_utl.c +280 -0
  818. data/third_party/boringssl/crypto/asn1/time_support.c +206 -0
  819. data/third_party/boringssl/crypto/base64/base64.c +466 -0
  820. data/third_party/boringssl/crypto/bio/bio.c +636 -0
  821. data/third_party/boringssl/crypto/bio/bio_mem.c +330 -0
  822. data/third_party/boringssl/crypto/bio/connect.c +542 -0
  823. data/third_party/boringssl/crypto/bio/fd.c +275 -0
  824. data/third_party/boringssl/crypto/bio/file.c +313 -0
  825. data/third_party/boringssl/crypto/bio/hexdump.c +192 -0
  826. data/third_party/boringssl/crypto/bio/internal.h +111 -0
  827. data/third_party/boringssl/crypto/bio/pair.c +489 -0
  828. data/third_party/boringssl/crypto/bio/printf.c +115 -0
  829. data/third_party/boringssl/crypto/bio/socket.c +202 -0
  830. data/third_party/boringssl/crypto/bio/socket_helper.c +114 -0
  831. data/third_party/boringssl/crypto/bn_extra/bn_asn1.c +64 -0
  832. data/third_party/boringssl/crypto/bn_extra/convert.c +465 -0
  833. data/third_party/boringssl/crypto/buf/buf.c +231 -0
  834. data/third_party/boringssl/crypto/bytestring/asn1_compat.c +52 -0
  835. data/third_party/boringssl/crypto/bytestring/ber.c +264 -0
  836. data/third_party/boringssl/crypto/bytestring/cbb.c +568 -0
  837. data/third_party/boringssl/crypto/bytestring/cbs.c +487 -0
  838. data/third_party/boringssl/crypto/bytestring/internal.h +75 -0
  839. data/third_party/boringssl/crypto/chacha/chacha.c +167 -0
  840. data/third_party/boringssl/crypto/cipher_extra/cipher_extra.c +114 -0
  841. data/third_party/boringssl/crypto/cipher_extra/derive_key.c +152 -0
  842. data/third_party/boringssl/crypto/cipher_extra/e_aesctrhmac.c +281 -0
  843. data/third_party/boringssl/crypto/cipher_extra/e_aesgcmsiv.c +867 -0
  844. data/third_party/boringssl/crypto/cipher_extra/e_chacha20poly1305.c +326 -0
  845. data/third_party/boringssl/crypto/cipher_extra/e_null.c +85 -0
  846. data/third_party/boringssl/crypto/cipher_extra/e_rc2.c +460 -0
  847. data/third_party/boringssl/crypto/cipher_extra/e_rc4.c +87 -0
  848. data/third_party/boringssl/crypto/cipher_extra/e_ssl3.c +460 -0
  849. data/third_party/boringssl/crypto/cipher_extra/e_tls.c +681 -0
  850. data/third_party/boringssl/crypto/cipher_extra/internal.h +128 -0
  851. data/third_party/boringssl/crypto/cipher_extra/tls_cbc.c +482 -0
  852. data/third_party/boringssl/crypto/cmac/cmac.c +241 -0
  853. data/third_party/boringssl/crypto/conf/conf.c +803 -0
  854. data/third_party/boringssl/crypto/conf/conf_def.h +127 -0
  855. data/third_party/boringssl/crypto/conf/internal.h +31 -0
  856. data/third_party/boringssl/crypto/cpu-aarch64-linux.c +61 -0
  857. data/third_party/boringssl/crypto/cpu-arm-linux.c +363 -0
  858. data/third_party/boringssl/crypto/cpu-arm.c +38 -0
  859. data/third_party/boringssl/crypto/cpu-intel.c +288 -0
  860. data/third_party/boringssl/crypto/cpu-ppc64le.c +38 -0
  861. data/third_party/boringssl/crypto/crypto.c +198 -0
  862. data/third_party/boringssl/crypto/curve25519/spake25519.c +539 -0
  863. data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +247 -0
  864. data/third_party/boringssl/crypto/dh/check.c +217 -0
  865. data/third_party/boringssl/crypto/dh/dh.c +519 -0
  866. data/third_party/boringssl/crypto/dh/dh_asn1.c +160 -0
  867. data/third_party/boringssl/crypto/dh/params.c +93 -0
  868. data/third_party/boringssl/crypto/digest_extra/digest_extra.c +240 -0
  869. data/third_party/boringssl/crypto/dsa/dsa.c +984 -0
  870. data/third_party/boringssl/crypto/dsa/dsa_asn1.c +339 -0
  871. data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +563 -0
  872. data/third_party/boringssl/crypto/ecdh/ecdh.c +161 -0
  873. data/third_party/boringssl/crypto/ecdsa_extra/ecdsa_asn1.c +275 -0
  874. data/third_party/boringssl/crypto/engine/engine.c +98 -0
  875. data/third_party/boringssl/crypto/err/err.c +847 -0
  876. data/third_party/boringssl/crypto/err/internal.h +58 -0
  877. data/third_party/boringssl/crypto/evp/digestsign.c +231 -0
  878. data/third_party/boringssl/crypto/evp/evp.c +362 -0
  879. data/third_party/boringssl/crypto/evp/evp_asn1.c +337 -0
  880. data/third_party/boringssl/crypto/evp/evp_ctx.c +446 -0
  881. data/third_party/boringssl/crypto/evp/internal.h +252 -0
  882. data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +268 -0
  883. data/third_party/boringssl/crypto/evp/p_ec.c +239 -0
  884. data/third_party/boringssl/crypto/evp/p_ec_asn1.c +256 -0
  885. data/third_party/boringssl/crypto/evp/p_ed25519.c +71 -0
  886. data/third_party/boringssl/crypto/evp/p_ed25519_asn1.c +190 -0
  887. data/third_party/boringssl/crypto/evp/p_rsa.c +634 -0
  888. data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +189 -0
  889. data/third_party/boringssl/crypto/evp/pbkdf.c +146 -0
  890. data/third_party/boringssl/crypto/evp/print.c +489 -0
  891. data/third_party/boringssl/crypto/evp/scrypt.c +209 -0
  892. data/third_party/boringssl/crypto/evp/sign.c +151 -0
  893. data/third_party/boringssl/crypto/ex_data.c +261 -0
  894. data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +1100 -0
  895. data/third_party/boringssl/crypto/fipsmodule/aes/internal.h +100 -0
  896. data/third_party/boringssl/crypto/fipsmodule/aes/key_wrap.c +138 -0
  897. data/third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.c +112 -0
  898. data/third_party/boringssl/crypto/fipsmodule/bcm.c +679 -0
  899. data/third_party/boringssl/crypto/fipsmodule/bn/add.c +371 -0
  900. data/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c +540 -0
  901. data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +370 -0
  902. data/third_party/boringssl/crypto/fipsmodule/bn/bytes.c +269 -0
  903. data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +254 -0
  904. data/third_party/boringssl/crypto/fipsmodule/bn/ctx.c +303 -0
  905. data/third_party/boringssl/crypto/fipsmodule/bn/div.c +733 -0
  906. data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +1390 -0
  907. data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +627 -0
  908. data/third_party/boringssl/crypto/fipsmodule/bn/generic.c +710 -0
  909. data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +413 -0
  910. data/third_party/boringssl/crypto/fipsmodule/bn/jacobi.c +146 -0
  911. data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +483 -0
  912. data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +207 -0
  913. data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +902 -0
  914. data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +894 -0
  915. data/third_party/boringssl/crypto/fipsmodule/bn/random.c +299 -0
  916. data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.c +254 -0
  917. data/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +53 -0
  918. data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +305 -0
  919. data/third_party/boringssl/crypto/fipsmodule/bn/sqrt.c +502 -0
  920. data/third_party/boringssl/crypto/fipsmodule/cipher/aead.c +284 -0
  921. data/third_party/boringssl/crypto/fipsmodule/cipher/cipher.c +615 -0
  922. data/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.c +1437 -0
  923. data/third_party/boringssl/crypto/fipsmodule/cipher/e_des.c +233 -0
  924. data/third_party/boringssl/crypto/fipsmodule/cipher/internal.h +129 -0
  925. data/third_party/boringssl/crypto/fipsmodule/delocate.h +88 -0
  926. data/third_party/boringssl/crypto/fipsmodule/des/des.c +785 -0
  927. data/third_party/boringssl/crypto/fipsmodule/des/internal.h +238 -0
  928. data/third_party/boringssl/crypto/fipsmodule/digest/digest.c +256 -0
  929. data/third_party/boringssl/crypto/fipsmodule/digest/digests.c +280 -0
  930. data/third_party/boringssl/crypto/fipsmodule/digest/internal.h +112 -0
  931. data/third_party/boringssl/crypto/fipsmodule/digest/md32_common.h +268 -0
  932. data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +943 -0
  933. data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +517 -0
  934. data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +277 -0
  935. data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +316 -0
  936. data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +404 -0
  937. data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +1131 -0
  938. data/third_party/boringssl/crypto/fipsmodule/ec/p256-64.c +1674 -0
  939. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +9543 -0
  940. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +456 -0
  941. data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.h +113 -0
  942. data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +1052 -0
  943. data/third_party/boringssl/crypto/fipsmodule/ec/util-64.c +109 -0
  944. data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +474 -0
  945. data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +442 -0
  946. data/third_party/boringssl/crypto/fipsmodule/hmac/hmac.c +228 -0
  947. data/third_party/boringssl/crypto/fipsmodule/is_fips.c +27 -0
  948. data/third_party/boringssl/crypto/fipsmodule/md4/md4.c +254 -0
  949. data/third_party/boringssl/crypto/fipsmodule/md5/md5.c +298 -0
  950. data/third_party/boringssl/crypto/fipsmodule/modes/cbc.c +211 -0
  951. data/third_party/boringssl/crypto/fipsmodule/modes/cfb.c +234 -0
  952. data/third_party/boringssl/crypto/fipsmodule/modes/ctr.c +220 -0
  953. data/third_party/boringssl/crypto/fipsmodule/modes/gcm.c +1063 -0
  954. data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +384 -0
  955. data/third_party/boringssl/crypto/fipsmodule/modes/ofb.c +95 -0
  956. data/third_party/boringssl/crypto/fipsmodule/modes/polyval.c +91 -0
  957. data/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.c +200 -0
  958. data/third_party/boringssl/crypto/fipsmodule/rand/internal.h +92 -0
  959. data/third_party/boringssl/crypto/fipsmodule/rand/rand.c +358 -0
  960. data/third_party/boringssl/crypto/fipsmodule/rand/urandom.c +302 -0
  961. data/third_party/boringssl/crypto/fipsmodule/rsa/blinding.c +263 -0
  962. data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +131 -0
  963. data/third_party/boringssl/crypto/fipsmodule/rsa/padding.c +692 -0
  964. data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +857 -0
  965. data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +1051 -0
  966. data/third_party/boringssl/crypto/fipsmodule/sha/sha1-altivec.c +361 -0
  967. data/third_party/boringssl/crypto/fipsmodule/sha/sha1.c +375 -0
  968. data/third_party/boringssl/crypto/fipsmodule/sha/sha256.c +337 -0
  969. data/third_party/boringssl/crypto/fipsmodule/sha/sha512.c +608 -0
  970. data/third_party/boringssl/crypto/hkdf/hkdf.c +112 -0
  971. data/third_party/boringssl/crypto/internal.h +676 -0
  972. data/third_party/boringssl/crypto/lhash/lhash.c +336 -0
  973. data/third_party/boringssl/crypto/mem.c +237 -0
  974. data/third_party/boringssl/crypto/obj/obj.c +621 -0
  975. data/third_party/boringssl/crypto/obj/obj_dat.h +6244 -0
  976. data/third_party/boringssl/crypto/obj/obj_xref.c +122 -0
  977. data/third_party/boringssl/crypto/pem/pem_all.c +262 -0
  978. data/third_party/boringssl/crypto/pem/pem_info.c +379 -0
  979. data/third_party/boringssl/crypto/pem/pem_lib.c +776 -0
  980. data/third_party/boringssl/crypto/pem/pem_oth.c +88 -0
  981. data/third_party/boringssl/crypto/pem/pem_pk8.c +258 -0
  982. data/third_party/boringssl/crypto/pem/pem_pkey.c +227 -0
  983. data/third_party/boringssl/crypto/pem/pem_x509.c +65 -0
  984. data/third_party/boringssl/crypto/pem/pem_xaux.c +65 -0
  985. data/third_party/boringssl/crypto/pkcs7/internal.h +49 -0
  986. data/third_party/boringssl/crypto/pkcs7/pkcs7.c +166 -0
  987. data/third_party/boringssl/crypto/pkcs7/pkcs7_x509.c +233 -0
  988. data/third_party/boringssl/crypto/pkcs8/internal.h +120 -0
  989. data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +307 -0
  990. data/third_party/boringssl/crypto/pkcs8/pkcs8.c +513 -0
  991. data/third_party/boringssl/crypto/pkcs8/pkcs8_x509.c +789 -0
  992. data/third_party/boringssl/crypto/poly1305/internal.h +41 -0
  993. data/third_party/boringssl/crypto/poly1305/poly1305.c +318 -0
  994. data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +304 -0
  995. data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +839 -0
  996. data/third_party/boringssl/crypto/pool/internal.h +45 -0
  997. data/third_party/boringssl/crypto/pool/pool.c +200 -0
  998. data/third_party/boringssl/crypto/rand_extra/deterministic.c +48 -0
  999. data/third_party/boringssl/crypto/rand_extra/forkunsafe.c +46 -0
  1000. data/third_party/boringssl/crypto/rand_extra/fuchsia.c +43 -0
  1001. data/third_party/boringssl/crypto/rand_extra/rand_extra.c +70 -0
  1002. data/third_party/boringssl/crypto/rand_extra/windows.c +53 -0
  1003. data/third_party/boringssl/crypto/rc4/rc4.c +98 -0
  1004. data/third_party/boringssl/crypto/refcount_c11.c +67 -0
  1005. data/third_party/boringssl/crypto/refcount_lock.c +53 -0
  1006. data/third_party/boringssl/crypto/rsa_extra/rsa_asn1.c +325 -0
  1007. data/third_party/boringssl/crypto/stack/stack.c +380 -0
  1008. data/third_party/boringssl/crypto/thread.c +110 -0
  1009. data/third_party/boringssl/crypto/thread_none.c +59 -0
  1010. data/third_party/boringssl/crypto/thread_pthread.c +176 -0
  1011. data/third_party/boringssl/crypto/thread_win.c +237 -0
  1012. data/third_party/boringssl/crypto/x509/a_digest.c +96 -0
  1013. data/third_party/boringssl/crypto/x509/a_sign.c +128 -0
  1014. data/third_party/boringssl/crypto/x509/a_strex.c +633 -0
  1015. data/third_party/boringssl/crypto/x509/a_verify.c +115 -0
  1016. data/third_party/boringssl/crypto/x509/algorithm.c +153 -0
  1017. data/third_party/boringssl/crypto/x509/asn1_gen.c +841 -0
  1018. data/third_party/boringssl/crypto/x509/by_dir.c +451 -0
  1019. data/third_party/boringssl/crypto/x509/by_file.c +274 -0
  1020. data/third_party/boringssl/crypto/x509/charmap.h +15 -0
  1021. data/third_party/boringssl/crypto/x509/i2d_pr.c +83 -0
  1022. data/third_party/boringssl/crypto/x509/internal.h +66 -0
  1023. data/third_party/boringssl/crypto/x509/rsa_pss.c +385 -0
  1024. data/third_party/boringssl/crypto/x509/t_crl.c +128 -0
  1025. data/third_party/boringssl/crypto/x509/t_req.c +246 -0
  1026. data/third_party/boringssl/crypto/x509/t_x509.c +547 -0
  1027. data/third_party/boringssl/crypto/x509/t_x509a.c +111 -0
  1028. data/third_party/boringssl/crypto/x509/vpm_int.h +70 -0
  1029. data/third_party/boringssl/crypto/x509/x509.c +157 -0
  1030. data/third_party/boringssl/crypto/x509/x509_att.c +381 -0
  1031. data/third_party/boringssl/crypto/x509/x509_cmp.c +477 -0
  1032. data/third_party/boringssl/crypto/x509/x509_d2.c +106 -0
  1033. data/third_party/boringssl/crypto/x509/x509_def.c +103 -0
  1034. data/third_party/boringssl/crypto/x509/x509_ext.c +206 -0
  1035. data/third_party/boringssl/crypto/x509/x509_lu.c +725 -0
  1036. data/third_party/boringssl/crypto/x509/x509_obj.c +198 -0
  1037. data/third_party/boringssl/crypto/x509/x509_r2x.c +117 -0
  1038. data/third_party/boringssl/crypto/x509/x509_req.c +322 -0
  1039. data/third_party/boringssl/crypto/x509/x509_set.c +164 -0
  1040. data/third_party/boringssl/crypto/x509/x509_trs.c +326 -0
  1041. data/third_party/boringssl/crypto/x509/x509_txt.c +205 -0
  1042. data/third_party/boringssl/crypto/x509/x509_v3.c +278 -0
  1043. data/third_party/boringssl/crypto/x509/x509_vfy.c +2472 -0
  1044. data/third_party/boringssl/crypto/x509/x509_vpm.c +648 -0
  1045. data/third_party/boringssl/crypto/x509/x509cset.c +170 -0
  1046. data/third_party/boringssl/crypto/x509/x509name.c +389 -0
  1047. data/third_party/boringssl/crypto/x509/x509rset.c +81 -0
  1048. data/third_party/boringssl/crypto/x509/x509spki.c +137 -0
  1049. data/third_party/boringssl/crypto/x509/x_algor.c +151 -0
  1050. data/third_party/boringssl/crypto/x509/x_all.c +501 -0
  1051. data/third_party/boringssl/crypto/x509/x_attrib.c +111 -0
  1052. data/third_party/boringssl/crypto/x509/x_crl.c +541 -0
  1053. data/third_party/boringssl/crypto/x509/x_exten.c +75 -0
  1054. data/third_party/boringssl/crypto/x509/x_info.c +98 -0
  1055. data/third_party/boringssl/crypto/x509/x_name.c +541 -0
  1056. data/third_party/boringssl/crypto/x509/x_pkey.c +106 -0
  1057. data/third_party/boringssl/crypto/x509/x_pubkey.c +368 -0
  1058. data/third_party/boringssl/crypto/x509/x_req.c +109 -0
  1059. data/third_party/boringssl/crypto/x509/x_sig.c +69 -0
  1060. data/third_party/boringssl/crypto/x509/x_spki.c +80 -0
  1061. data/third_party/boringssl/crypto/x509/x_val.c +69 -0
  1062. data/third_party/boringssl/crypto/x509/x_x509.c +328 -0
  1063. data/third_party/boringssl/crypto/x509/x_x509a.c +198 -0
  1064. data/third_party/boringssl/crypto/x509v3/ext_dat.h +143 -0
  1065. data/third_party/boringssl/crypto/x509v3/pcy_cache.c +284 -0
  1066. data/third_party/boringssl/crypto/x509v3/pcy_data.c +130 -0
  1067. data/third_party/boringssl/crypto/x509v3/pcy_int.h +217 -0
  1068. data/third_party/boringssl/crypto/x509v3/pcy_lib.c +155 -0
  1069. data/third_party/boringssl/crypto/x509v3/pcy_map.c +130 -0
  1070. data/third_party/boringssl/crypto/x509v3/pcy_node.c +188 -0
  1071. data/third_party/boringssl/crypto/x509v3/pcy_tree.c +840 -0
  1072. data/third_party/boringssl/crypto/x509v3/v3_akey.c +204 -0
  1073. data/third_party/boringssl/crypto/x509v3/v3_akeya.c +72 -0
  1074. data/third_party/boringssl/crypto/x509v3/v3_alt.c +623 -0
  1075. data/third_party/boringssl/crypto/x509v3/v3_bcons.c +133 -0
  1076. data/third_party/boringssl/crypto/x509v3/v3_bitst.c +141 -0
  1077. data/third_party/boringssl/crypto/x509v3/v3_conf.c +462 -0
  1078. data/third_party/boringssl/crypto/x509v3/v3_cpols.c +502 -0
  1079. data/third_party/boringssl/crypto/x509v3/v3_crld.c +561 -0
  1080. data/third_party/boringssl/crypto/x509v3/v3_enum.c +100 -0
  1081. data/third_party/boringssl/crypto/x509v3/v3_extku.c +148 -0
  1082. data/third_party/boringssl/crypto/x509v3/v3_genn.c +251 -0
  1083. data/third_party/boringssl/crypto/x509v3/v3_ia5.c +122 -0
  1084. data/third_party/boringssl/crypto/x509v3/v3_info.c +219 -0
  1085. data/third_party/boringssl/crypto/x509v3/v3_int.c +91 -0
  1086. data/third_party/boringssl/crypto/x509v3/v3_lib.c +370 -0
  1087. data/third_party/boringssl/crypto/x509v3/v3_ncons.c +501 -0
  1088. data/third_party/boringssl/crypto/x509v3/v3_pci.c +287 -0
  1089. data/third_party/boringssl/crypto/x509v3/v3_pcia.c +57 -0
  1090. data/third_party/boringssl/crypto/x509v3/v3_pcons.c +139 -0
  1091. data/third_party/boringssl/crypto/x509v3/v3_pku.c +110 -0
  1092. data/third_party/boringssl/crypto/x509v3/v3_pmaps.c +154 -0
  1093. data/third_party/boringssl/crypto/x509v3/v3_prn.c +229 -0
  1094. data/third_party/boringssl/crypto/x509v3/v3_purp.c +866 -0
  1095. data/third_party/boringssl/crypto/x509v3/v3_skey.c +152 -0
  1096. data/third_party/boringssl/crypto/x509v3/v3_sxnet.c +274 -0
  1097. data/third_party/boringssl/crypto/x509v3/v3_utl.c +1352 -0
  1098. data/third_party/boringssl/include/openssl/aead.h +423 -0
  1099. data/third_party/boringssl/include/openssl/aes.h +170 -0
  1100. data/third_party/boringssl/include/openssl/arm_arch.h +121 -0
  1101. data/third_party/boringssl/include/openssl/asn1.h +982 -0
  1102. data/third_party/boringssl/include/openssl/asn1_mac.h +18 -0
  1103. data/third_party/boringssl/include/openssl/asn1t.h +892 -0
  1104. data/third_party/boringssl/include/openssl/base.h +469 -0
  1105. data/third_party/boringssl/include/openssl/base64.h +187 -0
  1106. data/third_party/boringssl/include/openssl/bio.h +902 -0
  1107. data/third_party/boringssl/include/openssl/blowfish.h +93 -0
  1108. data/third_party/boringssl/include/openssl/bn.h +975 -0
  1109. data/third_party/boringssl/include/openssl/buf.h +137 -0
  1110. data/third_party/boringssl/include/openssl/buffer.h +18 -0
  1111. data/third_party/boringssl/include/openssl/bytestring.h +480 -0
  1112. data/third_party/boringssl/include/openssl/cast.h +96 -0
  1113. data/third_party/boringssl/include/openssl/chacha.h +41 -0
  1114. data/third_party/boringssl/include/openssl/cipher.h +608 -0
  1115. data/third_party/boringssl/include/openssl/cmac.h +87 -0
  1116. data/third_party/boringssl/include/openssl/conf.h +183 -0
  1117. data/third_party/boringssl/include/openssl/cpu.h +196 -0
  1118. data/third_party/boringssl/include/openssl/crypto.h +118 -0
  1119. data/third_party/boringssl/include/openssl/curve25519.h +201 -0
  1120. data/third_party/boringssl/include/openssl/des.h +177 -0
  1121. data/third_party/boringssl/include/openssl/dh.h +298 -0
  1122. data/third_party/boringssl/include/openssl/digest.h +316 -0
  1123. data/third_party/boringssl/include/openssl/dsa.h +435 -0
  1124. data/third_party/boringssl/include/openssl/dtls1.h +16 -0
  1125. data/third_party/boringssl/include/openssl/ec.h +407 -0
  1126. data/third_party/boringssl/include/openssl/ec_key.h +341 -0
  1127. data/third_party/boringssl/include/openssl/ecdh.h +101 -0
  1128. data/third_party/boringssl/include/openssl/ecdsa.h +199 -0
  1129. data/third_party/boringssl/include/openssl/engine.h +109 -0
  1130. data/third_party/boringssl/include/openssl/err.h +458 -0
  1131. data/third_party/boringssl/include/openssl/evp.h +873 -0
  1132. data/third_party/boringssl/include/openssl/ex_data.h +203 -0
  1133. data/third_party/boringssl/include/openssl/hkdf.h +64 -0
  1134. data/third_party/boringssl/include/openssl/hmac.h +186 -0
  1135. data/third_party/boringssl/include/openssl/is_boringssl.h +16 -0
  1136. data/third_party/boringssl/include/openssl/lhash.h +174 -0
  1137. data/third_party/boringssl/include/openssl/lhash_macros.h +174 -0
  1138. data/third_party/boringssl/include/openssl/md4.h +106 -0
  1139. data/third_party/boringssl/include/openssl/md5.h +107 -0
  1140. data/third_party/boringssl/include/openssl/mem.h +156 -0
  1141. data/third_party/boringssl/include/openssl/nid.h +4242 -0
  1142. data/third_party/boringssl/include/openssl/obj.h +233 -0
  1143. data/third_party/boringssl/include/openssl/obj_mac.h +18 -0
  1144. data/third_party/boringssl/include/openssl/objects.h +18 -0
  1145. data/third_party/boringssl/include/openssl/opensslconf.h +67 -0
  1146. data/third_party/boringssl/include/openssl/opensslv.h +18 -0
  1147. data/third_party/boringssl/include/openssl/ossl_typ.h +18 -0
  1148. data/third_party/boringssl/include/openssl/pem.h +397 -0
  1149. data/third_party/boringssl/include/openssl/pkcs12.h +18 -0
  1150. data/third_party/boringssl/include/openssl/pkcs7.h +82 -0
  1151. data/third_party/boringssl/include/openssl/pkcs8.h +230 -0
  1152. data/third_party/boringssl/include/openssl/poly1305.h +51 -0
  1153. data/third_party/boringssl/include/openssl/pool.h +91 -0
  1154. data/third_party/boringssl/include/openssl/rand.h +125 -0
  1155. data/third_party/boringssl/include/openssl/rc4.h +96 -0
  1156. data/third_party/boringssl/include/openssl/ripemd.h +107 -0
  1157. data/third_party/boringssl/include/openssl/rsa.h +731 -0
  1158. data/third_party/boringssl/include/openssl/safestack.h +16 -0
  1159. data/third_party/boringssl/include/openssl/sha.h +256 -0
  1160. data/third_party/boringssl/include/openssl/span.h +191 -0
  1161. data/third_party/boringssl/include/openssl/srtp.h +18 -0
  1162. data/third_party/boringssl/include/openssl/ssl.h +4592 -0
  1163. data/third_party/boringssl/include/openssl/ssl3.h +333 -0
  1164. data/third_party/boringssl/include/openssl/stack.h +485 -0
  1165. data/third_party/boringssl/include/openssl/thread.h +191 -0
  1166. data/third_party/boringssl/include/openssl/tls1.h +610 -0
  1167. data/third_party/boringssl/include/openssl/type_check.h +91 -0
  1168. data/third_party/boringssl/include/openssl/x509.h +1176 -0
  1169. data/third_party/boringssl/include/openssl/x509_vfy.h +614 -0
  1170. data/third_party/boringssl/include/openssl/x509v3.h +826 -0
  1171. data/third_party/boringssl/ssl/bio_ssl.cc +179 -0
  1172. data/third_party/boringssl/ssl/custom_extensions.cc +265 -0
  1173. data/third_party/boringssl/ssl/d1_both.cc +837 -0
  1174. data/third_party/boringssl/ssl/d1_lib.cc +267 -0
  1175. data/third_party/boringssl/ssl/d1_pkt.cc +274 -0
  1176. data/third_party/boringssl/ssl/d1_srtp.cc +232 -0
  1177. data/third_party/boringssl/ssl/dtls_method.cc +193 -0
  1178. data/third_party/boringssl/ssl/dtls_record.cc +353 -0
  1179. data/third_party/boringssl/ssl/handshake.cc +616 -0
  1180. data/third_party/boringssl/ssl/handshake_client.cc +1836 -0
  1181. data/third_party/boringssl/ssl/handshake_server.cc +1662 -0
  1182. data/third_party/boringssl/ssl/internal.h +3011 -0
  1183. data/third_party/boringssl/ssl/s3_both.cc +585 -0
  1184. data/third_party/boringssl/ssl/s3_lib.cc +224 -0
  1185. data/third_party/boringssl/ssl/s3_pkt.cc +443 -0
  1186. data/third_party/boringssl/ssl/ssl_aead_ctx.cc +415 -0
  1187. data/third_party/boringssl/ssl/ssl_asn1.cc +840 -0
  1188. data/third_party/boringssl/ssl/ssl_buffer.cc +286 -0
  1189. data/third_party/boringssl/ssl/ssl_cert.cc +913 -0
  1190. data/third_party/boringssl/ssl/ssl_cipher.cc +1777 -0
  1191. data/third_party/boringssl/ssl/ssl_file.cc +583 -0
  1192. data/third_party/boringssl/ssl/ssl_key_share.cc +250 -0
  1193. data/third_party/boringssl/ssl/ssl_lib.cc +2650 -0
  1194. data/third_party/boringssl/ssl/ssl_privkey.cc +488 -0
  1195. data/third_party/boringssl/ssl/ssl_session.cc +1221 -0
  1196. data/third_party/boringssl/ssl/ssl_stat.cc +224 -0
  1197. data/third_party/boringssl/ssl/ssl_transcript.cc +398 -0
  1198. data/third_party/boringssl/ssl/ssl_versions.cc +472 -0
  1199. data/third_party/boringssl/ssl/ssl_x509.cc +1299 -0
  1200. data/third_party/boringssl/ssl/t1_enc.cc +503 -0
  1201. data/third_party/boringssl/ssl/t1_lib.cc +3457 -0
  1202. data/third_party/boringssl/ssl/tls13_both.cc +551 -0
  1203. data/third_party/boringssl/ssl/tls13_client.cc +977 -0
  1204. data/third_party/boringssl/ssl/tls13_enc.cc +563 -0
  1205. data/third_party/boringssl/ssl/tls13_server.cc +1068 -0
  1206. data/third_party/boringssl/ssl/tls_method.cc +291 -0
  1207. data/third_party/boringssl/ssl/tls_record.cc +712 -0
  1208. data/third_party/boringssl/third_party/fiat/curve25519.c +5062 -0
  1209. data/third_party/boringssl/third_party/fiat/internal.h +142 -0
  1210. data/third_party/cares/ares_build.h +223 -0
  1211. data/third_party/cares/cares/ares.h +658 -0
  1212. data/third_party/cares/cares/ares__close_sockets.c +61 -0
  1213. data/third_party/cares/cares/ares__get_hostent.c +261 -0
  1214. data/third_party/cares/cares/ares__read_line.c +73 -0
  1215. data/third_party/cares/cares/ares__timeval.c +111 -0
  1216. data/third_party/cares/cares/ares_cancel.c +63 -0
  1217. data/third_party/cares/cares/ares_create_query.c +202 -0
  1218. data/third_party/cares/cares/ares_data.c +221 -0
  1219. data/third_party/cares/cares/ares_data.h +72 -0
  1220. data/third_party/cares/cares/ares_destroy.c +108 -0
  1221. data/third_party/cares/cares/ares_dns.h +103 -0
  1222. data/third_party/cares/cares/ares_expand_name.c +209 -0
  1223. data/third_party/cares/cares/ares_expand_string.c +70 -0
  1224. data/third_party/cares/cares/ares_fds.c +59 -0
  1225. data/third_party/cares/cares/ares_free_hostent.c +41 -0
  1226. data/third_party/cares/cares/ares_free_string.c +25 -0
  1227. data/third_party/cares/cares/ares_getenv.c +30 -0
  1228. data/third_party/cares/cares/ares_getenv.h +26 -0
  1229. data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
  1230. data/third_party/cares/cares/ares_gethostbyname.c +518 -0
  1231. data/third_party/cares/cares/ares_getnameinfo.c +442 -0
  1232. data/third_party/cares/cares/ares_getopt.c +122 -0
  1233. data/third_party/cares/cares/ares_getopt.h +53 -0
  1234. data/third_party/cares/cares/ares_getsock.c +66 -0
  1235. data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
  1236. data/third_party/cares/cares/ares_init.c +2514 -0
  1237. data/third_party/cares/cares/ares_iphlpapi.h +221 -0
  1238. data/third_party/cares/cares/ares_ipv6.h +78 -0
  1239. data/third_party/cares/cares/ares_library_init.c +177 -0
  1240. data/third_party/cares/cares/ares_library_init.h +43 -0
  1241. data/third_party/cares/cares/ares_llist.c +63 -0
  1242. data/third_party/cares/cares/ares_llist.h +39 -0
  1243. data/third_party/cares/cares/ares_mkquery.c +24 -0
  1244. data/third_party/cares/cares/ares_nowarn.c +260 -0
  1245. data/third_party/cares/cares/ares_nowarn.h +61 -0
  1246. data/third_party/cares/cares/ares_options.c +402 -0
  1247. data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
  1248. data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
  1249. data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
  1250. data/third_party/cares/cares/ares_parse_naptr_reply.c +193 -0
  1251. data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
  1252. data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
  1253. data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
  1254. data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
  1255. data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
  1256. data/third_party/cares/cares/ares_platform.c +11035 -0
  1257. data/third_party/cares/cares/ares_platform.h +43 -0
  1258. data/third_party/cares/cares/ares_private.h +374 -0
  1259. data/third_party/cares/cares/ares_process.c +1448 -0
  1260. data/third_party/cares/cares/ares_query.c +186 -0
  1261. data/third_party/cares/cares/ares_rules.h +125 -0
  1262. data/third_party/cares/cares/ares_search.c +316 -0
  1263. data/third_party/cares/cares/ares_send.c +131 -0
  1264. data/third_party/cares/cares/ares_setup.h +217 -0
  1265. data/third_party/cares/cares/ares_strcasecmp.c +66 -0
  1266. data/third_party/cares/cares/ares_strcasecmp.h +30 -0
  1267. data/third_party/cares/cares/ares_strdup.c +49 -0
  1268. data/third_party/cares/cares/ares_strdup.h +24 -0
  1269. data/third_party/cares/cares/ares_strerror.c +56 -0
  1270. data/third_party/cares/cares/ares_timeout.c +88 -0
  1271. data/third_party/cares/cares/ares_version.c +11 -0
  1272. data/third_party/cares/cares/ares_version.h +24 -0
  1273. data/third_party/cares/cares/ares_writev.c +79 -0
  1274. data/third_party/cares/cares/bitncmp.c +59 -0
  1275. data/third_party/cares/cares/bitncmp.h +26 -0
  1276. data/third_party/cares/cares/config-win32.h +351 -0
  1277. data/third_party/cares/cares/inet_net_pton.c +450 -0
  1278. data/third_party/cares/cares/inet_ntop.c +208 -0
  1279. data/third_party/cares/cares/setup_once.h +554 -0
  1280. data/third_party/cares/cares/windows_port.c +22 -0
  1281. data/third_party/cares/config_darwin/ares_config.h +425 -0
  1282. data/third_party/cares/config_freebsd/ares_config.h +502 -0
  1283. data/third_party/cares/config_linux/ares_config.h +458 -0
  1284. data/third_party/cares/config_openbsd/ares_config.h +502 -0
  1285. data/third_party/nanopb/pb.h +579 -0
  1286. data/third_party/nanopb/pb_common.c +97 -0
  1287. data/third_party/nanopb/pb_common.h +42 -0
  1288. data/third_party/nanopb/pb_decode.c +1347 -0
  1289. data/third_party/nanopb/pb_decode.h +149 -0
  1290. data/third_party/nanopb/pb_encode.c +696 -0
  1291. data/third_party/nanopb/pb_encode.h +154 -0
  1292. data/third_party/zlib/adler32.c +186 -0
  1293. data/third_party/zlib/compress.c +86 -0
  1294. data/third_party/zlib/crc32.c +442 -0
  1295. data/third_party/zlib/crc32.h +441 -0
  1296. data/third_party/zlib/deflate.c +2163 -0
  1297. data/third_party/zlib/deflate.h +349 -0
  1298. data/third_party/zlib/gzclose.c +25 -0
  1299. data/third_party/zlib/gzguts.h +218 -0
  1300. data/third_party/zlib/gzlib.c +637 -0
  1301. data/third_party/zlib/gzread.c +654 -0
  1302. data/third_party/zlib/gzwrite.c +665 -0
  1303. data/third_party/zlib/infback.c +640 -0
  1304. data/third_party/zlib/inffast.c +323 -0
  1305. data/third_party/zlib/inffast.h +11 -0
  1306. data/third_party/zlib/inffixed.h +94 -0
  1307. data/third_party/zlib/inflate.c +1561 -0
  1308. data/third_party/zlib/inflate.h +125 -0
  1309. data/third_party/zlib/inftrees.c +304 -0
  1310. data/third_party/zlib/inftrees.h +62 -0
  1311. data/third_party/zlib/trees.c +1203 -0
  1312. data/third_party/zlib/trees.h +128 -0
  1313. data/third_party/zlib/uncompr.c +93 -0
  1314. data/third_party/zlib/zconf.h +534 -0
  1315. data/third_party/zlib/zlib.h +1912 -0
  1316. data/third_party/zlib/zutil.c +325 -0
  1317. data/third_party/zlib/zutil.h +271 -0
  1318. metadata +1586 -0
@@ -0,0 +1,18 @@
1
+ /* Copyright (c) 2015, Google Inc.
2
+ *
3
+ * Permission to use, copy, modify, and/or distribute this software for any
4
+ * purpose with or without fee is hereby granted, provided that the above
5
+ * copyright notice and this permission notice appear in all copies.
6
+ *
7
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
+
15
+ /* This header is provided in order to make compiling against code that expects
16
+ OpenSSL easier. */
17
+
18
+ #include "ssl.h"
@@ -0,0 +1,4592 @@
1
+ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
2
+ * All rights reserved.
3
+ *
4
+ * This package is an SSL implementation written
5
+ * by Eric Young (eay@cryptsoft.com).
6
+ * The implementation was written so as to conform with Netscapes SSL.
7
+ *
8
+ * This library is free for commercial and non-commercial use as long as
9
+ * the following conditions are aheared to. The following conditions
10
+ * apply to all code found in this distribution, be it the RC4, RSA,
11
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
12
+ * included with this distribution is covered by the same copyright terms
13
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
14
+ *
15
+ * Copyright remains Eric Young's, and as such any Copyright notices in
16
+ * the code are not to be removed.
17
+ * If this package is used in a product, Eric Young should be given attribution
18
+ * as the author of the parts of the library used.
19
+ * This can be in the form of a textual message at program startup or
20
+ * in documentation (online or textual) provided with the package.
21
+ *
22
+ * Redistribution and use in source and binary forms, with or without
23
+ * modification, are permitted provided that the following conditions
24
+ * are met:
25
+ * 1. Redistributions of source code must retain the copyright
26
+ * notice, this list of conditions and the following disclaimer.
27
+ * 2. Redistributions in binary form must reproduce the above copyright
28
+ * notice, this list of conditions and the following disclaimer in the
29
+ * documentation and/or other materials provided with the distribution.
30
+ * 3. All advertising materials mentioning features or use of this software
31
+ * must display the following acknowledgement:
32
+ * "This product includes cryptographic software written by
33
+ * Eric Young (eay@cryptsoft.com)"
34
+ * The word 'cryptographic' can be left out if the rouines from the library
35
+ * being used are not cryptographic related :-).
36
+ * 4. If you include any Windows specific code (or a derivative thereof) from
37
+ * the apps directory (application code) you must include an acknowledgement:
38
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
39
+ *
40
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50
+ * SUCH DAMAGE.
51
+ *
52
+ * The licence and distribution terms for any publically available version or
53
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
54
+ * copied and put under another distribution licence
55
+ * [including the GNU Public Licence.]
56
+ */
57
+ /* ====================================================================
58
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
59
+ *
60
+ * Redistribution and use in source and binary forms, with or without
61
+ * modification, are permitted provided that the following conditions
62
+ * are met:
63
+ *
64
+ * 1. Redistributions of source code must retain the above copyright
65
+ * notice, this list of conditions and the following disclaimer.
66
+ *
67
+ * 2. Redistributions in binary form must reproduce the above copyright
68
+ * notice, this list of conditions and the following disclaimer in
69
+ * the documentation and/or other materials provided with the
70
+ * distribution.
71
+ *
72
+ * 3. All advertising materials mentioning features or use of this
73
+ * software must display the following acknowledgment:
74
+ * "This product includes software developed by the OpenSSL Project
75
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
76
+ *
77
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
78
+ * endorse or promote products derived from this software without
79
+ * prior written permission. For written permission, please contact
80
+ * openssl-core@openssl.org.
81
+ *
82
+ * 5. Products derived from this software may not be called "OpenSSL"
83
+ * nor may "OpenSSL" appear in their names without prior written
84
+ * permission of the OpenSSL Project.
85
+ *
86
+ * 6. Redistributions of any form whatsoever must retain the following
87
+ * acknowledgment:
88
+ * "This product includes software developed by the OpenSSL Project
89
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
90
+ *
91
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
92
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
93
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
94
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
95
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
96
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
97
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
98
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
99
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
100
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
101
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
102
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
103
+ * ====================================================================
104
+ *
105
+ * This product includes cryptographic software written by Eric Young
106
+ * (eay@cryptsoft.com). This product includes software written by Tim
107
+ * Hudson (tjh@cryptsoft.com).
108
+ *
109
+ */
110
+ /* ====================================================================
111
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
112
+ * ECC cipher suite support in OpenSSL originally developed by
113
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
114
+ */
115
+ /* ====================================================================
116
+ * Copyright 2005 Nokia. All rights reserved.
117
+ *
118
+ * The portions of the attached software ("Contribution") is developed by
119
+ * Nokia Corporation and is licensed pursuant to the OpenSSL open source
120
+ * license.
121
+ *
122
+ * The Contribution, originally written by Mika Kousa and Pasi Eronen of
123
+ * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
124
+ * support (see RFC 4279) to OpenSSL.
125
+ *
126
+ * No patent licenses or other rights except those expressly stated in
127
+ * the OpenSSL open source license shall be deemed granted or received
128
+ * expressly, by implication, estoppel, or otherwise.
129
+ *
130
+ * No assurances are provided by Nokia that the Contribution does not
131
+ * infringe the patent or other intellectual property rights of any third
132
+ * party or that the license provides you with all the necessary rights
133
+ * to make use of the Contribution.
134
+ *
135
+ * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
136
+ * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
137
+ * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
138
+ * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
139
+ * OTHERWISE.
140
+ */
141
+
142
+ #ifndef OPENSSL_HEADER_SSL_H
143
+ #define OPENSSL_HEADER_SSL_H
144
+
145
+ #include <openssl/base.h>
146
+
147
+ #include <openssl/bio.h>
148
+ #include <openssl/buf.h>
149
+ #include <openssl/pem.h>
150
+ #include <openssl/span.h>
151
+ #include <openssl/ssl3.h>
152
+ #include <openssl/thread.h>
153
+ #include <openssl/tls1.h>
154
+ #include <openssl/x509.h>
155
+
156
+ #if !defined(OPENSSL_WINDOWS)
157
+ #include <sys/time.h>
158
+ #endif
159
+
160
+ // NGINX needs this #include. Consider revisiting this after NGINX 1.14.0 has
161
+ // been out for a year or so (assuming that they fix it in that release.) See
162
+ // https://boringssl-review.googlesource.com/c/boringssl/+/21664.
163
+ #include <openssl/hmac.h>
164
+
165
+ // Forward-declare struct timeval. On Windows, it is defined in winsock2.h and
166
+ // Windows headers define too many macros to be included in public headers.
167
+ // However, only a forward declaration is needed.
168
+ struct timeval;
169
+
170
+ #if defined(__cplusplus)
171
+ extern "C" {
172
+ #endif
173
+
174
+
175
+ // SSL implementation.
176
+
177
+
178
+ // SSL contexts.
179
+ //
180
+ // |SSL_CTX| objects manage shared state and configuration between multiple TLS
181
+ // or DTLS connections. Whether the connections are TLS or DTLS is selected by
182
+ // an |SSL_METHOD| on creation.
183
+ //
184
+ // |SSL_CTX| are reference-counted and may be shared by connections across
185
+ // multiple threads. Once shared, functions which change the |SSL_CTX|'s
186
+ // configuration may not be used.
187
+
188
+ // TLS_method is the |SSL_METHOD| used for TLS (and SSLv3) connections.
189
+ OPENSSL_EXPORT const SSL_METHOD *TLS_method(void);
190
+
191
+ // DTLS_method is the |SSL_METHOD| used for DTLS connections.
192
+ OPENSSL_EXPORT const SSL_METHOD *DTLS_method(void);
193
+
194
+ // TLS_with_buffers_method is like |TLS_method|, but avoids all use of
195
+ // crypto/x509.
196
+ OPENSSL_EXPORT const SSL_METHOD *TLS_with_buffers_method(void);
197
+
198
+ // DTLS_with_buffers_method is like |DTLS_method|, but avoids all use of
199
+ // crypto/x509.
200
+ OPENSSL_EXPORT const SSL_METHOD *DTLS_with_buffers_method(void);
201
+
202
+ // SSL_CTX_new returns a newly-allocated |SSL_CTX| with default settings or NULL
203
+ // on error.
204
+ OPENSSL_EXPORT SSL_CTX *SSL_CTX_new(const SSL_METHOD *method);
205
+
206
+ // SSL_CTX_up_ref increments the reference count of |ctx|. It returns one.
207
+ OPENSSL_EXPORT int SSL_CTX_up_ref(SSL_CTX *ctx);
208
+
209
+ // SSL_CTX_free releases memory associated with |ctx|.
210
+ OPENSSL_EXPORT void SSL_CTX_free(SSL_CTX *ctx);
211
+
212
+
213
+ // SSL connections.
214
+ //
215
+ // An |SSL| object represents a single TLS or DTLS connection. Although the
216
+ // shared |SSL_CTX| is thread-safe, an |SSL| is not thread-safe and may only be
217
+ // used on one thread at a time.
218
+
219
+ // SSL_new returns a newly-allocated |SSL| using |ctx| or NULL on error. The new
220
+ // connection inherits settings from |ctx| at the time of creation. Settings may
221
+ // also be individually configured on the connection.
222
+ //
223
+ // On creation, an |SSL| is not configured to be either a client or server. Call
224
+ // |SSL_set_connect_state| or |SSL_set_accept_state| to set this.
225
+ OPENSSL_EXPORT SSL *SSL_new(SSL_CTX *ctx);
226
+
227
+ // SSL_free releases memory associated with |ssl|.
228
+ OPENSSL_EXPORT void SSL_free(SSL *ssl);
229
+
230
+ // SSL_get_SSL_CTX returns the |SSL_CTX| associated with |ssl|. If
231
+ // |SSL_set_SSL_CTX| is called, it returns the new |SSL_CTX|, not the initial
232
+ // one.
233
+ OPENSSL_EXPORT SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);
234
+
235
+ // SSL_set_connect_state configures |ssl| to be a client.
236
+ OPENSSL_EXPORT void SSL_set_connect_state(SSL *ssl);
237
+
238
+ // SSL_set_accept_state configures |ssl| to be a server.
239
+ OPENSSL_EXPORT void SSL_set_accept_state(SSL *ssl);
240
+
241
+ // SSL_is_server returns one if |ssl| is configured as a server and zero
242
+ // otherwise.
243
+ OPENSSL_EXPORT int SSL_is_server(const SSL *ssl);
244
+
245
+ // SSL_is_dtls returns one if |ssl| is a DTLS connection and zero otherwise.
246
+ OPENSSL_EXPORT int SSL_is_dtls(const SSL *ssl);
247
+
248
+ // SSL_set_bio configures |ssl| to read from |rbio| and write to |wbio|. |ssl|
249
+ // takes ownership of the two |BIO|s. If |rbio| and |wbio| are the same, |ssl|
250
+ // only takes ownership of one reference.
251
+ //
252
+ // In DTLS, |rbio| must be non-blocking to properly handle timeouts and
253
+ // retransmits.
254
+ //
255
+ // If |rbio| is the same as the currently configured |BIO| for reading, that
256
+ // side is left untouched and is not freed.
257
+ //
258
+ // If |wbio| is the same as the currently configured |BIO| for writing AND |ssl|
259
+ // is not currently configured to read from and write to the same |BIO|, that
260
+ // side is left untouched and is not freed. This asymmetry is present for
261
+ // historical reasons.
262
+ //
263
+ // Due to the very complex historical behavior of this function, calling this
264
+ // function if |ssl| already has |BIO|s configured is deprecated. Prefer
265
+ // |SSL_set0_rbio| and |SSL_set0_wbio| instead.
266
+ OPENSSL_EXPORT void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);
267
+
268
+ // SSL_set0_rbio configures |ssl| to write to |rbio|. It takes ownership of
269
+ // |rbio|.
270
+ //
271
+ // Note that, although this function and |SSL_set0_wbio| may be called on the
272
+ // same |BIO|, each call takes a reference. Use |BIO_up_ref| to balance this.
273
+ OPENSSL_EXPORT void SSL_set0_rbio(SSL *ssl, BIO *rbio);
274
+
275
+ // SSL_set0_wbio configures |ssl| to write to |wbio|. It takes ownership of
276
+ // |wbio|.
277
+ //
278
+ // Note that, although this function and |SSL_set0_rbio| may be called on the
279
+ // same |BIO|, each call takes a reference. Use |BIO_up_ref| to balance this.
280
+ OPENSSL_EXPORT void SSL_set0_wbio(SSL *ssl, BIO *wbio);
281
+
282
+ // SSL_get_rbio returns the |BIO| that |ssl| reads from.
283
+ OPENSSL_EXPORT BIO *SSL_get_rbio(const SSL *ssl);
284
+
285
+ // SSL_get_wbio returns the |BIO| that |ssl| writes to.
286
+ OPENSSL_EXPORT BIO *SSL_get_wbio(const SSL *ssl);
287
+
288
+ // SSL_get_fd calls |SSL_get_rfd|.
289
+ OPENSSL_EXPORT int SSL_get_fd(const SSL *ssl);
290
+
291
+ // SSL_get_rfd returns the file descriptor that |ssl| is configured to read
292
+ // from. If |ssl|'s read |BIO| is not configured or doesn't wrap a file
293
+ // descriptor then it returns -1.
294
+ //
295
+ // Note: On Windows, this may return either a file descriptor or a socket (cast
296
+ // to int), depending on whether |ssl| was configured with a file descriptor or
297
+ // socket |BIO|.
298
+ OPENSSL_EXPORT int SSL_get_rfd(const SSL *ssl);
299
+
300
+ // SSL_get_wfd returns the file descriptor that |ssl| is configured to write
301
+ // to. If |ssl|'s write |BIO| is not configured or doesn't wrap a file
302
+ // descriptor then it returns -1.
303
+ //
304
+ // Note: On Windows, this may return either a file descriptor or a socket (cast
305
+ // to int), depending on whether |ssl| was configured with a file descriptor or
306
+ // socket |BIO|.
307
+ OPENSSL_EXPORT int SSL_get_wfd(const SSL *ssl);
308
+
309
+ // SSL_set_fd configures |ssl| to read from and write to |fd|. It returns one
310
+ // on success and zero on allocation error. The caller retains ownership of
311
+ // |fd|.
312
+ //
313
+ // On Windows, |fd| is cast to a |SOCKET| and used with Winsock APIs.
314
+ OPENSSL_EXPORT int SSL_set_fd(SSL *ssl, int fd);
315
+
316
+ // SSL_set_rfd configures |ssl| to read from |fd|. It returns one on success and
317
+ // zero on allocation error. The caller retains ownership of |fd|.
318
+ //
319
+ // On Windows, |fd| is cast to a |SOCKET| and used with Winsock APIs.
320
+ OPENSSL_EXPORT int SSL_set_rfd(SSL *ssl, int fd);
321
+
322
+ // SSL_set_wfd configures |ssl| to write to |fd|. It returns one on success and
323
+ // zero on allocation error. The caller retains ownership of |fd|.
324
+ //
325
+ // On Windows, |fd| is cast to a |SOCKET| and used with Winsock APIs.
326
+ OPENSSL_EXPORT int SSL_set_wfd(SSL *ssl, int fd);
327
+
328
+ // SSL_do_handshake continues the current handshake. If there is none or the
329
+ // handshake has completed or False Started, it returns one. Otherwise, it
330
+ // returns <= 0. The caller should pass the value into |SSL_get_error| to
331
+ // determine how to proceed.
332
+ //
333
+ // In DTLS, the caller must drive retransmissions. Whenever |SSL_get_error|
334
+ // signals |SSL_ERROR_WANT_READ|, use |DTLSv1_get_timeout| to determine the
335
+ // current timeout. If it expires before the next retry, call
336
+ // |DTLSv1_handle_timeout|. Note that DTLS handshake retransmissions use fresh
337
+ // sequence numbers, so it is not sufficient to replay packets at the transport.
338
+ //
339
+ // TODO(davidben): Ensure 0 is only returned on transport EOF.
340
+ // https://crbug.com/466303.
341
+ OPENSSL_EXPORT int SSL_do_handshake(SSL *ssl);
342
+
343
+ // SSL_connect configures |ssl| as a client, if unconfigured, and calls
344
+ // |SSL_do_handshake|.
345
+ OPENSSL_EXPORT int SSL_connect(SSL *ssl);
346
+
347
+ // SSL_accept configures |ssl| as a server, if unconfigured, and calls
348
+ // |SSL_do_handshake|.
349
+ OPENSSL_EXPORT int SSL_accept(SSL *ssl);
350
+
351
+ // SSL_read reads up to |num| bytes from |ssl| into |buf|. It implicitly runs
352
+ // any pending handshakes, including renegotiations when enabled. On success, it
353
+ // returns the number of bytes read. Otherwise, it returns <= 0. The caller
354
+ // should pass the value into |SSL_get_error| to determine how to proceed.
355
+ //
356
+ // TODO(davidben): Ensure 0 is only returned on transport EOF.
357
+ // https://crbug.com/466303.
358
+ OPENSSL_EXPORT int SSL_read(SSL *ssl, void *buf, int num);
359
+
360
+ // SSL_peek behaves like |SSL_read| but does not consume any bytes returned.
361
+ OPENSSL_EXPORT int SSL_peek(SSL *ssl, void *buf, int num);
362
+
363
+ // SSL_pending returns the number of bytes available in |ssl|. It does not read
364
+ // from the transport.
365
+ OPENSSL_EXPORT int SSL_pending(const SSL *ssl);
366
+
367
+ // SSL_write writes up to |num| bytes from |buf| into |ssl|. It implicitly runs
368
+ // any pending handshakes, including renegotiations when enabled. On success, it
369
+ // returns the number of bytes written. Otherwise, it returns <= 0. The caller
370
+ // should pass the value into |SSL_get_error| to determine how to proceed.
371
+ //
372
+ // In TLS, a non-blocking |SSL_write| differs from non-blocking |write| in that
373
+ // a failed |SSL_write| still commits to the data passed in. When retrying, the
374
+ // caller must supply the original write buffer (or a larger one containing the
375
+ // original as a prefix). By default, retries will fail if they also do not
376
+ // reuse the same |buf| pointer. This may be relaxed with
377
+ // |SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER|, but the buffer contents still must be
378
+ // unchanged.
379
+ //
380
+ // By default, in TLS, |SSL_write| will not return success until all |num| bytes
381
+ // are written. This may be relaxed with |SSL_MODE_ENABLE_PARTIAL_WRITE|. It
382
+ // allows |SSL_write| to complete with a partial result when only part of the
383
+ // input was written in a single record.
384
+ //
385
+ // In DTLS, neither |SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER| and
386
+ // |SSL_MODE_ENABLE_PARTIAL_WRITE| do anything. The caller may retry with a
387
+ // different buffer freely. A single call to |SSL_write| only ever writes a
388
+ // single record in a single packet, so |num| must be at most
389
+ // |SSL3_RT_MAX_PLAIN_LENGTH|.
390
+ //
391
+ // TODO(davidben): Ensure 0 is only returned on transport EOF.
392
+ // https://crbug.com/466303.
393
+ OPENSSL_EXPORT int SSL_write(SSL *ssl, const void *buf, int num);
394
+
395
+ // SSL_shutdown shuts down |ssl|. On success, it completes in two stages. First,
396
+ // it returns 0 if |ssl| completed uni-directional shutdown; close_notify has
397
+ // been sent, but the peer's close_notify has not been received. Most callers
398
+ // may stop at this point. For bi-directional shutdown, call |SSL_shutdown|
399
+ // again. It returns 1 if close_notify has been both sent and received.
400
+ //
401
+ // If the peer's close_notify arrived first, the first stage is skipped.
402
+ // |SSL_shutdown| will return 1 once close_notify is sent and skip 0. Callers
403
+ // only interested in uni-directional shutdown must therefore allow for the
404
+ // first stage returning either 0 or 1.
405
+ //
406
+ // |SSL_shutdown| returns -1 on failure. The caller should pass the return value
407
+ // into |SSL_get_error| to determine how to proceed. If the underlying |BIO| is
408
+ // non-blocking, both stages may require retry.
409
+ OPENSSL_EXPORT int SSL_shutdown(SSL *ssl);
410
+
411
+ // SSL_CTX_set_quiet_shutdown sets quiet shutdown on |ctx| to |mode|. If
412
+ // enabled, |SSL_shutdown| will not send a close_notify alert or wait for one
413
+ // from the peer. It will instead synchronously return one.
414
+ OPENSSL_EXPORT void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode);
415
+
416
+ // SSL_CTX_get_quiet_shutdown returns whether quiet shutdown is enabled for
417
+ // |ctx|.
418
+ OPENSSL_EXPORT int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);
419
+
420
+ // SSL_set_quiet_shutdown sets quiet shutdown on |ssl| to |mode|. If enabled,
421
+ // |SSL_shutdown| will not send a close_notify alert or wait for one from the
422
+ // peer. It will instead synchronously return one.
423
+ OPENSSL_EXPORT void SSL_set_quiet_shutdown(SSL *ssl, int mode);
424
+
425
+ // SSL_get_quiet_shutdown returns whether quiet shutdown is enabled for
426
+ // |ssl|.
427
+ OPENSSL_EXPORT int SSL_get_quiet_shutdown(const SSL *ssl);
428
+
429
+ // SSL_get_error returns a |SSL_ERROR_*| value for the most recent operation on
430
+ // |ssl|. It should be called after an operation failed to determine whether the
431
+ // error was fatal and, if not, when to retry.
432
+ OPENSSL_EXPORT int SSL_get_error(const SSL *ssl, int ret_code);
433
+
434
+ // SSL_ERROR_NONE indicates the operation succeeded.
435
+ #define SSL_ERROR_NONE 0
436
+
437
+ // SSL_ERROR_SSL indicates the operation failed within the library. The caller
438
+ // may inspect the error queue for more information.
439
+ #define SSL_ERROR_SSL 1
440
+
441
+ // SSL_ERROR_WANT_READ indicates the operation failed attempting to read from
442
+ // the transport. The caller may retry the operation when the transport is ready
443
+ // for reading.
444
+ //
445
+ // If signaled by a DTLS handshake, the caller must also call
446
+ // |DTLSv1_get_timeout| and |DTLSv1_handle_timeout| as appropriate. See
447
+ // |SSL_do_handshake|.
448
+ #define SSL_ERROR_WANT_READ 2
449
+
450
+ // SSL_ERROR_WANT_WRITE indicates the operation failed attempting to write to
451
+ // the transport. The caller may retry the operation when the transport is ready
452
+ // for writing.
453
+ #define SSL_ERROR_WANT_WRITE 3
454
+
455
+ // SSL_ERROR_WANT_X509_LOOKUP indicates the operation failed in calling the
456
+ // |cert_cb| or |client_cert_cb|. The caller may retry the operation when the
457
+ // callback is ready to return a certificate or one has been configured
458
+ // externally.
459
+ //
460
+ // See also |SSL_CTX_set_cert_cb| and |SSL_CTX_set_client_cert_cb|.
461
+ #define SSL_ERROR_WANT_X509_LOOKUP 4
462
+
463
+ // SSL_ERROR_SYSCALL indicates the operation failed externally to the library.
464
+ // The caller should consult the system-specific error mechanism. This is
465
+ // typically |errno| but may be something custom if using a custom |BIO|. It
466
+ // may also be signaled if the transport returned EOF, in which case the
467
+ // operation's return value will be zero.
468
+ #define SSL_ERROR_SYSCALL 5
469
+
470
+ // SSL_ERROR_ZERO_RETURN indicates the operation failed because the connection
471
+ // was cleanly shut down with a close_notify alert.
472
+ #define SSL_ERROR_ZERO_RETURN 6
473
+
474
+ // SSL_ERROR_WANT_CONNECT indicates the operation failed attempting to connect
475
+ // the transport (the |BIO| signaled |BIO_RR_CONNECT|). The caller may retry the
476
+ // operation when the transport is ready.
477
+ #define SSL_ERROR_WANT_CONNECT 7
478
+
479
+ // SSL_ERROR_WANT_ACCEPT indicates the operation failed attempting to accept a
480
+ // connection from the transport (the |BIO| signaled |BIO_RR_ACCEPT|). The
481
+ // caller may retry the operation when the transport is ready.
482
+ //
483
+ // TODO(davidben): Remove this. It's used by accept BIOs which are bizarre.
484
+ #define SSL_ERROR_WANT_ACCEPT 8
485
+
486
+ // SSL_ERROR_WANT_CHANNEL_ID_LOOKUP indicates the operation failed looking up
487
+ // the Channel ID key. The caller may retry the operation when |channel_id_cb|
488
+ // is ready to return a key or one has been configured with
489
+ // |SSL_set1_tls_channel_id|.
490
+ //
491
+ // See also |SSL_CTX_set_channel_id_cb|.
492
+ #define SSL_ERROR_WANT_CHANNEL_ID_LOOKUP 9
493
+
494
+ // SSL_ERROR_PENDING_SESSION indicates the operation failed because the session
495
+ // lookup callback indicated the session was unavailable. The caller may retry
496
+ // the operation when lookup has completed.
497
+ //
498
+ // See also |SSL_CTX_sess_set_get_cb| and |SSL_magic_pending_session_ptr|.
499
+ #define SSL_ERROR_PENDING_SESSION 11
500
+
501
+ // SSL_ERROR_PENDING_CERTIFICATE indicates the operation failed because the
502
+ // early callback indicated certificate lookup was incomplete. The caller may
503
+ // retry the operation when lookup has completed.
504
+ //
505
+ // See also |SSL_CTX_set_select_certificate_cb|.
506
+ #define SSL_ERROR_PENDING_CERTIFICATE 12
507
+
508
+ // SSL_ERROR_WANT_PRIVATE_KEY_OPERATION indicates the operation failed because
509
+ // a private key operation was unfinished. The caller may retry the operation
510
+ // when the private key operation is complete.
511
+ //
512
+ // See also |SSL_set_private_key_method| and
513
+ // |SSL_CTX_set_private_key_method|.
514
+ #define SSL_ERROR_WANT_PRIVATE_KEY_OPERATION 13
515
+
516
+ // SSL_ERROR_PENDING_TICKET indicates that a ticket decryption is pending. The
517
+ // caller may retry the operation when the decryption is ready.
518
+ //
519
+ // See also |SSL_CTX_set_ticket_aead_method|.
520
+ #define SSL_ERROR_PENDING_TICKET 14
521
+
522
+ // SSL_ERROR_EARLY_DATA_REJECTED indicates that early data was rejected. The
523
+ // caller should treat this as a connection failure and retry any operations
524
+ // associated with the rejected early data. |SSL_reset_early_data_reject| may be
525
+ // used to reuse the underlying connection for the retry.
526
+ #define SSL_ERROR_EARLY_DATA_REJECTED 15
527
+
528
+ // SSL_ERROR_WANT_CERTIFICATE_VERIFY indicates the operation failed because
529
+ // certificate verification was incomplete. The caller may retry the operation
530
+ // when certificate verification is complete.
531
+ //
532
+ // See also |SSL_CTX_set_custom_verify|.
533
+ #define SSL_ERROR_WANT_CERTIFICATE_VERIFY 16
534
+
535
+ // SSL_set_mtu sets the |ssl|'s MTU in DTLS to |mtu|. It returns one on success
536
+ // and zero on failure.
537
+ OPENSSL_EXPORT int SSL_set_mtu(SSL *ssl, unsigned mtu);
538
+
539
+ // DTLSv1_set_initial_timeout_duration sets the initial duration for a DTLS
540
+ // handshake timeout.
541
+ //
542
+ // This duration overrides the default of 1 second, which is the strong
543
+ // recommendation of RFC 6347 (see section 4.2.4.1). However, there may exist
544
+ // situations where a shorter timeout would be beneficial, such as for
545
+ // time-sensitive applications.
546
+ OPENSSL_EXPORT void DTLSv1_set_initial_timeout_duration(SSL *ssl,
547
+ unsigned duration_ms);
548
+
549
+ // DTLSv1_get_timeout queries the next DTLS handshake timeout. If there is a
550
+ // timeout in progress, it sets |*out| to the time remaining and returns one.
551
+ // Otherwise, it returns zero.
552
+ //
553
+ // When the timeout expires, call |DTLSv1_handle_timeout| to handle the
554
+ // retransmit behavior.
555
+ //
556
+ // NOTE: This function must be queried again whenever the handshake state
557
+ // machine changes, including when |DTLSv1_handle_timeout| is called.
558
+ OPENSSL_EXPORT int DTLSv1_get_timeout(const SSL *ssl, struct timeval *out);
559
+
560
+ // DTLSv1_handle_timeout is called when a DTLS handshake timeout expires. If no
561
+ // timeout had expired, it returns 0. Otherwise, it retransmits the previous
562
+ // flight of handshake messages and returns 1. If too many timeouts had expired
563
+ // without progress or an error occurs, it returns -1.
564
+ //
565
+ // The caller's external timer should be compatible with the one |ssl| queries
566
+ // within some fudge factor. Otherwise, the call will be a no-op, but
567
+ // |DTLSv1_get_timeout| will return an updated timeout.
568
+ //
569
+ // If the function returns -1, checking if |SSL_get_error| returns
570
+ // |SSL_ERROR_WANT_WRITE| may be used to determine if the retransmit failed due
571
+ // to a non-fatal error at the write |BIO|. However, the operation may not be
572
+ // retried until the next timeout fires.
573
+ //
574
+ // WARNING: This function breaks the usual return value convention.
575
+ //
576
+ // TODO(davidben): This |SSL_ERROR_WANT_WRITE| behavior is kind of bizarre.
577
+ OPENSSL_EXPORT int DTLSv1_handle_timeout(SSL *ssl);
578
+
579
+
580
+ // Protocol versions.
581
+
582
+ #define DTLS1_VERSION_MAJOR 0xfe
583
+ #define SSL3_VERSION_MAJOR 0x03
584
+
585
+ #define SSL3_VERSION 0x0300
586
+ #define TLS1_VERSION 0x0301
587
+ #define TLS1_1_VERSION 0x0302
588
+ #define TLS1_2_VERSION 0x0303
589
+ #define TLS1_3_VERSION 0x0304
590
+
591
+ #define DTLS1_VERSION 0xfeff
592
+ #define DTLS1_2_VERSION 0xfefd
593
+
594
+ #define TLS1_3_DRAFT_VERSION 0x7f12
595
+ #define TLS1_3_DRAFT21_VERSION 0x7f15
596
+ #define TLS1_3_DRAFT22_VERSION 0x7e04
597
+ #define TLS1_3_EXPERIMENT_VERSION 0x7e01
598
+ #define TLS1_3_EXPERIMENT2_VERSION 0x7e02
599
+ #define TLS1_3_EXPERIMENT3_VERSION 0x7e03
600
+
601
+ // SSL_CTX_set_min_proto_version sets the minimum protocol version for |ctx| to
602
+ // |version|. If |version| is zero, the default minimum version is used. It
603
+ // returns one on success and zero if |version| is invalid.
604
+ OPENSSL_EXPORT int SSL_CTX_set_min_proto_version(SSL_CTX *ctx,
605
+ uint16_t version);
606
+
607
+ // SSL_CTX_set_max_proto_version sets the maximum protocol version for |ctx| to
608
+ // |version|. If |version| is zero, the default maximum version is used. It
609
+ // returns one on success and zero if |version| is invalid.
610
+ OPENSSL_EXPORT int SSL_CTX_set_max_proto_version(SSL_CTX *ctx,
611
+ uint16_t version);
612
+
613
+ // SSL_set_min_proto_version sets the minimum protocol version for |ssl| to
614
+ // |version|. If |version| is zero, the default minimum version is used. It
615
+ // returns one on success and zero if |version| is invalid.
616
+ OPENSSL_EXPORT int SSL_set_min_proto_version(SSL *ssl, uint16_t version);
617
+
618
+ // SSL_set_max_proto_version sets the maximum protocol version for |ssl| to
619
+ // |version|. If |version| is zero, the default maximum version is used. It
620
+ // returns one on success and zero if |version| is invalid.
621
+ OPENSSL_EXPORT int SSL_set_max_proto_version(SSL *ssl, uint16_t version);
622
+
623
+ // SSL_version returns the TLS or DTLS protocol version used by |ssl|, which is
624
+ // one of the |*_VERSION| values. (E.g. |TLS1_2_VERSION|.) Before the version
625
+ // is negotiated, the result is undefined.
626
+ OPENSSL_EXPORT int SSL_version(const SSL *ssl);
627
+
628
+
629
+ // Options.
630
+ //
631
+ // Options configure protocol behavior.
632
+
633
+ // SSL_OP_NO_QUERY_MTU, in DTLS, disables querying the MTU from the underlying
634
+ // |BIO|. Instead, the MTU is configured with |SSL_set_mtu|.
635
+ #define SSL_OP_NO_QUERY_MTU 0x00001000L
636
+
637
+ // SSL_OP_NO_TICKET disables session ticket support (RFC 5077).
638
+ #define SSL_OP_NO_TICKET 0x00004000L
639
+
640
+ // SSL_OP_CIPHER_SERVER_PREFERENCE configures servers to select ciphers and
641
+ // ECDHE curves according to the server's preferences instead of the
642
+ // client's.
643
+ #define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L
644
+
645
+ // The following flags toggle individual protocol versions. This is deprecated.
646
+ // Use |SSL_CTX_set_min_proto_version| and |SSL_CTX_set_max_proto_version|
647
+ // instead.
648
+ #define SSL_OP_NO_SSLv3 0x02000000L
649
+ #define SSL_OP_NO_TLSv1 0x04000000L
650
+ #define SSL_OP_NO_TLSv1_2 0x08000000L
651
+ #define SSL_OP_NO_TLSv1_1 0x10000000L
652
+ #define SSL_OP_NO_TLSv1_3 0x20000000L
653
+ #define SSL_OP_NO_DTLSv1 SSL_OP_NO_TLSv1
654
+ #define SSL_OP_NO_DTLSv1_2 SSL_OP_NO_TLSv1_2
655
+
656
+ // SSL_CTX_set_options enables all options set in |options| (which should be one
657
+ // or more of the |SSL_OP_*| values, ORed together) in |ctx|. It returns a
658
+ // bitmask representing the resulting enabled options.
659
+ OPENSSL_EXPORT uint32_t SSL_CTX_set_options(SSL_CTX *ctx, uint32_t options);
660
+
661
+ // SSL_CTX_clear_options disables all options set in |options| (which should be
662
+ // one or more of the |SSL_OP_*| values, ORed together) in |ctx|. It returns a
663
+ // bitmask representing the resulting enabled options.
664
+ OPENSSL_EXPORT uint32_t SSL_CTX_clear_options(SSL_CTX *ctx, uint32_t options);
665
+
666
+ // SSL_CTX_get_options returns a bitmask of |SSL_OP_*| values that represent all
667
+ // the options enabled for |ctx|.
668
+ OPENSSL_EXPORT uint32_t SSL_CTX_get_options(const SSL_CTX *ctx);
669
+
670
+ // SSL_set_options enables all options set in |options| (which should be one or
671
+ // more of the |SSL_OP_*| values, ORed together) in |ssl|. It returns a bitmask
672
+ // representing the resulting enabled options.
673
+ OPENSSL_EXPORT uint32_t SSL_set_options(SSL *ssl, uint32_t options);
674
+
675
+ // SSL_clear_options disables all options set in |options| (which should be one
676
+ // or more of the |SSL_OP_*| values, ORed together) in |ssl|. It returns a
677
+ // bitmask representing the resulting enabled options.
678
+ OPENSSL_EXPORT uint32_t SSL_clear_options(SSL *ssl, uint32_t options);
679
+
680
+ // SSL_get_options returns a bitmask of |SSL_OP_*| values that represent all the
681
+ // options enabled for |ssl|.
682
+ OPENSSL_EXPORT uint32_t SSL_get_options(const SSL *ssl);
683
+
684
+
685
+ // Modes.
686
+ //
687
+ // Modes configure API behavior.
688
+
689
+ // SSL_MODE_ENABLE_PARTIAL_WRITE, in TLS, allows |SSL_write| to complete with a
690
+ // partial result when the only part of the input was written in a single
691
+ // record. In DTLS, it does nothing.
692
+ #define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001L
693
+
694
+ // SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER, in TLS, allows retrying an incomplete
695
+ // |SSL_write| with a different buffer. However, |SSL_write| still assumes the
696
+ // buffer contents are unchanged. This is not the default to avoid the
697
+ // misconception that non-blocking |SSL_write| behaves like non-blocking
698
+ // |write|. In DTLS, it does nothing.
699
+ #define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L
700
+
701
+ // SSL_MODE_NO_AUTO_CHAIN disables automatically building a certificate chain
702
+ // before sending certificates to the peer. This flag is set (and the feature
703
+ // disabled) by default.
704
+ // TODO(davidben): Remove this behavior. https://crbug.com/boringssl/42.
705
+ #define SSL_MODE_NO_AUTO_CHAIN 0x00000008L
706
+
707
+ // SSL_MODE_ENABLE_FALSE_START allows clients to send application data before
708
+ // receipt of ChangeCipherSpec and Finished. This mode enables full handshakes
709
+ // to 'complete' in one RTT. See RFC 7918.
710
+ //
711
+ // When False Start is enabled, |SSL_do_handshake| may succeed before the
712
+ // handshake has completely finished. |SSL_write| will function at this point,
713
+ // and |SSL_read| will transparently wait for the final handshake leg before
714
+ // returning application data. To determine if False Start occurred or when the
715
+ // handshake is completely finished, see |SSL_in_false_start|, |SSL_in_init|,
716
+ // and |SSL_CB_HANDSHAKE_DONE| from |SSL_CTX_set_info_callback|.
717
+ #define SSL_MODE_ENABLE_FALSE_START 0x00000080L
718
+
719
+ // SSL_MODE_CBC_RECORD_SPLITTING causes multi-byte CBC records in SSL 3.0 and
720
+ // TLS 1.0 to be split in two: the first record will contain a single byte and
721
+ // the second will contain the remainder. This effectively randomises the IV and
722
+ // prevents BEAST attacks.
723
+ #define SSL_MODE_CBC_RECORD_SPLITTING 0x00000100L
724
+
725
+ // SSL_MODE_NO_SESSION_CREATION will cause any attempts to create a session to
726
+ // fail with SSL_R_SESSION_MAY_NOT_BE_CREATED. This can be used to enforce that
727
+ // session resumption is used for a given SSL*.
728
+ #define SSL_MODE_NO_SESSION_CREATION 0x00000200L
729
+
730
+ // SSL_MODE_SEND_FALLBACK_SCSV sends TLS_FALLBACK_SCSV in the ClientHello.
731
+ // To be set only by applications that reconnect with a downgraded protocol
732
+ // version; see RFC 7507 for details.
733
+ //
734
+ // DO NOT ENABLE THIS if your application attempts a normal handshake. Only use
735
+ // this in explicit fallback retries, following the guidance in RFC 7507.
736
+ #define SSL_MODE_SEND_FALLBACK_SCSV 0x00000400L
737
+
738
+ // SSL_CTX_set_mode enables all modes set in |mode| (which should be one or more
739
+ // of the |SSL_MODE_*| values, ORed together) in |ctx|. It returns a bitmask
740
+ // representing the resulting enabled modes.
741
+ OPENSSL_EXPORT uint32_t SSL_CTX_set_mode(SSL_CTX *ctx, uint32_t mode);
742
+
743
+ // SSL_CTX_clear_mode disables all modes set in |mode| (which should be one or
744
+ // more of the |SSL_MODE_*| values, ORed together) in |ctx|. It returns a
745
+ // bitmask representing the resulting enabled modes.
746
+ OPENSSL_EXPORT uint32_t SSL_CTX_clear_mode(SSL_CTX *ctx, uint32_t mode);
747
+
748
+ // SSL_CTX_get_mode returns a bitmask of |SSL_MODE_*| values that represent all
749
+ // the modes enabled for |ssl|.
750
+ OPENSSL_EXPORT uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx);
751
+
752
+ // SSL_set_mode enables all modes set in |mode| (which should be one or more of
753
+ // the |SSL_MODE_*| values, ORed together) in |ssl|. It returns a bitmask
754
+ // representing the resulting enabled modes.
755
+ OPENSSL_EXPORT uint32_t SSL_set_mode(SSL *ssl, uint32_t mode);
756
+
757
+ // SSL_clear_mode disables all modes set in |mode| (which should be one or more
758
+ // of the |SSL_MODE_*| values, ORed together) in |ssl|. It returns a bitmask
759
+ // representing the resulting enabled modes.
760
+ OPENSSL_EXPORT uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode);
761
+
762
+ // SSL_get_mode returns a bitmask of |SSL_MODE_*| values that represent all the
763
+ // modes enabled for |ssl|.
764
+ OPENSSL_EXPORT uint32_t SSL_get_mode(const SSL *ssl);
765
+
766
+ // SSL_CTX_set0_buffer_pool sets a |CRYPTO_BUFFER_POOL| that will be used to
767
+ // store certificates. This can allow multiple connections to share
768
+ // certificates and thus save memory.
769
+ //
770
+ // The SSL_CTX does not take ownership of |pool| and the caller must ensure
771
+ // that |pool| outlives |ctx| and all objects linked to it, including |SSL|,
772
+ // |X509| and |SSL_SESSION| objects. Basically, don't ever free |pool|.
773
+ OPENSSL_EXPORT void SSL_CTX_set0_buffer_pool(SSL_CTX *ctx,
774
+ CRYPTO_BUFFER_POOL *pool);
775
+
776
+
777
+ // Configuring certificates and private keys.
778
+ //
779
+ // These functions configure the connection's leaf certificate, private key, and
780
+ // certificate chain. The certificate chain is ordered leaf to root (as sent on
781
+ // the wire) but does not include the leaf. Both client and server certificates
782
+ // use these functions.
783
+ //
784
+ // Certificates and keys may be configured before the handshake or dynamically
785
+ // in the early callback and certificate callback.
786
+
787
+ // SSL_CTX_use_certificate sets |ctx|'s leaf certificate to |x509|. It returns
788
+ // one on success and zero on failure.
789
+ OPENSSL_EXPORT int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x509);
790
+
791
+ // SSL_use_certificate sets |ssl|'s leaf certificate to |x509|. It returns one
792
+ // on success and zero on failure.
793
+ OPENSSL_EXPORT int SSL_use_certificate(SSL *ssl, X509 *x509);
794
+
795
+ // SSL_CTX_use_PrivateKey sets |ctx|'s private key to |pkey|. It returns one on
796
+ // success and zero on failure.
797
+ OPENSSL_EXPORT int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
798
+
799
+ // SSL_use_PrivateKey sets |ssl|'s private key to |pkey|. It returns one on
800
+ // success and zero on failure.
801
+ OPENSSL_EXPORT int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
802
+
803
+ // SSL_CTX_set0_chain sets |ctx|'s certificate chain, excluding the leaf, to
804
+ // |chain|. On success, it returns one and takes ownership of |chain|.
805
+ // Otherwise, it returns zero.
806
+ OPENSSL_EXPORT int SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *chain);
807
+
808
+ // SSL_CTX_set1_chain sets |ctx|'s certificate chain, excluding the leaf, to
809
+ // |chain|. It returns one on success and zero on failure. The caller retains
810
+ // ownership of |chain| and may release it freely.
811
+ OPENSSL_EXPORT int SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *chain);
812
+
813
+ // SSL_set0_chain sets |ssl|'s certificate chain, excluding the leaf, to
814
+ // |chain|. On success, it returns one and takes ownership of |chain|.
815
+ // Otherwise, it returns zero.
816
+ OPENSSL_EXPORT int SSL_set0_chain(SSL *ssl, STACK_OF(X509) *chain);
817
+
818
+ // SSL_set1_chain sets |ssl|'s certificate chain, excluding the leaf, to
819
+ // |chain|. It returns one on success and zero on failure. The caller retains
820
+ // ownership of |chain| and may release it freely.
821
+ OPENSSL_EXPORT int SSL_set1_chain(SSL *ssl, STACK_OF(X509) *chain);
822
+
823
+ // SSL_CTX_add0_chain_cert appends |x509| to |ctx|'s certificate chain. On
824
+ // success, it returns one and takes ownership of |x509|. Otherwise, it returns
825
+ // zero.
826
+ OPENSSL_EXPORT int SSL_CTX_add0_chain_cert(SSL_CTX *ctx, X509 *x509);
827
+
828
+ // SSL_CTX_add1_chain_cert appends |x509| to |ctx|'s certificate chain. It
829
+ // returns one on success and zero on failure. The caller retains ownership of
830
+ // |x509| and may release it freely.
831
+ OPENSSL_EXPORT int SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509);
832
+
833
+ // SSL_add0_chain_cert appends |x509| to |ctx|'s certificate chain. On success,
834
+ // it returns one and takes ownership of |x509|. Otherwise, it returns zero.
835
+ OPENSSL_EXPORT int SSL_add0_chain_cert(SSL *ssl, X509 *x509);
836
+
837
+ // SSL_CTX_add_extra_chain_cert calls |SSL_CTX_add0_chain_cert|.
838
+ OPENSSL_EXPORT int SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *x509);
839
+
840
+ // SSL_add1_chain_cert appends |x509| to |ctx|'s certificate chain. It returns
841
+ // one on success and zero on failure. The caller retains ownership of |x509|
842
+ // and may release it freely.
843
+ OPENSSL_EXPORT int SSL_add1_chain_cert(SSL *ssl, X509 *x509);
844
+
845
+ // SSL_CTX_clear_chain_certs clears |ctx|'s certificate chain and returns
846
+ // one.
847
+ OPENSSL_EXPORT int SSL_CTX_clear_chain_certs(SSL_CTX *ctx);
848
+
849
+ // SSL_CTX_clear_extra_chain_certs calls |SSL_CTX_clear_chain_certs|.
850
+ OPENSSL_EXPORT int SSL_CTX_clear_extra_chain_certs(SSL_CTX *ctx);
851
+
852
+ // SSL_clear_chain_certs clears |ssl|'s certificate chain and returns one.
853
+ OPENSSL_EXPORT int SSL_clear_chain_certs(SSL *ssl);
854
+
855
+ // SSL_CTX_set_cert_cb sets a callback that is called to select a certificate.
856
+ // The callback returns one on success, zero on internal error, and a negative
857
+ // number on failure or to pause the handshake. If the handshake is paused,
858
+ // |SSL_get_error| will return |SSL_ERROR_WANT_X509_LOOKUP|.
859
+ //
860
+ // On the client, the callback may call |SSL_get0_certificate_types| and
861
+ // |SSL_get_client_CA_list| for information on the server's certificate
862
+ // request.
863
+ //
864
+ // On the server, the callback will be called on non-resumption handshakes,
865
+ // after extensions have been processed.
866
+ OPENSSL_EXPORT void SSL_CTX_set_cert_cb(SSL_CTX *ctx,
867
+ int (*cb)(SSL *ssl, void *arg),
868
+ void *arg);
869
+
870
+ // SSL_set_cert_cb sets a callback that is called to select a certificate. The
871
+ // callback returns one on success, zero on internal error, and a negative
872
+ // number on failure or to pause the handshake. If the handshake is paused,
873
+ // |SSL_get_error| will return |SSL_ERROR_WANT_X509_LOOKUP|.
874
+ //
875
+ // On the client, the callback may call |SSL_get0_certificate_types| and
876
+ // |SSL_get_client_CA_list| for information on the server's certificate
877
+ // request.
878
+ OPENSSL_EXPORT void SSL_set_cert_cb(SSL *ssl, int (*cb)(SSL *ssl, void *arg),
879
+ void *arg);
880
+
881
+ // SSL_get0_certificate_types, for a client, sets |*out_types| to an array
882
+ // containing the client certificate types requested by a server. It returns the
883
+ // length of the array.
884
+ //
885
+ // The behavior of this function is undefined except during the callbacks set by
886
+ // by |SSL_CTX_set_cert_cb| and |SSL_CTX_set_client_cert_cb| or when the
887
+ // handshake is paused because of them.
888
+ OPENSSL_EXPORT size_t SSL_get0_certificate_types(SSL *ssl,
889
+ const uint8_t **out_types);
890
+
891
+ // SSL_certs_clear resets the private key, leaf certificate, and certificate
892
+ // chain of |ssl|.
893
+ OPENSSL_EXPORT void SSL_certs_clear(SSL *ssl);
894
+
895
+ // SSL_CTX_check_private_key returns one if the certificate and private key
896
+ // configured in |ctx| are consistent and zero otherwise.
897
+ OPENSSL_EXPORT int SSL_CTX_check_private_key(const SSL_CTX *ctx);
898
+
899
+ // SSL_check_private_key returns one if the certificate and private key
900
+ // configured in |ssl| are consistent and zero otherwise.
901
+ OPENSSL_EXPORT int SSL_check_private_key(const SSL *ssl);
902
+
903
+ // SSL_CTX_get0_certificate returns |ctx|'s leaf certificate.
904
+ OPENSSL_EXPORT X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx);
905
+
906
+ // SSL_get_certificate returns |ssl|'s leaf certificate.
907
+ OPENSSL_EXPORT X509 *SSL_get_certificate(const SSL *ssl);
908
+
909
+ // SSL_CTX_get0_privatekey returns |ctx|'s private key.
910
+ OPENSSL_EXPORT EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx);
911
+
912
+ // SSL_get_privatekey returns |ssl|'s private key.
913
+ OPENSSL_EXPORT EVP_PKEY *SSL_get_privatekey(const SSL *ssl);
914
+
915
+ // SSL_CTX_get0_chain_certs sets |*out_chain| to |ctx|'s certificate chain and
916
+ // returns one.
917
+ OPENSSL_EXPORT int SSL_CTX_get0_chain_certs(const SSL_CTX *ctx,
918
+ STACK_OF(X509) **out_chain);
919
+
920
+ // SSL_CTX_get_extra_chain_certs calls |SSL_CTX_get0_chain_certs|.
921
+ OPENSSL_EXPORT int SSL_CTX_get_extra_chain_certs(const SSL_CTX *ctx,
922
+ STACK_OF(X509) **out_chain);
923
+
924
+ // SSL_get0_chain_certs sets |*out_chain| to |ssl|'s certificate chain and
925
+ // returns one.
926
+ OPENSSL_EXPORT int SSL_get0_chain_certs(const SSL *ssl,
927
+ STACK_OF(X509) **out_chain);
928
+
929
+ // SSL_CTX_set_signed_cert_timestamp_list sets the list of signed certificate
930
+ // timestamps that is sent to clients that request it. The |list| argument must
931
+ // contain one or more SCT structures serialised as a SignedCertificateTimestamp
932
+ // List (see https://tools.ietf.org/html/rfc6962#section-3.3) – i.e. each SCT
933
+ // is prefixed by a big-endian, uint16 length and the concatenation of one or
934
+ // more such prefixed SCTs are themselves also prefixed by a uint16 length. It
935
+ // returns one on success and zero on error. The caller retains ownership of
936
+ // |list|.
937
+ OPENSSL_EXPORT int SSL_CTX_set_signed_cert_timestamp_list(SSL_CTX *ctx,
938
+ const uint8_t *list,
939
+ size_t list_len);
940
+
941
+ // SSL_set_signed_cert_timestamp_list sets the list of signed certificate
942
+ // timestamps that is sent to clients that request is. The same format as the
943
+ // one used for |SSL_CTX_set_signed_cert_timestamp_list| applies. The caller
944
+ // retains ownership of |list|.
945
+ OPENSSL_EXPORT int SSL_set_signed_cert_timestamp_list(SSL *ctx,
946
+ const uint8_t *list,
947
+ size_t list_len);
948
+
949
+ // SSL_CTX_set_ocsp_response sets the OCSP response that is sent to clients
950
+ // which request it. It returns one on success and zero on error. The caller
951
+ // retains ownership of |response|.
952
+ OPENSSL_EXPORT int SSL_CTX_set_ocsp_response(SSL_CTX *ctx,
953
+ const uint8_t *response,
954
+ size_t response_len);
955
+
956
+ // SSL_set_ocsp_response sets the OCSP response that is sent to clients which
957
+ // request it. It returns one on success and zero on error. The caller retains
958
+ // ownership of |response|.
959
+ OPENSSL_EXPORT int SSL_set_ocsp_response(SSL *ssl,
960
+ const uint8_t *response,
961
+ size_t response_len);
962
+
963
+ // SSL_SIGN_* are signature algorithm values as defined in TLS 1.3.
964
+ #define SSL_SIGN_RSA_PKCS1_SHA1 0x0201
965
+ #define SSL_SIGN_RSA_PKCS1_SHA256 0x0401
966
+ #define SSL_SIGN_RSA_PKCS1_SHA384 0x0501
967
+ #define SSL_SIGN_RSA_PKCS1_SHA512 0x0601
968
+ #define SSL_SIGN_ECDSA_SHA1 0x0203
969
+ #define SSL_SIGN_ECDSA_SECP256R1_SHA256 0x0403
970
+ #define SSL_SIGN_ECDSA_SECP384R1_SHA384 0x0503
971
+ #define SSL_SIGN_ECDSA_SECP521R1_SHA512 0x0603
972
+ #define SSL_SIGN_RSA_PSS_SHA256 0x0804
973
+ #define SSL_SIGN_RSA_PSS_SHA384 0x0805
974
+ #define SSL_SIGN_RSA_PSS_SHA512 0x0806
975
+ #define SSL_SIGN_ED25519 0x0807
976
+
977
+ // SSL_SIGN_RSA_PKCS1_MD5_SHA1 is an internal signature algorithm used to
978
+ // specify raw RSASSA-PKCS1-v1_5 with an MD5/SHA-1 concatenation, as used in TLS
979
+ // before TLS 1.2.
980
+ #define SSL_SIGN_RSA_PKCS1_MD5_SHA1 0xff01
981
+
982
+ // SSL_get_signature_algorithm_name returns a human-readable name for |sigalg|,
983
+ // or NULL if unknown. If |include_curve| is one, the curve for ECDSA algorithms
984
+ // is included as in TLS 1.3. Otherwise, it is excluded as in TLS 1.2.
985
+ OPENSSL_EXPORT const char *SSL_get_signature_algorithm_name(uint16_t sigalg,
986
+ int include_curve);
987
+
988
+ // SSL_get_signature_algorithm_key_type returns the key type associated with
989
+ // |sigalg| as an |EVP_PKEY_*| constant or |EVP_PKEY_NONE| if unknown.
990
+ OPENSSL_EXPORT int SSL_get_signature_algorithm_key_type(uint16_t sigalg);
991
+
992
+ // SSL_get_signature_algorithm_digest returns the digest function associated
993
+ // with |sigalg| or |NULL| if |sigalg| has no prehash (Ed25519) or is unknown.
994
+ OPENSSL_EXPORT const EVP_MD *SSL_get_signature_algorithm_digest(
995
+ uint16_t sigalg);
996
+
997
+ // SSL_is_signature_algorithm_rsa_pss returns one if |sigalg| is an RSA-PSS
998
+ // signature algorithm and zero otherwise.
999
+ OPENSSL_EXPORT int SSL_is_signature_algorithm_rsa_pss(uint16_t sigalg);
1000
+
1001
+ // SSL_CTX_set_signing_algorithm_prefs configures |ctx| to use |prefs| as the
1002
+ // preference list when signing with |ctx|'s private key. It returns one on
1003
+ // success and zero on error. |prefs| should not include the internal-only value
1004
+ // |SSL_SIGN_RSA_PKCS1_MD5_SHA1|.
1005
+ OPENSSL_EXPORT int SSL_CTX_set_signing_algorithm_prefs(SSL_CTX *ctx,
1006
+ const uint16_t *prefs,
1007
+ size_t num_prefs);
1008
+
1009
+ // SSL_set_signing_algorithm_prefs configures |ssl| to use |prefs| as the
1010
+ // preference list when signing with |ssl|'s private key. It returns one on
1011
+ // success and zero on error. |prefs| should not include the internal-only value
1012
+ // |SSL_SIGN_RSA_PKCS1_MD5_SHA1|.
1013
+ OPENSSL_EXPORT int SSL_set_signing_algorithm_prefs(SSL *ssl,
1014
+ const uint16_t *prefs,
1015
+ size_t num_prefs);
1016
+
1017
+
1018
+ // Certificate and private key convenience functions.
1019
+
1020
+ // SSL_CTX_set_chain_and_key sets the certificate chain and private key for a
1021
+ // TLS client or server. References to the given |CRYPTO_BUFFER| and |EVP_PKEY|
1022
+ // objects are added as needed. Exactly one of |privkey| or |privkey_method|
1023
+ // may be non-NULL. Returns one on success and zero on error.
1024
+ OPENSSL_EXPORT int SSL_CTX_set_chain_and_key(
1025
+ SSL_CTX *ctx, CRYPTO_BUFFER *const *certs, size_t num_certs,
1026
+ EVP_PKEY *privkey, const SSL_PRIVATE_KEY_METHOD *privkey_method);
1027
+
1028
+ // SSL_set_chain_and_key sets the certificate chain and private key for a TLS
1029
+ // client or server. References to the given |CRYPTO_BUFFER| and |EVP_PKEY|
1030
+ // objects are added as needed. Exactly one of |privkey| or |privkey_method|
1031
+ // may be non-NULL. Returns one on success and zero on error.
1032
+ OPENSSL_EXPORT int SSL_set_chain_and_key(
1033
+ SSL *ssl, CRYPTO_BUFFER *const *certs, size_t num_certs, EVP_PKEY *privkey,
1034
+ const SSL_PRIVATE_KEY_METHOD *privkey_method);
1035
+
1036
+ // SSL_CTX_use_RSAPrivateKey sets |ctx|'s private key to |rsa|. It returns one
1037
+ // on success and zero on failure.
1038
+ OPENSSL_EXPORT int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
1039
+
1040
+ // SSL_use_RSAPrivateKey sets |ctx|'s private key to |rsa|. It returns one on
1041
+ // success and zero on failure.
1042
+ OPENSSL_EXPORT int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
1043
+
1044
+ // The following functions configure certificates or private keys but take as
1045
+ // input DER-encoded structures. They return one on success and zero on
1046
+ // failure.
1047
+
1048
+ OPENSSL_EXPORT int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, size_t der_len,
1049
+ const uint8_t *der);
1050
+ OPENSSL_EXPORT int SSL_use_certificate_ASN1(SSL *ssl, const uint8_t *der,
1051
+ size_t der_len);
1052
+
1053
+ OPENSSL_EXPORT int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx,
1054
+ const uint8_t *der,
1055
+ size_t der_len);
1056
+ OPENSSL_EXPORT int SSL_use_PrivateKey_ASN1(int type, SSL *ssl,
1057
+ const uint8_t *der, size_t der_len);
1058
+
1059
+ OPENSSL_EXPORT int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx,
1060
+ const uint8_t *der,
1061
+ size_t der_len);
1062
+ OPENSSL_EXPORT int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const uint8_t *der,
1063
+ size_t der_len);
1064
+
1065
+ // The following functions configure certificates or private keys but take as
1066
+ // input files to read from. They return one on success and zero on failure. The
1067
+ // |type| parameter is one of the |SSL_FILETYPE_*| values and determines whether
1068
+ // the file's contents are read as PEM or DER.
1069
+
1070
+ #define SSL_FILETYPE_PEM 1
1071
+ #define SSL_FILETYPE_ASN1 2
1072
+
1073
+ OPENSSL_EXPORT int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx,
1074
+ const char *file,
1075
+ int type);
1076
+ OPENSSL_EXPORT int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file,
1077
+ int type);
1078
+
1079
+ OPENSSL_EXPORT int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file,
1080
+ int type);
1081
+ OPENSSL_EXPORT int SSL_use_certificate_file(SSL *ssl, const char *file,
1082
+ int type);
1083
+
1084
+ OPENSSL_EXPORT int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file,
1085
+ int type);
1086
+ OPENSSL_EXPORT int SSL_use_PrivateKey_file(SSL *ssl, const char *file,
1087
+ int type);
1088
+
1089
+ // SSL_CTX_use_certificate_chain_file configures certificates for |ctx|. It
1090
+ // reads the contents of |file| as a PEM-encoded leaf certificate followed
1091
+ // optionally by the certificate chain to send to the peer. It returns one on
1092
+ // success and zero on failure.
1093
+ OPENSSL_EXPORT int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx,
1094
+ const char *file);
1095
+
1096
+ // SSL_CTX_set_default_passwd_cb sets the password callback for PEM-based
1097
+ // convenience functions called on |ctx|.
1098
+ OPENSSL_EXPORT void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx,
1099
+ pem_password_cb *cb);
1100
+
1101
+ // SSL_CTX_get_default_passwd_cb returns the callback set by
1102
+ // |SSL_CTX_set_default_passwd_cb|.
1103
+ OPENSSL_EXPORT pem_password_cb *SSL_CTX_get_default_passwd_cb(
1104
+ const SSL_CTX *ctx);
1105
+
1106
+ // SSL_CTX_set_default_passwd_cb_userdata sets the userdata parameter for
1107
+ // |ctx|'s password callback.
1108
+ OPENSSL_EXPORT void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx,
1109
+ void *data);
1110
+
1111
+ // SSL_CTX_get_default_passwd_cb_userdata returns the userdata parameter set by
1112
+ // |SSL_CTX_set_default_passwd_cb_userdata|.
1113
+ OPENSSL_EXPORT void *SSL_CTX_get_default_passwd_cb_userdata(const SSL_CTX *ctx);
1114
+
1115
+
1116
+ // Custom private keys.
1117
+
1118
+ enum ssl_private_key_result_t {
1119
+ ssl_private_key_success,
1120
+ ssl_private_key_retry,
1121
+ ssl_private_key_failure,
1122
+ };
1123
+
1124
+ // ssl_private_key_method_st (aka |SSL_PRIVATE_KEY_METHOD|) describes private
1125
+ // key hooks. This is used to off-load signing operations to a custom,
1126
+ // potentially asynchronous, backend. Metadata about the key such as the type
1127
+ // and size are parsed out of the certificate.
1128
+ struct ssl_private_key_method_st {
1129
+ // sign signs the message |in| in using the specified signature algorithm. On
1130
+ // success, it returns |ssl_private_key_success| and writes at most |max_out|
1131
+ // bytes of signature data to |out| and sets |*out_len| to the number of bytes
1132
+ // written. On failure, it returns |ssl_private_key_failure|. If the operation
1133
+ // has not completed, it returns |ssl_private_key_retry|. |sign| should
1134
+ // arrange for the high-level operation on |ssl| to be retried when the
1135
+ // operation is completed. This will result in a call to |complete|.
1136
+ //
1137
+ // |signature_algorithm| is one of the |SSL_SIGN_*| values, as defined in TLS
1138
+ // 1.3. Note that, in TLS 1.2, ECDSA algorithms do not require that curve
1139
+ // sizes match hash sizes, so the curve portion of |SSL_SIGN_ECDSA_*| values
1140
+ // must be ignored. BoringSSL will internally handle the curve matching logic
1141
+ // where appropriate.
1142
+ //
1143
+ // It is an error to call |sign| while another private key operation is in
1144
+ // progress on |ssl|.
1145
+ enum ssl_private_key_result_t (*sign)(SSL *ssl, uint8_t *out, size_t *out_len,
1146
+ size_t max_out,
1147
+ uint16_t signature_algorithm,
1148
+ const uint8_t *in, size_t in_len);
1149
+
1150
+ // decrypt decrypts |in_len| bytes of encrypted data from |in|. On success it
1151
+ // returns |ssl_private_key_success|, writes at most |max_out| bytes of
1152
+ // decrypted data to |out| and sets |*out_len| to the actual number of bytes
1153
+ // written. On failure it returns |ssl_private_key_failure|. If the operation
1154
+ // has not completed, it returns |ssl_private_key_retry|. The caller should
1155
+ // arrange for the high-level operation on |ssl| to be retried when the
1156
+ // operation is completed, which will result in a call to |complete|. This
1157
+ // function only works with RSA keys and should perform a raw RSA decryption
1158
+ // operation with no padding.
1159
+ //
1160
+ // It is an error to call |decrypt| while another private key operation is in
1161
+ // progress on |ssl|.
1162
+ enum ssl_private_key_result_t (*decrypt)(SSL *ssl, uint8_t *out,
1163
+ size_t *out_len, size_t max_out,
1164
+ const uint8_t *in, size_t in_len);
1165
+
1166
+ // complete completes a pending operation. If the operation has completed, it
1167
+ // returns |ssl_private_key_success| and writes the result to |out| as in
1168
+ // |sign|. Otherwise, it returns |ssl_private_key_failure| on failure and
1169
+ // |ssl_private_key_retry| if the operation is still in progress.
1170
+ //
1171
+ // |complete| may be called arbitrarily many times before completion, but it
1172
+ // is an error to call |complete| if there is no pending operation in progress
1173
+ // on |ssl|.
1174
+ enum ssl_private_key_result_t (*complete)(SSL *ssl, uint8_t *out,
1175
+ size_t *out_len, size_t max_out);
1176
+ };
1177
+
1178
+ // SSL_set_private_key_method configures a custom private key on |ssl|.
1179
+ // |key_method| must remain valid for the lifetime of |ssl|.
1180
+ OPENSSL_EXPORT void SSL_set_private_key_method(
1181
+ SSL *ssl, const SSL_PRIVATE_KEY_METHOD *key_method);
1182
+
1183
+ // SSL_CTX_set_private_key_method configures a custom private key on |ctx|.
1184
+ // |key_method| must remain valid for the lifetime of |ctx|.
1185
+ OPENSSL_EXPORT void SSL_CTX_set_private_key_method(
1186
+ SSL_CTX *ctx, const SSL_PRIVATE_KEY_METHOD *key_method);
1187
+
1188
+
1189
+ // Cipher suites.
1190
+ //
1191
+ // |SSL_CIPHER| objects represent cipher suites.
1192
+
1193
+ DEFINE_CONST_STACK_OF(SSL_CIPHER)
1194
+
1195
+ // SSL_get_cipher_by_value returns the structure representing a TLS cipher
1196
+ // suite based on its assigned number, or NULL if unknown. See
1197
+ // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4.
1198
+ OPENSSL_EXPORT const SSL_CIPHER *SSL_get_cipher_by_value(uint16_t value);
1199
+
1200
+ // SSL_CIPHER_get_id returns |cipher|'s id. It may be cast to a |uint16_t| to
1201
+ // get the cipher suite value.
1202
+ OPENSSL_EXPORT uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *cipher);
1203
+
1204
+ // SSL_CIPHER_is_aead returns one if |cipher| uses an AEAD cipher.
1205
+ OPENSSL_EXPORT int SSL_CIPHER_is_aead(const SSL_CIPHER *cipher);
1206
+
1207
+ // SSL_CIPHER_is_block_cipher returns one if |cipher| is a block cipher.
1208
+ OPENSSL_EXPORT int SSL_CIPHER_is_block_cipher(const SSL_CIPHER *cipher);
1209
+
1210
+ // SSL_CIPHER_get_cipher_nid returns the NID for |cipher|'s bulk
1211
+ // cipher. Possible values are |NID_aes_128_gcm|, |NID_aes_256_gcm|,
1212
+ // |NID_chacha20_poly1305|, |NID_aes_128_cbc|, |NID_aes_256_cbc|, and
1213
+ // |NID_des_ede3_cbc|.
1214
+ OPENSSL_EXPORT int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *cipher);
1215
+
1216
+ // SSL_CIPHER_get_digest_nid returns the NID for |cipher|'s HMAC if it is a
1217
+ // legacy cipher suite. For modern AEAD-based ciphers (see
1218
+ // |SSL_CIPHER_is_aead|), it returns |NID_undef|.
1219
+ //
1220
+ // Note this function only returns the legacy HMAC digest, not the PRF hash.
1221
+ OPENSSL_EXPORT int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *cipher);
1222
+
1223
+ // SSL_CIPHER_get_kx_nid returns the NID for |cipher|'s key exchange. This may
1224
+ // be |NID_kx_rsa|, |NID_kx_ecdhe|, or |NID_kx_psk| for TLS 1.2. In TLS 1.3,
1225
+ // cipher suites do not specify the key exchange, so this function returns
1226
+ // |NID_kx_any|.
1227
+ OPENSSL_EXPORT int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *cipher);
1228
+
1229
+ // SSL_CIPHER_get_auth_nid returns the NID for |cipher|'s authentication
1230
+ // type. This may be |NID_auth_rsa|, |NID_auth_ecdsa|, or |NID_auth_psk| for TLS
1231
+ // 1.2. In TLS 1.3, cipher suites do not specify authentication, so this
1232
+ // function returns |NID_auth_any|.
1233
+ OPENSSL_EXPORT int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *cipher);
1234
+
1235
+ // SSL_CIPHER_get_prf_nid retuns the NID for |cipher|'s PRF hash. If |cipher| is
1236
+ // a pre-TLS-1.2 cipher, it returns |NID_md5_sha1| but note these ciphers use
1237
+ // SHA-256 in TLS 1.2. Other return values may be treated uniformly in all
1238
+ // applicable versions.
1239
+ OPENSSL_EXPORT int SSL_CIPHER_get_prf_nid(const SSL_CIPHER *cipher);
1240
+
1241
+ // SSL_CIPHER_get_min_version returns the minimum protocol version required
1242
+ // for |cipher|.
1243
+ OPENSSL_EXPORT uint16_t SSL_CIPHER_get_min_version(const SSL_CIPHER *cipher);
1244
+
1245
+ // SSL_CIPHER_get_max_version returns the maximum protocol version that
1246
+ // supports |cipher|.
1247
+ OPENSSL_EXPORT uint16_t SSL_CIPHER_get_max_version(const SSL_CIPHER *cipher);
1248
+
1249
+ // SSL_CIPHER_standard_name returns the standard IETF name for |cipher|. For
1250
+ // example, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256".
1251
+ OPENSSL_EXPORT const char *SSL_CIPHER_standard_name(const SSL_CIPHER *cipher);
1252
+
1253
+ // SSL_CIPHER_get_name returns the OpenSSL name of |cipher|. For example,
1254
+ // "ECDHE-RSA-AES128-GCM-SHA256".
1255
+ OPENSSL_EXPORT const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);
1256
+
1257
+ // SSL_CIPHER_get_kx_name returns a string that describes the key-exchange
1258
+ // method used by |cipher|. For example, "ECDHE_ECDSA". TLS 1.3 AEAD-only
1259
+ // ciphers return the string "GENERIC".
1260
+ OPENSSL_EXPORT const char *SSL_CIPHER_get_kx_name(const SSL_CIPHER *cipher);
1261
+
1262
+ // SSL_CIPHER_get_bits returns the strength, in bits, of |cipher|. If
1263
+ // |out_alg_bits| is not NULL, it writes the number of bits consumed by the
1264
+ // symmetric algorithm to |*out_alg_bits|.
1265
+ OPENSSL_EXPORT int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher,
1266
+ int *out_alg_bits);
1267
+
1268
+
1269
+ // Cipher suite configuration.
1270
+ //
1271
+ // OpenSSL uses a mini-language to configure cipher suites. The language
1272
+ // maintains an ordered list of enabled ciphers, along with an ordered list of
1273
+ // disabled but available ciphers. Initially, all ciphers are disabled with a
1274
+ // default ordering. The cipher string is then interpreted as a sequence of
1275
+ // directives, separated by colons, each of which modifies this state.
1276
+ //
1277
+ // Most directives consist of a one character or empty opcode followed by a
1278
+ // selector which matches a subset of available ciphers.
1279
+ //
1280
+ // Available opcodes are:
1281
+ //
1282
+ // The empty opcode enables and appends all matching disabled ciphers to the
1283
+ // end of the enabled list. The newly appended ciphers are ordered relative to
1284
+ // each other matching their order in the disabled list.
1285
+ //
1286
+ // |-| disables all matching enabled ciphers and prepends them to the disabled
1287
+ // list, with relative order from the enabled list preserved. This means the
1288
+ // most recently disabled ciphers get highest preference relative to other
1289
+ // disabled ciphers if re-enabled.
1290
+ //
1291
+ // |+| moves all matching enabled ciphers to the end of the enabled list, with
1292
+ // relative order preserved.
1293
+ //
1294
+ // |!| deletes all matching ciphers, enabled or not, from either list. Deleted
1295
+ // ciphers will not matched by future operations.
1296
+ //
1297
+ // A selector may be a specific cipher (using either the standard or OpenSSL
1298
+ // name for the cipher) or one or more rules separated by |+|. The final
1299
+ // selector matches the intersection of each rule. For instance, |AESGCM+aECDSA|
1300
+ // matches ECDSA-authenticated AES-GCM ciphers.
1301
+ //
1302
+ // Available cipher rules are:
1303
+ //
1304
+ // |ALL| matches all ciphers.
1305
+ //
1306
+ // |kRSA|, |kDHE|, |kECDHE|, and |kPSK| match ciphers using plain RSA, DHE,
1307
+ // ECDHE, and plain PSK key exchanges, respectively. Note that ECDHE_PSK is
1308
+ // matched by |kECDHE| and not |kPSK|.
1309
+ //
1310
+ // |aRSA|, |aECDSA|, and |aPSK| match ciphers authenticated by RSA, ECDSA, and
1311
+ // a pre-shared key, respectively.
1312
+ //
1313
+ // |RSA|, |DHE|, |ECDHE|, |PSK|, |ECDSA|, and |PSK| are aliases for the
1314
+ // corresponding |k*| or |a*| cipher rule. |RSA| is an alias for |kRSA|, not
1315
+ // |aRSA|.
1316
+ //
1317
+ // |3DES|, |AES128|, |AES256|, |AES|, |AESGCM|, |CHACHA20| match ciphers
1318
+ // whose bulk cipher use the corresponding encryption scheme. Note that
1319
+ // |AES|, |AES128|, and |AES256| match both CBC and GCM ciphers.
1320
+ //
1321
+ // |SHA1|, |SHA256|, and |SHA384| match legacy cipher suites using the
1322
+ // corresponding hash function in their MAC. AEADs are matched by none of
1323
+ // these.
1324
+ //
1325
+ // |SHA| is an alias for |SHA1|.
1326
+ //
1327
+ // Although implemented, authentication-only ciphers match no rules and must be
1328
+ // explicitly selected by name.
1329
+ //
1330
+ // Deprecated cipher rules:
1331
+ //
1332
+ // |kEDH|, |EDH|, |kEECDH|, and |EECDH| are legacy aliases for |kDHE|, |DHE|,
1333
+ // |kECDHE|, and |ECDHE|, respectively.
1334
+ //
1335
+ // |HIGH| is an alias for |ALL|.
1336
+ //
1337
+ // |FIPS| is an alias for |HIGH|.
1338
+ //
1339
+ // |SSLv3| and |TLSv1| match ciphers available in TLS 1.1 or earlier.
1340
+ // |TLSv1_2| matches ciphers new in TLS 1.2. This is confusing and should not
1341
+ // be used.
1342
+ //
1343
+ // Unknown rules are silently ignored by legacy APIs, and rejected by APIs with
1344
+ // "strict" in the name, which should be preferred. Cipher lists can be long
1345
+ // and it's easy to commit typos. Strict functions will also reject the use of
1346
+ // spaces, semi-colons and commas as alternative separators.
1347
+ //
1348
+ // The special |@STRENGTH| directive will sort all enabled ciphers by strength.
1349
+ //
1350
+ // The |DEFAULT| directive, when appearing at the front of the string, expands
1351
+ // to the default ordering of available ciphers.
1352
+ //
1353
+ // If configuring a server, one may also configure equal-preference groups to
1354
+ // partially respect the client's preferences when
1355
+ // |SSL_OP_CIPHER_SERVER_PREFERENCE| is enabled. Ciphers in an equal-preference
1356
+ // group have equal priority and use the client order. This may be used to
1357
+ // enforce that AEADs are preferred but select AES-GCM vs. ChaCha20-Poly1305
1358
+ // based on client preferences. An equal-preference is specified with square
1359
+ // brackets, combining multiple selectors separated by |. For example:
1360
+ //
1361
+ // [ECDHE-ECDSA-CHACHA20-POLY1305|ECDHE-ECDSA-AES128-GCM-SHA256]
1362
+ //
1363
+ // Once an equal-preference group is used, future directives must be
1364
+ // opcode-less. Inside an equal-preference group, spaces are not allowed.
1365
+ //
1366
+ // TLS 1.3 ciphers do not participate in this mechanism and instead have a
1367
+ // built-in preference order. Functions to set cipher lists do not affect TLS
1368
+ // 1.3, and functions to query the cipher list do not include TLS 1.3
1369
+ // ciphers.
1370
+
1371
+ // SSL_DEFAULT_CIPHER_LIST is the default cipher suite configuration. It is
1372
+ // substituted when a cipher string starts with 'DEFAULT'.
1373
+ #define SSL_DEFAULT_CIPHER_LIST "ALL"
1374
+
1375
+ // SSL_CTX_set_strict_cipher_list configures the cipher list for |ctx|,
1376
+ // evaluating |str| as a cipher string and returning error if |str| contains
1377
+ // anything meaningless. It returns one on success and zero on failure.
1378
+ OPENSSL_EXPORT int SSL_CTX_set_strict_cipher_list(SSL_CTX *ctx,
1379
+ const char *str);
1380
+
1381
+ // SSL_CTX_set_cipher_list configures the cipher list for |ctx|, evaluating
1382
+ // |str| as a cipher string. It returns one on success and zero on failure.
1383
+ //
1384
+ // Prefer to use |SSL_CTX_set_strict_cipher_list|. This function tolerates
1385
+ // garbage inputs, unless an empty cipher list results.
1386
+ OPENSSL_EXPORT int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
1387
+
1388
+ // SSL_set_strict_cipher_list configures the cipher list for |ssl|, evaluating
1389
+ // |str| as a cipher string and returning error if |str| contains anything
1390
+ // meaningless. It returns one on success and zero on failure.
1391
+ OPENSSL_EXPORT int SSL_set_strict_cipher_list(SSL *ssl, const char *str);
1392
+
1393
+ // SSL_set_cipher_list configures the cipher list for |ssl|, evaluating |str| as
1394
+ // a cipher string. It returns one on success and zero on failure.
1395
+ //
1396
+ // Prefer to use |SSL_set_strict_cipher_list|. This function tolerates garbage
1397
+ // inputs, unless an empty cipher list results.
1398
+ OPENSSL_EXPORT int SSL_set_cipher_list(SSL *ssl, const char *str);
1399
+
1400
+ // SSL_CTX_get_ciphers returns the cipher list for |ctx|, in order of
1401
+ // preference.
1402
+ OPENSSL_EXPORT STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx);
1403
+
1404
+ // SSL_CTX_cipher_in_group returns one if the |i|th cipher (see
1405
+ // |SSL_CTX_get_ciphers|) is in the same equipreference group as the one
1406
+ // following it and zero otherwise.
1407
+ OPENSSL_EXPORT int SSL_CTX_cipher_in_group(const SSL_CTX *ctx, size_t i);
1408
+
1409
+ // SSL_get_ciphers returns the cipher list for |ssl|, in order of preference.
1410
+ OPENSSL_EXPORT STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);
1411
+
1412
+
1413
+ // Connection information.
1414
+
1415
+ // SSL_is_init_finished returns one if |ssl| has completed its initial handshake
1416
+ // and has no pending handshake. It returns zero otherwise.
1417
+ OPENSSL_EXPORT int SSL_is_init_finished(const SSL *ssl);
1418
+
1419
+ // SSL_in_init returns one if |ssl| has a pending handshake and zero
1420
+ // otherwise.
1421
+ OPENSSL_EXPORT int SSL_in_init(const SSL *ssl);
1422
+
1423
+ // SSL_in_false_start returns one if |ssl| has a pending handshake that is in
1424
+ // False Start. |SSL_write| may be called at this point without waiting for the
1425
+ // peer, but |SSL_read| will complete the handshake before accepting application
1426
+ // data.
1427
+ //
1428
+ // See also |SSL_MODE_ENABLE_FALSE_START|.
1429
+ OPENSSL_EXPORT int SSL_in_false_start(const SSL *ssl);
1430
+
1431
+ // SSL_get_peer_certificate returns the peer's leaf certificate or NULL if the
1432
+ // peer did not use certificates. The caller must call |X509_free| on the
1433
+ // result to release it.
1434
+ OPENSSL_EXPORT X509 *SSL_get_peer_certificate(const SSL *ssl);
1435
+
1436
+ // SSL_get_peer_cert_chain returns the peer's certificate chain or NULL if
1437
+ // unavailable or the peer did not use certificates. This is the unverified list
1438
+ // of certificates as sent by the peer, not the final chain built during
1439
+ // verification. The caller does not take ownership of the result.
1440
+ //
1441
+ // WARNING: This function behaves differently between client and server. If
1442
+ // |ssl| is a server, the returned chain does not include the leaf certificate.
1443
+ // If a client, it does.
1444
+ OPENSSL_EXPORT STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl);
1445
+
1446
+ // SSL_get_peer_full_cert_chain returns the peer's certificate chain, or NULL if
1447
+ // unavailable or the peer did not use certificates. This is the unverified list
1448
+ // of certificates as sent by the peer, not the final chain built during
1449
+ // verification. The caller does not take ownership of the result.
1450
+ //
1451
+ // This is the same as |SSL_get_peer_cert_chain| except that this function
1452
+ // always returns the full chain, i.e. the first element of the return value
1453
+ // (if any) will be the leaf certificate. In constrast,
1454
+ // |SSL_get_peer_cert_chain| returns only the intermediate certificates if the
1455
+ // |ssl| is a server.
1456
+ OPENSSL_EXPORT STACK_OF(X509) *SSL_get_peer_full_cert_chain(const SSL *ssl);
1457
+
1458
+ // SSL_get0_peer_certificates returns the peer's certificate chain, or NULL if
1459
+ // unavailable or the peer did not use certificates. This is the unverified list
1460
+ // of certificates as sent by the peer, not the final chain built during
1461
+ // verification. The caller does not take ownership of the result.
1462
+ //
1463
+ // This is the |CRYPTO_BUFFER| variant of |SSL_get_peer_full_cert_chain|.
1464
+ OPENSSL_EXPORT STACK_OF(CRYPTO_BUFFER) *
1465
+ SSL_get0_peer_certificates(const SSL *ssl);
1466
+
1467
+ // SSL_get0_signed_cert_timestamp_list sets |*out| and |*out_len| to point to
1468
+ // |*out_len| bytes of SCT information from the server. This is only valid if
1469
+ // |ssl| is a client. The SCT information is a SignedCertificateTimestampList
1470
+ // (including the two leading length bytes).
1471
+ // See https://tools.ietf.org/html/rfc6962#section-3.3
1472
+ // If no SCT was received then |*out_len| will be zero on return.
1473
+ //
1474
+ // WARNING: the returned data is not guaranteed to be well formed.
1475
+ OPENSSL_EXPORT void SSL_get0_signed_cert_timestamp_list(const SSL *ssl,
1476
+ const uint8_t **out,
1477
+ size_t *out_len);
1478
+
1479
+ // SSL_get0_ocsp_response sets |*out| and |*out_len| to point to |*out_len|
1480
+ // bytes of an OCSP response from the server. This is the DER encoding of an
1481
+ // OCSPResponse type as defined in RFC 2560.
1482
+ //
1483
+ // WARNING: the returned data is not guaranteed to be well formed.
1484
+ OPENSSL_EXPORT void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out,
1485
+ size_t *out_len);
1486
+
1487
+ // SSL_get_tls_unique writes at most |max_out| bytes of the tls-unique value
1488
+ // for |ssl| to |out| and sets |*out_len| to the number of bytes written. It
1489
+ // returns one on success or zero on error. In general |max_out| should be at
1490
+ // least 12.
1491
+ //
1492
+ // This function will always fail if the initial handshake has not completed.
1493
+ // The tls-unique value will change after a renegotiation but, since
1494
+ // renegotiations can be initiated by the server at any point, the higher-level
1495
+ // protocol must either leave them disabled or define states in which the
1496
+ // tls-unique value can be read.
1497
+ //
1498
+ // The tls-unique value is defined by
1499
+ // https://tools.ietf.org/html/rfc5929#section-3.1. Due to a weakness in the
1500
+ // TLS protocol, tls-unique is broken for resumed connections unless the
1501
+ // Extended Master Secret extension is negotiated. Thus this function will
1502
+ // return zero if |ssl| performed session resumption unless EMS was used when
1503
+ // negotiating the original session.
1504
+ OPENSSL_EXPORT int SSL_get_tls_unique(const SSL *ssl, uint8_t *out,
1505
+ size_t *out_len, size_t max_out);
1506
+
1507
+ // SSL_get_extms_support returns one if the Extended Master Secret extension or
1508
+ // TLS 1.3 was negotiated. Otherwise, it returns zero.
1509
+ OPENSSL_EXPORT int SSL_get_extms_support(const SSL *ssl);
1510
+
1511
+ // SSL_get_current_cipher returns the cipher used in the current outgoing
1512
+ // connection state, or NULL if the null cipher is active.
1513
+ OPENSSL_EXPORT const SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl);
1514
+
1515
+ // SSL_session_reused returns one if |ssl| performed an abbreviated handshake
1516
+ // and zero otherwise.
1517
+ //
1518
+ // TODO(davidben): Hammer down the semantics of this API while a handshake,
1519
+ // initial or renego, is in progress.
1520
+ OPENSSL_EXPORT int SSL_session_reused(const SSL *ssl);
1521
+
1522
+ // SSL_get_secure_renegotiation_support returns one if the peer supports secure
1523
+ // renegotiation (RFC 5746) or TLS 1.3. Otherwise, it returns zero.
1524
+ OPENSSL_EXPORT int SSL_get_secure_renegotiation_support(const SSL *ssl);
1525
+
1526
+ // SSL_export_keying_material exports a value derived from the master secret, as
1527
+ // specified in RFC 5705. It writes |out_len| bytes to |out| given a label and
1528
+ // optional context. (Since a zero length context is allowed, the |use_context|
1529
+ // flag controls whether a context is included.)
1530
+ //
1531
+ // It returns one on success and zero otherwise.
1532
+ OPENSSL_EXPORT int SSL_export_keying_material(
1533
+ SSL *ssl, uint8_t *out, size_t out_len, const char *label, size_t label_len,
1534
+ const uint8_t *context, size_t context_len, int use_context);
1535
+
1536
+
1537
+ // Custom extensions.
1538
+ //
1539
+ // The custom extension functions allow TLS extensions to be added to
1540
+ // ClientHello and ServerHello messages.
1541
+
1542
+ // SSL_custom_ext_add_cb is a callback function that is called when the
1543
+ // ClientHello (for clients) or ServerHello (for servers) is constructed. In
1544
+ // the case of a server, this callback will only be called for a given
1545
+ // extension if the ClientHello contained that extension – it's not possible to
1546
+ // inject extensions into a ServerHello that the client didn't request.
1547
+ //
1548
+ // When called, |extension_value| will contain the extension number that is
1549
+ // being considered for addition (so that a single callback can handle multiple
1550
+ // extensions). If the callback wishes to include the extension, it must set
1551
+ // |*out| to point to |*out_len| bytes of extension contents and return one. In
1552
+ // this case, the corresponding |SSL_custom_ext_free_cb| callback will later be
1553
+ // called with the value of |*out| once that data has been copied.
1554
+ //
1555
+ // If the callback does not wish to add an extension it must return zero.
1556
+ //
1557
+ // Alternatively, the callback can abort the connection by setting
1558
+ // |*out_alert_value| to a TLS alert number and returning -1.
1559
+ typedef int (*SSL_custom_ext_add_cb)(SSL *ssl, unsigned extension_value,
1560
+ const uint8_t **out, size_t *out_len,
1561
+ int *out_alert_value, void *add_arg);
1562
+
1563
+ // SSL_custom_ext_free_cb is a callback function that is called by OpenSSL iff
1564
+ // an |SSL_custom_ext_add_cb| callback previously returned one. In that case,
1565
+ // this callback is called and passed the |out| pointer that was returned by
1566
+ // the add callback. This is to free any dynamically allocated data created by
1567
+ // the add callback.
1568
+ typedef void (*SSL_custom_ext_free_cb)(SSL *ssl, unsigned extension_value,
1569
+ const uint8_t *out, void *add_arg);
1570
+
1571
+ // SSL_custom_ext_parse_cb is a callback function that is called by OpenSSL to
1572
+ // parse an extension from the peer: that is from the ServerHello for a client
1573
+ // and from the ClientHello for a server.
1574
+ //
1575
+ // When called, |extension_value| will contain the extension number and the
1576
+ // contents of the extension are |contents_len| bytes at |contents|.
1577
+ //
1578
+ // The callback must return one to continue the handshake. Otherwise, if it
1579
+ // returns zero, a fatal alert with value |*out_alert_value| is sent and the
1580
+ // handshake is aborted.
1581
+ typedef int (*SSL_custom_ext_parse_cb)(SSL *ssl, unsigned extension_value,
1582
+ const uint8_t *contents,
1583
+ size_t contents_len,
1584
+ int *out_alert_value, void *parse_arg);
1585
+
1586
+ // SSL_extension_supported returns one iff OpenSSL internally handles
1587
+ // extensions of type |extension_value|. This can be used to avoid registering
1588
+ // custom extension handlers for extensions that a future version of OpenSSL
1589
+ // may handle internally.
1590
+ OPENSSL_EXPORT int SSL_extension_supported(unsigned extension_value);
1591
+
1592
+ // SSL_CTX_add_client_custom_ext registers callback functions for handling
1593
+ // custom TLS extensions for client connections.
1594
+ //
1595
+ // If |add_cb| is NULL then an empty extension will be added in each
1596
+ // ClientHello. Otherwise, see the comment for |SSL_custom_ext_add_cb| about
1597
+ // this callback.
1598
+ //
1599
+ // The |free_cb| may be NULL if |add_cb| doesn't dynamically allocate data that
1600
+ // needs to be freed.
1601
+ //
1602
+ // It returns one on success or zero on error. It's always an error to register
1603
+ // callbacks for the same extension twice, or to register callbacks for an
1604
+ // extension that OpenSSL handles internally. See |SSL_extension_supported| to
1605
+ // discover, at runtime, which extensions OpenSSL handles internally.
1606
+ OPENSSL_EXPORT int SSL_CTX_add_client_custom_ext(
1607
+ SSL_CTX *ctx, unsigned extension_value, SSL_custom_ext_add_cb add_cb,
1608
+ SSL_custom_ext_free_cb free_cb, void *add_arg,
1609
+ SSL_custom_ext_parse_cb parse_cb, void *parse_arg);
1610
+
1611
+ // SSL_CTX_add_server_custom_ext is the same as
1612
+ // |SSL_CTX_add_client_custom_ext|, but for server connections.
1613
+ //
1614
+ // Unlike on the client side, if |add_cb| is NULL no extension will be added.
1615
+ // The |add_cb|, if any, will only be called if the ClientHello contained a
1616
+ // matching extension.
1617
+ OPENSSL_EXPORT int SSL_CTX_add_server_custom_ext(
1618
+ SSL_CTX *ctx, unsigned extension_value, SSL_custom_ext_add_cb add_cb,
1619
+ SSL_custom_ext_free_cb free_cb, void *add_arg,
1620
+ SSL_custom_ext_parse_cb parse_cb, void *parse_arg);
1621
+
1622
+
1623
+ // Sessions.
1624
+ //
1625
+ // An |SSL_SESSION| represents an SSL session that may be resumed in an
1626
+ // abbreviated handshake. It is reference-counted and immutable. Once
1627
+ // established, an |SSL_SESSION| may be shared by multiple |SSL| objects on
1628
+ // different threads and must not be modified.
1629
+
1630
+ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
1631
+
1632
+ // SSL_SESSION_new returns a newly-allocated blank |SSL_SESSION| or NULL on
1633
+ // error. This may be useful when writing tests but should otherwise not be
1634
+ // used.
1635
+ OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_new(const SSL_CTX *ctx);
1636
+
1637
+ // SSL_SESSION_up_ref increments the reference count of |session| and returns
1638
+ // one.
1639
+ OPENSSL_EXPORT int SSL_SESSION_up_ref(SSL_SESSION *session);
1640
+
1641
+ // SSL_SESSION_free decrements the reference count of |session|. If it reaches
1642
+ // zero, all data referenced by |session| and |session| itself are released.
1643
+ OPENSSL_EXPORT void SSL_SESSION_free(SSL_SESSION *session);
1644
+
1645
+ // SSL_SESSION_to_bytes serializes |in| into a newly allocated buffer and sets
1646
+ // |*out_data| to that buffer and |*out_len| to its length. The caller takes
1647
+ // ownership of the buffer and must call |OPENSSL_free| when done. It returns
1648
+ // one on success and zero on error.
1649
+ OPENSSL_EXPORT int SSL_SESSION_to_bytes(const SSL_SESSION *in,
1650
+ uint8_t **out_data, size_t *out_len);
1651
+
1652
+ // SSL_SESSION_to_bytes_for_ticket serializes |in|, but excludes the session
1653
+ // identification information, namely the session ID and ticket.
1654
+ OPENSSL_EXPORT int SSL_SESSION_to_bytes_for_ticket(const SSL_SESSION *in,
1655
+ uint8_t **out_data,
1656
+ size_t *out_len);
1657
+
1658
+ // SSL_SESSION_from_bytes parses |in_len| bytes from |in| as an SSL_SESSION. It
1659
+ // returns a newly-allocated |SSL_SESSION| on success or NULL on error.
1660
+ OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_from_bytes(
1661
+ const uint8_t *in, size_t in_len, const SSL_CTX *ctx);
1662
+
1663
+ // SSL_SESSION_get_version returns a string describing the TLS or DTLS version
1664
+ // |session| was established at. For example, "TLSv1.2" or "SSLv3".
1665
+ OPENSSL_EXPORT const char *SSL_SESSION_get_version(const SSL_SESSION *session);
1666
+
1667
+ // SSL_SESSION_get_protocol_version returns the TLS or DTLS version |session|
1668
+ // was established at.
1669
+ OPENSSL_EXPORT uint16_t
1670
+ SSL_SESSION_get_protocol_version(const SSL_SESSION *session);
1671
+
1672
+ // SSL_SESSION_set_protocol_version sets |session|'s TLS or DTLS version to
1673
+ // |version|. This may be useful when writing tests but should otherwise not be
1674
+ // used. It returns one on success and zero on error.
1675
+ OPENSSL_EXPORT int SSL_SESSION_set_protocol_version(SSL_SESSION *session,
1676
+ uint16_t version);
1677
+
1678
+ // SSL_SESSION_get_id returns a pointer to a buffer containing |session|'s
1679
+ // session ID and sets |*out_len| to its length.
1680
+ OPENSSL_EXPORT const uint8_t *SSL_SESSION_get_id(const SSL_SESSION *session,
1681
+ unsigned *out_len);
1682
+
1683
+ // SSL_SESSION_get_time returns the time at which |session| was established in
1684
+ // seconds since the UNIX epoch.
1685
+ OPENSSL_EXPORT uint64_t SSL_SESSION_get_time(const SSL_SESSION *session);
1686
+
1687
+ // SSL_SESSION_get_timeout returns the lifetime of |session| in seconds.
1688
+ OPENSSL_EXPORT uint32_t SSL_SESSION_get_timeout(const SSL_SESSION *session);
1689
+
1690
+ // SSL_SESSION_get0_peer returns the peer leaf certificate stored in
1691
+ // |session|.
1692
+ //
1693
+ // TODO(davidben): This should return a const X509 *.
1694
+ OPENSSL_EXPORT X509 *SSL_SESSION_get0_peer(const SSL_SESSION *session);
1695
+
1696
+ // SSL_SESSION_get_master_key writes up to |max_out| bytes of |session|'s master
1697
+ // secret to |out| and returns the number of bytes written. If |max_out| is
1698
+ // zero, it returns the size of the master secret.
1699
+ OPENSSL_EXPORT size_t SSL_SESSION_get_master_key(const SSL_SESSION *session,
1700
+ uint8_t *out, size_t max_out);
1701
+
1702
+ // SSL_SESSION_set_time sets |session|'s creation time to |time| and returns
1703
+ // |time|. This function may be useful in writing tests but otherwise should not
1704
+ // be used.
1705
+ OPENSSL_EXPORT uint64_t SSL_SESSION_set_time(SSL_SESSION *session,
1706
+ uint64_t time);
1707
+
1708
+ // SSL_SESSION_set_timeout sets |session|'s timeout to |timeout| and returns
1709
+ // one. This function may be useful in writing tests but otherwise should not
1710
+ // be used.
1711
+ OPENSSL_EXPORT uint32_t SSL_SESSION_set_timeout(SSL_SESSION *session,
1712
+ uint32_t timeout);
1713
+
1714
+ // SSL_SESSION_set1_id_context sets |session|'s session ID context (see
1715
+ // |SSL_CTX_set_session_id_context|) to |sid_ctx|. It returns one on success and
1716
+ // zero on error. This function may be useful in writing tests but otherwise
1717
+ // should not be used.
1718
+ OPENSSL_EXPORT int SSL_SESSION_set1_id_context(SSL_SESSION *session,
1719
+ const uint8_t *sid_ctx,
1720
+ size_t sid_ctx_len);
1721
+
1722
+ // SSL_SESSION_should_be_single_use returns one if |session| should be
1723
+ // single-use (TLS 1.3 and later) and zero otherwise.
1724
+ //
1725
+ // If this function returns one, clients retain multiple sessions and use each
1726
+ // only once. This prevents passive observers from correlating connections with
1727
+ // tickets. See draft-ietf-tls-tls13-18, appendix B.5. If it returns zero,
1728
+ // |session| cannot be used without leaking a correlator.
1729
+ OPENSSL_EXPORT int SSL_SESSION_should_be_single_use(const SSL_SESSION *session);
1730
+
1731
+ // SSL_SESSION_is_resumable returns one if |session| is resumable and zero
1732
+ // otherwise.
1733
+ OPENSSL_EXPORT int SSL_SESSION_is_resumable(const SSL_SESSION *session);
1734
+
1735
+ // SSL_SESSION_has_ticket returns one if |session| has a ticket and zero
1736
+ // otherwise.
1737
+ OPENSSL_EXPORT int SSL_SESSION_has_ticket(const SSL_SESSION *session);
1738
+
1739
+ // SSL_SESSION_get0_ticket sets |*out_ticket| and |*out_len| to |session|'s
1740
+ // ticket, or NULL and zero if it does not have one. |out_ticket| may be NULL
1741
+ // if only the ticket length is needed.
1742
+ OPENSSL_EXPORT void SSL_SESSION_get0_ticket(const SSL_SESSION *session,
1743
+ const uint8_t **out_ticket,
1744
+ size_t *out_len);
1745
+
1746
+ // SSL_SESSION_get_ticket_lifetime_hint returns ticket lifetime hint of
1747
+ // |session| in seconds or zero if none was set.
1748
+ OPENSSL_EXPORT uint32_t
1749
+ SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *session);
1750
+
1751
+
1752
+ // Session caching.
1753
+ //
1754
+ // Session caching allows connections to be established more efficiently based
1755
+ // on saved parameters from a previous connection, called a session (see
1756
+ // |SSL_SESSION|). The client offers a saved session, using an opaque identifier
1757
+ // from a previous connection. The server may accept the session, if it has the
1758
+ // parameters available. Otherwise, it will decline and continue with a full
1759
+ // handshake.
1760
+ //
1761
+ // This requires both the client and the server to retain session state. A
1762
+ // client does so with a stateful session cache. A server may do the same or, if
1763
+ // supported by both sides, statelessly using session tickets. For more
1764
+ // information on the latter, see the next section.
1765
+ //
1766
+ // For a server, the library implements a built-in internal session cache as an
1767
+ // in-memory hash table. Servers may also use |SSL_CTX_sess_set_get_cb| and
1768
+ // |SSL_CTX_sess_set_new_cb| to implement a custom external session cache. In
1769
+ // particular, this may be used to share a session cache between multiple
1770
+ // servers in a large deployment. An external cache may be used in addition to
1771
+ // or instead of the internal one. Use |SSL_CTX_set_session_cache_mode| to
1772
+ // toggle the internal cache.
1773
+ //
1774
+ // For a client, the only option is an external session cache. Clients may use
1775
+ // |SSL_CTX_sess_set_new_cb| to register a callback for when new sessions are
1776
+ // available. These may be cached and, in subsequent compatible connections,
1777
+ // configured with |SSL_set_session|.
1778
+ //
1779
+ // Note that offering or accepting a session short-circuits certificate
1780
+ // verification and most parameter negotiation. Resuming sessions across
1781
+ // different contexts may result in security failures and surprising
1782
+ // behavior. For a typical client, this means sessions for different hosts must
1783
+ // be cached under different keys. A client that connects to the same host with,
1784
+ // e.g., different cipher suite settings or client certificates should also use
1785
+ // separate session caches between those contexts. Servers should also partition
1786
+ // session caches between SNI hosts with |SSL_CTX_set_session_id_context|.
1787
+ //
1788
+ // Note also, in TLS 1.2 and earlier, offering sessions allows passive observers
1789
+ // to correlate different client connections. TLS 1.3 and later fix this,
1790
+ // provided clients use sessions at most once. Session caches are managed by the
1791
+ // caller in BoringSSL, so this must be implemented externally. See
1792
+ // |SSL_SESSION_should_be_single_use| for details.
1793
+
1794
+ // SSL_SESS_CACHE_OFF disables all session caching.
1795
+ #define SSL_SESS_CACHE_OFF 0x0000
1796
+
1797
+ // SSL_SESS_CACHE_CLIENT enables session caching for a client. The internal
1798
+ // cache is never used on a client, so this only enables the callbacks.
1799
+ #define SSL_SESS_CACHE_CLIENT 0x0001
1800
+
1801
+ // SSL_SESS_CACHE_SERVER enables session caching for a server.
1802
+ #define SSL_SESS_CACHE_SERVER 0x0002
1803
+
1804
+ // SSL_SESS_CACHE_BOTH enables session caching for both client and server.
1805
+ #define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT | SSL_SESS_CACHE_SERVER)
1806
+
1807
+ // SSL_SESS_CACHE_NO_AUTO_CLEAR disables automatically calling
1808
+ // |SSL_CTX_flush_sessions| every 255 connections.
1809
+ #define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080
1810
+
1811
+ // SSL_SESS_CACHE_NO_INTERNAL_LOOKUP, on a server, disables looking up a session
1812
+ // from the internal session cache.
1813
+ #define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100
1814
+
1815
+ // SSL_SESS_CACHE_NO_INTERNAL_STORE, on a server, disables storing sessions in
1816
+ // the internal session cache.
1817
+ #define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200
1818
+
1819
+ // SSL_SESS_CACHE_NO_INTERNAL, on a server, disables the internal session
1820
+ // cache.
1821
+ #define SSL_SESS_CACHE_NO_INTERNAL \
1822
+ (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | SSL_SESS_CACHE_NO_INTERNAL_STORE)
1823
+
1824
+ // SSL_CTX_set_session_cache_mode sets the session cache mode bits for |ctx| to
1825
+ // |mode|. It returns the previous value.
1826
+ OPENSSL_EXPORT int SSL_CTX_set_session_cache_mode(SSL_CTX *ctx, int mode);
1827
+
1828
+ // SSL_CTX_get_session_cache_mode returns the session cache mode bits for
1829
+ // |ctx|
1830
+ OPENSSL_EXPORT int SSL_CTX_get_session_cache_mode(const SSL_CTX *ctx);
1831
+
1832
+ // SSL_set_session, for a client, configures |ssl| to offer to resume |session|
1833
+ // in the initial handshake and returns one. The caller retains ownership of
1834
+ // |session|.
1835
+ //
1836
+ // It is an error to call this function after the handshake has begun.
1837
+ OPENSSL_EXPORT int SSL_set_session(SSL *ssl, SSL_SESSION *session);
1838
+
1839
+ // SSL_DEFAULT_SESSION_TIMEOUT is the default lifetime, in seconds, of a
1840
+ // session in TLS 1.2 or earlier. This is how long we are willing to use the
1841
+ // secret to encrypt traffic without fresh key material.
1842
+ #define SSL_DEFAULT_SESSION_TIMEOUT (2 * 60 * 60)
1843
+
1844
+ // SSL_DEFAULT_SESSION_PSK_DHE_TIMEOUT is the default lifetime, in seconds, of a
1845
+ // session for TLS 1.3 psk_dhe_ke. This is how long we are willing to use the
1846
+ // secret as an authenticator.
1847
+ #define SSL_DEFAULT_SESSION_PSK_DHE_TIMEOUT (2 * 24 * 60 * 60)
1848
+
1849
+ // SSL_DEFAULT_SESSION_AUTH_TIMEOUT is the default non-renewable lifetime, in
1850
+ // seconds, of a TLS 1.3 session. This is how long we are willing to trust the
1851
+ // signature in the initial handshake.
1852
+ #define SSL_DEFAULT_SESSION_AUTH_TIMEOUT (7 * 24 * 60 * 60)
1853
+
1854
+ // SSL_CTX_set_timeout sets the lifetime, in seconds, of TLS 1.2 (or earlier)
1855
+ // sessions created in |ctx| to |timeout|.
1856
+ OPENSSL_EXPORT uint32_t SSL_CTX_set_timeout(SSL_CTX *ctx, uint32_t timeout);
1857
+
1858
+ // SSL_CTX_set_session_psk_dhe_timeout sets the lifetime, in seconds, of TLS 1.3
1859
+ // sessions created in |ctx| to |timeout|.
1860
+ OPENSSL_EXPORT void SSL_CTX_set_session_psk_dhe_timeout(SSL_CTX *ctx,
1861
+ uint32_t timeout);
1862
+
1863
+ // SSL_CTX_get_timeout returns the lifetime, in seconds, of TLS 1.2 (or earlier)
1864
+ // sessions created in |ctx|.
1865
+ OPENSSL_EXPORT uint32_t SSL_CTX_get_timeout(const SSL_CTX *ctx);
1866
+
1867
+ // SSL_CTX_set_session_id_context sets |ctx|'s session ID context to |sid_ctx|.
1868
+ // It returns one on success and zero on error. The session ID context is an
1869
+ // application-defined opaque byte string. A session will not be used in a
1870
+ // connection without a matching session ID context.
1871
+ //
1872
+ // For a server, if |SSL_VERIFY_PEER| is enabled, it is an error to not set a
1873
+ // session ID context.
1874
+ OPENSSL_EXPORT int SSL_CTX_set_session_id_context(SSL_CTX *ctx,
1875
+ const uint8_t *sid_ctx,
1876
+ size_t sid_ctx_len);
1877
+
1878
+ // SSL_set_session_id_context sets |ssl|'s session ID context to |sid_ctx|. It
1879
+ // returns one on success and zero on error. See also
1880
+ // |SSL_CTX_set_session_id_context|.
1881
+ OPENSSL_EXPORT int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
1882
+ size_t sid_ctx_len);
1883
+
1884
+ // SSL_get0_session_id_context returns a pointer to |ssl|'s session ID context
1885
+ // and sets |*out_len| to its length.
1886
+ OPENSSL_EXPORT const uint8_t *SSL_get0_session_id_context(const SSL *ssl,
1887
+ size_t *out_len);
1888
+
1889
+ // SSL_SESSION_CACHE_MAX_SIZE_DEFAULT is the default maximum size of a session
1890
+ // cache.
1891
+ #define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024 * 20)
1892
+
1893
+ // SSL_CTX_sess_set_cache_size sets the maximum size of |ctx|'s internal session
1894
+ // cache to |size|. It returns the previous value.
1895
+ OPENSSL_EXPORT unsigned long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx,
1896
+ unsigned long size);
1897
+
1898
+ // SSL_CTX_sess_get_cache_size returns the maximum size of |ctx|'s internal
1899
+ // session cache.
1900
+ OPENSSL_EXPORT unsigned long SSL_CTX_sess_get_cache_size(const SSL_CTX *ctx);
1901
+
1902
+ // SSL_CTX_sess_number returns the number of sessions in |ctx|'s internal
1903
+ // session cache.
1904
+ OPENSSL_EXPORT size_t SSL_CTX_sess_number(const SSL_CTX *ctx);
1905
+
1906
+ // SSL_CTX_add_session inserts |session| into |ctx|'s internal session cache. It
1907
+ // returns one on success and zero on error or if |session| is already in the
1908
+ // cache. The caller retains its reference to |session|.
1909
+ OPENSSL_EXPORT int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session);
1910
+
1911
+ // SSL_CTX_remove_session removes |session| from |ctx|'s internal session cache.
1912
+ // It returns one on success and zero if |session| was not in the cache.
1913
+ OPENSSL_EXPORT int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session);
1914
+
1915
+ // SSL_CTX_flush_sessions removes all sessions from |ctx| which have expired as
1916
+ // of time |time|. If |time| is zero, all sessions are removed.
1917
+ OPENSSL_EXPORT void SSL_CTX_flush_sessions(SSL_CTX *ctx, uint64_t time);
1918
+
1919
+ // SSL_CTX_sess_set_new_cb sets the callback to be called when a new session is
1920
+ // established and ready to be cached. If the session cache is disabled (the
1921
+ // appropriate one of |SSL_SESS_CACHE_CLIENT| or |SSL_SESS_CACHE_SERVER| is
1922
+ // unset), the callback is not called.
1923
+ //
1924
+ // The callback is passed a reference to |session|. It returns one if it takes
1925
+ // ownership (and then calls |SSL_SESSION_free| when done) and zero otherwise. A
1926
+ // consumer which places |session| into an in-memory cache will likely return
1927
+ // one, with the cache calling |SSL_SESSION_free|. A consumer which serializes
1928
+ // |session| with |SSL_SESSION_to_bytes| may not need to retain |session| and
1929
+ // will likely return zero. Returning one is equivalent to calling
1930
+ // |SSL_SESSION_up_ref| and then returning zero.
1931
+ //
1932
+ // Note: For a client, the callback may be called on abbreviated handshakes if a
1933
+ // ticket is renewed. Further, it may not be called until some time after
1934
+ // |SSL_do_handshake| or |SSL_connect| completes if False Start is enabled. Thus
1935
+ // it's recommended to use this callback over calling |SSL_get_session| on
1936
+ // handshake completion.
1937
+ OPENSSL_EXPORT void SSL_CTX_sess_set_new_cb(
1938
+ SSL_CTX *ctx, int (*new_session_cb)(SSL *ssl, SSL_SESSION *session));
1939
+
1940
+ // SSL_CTX_sess_get_new_cb returns the callback set by
1941
+ // |SSL_CTX_sess_set_new_cb|.
1942
+ OPENSSL_EXPORT int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(
1943
+ SSL *ssl, SSL_SESSION *session);
1944
+
1945
+ // SSL_CTX_sess_set_remove_cb sets a callback which is called when a session is
1946
+ // removed from the internal session cache.
1947
+ //
1948
+ // TODO(davidben): What is the point of this callback? It seems useless since it
1949
+ // only fires on sessions in the internal cache.
1950
+ OPENSSL_EXPORT void SSL_CTX_sess_set_remove_cb(
1951
+ SSL_CTX *ctx,
1952
+ void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *session));
1953
+
1954
+ // SSL_CTX_sess_get_remove_cb returns the callback set by
1955
+ // |SSL_CTX_sess_set_remove_cb|.
1956
+ OPENSSL_EXPORT void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(
1957
+ SSL_CTX *ctx, SSL_SESSION *session);
1958
+
1959
+ // SSL_CTX_sess_set_get_cb sets a callback to look up a session by ID for a
1960
+ // server. The callback is passed the session ID and should return a matching
1961
+ // |SSL_SESSION| or NULL if not found. It should set |*out_copy| to zero and
1962
+ // return a new reference to the session. This callback is not used for a
1963
+ // client.
1964
+ //
1965
+ // For historical reasons, if |*out_copy| is set to one (default), the SSL
1966
+ // library will take a new reference to the returned |SSL_SESSION|, expecting
1967
+ // the callback to return a non-owning pointer. This is not recommended. If
1968
+ // |ctx| and thus the callback is used on multiple threads, the session may be
1969
+ // removed and invalidated before the SSL library calls |SSL_SESSION_up_ref|,
1970
+ // whereas the callback may synchronize internally.
1971
+ //
1972
+ // To look up a session asynchronously, the callback may return
1973
+ // |SSL_magic_pending_session_ptr|. See the documentation for that function and
1974
+ // |SSL_ERROR_PENDING_SESSION|.
1975
+ //
1976
+ // If the internal session cache is enabled, the callback is only consulted if
1977
+ // the internal cache does not return a match.
1978
+ OPENSSL_EXPORT void SSL_CTX_sess_set_get_cb(
1979
+ SSL_CTX *ctx, SSL_SESSION *(*get_session_cb)(SSL *ssl, const uint8_t *id,
1980
+ int id_len, int *out_copy));
1981
+
1982
+ // SSL_CTX_sess_get_get_cb returns the callback set by
1983
+ // |SSL_CTX_sess_set_get_cb|.
1984
+ OPENSSL_EXPORT SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(
1985
+ SSL *ssl, const uint8_t *id, int id_len, int *out_copy);
1986
+
1987
+ // SSL_magic_pending_session_ptr returns a magic |SSL_SESSION|* which indicates
1988
+ // that the session isn't currently unavailable. |SSL_get_error| will then
1989
+ // return |SSL_ERROR_PENDING_SESSION| and the handshake can be retried later
1990
+ // when the lookup has completed.
1991
+ OPENSSL_EXPORT SSL_SESSION *SSL_magic_pending_session_ptr(void);
1992
+
1993
+
1994
+ // Session tickets.
1995
+ //
1996
+ // Session tickets, from RFC 5077, allow session resumption without server-side
1997
+ // state. The server maintains a secret ticket key and sends the client opaque
1998
+ // encrypted session parameters, called a ticket. When offering the session, the
1999
+ // client sends the ticket which the server decrypts to recover session state.
2000
+ // Session tickets are enabled by default but may be disabled with
2001
+ // |SSL_OP_NO_TICKET|.
2002
+ //
2003
+ // On the client, ticket-based sessions use the same APIs as ID-based tickets.
2004
+ // Callers do not need to handle them differently.
2005
+ //
2006
+ // On the server, tickets are encrypted and authenticated with a secret key. By
2007
+ // default, an |SSL_CTX| generates a key on creation and uses it for the
2008
+ // lifetime of the |SSL_CTX|. Tickets are minted and processed
2009
+ // transparently. The following functions may be used to configure a persistent
2010
+ // key or implement more custom behavior, including key rotation and sharing
2011
+ // keys between multiple servers in a large deployment. There are three levels
2012
+ // of customisation possible:
2013
+ //
2014
+ // 1) One can simply set the keys with |SSL_CTX_set_tlsext_ticket_keys|.
2015
+ // 2) One can configure an |EVP_CIPHER_CTX| and |HMAC_CTX| directly for
2016
+ // encryption and authentication.
2017
+ // 3) One can configure an |SSL_TICKET_AEAD_METHOD| to have more control
2018
+ // and the option of asynchronous decryption.
2019
+ //
2020
+ // An attacker that compromises a server's session ticket key can impersonate
2021
+ // the server and, prior to TLS 1.3, retroactively decrypt all application
2022
+ // traffic from sessions using that ticket key. Thus ticket keys must be
2023
+ // regularly rotated for forward secrecy. Note the default key is rotated
2024
+ // automatically once every 48 hours but manually configured keys are not.
2025
+
2026
+ // SSL_DEFAULT_TICKET_KEY_ROTATION_INTERVAL is the interval with which the
2027
+ // default session ticket encryption key is rotated, if in use. If any
2028
+ // non-default ticket encryption mechanism is configured, automatic rotation is
2029
+ // disabled.
2030
+ #define SSL_DEFAULT_TICKET_KEY_ROTATION_INTERVAL (2 * 24 * 60 * 60)
2031
+
2032
+ // SSL_CTX_get_tlsext_ticket_keys writes |ctx|'s session ticket key material to
2033
+ // |len| bytes of |out|. It returns one on success and zero if |len| is not
2034
+ // 48. If |out| is NULL, it returns 48 instead.
2035
+ OPENSSL_EXPORT int SSL_CTX_get_tlsext_ticket_keys(SSL_CTX *ctx, void *out,
2036
+ size_t len);
2037
+
2038
+ // SSL_CTX_set_tlsext_ticket_keys sets |ctx|'s session ticket key material to
2039
+ // |len| bytes of |in|. It returns one on success and zero if |len| is not
2040
+ // 48. If |in| is NULL, it returns 48 instead.
2041
+ OPENSSL_EXPORT int SSL_CTX_set_tlsext_ticket_keys(SSL_CTX *ctx, const void *in,
2042
+ size_t len);
2043
+
2044
+ // SSL_TICKET_KEY_NAME_LEN is the length of the key name prefix of a session
2045
+ // ticket.
2046
+ #define SSL_TICKET_KEY_NAME_LEN 16
2047
+
2048
+ // SSL_CTX_set_tlsext_ticket_key_cb sets the ticket callback to |callback| and
2049
+ // returns one. |callback| will be called when encrypting a new ticket and when
2050
+ // decrypting a ticket from the client.
2051
+ //
2052
+ // In both modes, |ctx| and |hmac_ctx| will already have been initialized with
2053
+ // |EVP_CIPHER_CTX_init| and |HMAC_CTX_init|, respectively. |callback|
2054
+ // configures |hmac_ctx| with an HMAC digest and key, and configures |ctx|
2055
+ // for encryption or decryption, based on the mode.
2056
+ //
2057
+ // When encrypting a new ticket, |encrypt| will be one. It writes a public
2058
+ // 16-byte key name to |key_name| and a fresh IV to |iv|. The output IV length
2059
+ // must match |EVP_CIPHER_CTX_iv_length| of the cipher selected. In this mode,
2060
+ // |callback| returns 1 on success and -1 on error.
2061
+ //
2062
+ // When decrypting a ticket, |encrypt| will be zero. |key_name| will point to a
2063
+ // 16-byte key name and |iv| points to an IV. The length of the IV consumed must
2064
+ // match |EVP_CIPHER_CTX_iv_length| of the cipher selected. In this mode,
2065
+ // |callback| returns -1 to abort the handshake, 0 if decrypting the ticket
2066
+ // failed, and 1 or 2 on success. If it returns 2, the ticket will be renewed.
2067
+ // This may be used to re-key the ticket.
2068
+ //
2069
+ // WARNING: |callback| wildly breaks the usual return value convention and is
2070
+ // called in two different modes.
2071
+ OPENSSL_EXPORT int SSL_CTX_set_tlsext_ticket_key_cb(
2072
+ SSL_CTX *ctx, int (*callback)(SSL *ssl, uint8_t *key_name, uint8_t *iv,
2073
+ EVP_CIPHER_CTX *ctx, HMAC_CTX *hmac_ctx,
2074
+ int encrypt));
2075
+
2076
+ // ssl_ticket_aead_result_t enumerates the possible results from decrypting a
2077
+ // ticket with an |SSL_TICKET_AEAD_METHOD|.
2078
+ enum ssl_ticket_aead_result_t {
2079
+ // ssl_ticket_aead_success indicates that the ticket was successfully
2080
+ // decrypted.
2081
+ ssl_ticket_aead_success,
2082
+ // ssl_ticket_aead_retry indicates that the operation could not be
2083
+ // immediately completed and must be reattempted, via |open|, at a later
2084
+ // point.
2085
+ ssl_ticket_aead_retry,
2086
+ // ssl_ticket_aead_ignore_ticket indicates that the ticket should be ignored
2087
+ // (i.e. is corrupt or otherwise undecryptable).
2088
+ ssl_ticket_aead_ignore_ticket,
2089
+ // ssl_ticket_aead_error indicates that a fatal error occured and the
2090
+ // handshake should be terminated.
2091
+ ssl_ticket_aead_error,
2092
+ };
2093
+
2094
+ // ssl_ticket_aead_method_st (aka |SSL_TICKET_AEAD_METHOD|) contains methods
2095
+ // for encrypting and decrypting session tickets.
2096
+ struct ssl_ticket_aead_method_st {
2097
+ // max_overhead returns the maximum number of bytes of overhead that |seal|
2098
+ // may add.
2099
+ size_t (*max_overhead)(SSL *ssl);
2100
+
2101
+ // seal encrypts and authenticates |in_len| bytes from |in|, writes, at most,
2102
+ // |max_out_len| bytes to |out|, and puts the number of bytes written in
2103
+ // |*out_len|. The |in| and |out| buffers may be equal but will not otherwise
2104
+ // alias. It returns one on success or zero on error.
2105
+ int (*seal)(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out_len,
2106
+ const uint8_t *in, size_t in_len);
2107
+
2108
+ // open authenticates and decrypts |in_len| bytes from |in|, writes, at most,
2109
+ // |max_out_len| bytes of plaintext to |out|, and puts the number of bytes
2110
+ // written in |*out_len|. The |in| and |out| buffers may be equal but will
2111
+ // not otherwise alias. See |ssl_ticket_aead_result_t| for details of the
2112
+ // return values. In the case that a retry is indicated, the caller should
2113
+ // arrange for the high-level operation on |ssl| to be retried when the
2114
+ // operation is completed, which will result in another call to |open|.
2115
+ enum ssl_ticket_aead_result_t (*open)(SSL *ssl, uint8_t *out, size_t *out_len,
2116
+ size_t max_out_len, const uint8_t *in,
2117
+ size_t in_len);
2118
+ };
2119
+
2120
+ // SSL_CTX_set_ticket_aead_method configures a custom ticket AEAD method table
2121
+ // on |ctx|. |aead_method| must remain valid for the lifetime of |ctx|.
2122
+ OPENSSL_EXPORT void SSL_CTX_set_ticket_aead_method(
2123
+ SSL_CTX *ctx, const SSL_TICKET_AEAD_METHOD *aead_method);
2124
+
2125
+
2126
+ // Elliptic curve Diffie-Hellman.
2127
+ //
2128
+ // Cipher suites using an ECDHE key exchange perform Diffie-Hellman over an
2129
+ // elliptic curve negotiated by both endpoints. See RFC 4492. Only named curves
2130
+ // are supported. ECDHE is always enabled, but the curve preferences may be
2131
+ // configured with these functions.
2132
+ //
2133
+ // Note that TLS 1.3 renames these from curves to groups. For consistency, we
2134
+ // currently use the TLS 1.2 name in the API.
2135
+
2136
+ // SSL_CTX_set1_curves sets the preferred curves for |ctx| to be |curves|. Each
2137
+ // element of |curves| should be a curve nid. It returns one on success and
2138
+ // zero on failure.
2139
+ //
2140
+ // Note that this API uses nid values from nid.h and not the |SSL_CURVE_*|
2141
+ // values defined below.
2142
+ OPENSSL_EXPORT int SSL_CTX_set1_curves(SSL_CTX *ctx, const int *curves,
2143
+ size_t curves_len);
2144
+
2145
+ // SSL_set1_curves sets the preferred curves for |ssl| to be |curves|. Each
2146
+ // element of |curves| should be a curve nid. It returns one on success and
2147
+ // zero on failure.
2148
+ //
2149
+ // Note that this API uses nid values from nid.h and not the |SSL_CURVE_*|
2150
+ // values defined below.
2151
+ OPENSSL_EXPORT int SSL_set1_curves(SSL *ssl, const int *curves,
2152
+ size_t curves_len);
2153
+
2154
+ // SSL_CTX_set1_curves_list sets the preferred curves for |ctx| to be the
2155
+ // colon-separated list |curves|. Each element of |curves| should be a curve
2156
+ // name (e.g. P-256, X25519, ...). It returns one on success and zero on
2157
+ // failure.
2158
+ OPENSSL_EXPORT int SSL_CTX_set1_curves_list(SSL_CTX *ctx, const char *curves);
2159
+
2160
+ // SSL_set1_curves_list sets the preferred curves for |ssl| to be the
2161
+ // colon-separated list |curves|. Each element of |curves| should be a curve
2162
+ // name (e.g. P-256, X25519, ...). It returns one on success and zero on
2163
+ // failure.
2164
+ OPENSSL_EXPORT int SSL_set1_curves_list(SSL *ssl, const char *curves);
2165
+
2166
+ // SSL_CURVE_* define TLS curve IDs.
2167
+ #define SSL_CURVE_SECP224R1 21
2168
+ #define SSL_CURVE_SECP256R1 23
2169
+ #define SSL_CURVE_SECP384R1 24
2170
+ #define SSL_CURVE_SECP521R1 25
2171
+ #define SSL_CURVE_X25519 29
2172
+
2173
+ // SSL_get_curve_id returns the ID of the curve used by |ssl|'s most recently
2174
+ // completed handshake or 0 if not applicable.
2175
+ //
2176
+ // TODO(davidben): This API currently does not work correctly if there is a
2177
+ // renegotiation in progress. Fix this.
2178
+ OPENSSL_EXPORT uint16_t SSL_get_curve_id(const SSL *ssl);
2179
+
2180
+ // SSL_get_curve_name returns a human-readable name for the curve specified by
2181
+ // the given TLS curve id, or NULL if the curve is unknown.
2182
+ OPENSSL_EXPORT const char *SSL_get_curve_name(uint16_t curve_id);
2183
+
2184
+
2185
+ // Certificate verification.
2186
+ //
2187
+ // SSL may authenticate either endpoint with an X.509 certificate. Typically
2188
+ // this is used to authenticate the server to the client. These functions
2189
+ // configure certificate verification.
2190
+ //
2191
+ // WARNING: By default, certificate verification errors on a client are not
2192
+ // fatal. See |SSL_VERIFY_NONE| This may be configured with
2193
+ // |SSL_CTX_set_verify|.
2194
+ //
2195
+ // By default clients are anonymous but a server may request a certificate from
2196
+ // the client by setting |SSL_VERIFY_PEER|.
2197
+ //
2198
+ // Many of these functions use OpenSSL's legacy X.509 stack which is
2199
+ // underdocumented and deprecated, but the replacement isn't ready yet. For
2200
+ // now, consumers may use the existing stack or bypass it by performing
2201
+ // certificate verification externally. This may be done with
2202
+ // |SSL_CTX_set_cert_verify_callback| or by extracting the chain with
2203
+ // |SSL_get_peer_cert_chain| after the handshake. In the future, functions will
2204
+ // be added to use the SSL stack without dependency on any part of the legacy
2205
+ // X.509 and ASN.1 stack.
2206
+ //
2207
+ // To augment certificate verification, a client may also enable OCSP stapling
2208
+ // (RFC 6066) and Certificate Transparency (RFC 6962) extensions.
2209
+
2210
+ // SSL_VERIFY_NONE, on a client, verifies the server certificate but does not
2211
+ // make errors fatal. The result may be checked with |SSL_get_verify_result|. On
2212
+ // a server it does not request a client certificate. This is the default.
2213
+ #define SSL_VERIFY_NONE 0x00
2214
+
2215
+ // SSL_VERIFY_PEER, on a client, makes server certificate errors fatal. On a
2216
+ // server it requests a client certificate and makes errors fatal. However,
2217
+ // anonymous clients are still allowed. See
2218
+ // |SSL_VERIFY_FAIL_IF_NO_PEER_CERT|.
2219
+ #define SSL_VERIFY_PEER 0x01
2220
+
2221
+ // SSL_VERIFY_FAIL_IF_NO_PEER_CERT configures a server to reject connections if
2222
+ // the client declines to send a certificate. This flag must be used together
2223
+ // with |SSL_VERIFY_PEER|, otherwise it won't work.
2224
+ #define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02
2225
+
2226
+ // SSL_VERIFY_PEER_IF_NO_OBC configures a server to request a client certificate
2227
+ // if and only if Channel ID is not negotiated.
2228
+ #define SSL_VERIFY_PEER_IF_NO_OBC 0x04
2229
+
2230
+ // SSL_CTX_set_verify configures certificate verification behavior. |mode| is
2231
+ // one of the |SSL_VERIFY_*| values defined above. |callback|, if not NULL, is
2232
+ // used to customize certificate verification. See the behavior of
2233
+ // |X509_STORE_CTX_set_verify_cb|.
2234
+ //
2235
+ // The callback may use |SSL_get_ex_data_X509_STORE_CTX_idx| with
2236
+ // |X509_STORE_CTX_get_ex_data| to look up the |SSL| from |store_ctx|.
2237
+ OPENSSL_EXPORT void SSL_CTX_set_verify(
2238
+ SSL_CTX *ctx, int mode, int (*callback)(int ok, X509_STORE_CTX *store_ctx));
2239
+
2240
+ // SSL_set_verify configures certificate verification behavior. |mode| is one of
2241
+ // the |SSL_VERIFY_*| values defined above. |callback|, if not NULL, is used to
2242
+ // customize certificate verification. See the behavior of
2243
+ // |X509_STORE_CTX_set_verify_cb|.
2244
+ //
2245
+ // The callback may use |SSL_get_ex_data_X509_STORE_CTX_idx| with
2246
+ // |X509_STORE_CTX_get_ex_data| to look up the |SSL| from |store_ctx|.
2247
+ OPENSSL_EXPORT void SSL_set_verify(SSL *ssl, int mode,
2248
+ int (*callback)(int ok,
2249
+ X509_STORE_CTX *store_ctx));
2250
+
2251
+ enum ssl_verify_result_t {
2252
+ ssl_verify_ok,
2253
+ ssl_verify_invalid,
2254
+ ssl_verify_retry,
2255
+ };
2256
+
2257
+ // SSL_CTX_set_custom_verify configures certificate verification. |mode| is one
2258
+ // of the |SSL_VERIFY_*| values defined above. |callback| performs the
2259
+ // certificate verification.
2260
+ //
2261
+ // The callback may call |SSL_get0_peer_certificates| for the certificate chain
2262
+ // to validate. The callback should return |ssl_verify_ok| if the certificate is
2263
+ // valid. If the certificate is invalid, the callback should return
2264
+ // |ssl_verify_invalid| and optionally set |*out_alert| to an alert to send to
2265
+ // the peer. Some useful alerts include |SSL_AD_CERTIFICATE_EXPIRED|,
2266
+ // |SSL_AD_CERTIFICATE_REVOKED|, |SSL_AD_UNKNOWN_CA|, |SSL_AD_BAD_CERTIFICATE|,
2267
+ // |SSL_AD_CERTIFICATE_UNKNOWN|, and |SSL_AD_INTERNAL_ERROR|. See RFC 5246
2268
+ // section 7.2.2 for their precise meanings. If unspecified,
2269
+ // |SSL_AD_CERTIFICATE_UNKNOWN| will be sent by default.
2270
+ //
2271
+ // To verify a certificate asynchronously, the callback may return
2272
+ // |ssl_verify_retry|. The handshake will then pause with |SSL_get_error|
2273
+ // returning |SSL_ERROR_WANT_CERTIFICATE_VERIFY|.
2274
+ OPENSSL_EXPORT void SSL_CTX_set_custom_verify(
2275
+ SSL_CTX *ctx, int mode,
2276
+ enum ssl_verify_result_t (*callback)(SSL *ssl, uint8_t *out_alert));
2277
+
2278
+ // SSL_set_custom_verify behaves like |SSL_CTX_set_custom_verify| but configures
2279
+ // an individual |SSL|.
2280
+ OPENSSL_EXPORT void SSL_set_custom_verify(
2281
+ SSL *ssl, int mode,
2282
+ enum ssl_verify_result_t (*callback)(SSL *ssl, uint8_t *out_alert));
2283
+
2284
+ // SSL_CTX_get_verify_mode returns |ctx|'s verify mode, set by
2285
+ // |SSL_CTX_set_verify|.
2286
+ OPENSSL_EXPORT int SSL_CTX_get_verify_mode(const SSL_CTX *ctx);
2287
+
2288
+ // SSL_get_verify_mode returns |ssl|'s verify mode, set by |SSL_CTX_set_verify|
2289
+ // or |SSL_set_verify|.
2290
+ OPENSSL_EXPORT int SSL_get_verify_mode(const SSL *ssl);
2291
+
2292
+ // SSL_CTX_get_verify_callback returns the callback set by
2293
+ // |SSL_CTX_set_verify|.
2294
+ OPENSSL_EXPORT int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(
2295
+ int ok, X509_STORE_CTX *store_ctx);
2296
+
2297
+ // SSL_get_verify_callback returns the callback set by |SSL_CTX_set_verify| or
2298
+ // |SSL_set_verify|.
2299
+ OPENSSL_EXPORT int (*SSL_get_verify_callback(const SSL *ssl))(
2300
+ int ok, X509_STORE_CTX *store_ctx);
2301
+
2302
+ // SSL_CTX_set_verify_depth sets the maximum depth of a certificate chain
2303
+ // accepted in verification. This number does not include the leaf, so a depth
2304
+ // of 1 allows the leaf and one CA certificate.
2305
+ OPENSSL_EXPORT void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth);
2306
+
2307
+ // SSL_set_verify_depth sets the maximum depth of a certificate chain accepted
2308
+ // in verification. This number does not include the leaf, so a depth of 1
2309
+ // allows the leaf and one CA certificate.
2310
+ OPENSSL_EXPORT void SSL_set_verify_depth(SSL *ssl, int depth);
2311
+
2312
+ // SSL_CTX_get_verify_depth returns the maximum depth of a certificate accepted
2313
+ // in verification.
2314
+ OPENSSL_EXPORT int SSL_CTX_get_verify_depth(const SSL_CTX *ctx);
2315
+
2316
+ // SSL_get_verify_depth returns the maximum depth of a certificate accepted in
2317
+ // verification.
2318
+ OPENSSL_EXPORT int SSL_get_verify_depth(const SSL *ssl);
2319
+
2320
+ // SSL_CTX_set1_param sets verification parameters from |param|. It returns one
2321
+ // on success and zero on failure. The caller retains ownership of |param|.
2322
+ OPENSSL_EXPORT int SSL_CTX_set1_param(SSL_CTX *ctx,
2323
+ const X509_VERIFY_PARAM *param);
2324
+
2325
+ // SSL_set1_param sets verification parameters from |param|. It returns one on
2326
+ // success and zero on failure. The caller retains ownership of |param|.
2327
+ OPENSSL_EXPORT int SSL_set1_param(SSL *ssl,
2328
+ const X509_VERIFY_PARAM *param);
2329
+
2330
+ // SSL_CTX_get0_param returns |ctx|'s |X509_VERIFY_PARAM| for certificate
2331
+ // verification. The caller must not release the returned pointer but may call
2332
+ // functions on it to configure it.
2333
+ OPENSSL_EXPORT X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx);
2334
+
2335
+ // SSL_get0_param returns |ssl|'s |X509_VERIFY_PARAM| for certificate
2336
+ // verification. The caller must not release the returned pointer but may call
2337
+ // functions on it to configure it.
2338
+ OPENSSL_EXPORT X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);
2339
+
2340
+ // SSL_CTX_set_purpose sets |ctx|'s |X509_VERIFY_PARAM|'s 'purpose' parameter to
2341
+ // |purpose|. It returns one on success and zero on error.
2342
+ OPENSSL_EXPORT int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose);
2343
+
2344
+ // SSL_set_purpose sets |ssl|'s |X509_VERIFY_PARAM|'s 'purpose' parameter to
2345
+ // |purpose|. It returns one on success and zero on error.
2346
+ OPENSSL_EXPORT int SSL_set_purpose(SSL *ssl, int purpose);
2347
+
2348
+ // SSL_CTX_set_trust sets |ctx|'s |X509_VERIFY_PARAM|'s 'trust' parameter to
2349
+ // |trust|. It returns one on success and zero on error.
2350
+ OPENSSL_EXPORT int SSL_CTX_set_trust(SSL_CTX *ctx, int trust);
2351
+
2352
+ // SSL_set_trust sets |ssl|'s |X509_VERIFY_PARAM|'s 'trust' parameter to
2353
+ // |trust|. It returns one on success and zero on error.
2354
+ OPENSSL_EXPORT int SSL_set_trust(SSL *ssl, int trust);
2355
+
2356
+ // SSL_CTX_set_cert_store sets |ctx|'s certificate store to |store|. It takes
2357
+ // ownership of |store|. The store is used for certificate verification.
2358
+ //
2359
+ // The store is also used for the auto-chaining feature, but this is deprecated.
2360
+ // See also |SSL_MODE_NO_AUTO_CHAIN|.
2361
+ OPENSSL_EXPORT void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store);
2362
+
2363
+ // SSL_CTX_get_cert_store returns |ctx|'s certificate store.
2364
+ OPENSSL_EXPORT X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx);
2365
+
2366
+ // SSL_CTX_set_default_verify_paths loads the OpenSSL system-default trust
2367
+ // anchors into |ctx|'s store. It returns one on success and zero on failure.
2368
+ OPENSSL_EXPORT int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
2369
+
2370
+ // SSL_CTX_load_verify_locations loads trust anchors into |ctx|'s store from
2371
+ // |ca_file| and |ca_dir|, either of which may be NULL. If |ca_file| is passed,
2372
+ // it is opened and PEM-encoded CA certificates are read. If |ca_dir| is passed,
2373
+ // it is treated as a directory in OpenSSL's hashed directory format. It returns
2374
+ // one on success and zero on failure.
2375
+ //
2376
+ // See
2377
+ // https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_load_verify_locations.html
2378
+ // for documentation on the directory format.
2379
+ OPENSSL_EXPORT int SSL_CTX_load_verify_locations(SSL_CTX *ctx,
2380
+ const char *ca_file,
2381
+ const char *ca_dir);
2382
+
2383
+ // SSL_get_verify_result returns the result of certificate verification. It is
2384
+ // either |X509_V_OK| or a |X509_V_ERR_*| value.
2385
+ OPENSSL_EXPORT long SSL_get_verify_result(const SSL *ssl);
2386
+
2387
+ // SSL_get_ex_data_X509_STORE_CTX_idx returns the ex_data index used to look up
2388
+ // the |SSL| associated with an |X509_STORE_CTX| in the verify callback.
2389
+ OPENSSL_EXPORT int SSL_get_ex_data_X509_STORE_CTX_idx(void);
2390
+
2391
+ // SSL_CTX_set_cert_verify_callback sets a custom callback to be called on
2392
+ // certificate verification rather than |X509_verify_cert|. |store_ctx| contains
2393
+ // the verification parameters. The callback should return one on success and
2394
+ // zero on fatal error. It may use |X509_STORE_CTX_set_error| to set a
2395
+ // verification result.
2396
+ //
2397
+ // The callback may use |SSL_get_ex_data_X509_STORE_CTX_idx| to recover the
2398
+ // |SSL| object from |store_ctx|.
2399
+ OPENSSL_EXPORT void SSL_CTX_set_cert_verify_callback(
2400
+ SSL_CTX *ctx, int (*callback)(X509_STORE_CTX *store_ctx, void *arg),
2401
+ void *arg);
2402
+
2403
+ // SSL_enable_signed_cert_timestamps causes |ssl| (which must be the client end
2404
+ // of a connection) to request SCTs from the server. See
2405
+ // https://tools.ietf.org/html/rfc6962.
2406
+ //
2407
+ // Call |SSL_get0_signed_cert_timestamp_list| to recover the SCT after the
2408
+ // handshake.
2409
+ OPENSSL_EXPORT void SSL_enable_signed_cert_timestamps(SSL *ssl);
2410
+
2411
+ // SSL_CTX_enable_signed_cert_timestamps enables SCT requests on all client SSL
2412
+ // objects created from |ctx|.
2413
+ //
2414
+ // Call |SSL_get0_signed_cert_timestamp_list| to recover the SCT after the
2415
+ // handshake.
2416
+ OPENSSL_EXPORT void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx);
2417
+
2418
+ // SSL_enable_ocsp_stapling causes |ssl| (which must be the client end of a
2419
+ // connection) to request a stapled OCSP response from the server.
2420
+ //
2421
+ // Call |SSL_get0_ocsp_response| to recover the OCSP response after the
2422
+ // handshake.
2423
+ OPENSSL_EXPORT void SSL_enable_ocsp_stapling(SSL *ssl);
2424
+
2425
+ // SSL_CTX_enable_ocsp_stapling enables OCSP stapling on all client SSL objects
2426
+ // created from |ctx|.
2427
+ //
2428
+ // Call |SSL_get0_ocsp_response| to recover the OCSP response after the
2429
+ // handshake.
2430
+ OPENSSL_EXPORT void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx);
2431
+
2432
+ // SSL_CTX_set0_verify_cert_store sets an |X509_STORE| that will be used
2433
+ // exclusively for certificate verification and returns one. Ownership of
2434
+ // |store| is transferred to the |SSL_CTX|.
2435
+ OPENSSL_EXPORT int SSL_CTX_set0_verify_cert_store(SSL_CTX *ctx,
2436
+ X509_STORE *store);
2437
+
2438
+ // SSL_CTX_set1_verify_cert_store sets an |X509_STORE| that will be used
2439
+ // exclusively for certificate verification and returns one. An additional
2440
+ // reference to |store| will be taken.
2441
+ OPENSSL_EXPORT int SSL_CTX_set1_verify_cert_store(SSL_CTX *ctx,
2442
+ X509_STORE *store);
2443
+
2444
+ // SSL_set0_verify_cert_store sets an |X509_STORE| that will be used
2445
+ // exclusively for certificate verification and returns one. Ownership of
2446
+ // |store| is transferred to the |SSL|.
2447
+ OPENSSL_EXPORT int SSL_set0_verify_cert_store(SSL *ssl, X509_STORE *store);
2448
+
2449
+ // SSL_set1_verify_cert_store sets an |X509_STORE| that will be used
2450
+ // exclusively for certificate verification and returns one. An additional
2451
+ // reference to |store| will be taken.
2452
+ OPENSSL_EXPORT int SSL_set1_verify_cert_store(SSL *ssl, X509_STORE *store);
2453
+
2454
+ // SSL_CTX_set_ed25519_enabled configures whether |ctx| advertises support for
2455
+ // the Ed25519 signature algorithm when using the default preference list.
2456
+ OPENSSL_EXPORT void SSL_CTX_set_ed25519_enabled(SSL_CTX *ctx, int enabled);
2457
+
2458
+ // SSL_CTX_set_verify_algorithm_prefs confingures |ctx| to use |prefs| as the
2459
+ // preference list when verifying signature's from the peer's long-term key. It
2460
+ // returns one on zero on error. |prefs| should not include the internal-only
2461
+ // value |SSL_SIGN_RSA_PKCS1_MD5_SHA1|.
2462
+ OPENSSL_EXPORT int SSL_CTX_set_verify_algorithm_prefs(SSL_CTX *ctx,
2463
+ const uint16_t *prefs,
2464
+ size_t num_prefs);
2465
+
2466
+
2467
+ // Client certificate CA list.
2468
+ //
2469
+ // When requesting a client certificate, a server may advertise a list of
2470
+ // certificate authorities which are accepted. These functions may be used to
2471
+ // configure this list.
2472
+
2473
+ // SSL_set_client_CA_list sets |ssl|'s client certificate CA list to
2474
+ // |name_list|. It takes ownership of |name_list|.
2475
+ OPENSSL_EXPORT void SSL_set_client_CA_list(SSL *ssl,
2476
+ STACK_OF(X509_NAME) *name_list);
2477
+
2478
+ // SSL_CTX_set_client_CA_list sets |ctx|'s client certificate CA list to
2479
+ // |name_list|. It takes ownership of |name_list|.
2480
+ OPENSSL_EXPORT void SSL_CTX_set_client_CA_list(SSL_CTX *ctx,
2481
+ STACK_OF(X509_NAME) *name_list);
2482
+
2483
+ // SSL_set0_client_CAs sets |ssl|'s client certificate CA list to |name_list|,
2484
+ // which should contain DER-encoded distinguished names (RFC 5280). It takes
2485
+ // ownership of |name_list|.
2486
+ OPENSSL_EXPORT void SSL_set0_client_CAs(SSL *ssl,
2487
+ STACK_OF(CRYPTO_BUFFER) *name_list);
2488
+
2489
+ // SSL_CTX_set0_client_CAs sets |ctx|'s client certificate CA list to
2490
+ // |name_list|, which should contain DER-encoded distinguished names (RFC 5280).
2491
+ // It takes ownership of |name_list|.
2492
+ OPENSSL_EXPORT void SSL_CTX_set0_client_CAs(SSL_CTX *ctx,
2493
+ STACK_OF(CRYPTO_BUFFER) *name_list);
2494
+
2495
+ // SSL_get_client_CA_list returns |ssl|'s client certificate CA list. If |ssl|
2496
+ // has not been configured as a client, this is the list configured by
2497
+ // |SSL_CTX_set_client_CA_list|.
2498
+ //
2499
+ // If configured as a client, it returns the client certificate CA list sent by
2500
+ // the server. In this mode, the behavior is undefined except during the
2501
+ // callbacks set by |SSL_CTX_set_cert_cb| and |SSL_CTX_set_client_cert_cb| or
2502
+ // when the handshake is paused because of them.
2503
+ OPENSSL_EXPORT STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *ssl);
2504
+
2505
+ // SSL_get0_server_requested_CAs returns the CAs sent by a server to guide a
2506
+ // client in certificate selection. They are a series of DER-encoded X.509
2507
+ // names. This function may only be called during a callback set by
2508
+ // |SSL_CTX_set_cert_cb| or when the handshake is paused because of it.
2509
+ //
2510
+ // The returned stack is owned by |ssl|, as are its contents. It should not be
2511
+ // used past the point where the handshake is restarted after the callback.
2512
+ OPENSSL_EXPORT STACK_OF(CRYPTO_BUFFER) *SSL_get0_server_requested_CAs(
2513
+ const SSL *ssl);
2514
+
2515
+ // SSL_CTX_get_client_CA_list returns |ctx|'s client certificate CA list.
2516
+ OPENSSL_EXPORT STACK_OF(X509_NAME) *
2517
+ SSL_CTX_get_client_CA_list(const SSL_CTX *ctx);
2518
+
2519
+ // SSL_add_client_CA appends |x509|'s subject to the client certificate CA list.
2520
+ // It returns one on success or zero on error. The caller retains ownership of
2521
+ // |x509|.
2522
+ OPENSSL_EXPORT int SSL_add_client_CA(SSL *ssl, X509 *x509);
2523
+
2524
+ // SSL_CTX_add_client_CA appends |x509|'s subject to the client certificate CA
2525
+ // list. It returns one on success or zero on error. The caller retains
2526
+ // ownership of |x509|.
2527
+ OPENSSL_EXPORT int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x509);
2528
+
2529
+ // SSL_load_client_CA_file opens |file| and reads PEM-encoded certificates from
2530
+ // it. It returns a newly-allocated stack of the certificate subjects or NULL
2531
+ // on error.
2532
+ OPENSSL_EXPORT STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
2533
+
2534
+ // SSL_dup_CA_list makes a deep copy of |list|. It returns the new list on
2535
+ // success or NULL on allocation error.
2536
+ OPENSSL_EXPORT STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *list);
2537
+
2538
+ // SSL_add_file_cert_subjects_to_stack behaves like |SSL_load_client_CA_file|
2539
+ // but appends the result to |out|. It returns one on success or zero on
2540
+ // error.
2541
+ OPENSSL_EXPORT int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *out,
2542
+ const char *file);
2543
+
2544
+
2545
+ // Server name indication.
2546
+ //
2547
+ // The server_name extension (RFC 3546) allows the client to advertise the name
2548
+ // of the server it is connecting to. This is used in virtual hosting
2549
+ // deployments to select one of a several certificates on a single IP. Only the
2550
+ // host_name name type is supported.
2551
+
2552
+ #define TLSEXT_NAMETYPE_host_name 0
2553
+
2554
+ // SSL_set_tlsext_host_name, for a client, configures |ssl| to advertise |name|
2555
+ // in the server_name extension. It returns one on success and zero on error.
2556
+ OPENSSL_EXPORT int SSL_set_tlsext_host_name(SSL *ssl, const char *name);
2557
+
2558
+ // SSL_get_servername, for a server, returns the hostname supplied by the
2559
+ // client or NULL if there was none. The |type| argument must be
2560
+ // |TLSEXT_NAMETYPE_host_name|.
2561
+ OPENSSL_EXPORT const char *SSL_get_servername(const SSL *ssl, const int type);
2562
+
2563
+ // SSL_get_servername_type, for a server, returns |TLSEXT_NAMETYPE_host_name|
2564
+ // if the client sent a hostname and -1 otherwise.
2565
+ OPENSSL_EXPORT int SSL_get_servername_type(const SSL *ssl);
2566
+
2567
+ // SSL_CTX_set_tlsext_servername_callback configures |callback| to be called on
2568
+ // the server after ClientHello extensions have been parsed and returns one.
2569
+ // The callback may use |SSL_get_servername| to examine the server_name
2570
+ // extension and returns a |SSL_TLSEXT_ERR_*| value. The value of |arg| may be
2571
+ // set by calling |SSL_CTX_set_tlsext_servername_arg|.
2572
+ //
2573
+ // If the callback returns |SSL_TLSEXT_ERR_NOACK|, the server_name extension is
2574
+ // not acknowledged in the ServerHello. If the return value is
2575
+ // |SSL_TLSEXT_ERR_ALERT_FATAL|, then |*out_alert| is the alert to send,
2576
+ // defaulting to |SSL_AD_UNRECOGNIZED_NAME|. |SSL_TLSEXT_ERR_ALERT_WARNING| is
2577
+ // ignored and treated as |SSL_TLSEXT_ERR_OK|.
2578
+ OPENSSL_EXPORT int SSL_CTX_set_tlsext_servername_callback(
2579
+ SSL_CTX *ctx, int (*callback)(SSL *ssl, int *out_alert, void *arg));
2580
+
2581
+ // SSL_CTX_set_tlsext_servername_arg sets the argument to the servername
2582
+ // callback and returns one. See |SSL_CTX_set_tlsext_servername_callback|.
2583
+ OPENSSL_EXPORT int SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);
2584
+
2585
+ // SSL_TLSEXT_ERR_* are values returned by some extension-related callbacks.
2586
+ #define SSL_TLSEXT_ERR_OK 0
2587
+ #define SSL_TLSEXT_ERR_ALERT_WARNING 1
2588
+ #define SSL_TLSEXT_ERR_ALERT_FATAL 2
2589
+ #define SSL_TLSEXT_ERR_NOACK 3
2590
+
2591
+ // SSL_set_SSL_CTX changes |ssl|'s |SSL_CTX|. |ssl| will use the
2592
+ // certificate-related settings from |ctx|, and |SSL_get_SSL_CTX| will report
2593
+ // |ctx|. This function may be used during the callbacks registered by
2594
+ // |SSL_CTX_set_select_certificate_cb|,
2595
+ // |SSL_CTX_set_tlsext_servername_callback|, and |SSL_CTX_set_cert_cb| or when
2596
+ // the handshake is paused from them. It is typically used to switch
2597
+ // certificates based on SNI.
2598
+ //
2599
+ // Note the session cache and related settings will continue to use the initial
2600
+ // |SSL_CTX|. Callers should use |SSL_CTX_set_session_id_context| to partition
2601
+ // the session cache between different domains.
2602
+ //
2603
+ // TODO(davidben): Should other settings change after this call?
2604
+ OPENSSL_EXPORT SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx);
2605
+
2606
+
2607
+ // Application-layer protocol negotiation.
2608
+ //
2609
+ // The ALPN extension (RFC 7301) allows negotiating different application-layer
2610
+ // protocols over a single port. This is used, for example, to negotiate
2611
+ // HTTP/2.
2612
+
2613
+ // SSL_CTX_set_alpn_protos sets the client ALPN protocol list on |ctx| to
2614
+ // |protos|. |protos| must be in wire-format (i.e. a series of non-empty, 8-bit
2615
+ // length-prefixed strings). It returns zero on success and one on failure.
2616
+ // Configuring this list enables ALPN on a client.
2617
+ //
2618
+ // WARNING: this function is dangerous because it breaks the usual return value
2619
+ // convention.
2620
+ OPENSSL_EXPORT int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const uint8_t *protos,
2621
+ unsigned protos_len);
2622
+
2623
+ // SSL_set_alpn_protos sets the client ALPN protocol list on |ssl| to |protos|.
2624
+ // |protos| must be in wire-format (i.e. a series of non-empty, 8-bit
2625
+ // length-prefixed strings). It returns zero on success and one on failure.
2626
+ // Configuring this list enables ALPN on a client.
2627
+ //
2628
+ // WARNING: this function is dangerous because it breaks the usual return value
2629
+ // convention.
2630
+ OPENSSL_EXPORT int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos,
2631
+ unsigned protos_len);
2632
+
2633
+ // SSL_CTX_set_alpn_select_cb sets a callback function on |ctx| that is called
2634
+ // during ClientHello processing in order to select an ALPN protocol from the
2635
+ // client's list of offered protocols. Configuring this callback enables ALPN on
2636
+ // a server.
2637
+ //
2638
+ // The callback is passed a wire-format (i.e. a series of non-empty, 8-bit
2639
+ // length-prefixed strings) ALPN protocol list in |in|. It should set |*out| and
2640
+ // |*out_len| to the selected protocol and return |SSL_TLSEXT_ERR_OK| on
2641
+ // success. It does not pass ownership of the buffer. Otherwise, it should
2642
+ // return |SSL_TLSEXT_ERR_NOACK|. Other |SSL_TLSEXT_ERR_*| values are
2643
+ // unimplemented and will be treated as |SSL_TLSEXT_ERR_NOACK|.
2644
+ //
2645
+ // The cipher suite is selected before negotiating ALPN. The callback may use
2646
+ // |SSL_get_pending_cipher| to query the cipher suite.
2647
+ OPENSSL_EXPORT void SSL_CTX_set_alpn_select_cb(
2648
+ SSL_CTX *ctx, int (*cb)(SSL *ssl, const uint8_t **out, uint8_t *out_len,
2649
+ const uint8_t *in, unsigned in_len, void *arg),
2650
+ void *arg);
2651
+
2652
+ // SSL_get0_alpn_selected gets the selected ALPN protocol (if any) from |ssl|.
2653
+ // On return it sets |*out_data| to point to |*out_len| bytes of protocol name
2654
+ // (not including the leading length-prefix byte). If the server didn't respond
2655
+ // with a negotiated protocol then |*out_len| will be zero.
2656
+ OPENSSL_EXPORT void SSL_get0_alpn_selected(const SSL *ssl,
2657
+ const uint8_t **out_data,
2658
+ unsigned *out_len);
2659
+
2660
+ // SSL_CTX_set_allow_unknown_alpn_protos configures client connections on |ctx|
2661
+ // to allow unknown ALPN protocols from the server. Otherwise, by default, the
2662
+ // client will require that the protocol be advertised in
2663
+ // |SSL_CTX_set_alpn_protos|.
2664
+ OPENSSL_EXPORT void SSL_CTX_set_allow_unknown_alpn_protos(SSL_CTX *ctx,
2665
+ int enabled);
2666
+
2667
+
2668
+ // Next protocol negotiation.
2669
+ //
2670
+ // The NPN extension (draft-agl-tls-nextprotoneg-03) is the predecessor to ALPN
2671
+ // and deprecated in favor of it.
2672
+
2673
+ // SSL_CTX_set_next_protos_advertised_cb sets a callback that is called when a
2674
+ // TLS server needs a list of supported protocols for Next Protocol
2675
+ // Negotiation. The returned list must be in wire format. The list is returned
2676
+ // by setting |*out| to point to it and |*out_len| to its length. This memory
2677
+ // will not be modified, but one should assume that |ssl| keeps a reference to
2678
+ // it.
2679
+ //
2680
+ // The callback should return |SSL_TLSEXT_ERR_OK| if it wishes to advertise.
2681
+ // Otherwise, no such extension will be included in the ServerHello.
2682
+ OPENSSL_EXPORT void SSL_CTX_set_next_protos_advertised_cb(
2683
+ SSL_CTX *ctx,
2684
+ int (*cb)(SSL *ssl, const uint8_t **out, unsigned *out_len, void *arg),
2685
+ void *arg);
2686
+
2687
+ // SSL_CTX_set_next_proto_select_cb sets a callback that is called when a client
2688
+ // needs to select a protocol from the server's provided list. |*out| must be
2689
+ // set to point to the selected protocol (which may be within |in|). The length
2690
+ // of the protocol name must be written into |*out_len|. The server's advertised
2691
+ // protocols are provided in |in| and |in_len|. The callback can assume that
2692
+ // |in| is syntactically valid.
2693
+ //
2694
+ // The client must select a protocol. It is fatal to the connection if this
2695
+ // callback returns a value other than |SSL_TLSEXT_ERR_OK|.
2696
+ //
2697
+ // Configuring this callback enables NPN on a client.
2698
+ OPENSSL_EXPORT void SSL_CTX_set_next_proto_select_cb(
2699
+ SSL_CTX *ctx, int (*cb)(SSL *ssl, uint8_t **out, uint8_t *out_len,
2700
+ const uint8_t *in, unsigned in_len, void *arg),
2701
+ void *arg);
2702
+
2703
+ // SSL_get0_next_proto_negotiated sets |*out_data| and |*out_len| to point to
2704
+ // the client's requested protocol for this connection. If the client didn't
2705
+ // request any protocol, then |*out_data| is set to NULL.
2706
+ //
2707
+ // Note that the client can request any protocol it chooses. The value returned
2708
+ // from this function need not be a member of the list of supported protocols
2709
+ // provided by the server.
2710
+ OPENSSL_EXPORT void SSL_get0_next_proto_negotiated(const SSL *ssl,
2711
+ const uint8_t **out_data,
2712
+ unsigned *out_len);
2713
+
2714
+ // SSL_select_next_proto implements the standard protocol selection. It is
2715
+ // expected that this function is called from the callback set by
2716
+ // |SSL_CTX_set_next_proto_select_cb|.
2717
+ //
2718
+ // |peer| and |supported| must be vectors of 8-bit, length-prefixed byte strings
2719
+ // containing the peer and locally-configured protocols, respectively. The
2720
+ // length byte itself is not included in the length. A byte string of length 0
2721
+ // is invalid. No byte string may be truncated. |supported| is assumed to be
2722
+ // non-empty.
2723
+ //
2724
+ // This function finds the first protocol in |peer| which is also in
2725
+ // |supported|. If one was found, it sets |*out| and |*out_len| to point to it
2726
+ // and returns |OPENSSL_NPN_NEGOTIATED|. Otherwise, it returns
2727
+ // |OPENSSL_NPN_NO_OVERLAP| and sets |*out| and |*out_len| to the first
2728
+ // supported protocol.
2729
+ OPENSSL_EXPORT int SSL_select_next_proto(uint8_t **out, uint8_t *out_len,
2730
+ const uint8_t *peer, unsigned peer_len,
2731
+ const uint8_t *supported,
2732
+ unsigned supported_len);
2733
+
2734
+ #define OPENSSL_NPN_UNSUPPORTED 0
2735
+ #define OPENSSL_NPN_NEGOTIATED 1
2736
+ #define OPENSSL_NPN_NO_OVERLAP 2
2737
+
2738
+
2739
+ // Channel ID.
2740
+ //
2741
+ // See draft-balfanz-tls-channelid-01.
2742
+
2743
+ // SSL_CTX_set_tls_channel_id_enabled configures whether connections associated
2744
+ // with |ctx| should enable Channel ID.
2745
+ OPENSSL_EXPORT void SSL_CTX_set_tls_channel_id_enabled(SSL_CTX *ctx,
2746
+ int enabled);
2747
+
2748
+ // SSL_set_tls_channel_id_enabled configures whether |ssl| should enable Channel
2749
+ // ID.
2750
+ OPENSSL_EXPORT void SSL_set_tls_channel_id_enabled(SSL *ssl, int enabled);
2751
+
2752
+ // SSL_CTX_set1_tls_channel_id configures a TLS client to send a TLS Channel ID
2753
+ // to compatible servers. |private_key| must be a P-256 EC key. It returns one
2754
+ // on success and zero on error.
2755
+ OPENSSL_EXPORT int SSL_CTX_set1_tls_channel_id(SSL_CTX *ctx,
2756
+ EVP_PKEY *private_key);
2757
+
2758
+ // SSL_set1_tls_channel_id configures a TLS client to send a TLS Channel ID to
2759
+ // compatible servers. |private_key| must be a P-256 EC key. It returns one on
2760
+ // success and zero on error.
2761
+ OPENSSL_EXPORT int SSL_set1_tls_channel_id(SSL *ssl, EVP_PKEY *private_key);
2762
+
2763
+ // SSL_get_tls_channel_id gets the client's TLS Channel ID from a server |SSL*|
2764
+ // and copies up to the first |max_out| bytes into |out|. The Channel ID
2765
+ // consists of the client's P-256 public key as an (x,y) pair where each is a
2766
+ // 32-byte, big-endian field element. It returns 0 if the client didn't offer a
2767
+ // Channel ID and the length of the complete Channel ID otherwise.
2768
+ OPENSSL_EXPORT size_t SSL_get_tls_channel_id(SSL *ssl, uint8_t *out,
2769
+ size_t max_out);
2770
+
2771
+ // SSL_CTX_set_channel_id_cb sets a callback to be called when a TLS Channel ID
2772
+ // is requested. The callback may set |*out_pkey| to a key, passing a reference
2773
+ // to the caller. If none is returned, the handshake will pause and
2774
+ // |SSL_get_error| will return |SSL_ERROR_WANT_CHANNEL_ID_LOOKUP|.
2775
+ //
2776
+ // See also |SSL_ERROR_WANT_CHANNEL_ID_LOOKUP|.
2777
+ OPENSSL_EXPORT void SSL_CTX_set_channel_id_cb(
2778
+ SSL_CTX *ctx, void (*channel_id_cb)(SSL *ssl, EVP_PKEY **out_pkey));
2779
+
2780
+ // SSL_CTX_get_channel_id_cb returns the callback set by
2781
+ // |SSL_CTX_set_channel_id_cb|.
2782
+ OPENSSL_EXPORT void (*SSL_CTX_get_channel_id_cb(SSL_CTX *ctx))(
2783
+ SSL *ssl, EVP_PKEY **out_pkey);
2784
+
2785
+
2786
+ // DTLS-SRTP.
2787
+ //
2788
+ // See RFC 5764.
2789
+
2790
+ // srtp_protection_profile_st (aka |SRTP_PROTECTION_PROFILE|) is an SRTP
2791
+ // profile for use with the use_srtp extension.
2792
+ struct srtp_protection_profile_st {
2793
+ const char *name;
2794
+ unsigned long id;
2795
+ } /* SRTP_PROTECTION_PROFILE */;
2796
+
2797
+ DEFINE_CONST_STACK_OF(SRTP_PROTECTION_PROFILE)
2798
+
2799
+ // SRTP_* define constants for SRTP profiles.
2800
+ #define SRTP_AES128_CM_SHA1_80 0x0001
2801
+ #define SRTP_AES128_CM_SHA1_32 0x0002
2802
+ #define SRTP_AES128_F8_SHA1_80 0x0003
2803
+ #define SRTP_AES128_F8_SHA1_32 0x0004
2804
+ #define SRTP_NULL_SHA1_80 0x0005
2805
+ #define SRTP_NULL_SHA1_32 0x0006
2806
+ #define SRTP_AEAD_AES_128_GCM 0x0007
2807
+ #define SRTP_AEAD_AES_256_GCM 0x0008
2808
+
2809
+ // SSL_CTX_set_srtp_profiles enables SRTP for all SSL objects created from
2810
+ // |ctx|. |profile| contains a colon-separated list of profile names. It returns
2811
+ // one on success and zero on failure.
2812
+ OPENSSL_EXPORT int SSL_CTX_set_srtp_profiles(SSL_CTX *ctx,
2813
+ const char *profiles);
2814
+
2815
+ // SSL_set_srtp_profiles enables SRTP for |ssl|. |profile| contains a
2816
+ // colon-separated list of profile names. It returns one on success and zero on
2817
+ // failure.
2818
+ OPENSSL_EXPORT int SSL_set_srtp_profiles(SSL *ssl, const char *profiles);
2819
+
2820
+ // SSL_get_srtp_profiles returns the SRTP profiles supported by |ssl|.
2821
+ OPENSSL_EXPORT STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(
2822
+ SSL *ssl);
2823
+
2824
+ // SSL_get_selected_srtp_profile returns the selected SRTP profile, or NULL if
2825
+ // SRTP was not negotiated.
2826
+ OPENSSL_EXPORT const SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(
2827
+ SSL *ssl);
2828
+
2829
+
2830
+ // Pre-shared keys.
2831
+ //
2832
+ // Connections may be configured with PSK (Pre-Shared Key) cipher suites. These
2833
+ // authenticate using out-of-band pre-shared keys rather than certificates. See
2834
+ // RFC 4279.
2835
+ //
2836
+ // This implementation uses NUL-terminated C strings for identities and identity
2837
+ // hints, so values with a NUL character are not supported. (RFC 4279 does not
2838
+ // specify the format of an identity.)
2839
+
2840
+ // PSK_MAX_IDENTITY_LEN is the maximum supported length of a PSK identity,
2841
+ // excluding the NUL terminator.
2842
+ #define PSK_MAX_IDENTITY_LEN 128
2843
+
2844
+ // PSK_MAX_PSK_LEN is the maximum supported length of a pre-shared key.
2845
+ #define PSK_MAX_PSK_LEN 256
2846
+
2847
+ // SSL_CTX_set_psk_client_callback sets the callback to be called when PSK is
2848
+ // negotiated on the client. This callback must be set to enable PSK cipher
2849
+ // suites on the client.
2850
+ //
2851
+ // The callback is passed the identity hint in |hint| or NULL if none was
2852
+ // provided. It should select a PSK identity and write the identity and the
2853
+ // corresponding PSK to |identity| and |psk|, respectively. The identity is
2854
+ // written as a NUL-terminated C string of length (excluding the NUL terminator)
2855
+ // at most |max_identity_len|. The PSK's length must be at most |max_psk_len|.
2856
+ // The callback returns the length of the PSK or 0 if no suitable identity was
2857
+ // found.
2858
+ OPENSSL_EXPORT void SSL_CTX_set_psk_client_callback(
2859
+ SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
2860
+ unsigned max_identity_len, uint8_t *psk,
2861
+ unsigned max_psk_len));
2862
+
2863
+ // SSL_set_psk_client_callback sets the callback to be called when PSK is
2864
+ // negotiated on the client. This callback must be set to enable PSK cipher
2865
+ // suites on the client. See also |SSL_CTX_set_psk_client_callback|.
2866
+ OPENSSL_EXPORT void SSL_set_psk_client_callback(
2867
+ SSL *ssl, unsigned (*cb)(SSL *ssl, const char *hint, char *identity,
2868
+ unsigned max_identity_len, uint8_t *psk,
2869
+ unsigned max_psk_len));
2870
+
2871
+ // SSL_CTX_set_psk_server_callback sets the callback to be called when PSK is
2872
+ // negotiated on the server. This callback must be set to enable PSK cipher
2873
+ // suites on the server.
2874
+ //
2875
+ // The callback is passed the identity in |identity|. It should write a PSK of
2876
+ // length at most |max_psk_len| to |psk| and return the number of bytes written
2877
+ // or zero if the PSK identity is unknown.
2878
+ OPENSSL_EXPORT void SSL_CTX_set_psk_server_callback(
2879
+ SSL_CTX *ctx, unsigned (*cb)(SSL *ssl, const char *identity, uint8_t *psk,
2880
+ unsigned max_psk_len));
2881
+
2882
+ // SSL_set_psk_server_callback sets the callback to be called when PSK is
2883
+ // negotiated on the server. This callback must be set to enable PSK cipher
2884
+ // suites on the server. See also |SSL_CTX_set_psk_server_callback|.
2885
+ OPENSSL_EXPORT void SSL_set_psk_server_callback(
2886
+ SSL *ssl, unsigned (*cb)(SSL *ssl, const char *identity, uint8_t *psk,
2887
+ unsigned max_psk_len));
2888
+
2889
+ // SSL_CTX_use_psk_identity_hint configures server connections to advertise an
2890
+ // identity hint of |identity_hint|. It returns one on success and zero on
2891
+ // error.
2892
+ OPENSSL_EXPORT int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx,
2893
+ const char *identity_hint);
2894
+
2895
+ // SSL_use_psk_identity_hint configures server connections to advertise an
2896
+ // identity hint of |identity_hint|. It returns one on success and zero on
2897
+ // error.
2898
+ OPENSSL_EXPORT int SSL_use_psk_identity_hint(SSL *ssl,
2899
+ const char *identity_hint);
2900
+
2901
+ // SSL_get_psk_identity_hint returns the PSK identity hint advertised for |ssl|
2902
+ // or NULL if there is none.
2903
+ OPENSSL_EXPORT const char *SSL_get_psk_identity_hint(const SSL *ssl);
2904
+
2905
+ // SSL_get_psk_identity, after the handshake completes, returns the PSK identity
2906
+ // that was negotiated by |ssl| or NULL if PSK was not used.
2907
+ OPENSSL_EXPORT const char *SSL_get_psk_identity(const SSL *ssl);
2908
+
2909
+
2910
+ // Early data.
2911
+ //
2912
+ // WARNING: 0-RTT support in BoringSSL is currently experimental and not fully
2913
+ // implemented. It may cause interoperability or security failures when used.
2914
+ //
2915
+ // Early data, or 0-RTT, is a feature in TLS 1.3 which allows clients to send
2916
+ // data on the first flight during a resumption handshake. This can save a
2917
+ // round-trip in some application protocols.
2918
+ //
2919
+ // WARNING: A 0-RTT handshake has different security properties from normal
2920
+ // handshake, so it is off by default unless opted in. In particular, early data
2921
+ // is replayable by a network attacker. Callers must account for this when
2922
+ // sending or processing data before the handshake is confirmed. See
2923
+ // draft-ietf-tls-tls13-18 for more information.
2924
+ //
2925
+ // As a server, if early data is accepted, |SSL_do_handshake| will complete as
2926
+ // soon as the ClientHello is processed and server flight sent. |SSL_write| may
2927
+ // be used to send half-RTT data. |SSL_read| will consume early data and
2928
+ // transition to 1-RTT data as appropriate. Prior to the transition,
2929
+ // |SSL_in_init| will report the handshake is still in progress. Callers may use
2930
+ // it or |SSL_in_early_data| to defer or reject requests as needed.
2931
+ //
2932
+ // Early data as a client is more complex. If the offered session (see
2933
+ // |SSL_set_session|) is 0-RTT-capable, the handshake will return after sending
2934
+ // the ClientHello. The predicted peer certificates and ALPN protocol will be
2935
+ // available via the usual APIs. |SSL_write| will write early data, up to the
2936
+ // session's limit. Writes past this limit and |SSL_read| will complete the
2937
+ // handshake before continuing. Callers may also call |SSL_do_handshake| again
2938
+ // to complete the handshake sooner.
2939
+ //
2940
+ // If the server accepts early data, the handshake will succeed. |SSL_read| and
2941
+ // |SSL_write| will then act as in a 1-RTT handshake. The peer certificates and
2942
+ // ALPN protocol will be as predicted and need not be re-queried.
2943
+ //
2944
+ // If the server rejects early data, |SSL_do_handshake| (and thus |SSL_read| and
2945
+ // |SSL_write|) will then fail with |SSL_get_error| returning
2946
+ // |SSL_ERROR_EARLY_DATA_REJECTED|. The caller should treat this as a connection
2947
+ // error and most likely perform a high-level retry. Note the server may still
2948
+ // have processed the early data due to attacker replays.
2949
+ //
2950
+ // To then continue the handshake on the original connection, use
2951
+ // |SSL_reset_early_data_reject|. The connection will then behave as one which
2952
+ // had not yet completed the handshake. This allows a faster retry than making a
2953
+ // fresh connection. |SSL_do_handshake| will complete the full handshake,
2954
+ // possibly resulting in different peer certificates, ALPN protocol, and other
2955
+ // properties. The caller must disregard any values from before the reset and
2956
+ // query again.
2957
+ //
2958
+ // Finally, to implement the fallback described in draft-ietf-tls-tls13-18
2959
+ // appendix C.3, retry on a fresh connection without 0-RTT if the handshake
2960
+ // fails with |SSL_R_WRONG_VERSION_ON_EARLY_DATA|.
2961
+
2962
+ // SSL_CTX_set_early_data_enabled sets whether early data is allowed to be used
2963
+ // with resumptions using |ctx|.
2964
+ OPENSSL_EXPORT void SSL_CTX_set_early_data_enabled(SSL_CTX *ctx, int enabled);
2965
+
2966
+ // SSL_set_early_data_enabled sets whether early data is allowed to be used
2967
+ // with resumptions using |ssl|. See |SSL_CTX_set_early_data_enabled| for more
2968
+ // information.
2969
+ OPENSSL_EXPORT void SSL_set_early_data_enabled(SSL *ssl, int enabled);
2970
+
2971
+ // SSL_in_early_data returns one if |ssl| has a pending handshake that has
2972
+ // progressed enough to send or receive early data. Clients may call |SSL_write|
2973
+ // to send early data, but |SSL_read| will complete the handshake before
2974
+ // accepting application data. Servers may call |SSL_read| to read early data
2975
+ // and |SSL_write| to send half-RTT data.
2976
+ OPENSSL_EXPORT int SSL_in_early_data(const SSL *ssl);
2977
+
2978
+ // SSL_early_data_accepted returns whether early data was accepted on the
2979
+ // handshake performed by |ssl|.
2980
+ OPENSSL_EXPORT int SSL_early_data_accepted(const SSL *ssl);
2981
+
2982
+ // SSL_reset_early_data_reject resets |ssl| after an early data reject. All
2983
+ // 0-RTT state is discarded, including any pending |SSL_write| calls. The caller
2984
+ // should treat |ssl| as a logically fresh connection, usually by driving the
2985
+ // handshake to completion using |SSL_do_handshake|.
2986
+ //
2987
+ // It is an error to call this function on an |SSL| object that is not signaling
2988
+ // |SSL_ERROR_EARLY_DATA_REJECTED|.
2989
+ OPENSSL_EXPORT void SSL_reset_early_data_reject(SSL *ssl);
2990
+
2991
+
2992
+ // Alerts.
2993
+ //
2994
+ // TLS and SSL 3.0 use alerts to signal error conditions. Alerts have a type
2995
+ // (warning or fatal) and description. OpenSSL internally handles fatal alerts
2996
+ // with dedicated error codes (see |SSL_AD_REASON_OFFSET|). Except for
2997
+ // close_notify, warning alerts are silently ignored and may only be surfaced
2998
+ // with |SSL_CTX_set_info_callback|.
2999
+
3000
+ // SSL_AD_REASON_OFFSET is the offset between error reasons and |SSL_AD_*|
3001
+ // values. Any error code under |ERR_LIB_SSL| with an error reason above this
3002
+ // value corresponds to an alert description. Consumers may add or subtract
3003
+ // |SSL_AD_REASON_OFFSET| to convert between them.
3004
+ //
3005
+ // make_errors.go reserves error codes above 1000 for manually-assigned errors.
3006
+ // This value must be kept in sync with reservedReasonCode in make_errors.h
3007
+ #define SSL_AD_REASON_OFFSET 1000
3008
+
3009
+ // SSL_AD_* are alert descriptions for SSL 3.0 and TLS.
3010
+ #define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY
3011
+ #define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE
3012
+ #define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC
3013
+ #define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED
3014
+ #define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW
3015
+ #define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE
3016
+ #define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE
3017
+ #define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE // Not used in TLS
3018
+ #define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE
3019
+ #define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE
3020
+ #define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED
3021
+ #define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED
3022
+ #define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN
3023
+ #define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER
3024
+ #define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA
3025
+ #define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED
3026
+ #define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR
3027
+ #define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR
3028
+ #define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION
3029
+ #define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION
3030
+ #define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY
3031
+ #define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR
3032
+ #define SSL_AD_INAPPROPRIATE_FALLBACK SSL3_AD_INAPPROPRIATE_FALLBACK
3033
+ #define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED
3034
+ #define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION
3035
+ #define SSL_AD_MISSING_EXTENSION TLS1_AD_MISSING_EXTENSION
3036
+ #define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION
3037
+ #define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE
3038
+ #define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME
3039
+ #define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE \
3040
+ TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE
3041
+ #define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE
3042
+ #define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY
3043
+ #define SSL_AD_CERTIFICATE_REQUIRED TLS1_AD_CERTIFICATE_REQUIRED
3044
+
3045
+ // SSL_alert_type_string_long returns a string description of |value| as an
3046
+ // alert type (warning or fatal).
3047
+ OPENSSL_EXPORT const char *SSL_alert_type_string_long(int value);
3048
+
3049
+ // SSL_alert_desc_string_long returns a string description of |value| as an
3050
+ // alert description or "unknown" if unknown.
3051
+ OPENSSL_EXPORT const char *SSL_alert_desc_string_long(int value);
3052
+
3053
+ // SSL_send_fatal_alert sends a fatal alert over |ssl| of the specified type,
3054
+ // which should be one of the |SSL_AD_*| constants. It returns one on success
3055
+ // and <= 0 on error. The caller should pass the return value into
3056
+ // |SSL_get_error| to determine how to proceed. Once this function has been
3057
+ // called, future calls to |SSL_write| will fail.
3058
+ //
3059
+ // If retrying a failed operation due to |SSL_ERROR_WANT_WRITE|, subsequent
3060
+ // calls must use the same |alert| parameter.
3061
+ OPENSSL_EXPORT int SSL_send_fatal_alert(SSL *ssl, uint8_t alert);
3062
+
3063
+
3064
+ // ex_data functions.
3065
+ //
3066
+ // See |ex_data.h| for details.
3067
+
3068
+ OPENSSL_EXPORT int SSL_set_ex_data(SSL *ssl, int idx, void *data);
3069
+ OPENSSL_EXPORT void *SSL_get_ex_data(const SSL *ssl, int idx);
3070
+ OPENSSL_EXPORT int SSL_get_ex_new_index(long argl, void *argp,
3071
+ CRYPTO_EX_unused *unused,
3072
+ CRYPTO_EX_dup *dup_unused,
3073
+ CRYPTO_EX_free *free_func);
3074
+
3075
+ OPENSSL_EXPORT int SSL_SESSION_set_ex_data(SSL_SESSION *session, int idx,
3076
+ void *data);
3077
+ OPENSSL_EXPORT void *SSL_SESSION_get_ex_data(const SSL_SESSION *session,
3078
+ int idx);
3079
+ OPENSSL_EXPORT int SSL_SESSION_get_ex_new_index(long argl, void *argp,
3080
+ CRYPTO_EX_unused *unused,
3081
+ CRYPTO_EX_dup *dup_unused,
3082
+ CRYPTO_EX_free *free_func);
3083
+
3084
+ OPENSSL_EXPORT int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *data);
3085
+ OPENSSL_EXPORT void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx);
3086
+ OPENSSL_EXPORT int SSL_CTX_get_ex_new_index(long argl, void *argp,
3087
+ CRYPTO_EX_unused *unused,
3088
+ CRYPTO_EX_dup *dup_unused,
3089
+ CRYPTO_EX_free *free_func);
3090
+
3091
+
3092
+ // Low-level record-layer state.
3093
+
3094
+ // SSL_get_ivs sets |*out_iv_len| to the length of the IVs for the ciphers
3095
+ // underlying |ssl| and sets |*out_read_iv| and |*out_write_iv| to point to the
3096
+ // current IVs for the read and write directions. This is only meaningful for
3097
+ // connections with implicit IVs (i.e. CBC mode with SSLv3 or TLS 1.0).
3098
+ //
3099
+ // It returns one on success or zero on error.
3100
+ OPENSSL_EXPORT int SSL_get_ivs(const SSL *ssl, const uint8_t **out_read_iv,
3101
+ const uint8_t **out_write_iv,
3102
+ size_t *out_iv_len);
3103
+
3104
+ // SSL_get_key_block_len returns the length of |ssl|'s key block.
3105
+ OPENSSL_EXPORT size_t SSL_get_key_block_len(const SSL *ssl);
3106
+
3107
+ // SSL_generate_key_block generates |out_len| bytes of key material for |ssl|'s
3108
+ // current connection state.
3109
+ OPENSSL_EXPORT int SSL_generate_key_block(const SSL *ssl, uint8_t *out,
3110
+ size_t out_len);
3111
+
3112
+ // SSL_get_read_sequence returns, in TLS, the expected sequence number of the
3113
+ // next incoming record in the current epoch. In DTLS, it returns the maximum
3114
+ // sequence number received in the current epoch and includes the epoch number
3115
+ // in the two most significant bytes.
3116
+ OPENSSL_EXPORT uint64_t SSL_get_read_sequence(const SSL *ssl);
3117
+
3118
+ // SSL_get_write_sequence returns the sequence number of the next outgoing
3119
+ // record in the current epoch. In DTLS, it includes the epoch number in the
3120
+ // two most significant bytes.
3121
+ OPENSSL_EXPORT uint64_t SSL_get_write_sequence(const SSL *ssl);
3122
+
3123
+
3124
+ // Obscure functions.
3125
+
3126
+ // SSL_get_structure_sizes returns the sizes of the SSL, SSL_CTX and
3127
+ // SSL_SESSION structures so that a test can ensure that outside code agrees on
3128
+ // these values.
3129
+ OPENSSL_EXPORT void SSL_get_structure_sizes(size_t *ssl_size,
3130
+ size_t *ssl_ctx_size,
3131
+ size_t *ssl_session_size);
3132
+
3133
+ // SSL_CTX_set_msg_callback installs |cb| as the message callback for |ctx|.
3134
+ // This callback will be called when sending or receiving low-level record
3135
+ // headers, complete handshake messages, ChangeCipherSpec, and alerts.
3136
+ // |write_p| is one for outgoing messages and zero for incoming messages.
3137
+ //
3138
+ // For each record header, |cb| is called with |version| = 0 and |content_type|
3139
+ // = |SSL3_RT_HEADER|. The |len| bytes from |buf| contain the header. Note that
3140
+ // this does not include the record body. If the record is sealed, the length
3141
+ // in the header is the length of the ciphertext.
3142
+ //
3143
+ // For each handshake message, ChangeCipherSpec, and alert, |version| is the
3144
+ // protocol version and |content_type| is the corresponding record type. The
3145
+ // |len| bytes from |buf| contain the handshake message, one-byte
3146
+ // ChangeCipherSpec body, and two-byte alert, respectively.
3147
+ //
3148
+ // For a V2ClientHello, |version| is |SSL2_VERSION|, |content_type| is zero, and
3149
+ // the |len| bytes from |buf| contain the V2ClientHello structure.
3150
+ OPENSSL_EXPORT void SSL_CTX_set_msg_callback(
3151
+ SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type,
3152
+ const void *buf, size_t len, SSL *ssl, void *arg));
3153
+
3154
+ // SSL_CTX_set_msg_callback_arg sets the |arg| parameter of the message
3155
+ // callback.
3156
+ OPENSSL_EXPORT void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg);
3157
+
3158
+ // SSL_set_msg_callback installs |cb| as the message callback of |ssl|. See
3159
+ // |SSL_CTX_set_msg_callback| for when this callback is called.
3160
+ OPENSSL_EXPORT void SSL_set_msg_callback(
3161
+ SSL *ssl, void (*cb)(int write_p, int version, int content_type,
3162
+ const void *buf, size_t len, SSL *ssl, void *arg));
3163
+
3164
+ // SSL_set_msg_callback_arg sets the |arg| parameter of the message callback.
3165
+ OPENSSL_EXPORT void SSL_set_msg_callback_arg(SSL *ssl, void *arg);
3166
+
3167
+ // SSL_CTX_set_keylog_callback configures a callback to log key material. This
3168
+ // is intended for debugging use with tools like Wireshark. The |cb| function
3169
+ // should log |line| followed by a newline, synchronizing with any concurrent
3170
+ // access to the log.
3171
+ //
3172
+ // The format is described in
3173
+ // https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format.
3174
+ OPENSSL_EXPORT void SSL_CTX_set_keylog_callback(
3175
+ SSL_CTX *ctx, void (*cb)(const SSL *ssl, const char *line));
3176
+
3177
+ // SSL_CTX_get_keylog_callback returns the callback configured by
3178
+ // |SSL_CTX_set_keylog_callback|.
3179
+ OPENSSL_EXPORT void (*SSL_CTX_get_keylog_callback(const SSL_CTX *ctx))(
3180
+ const SSL *ssl, const char *line);
3181
+
3182
+ // SSL_CTX_set_current_time_cb configures a callback to retrieve the current
3183
+ // time, which should be set in |*out_clock|. This can be used for testing
3184
+ // purposes; for example, a callback can be configured that returns a time
3185
+ // set explicitly by the test. The |ssl| pointer passed to |cb| is always null.
3186
+ OPENSSL_EXPORT void SSL_CTX_set_current_time_cb(
3187
+ SSL_CTX *ctx, void (*cb)(const SSL *ssl, struct timeval *out_clock));
3188
+
3189
+ enum ssl_renegotiate_mode_t {
3190
+ ssl_renegotiate_never = 0,
3191
+ ssl_renegotiate_once,
3192
+ ssl_renegotiate_freely,
3193
+ ssl_renegotiate_ignore,
3194
+ };
3195
+
3196
+ // SSL_set_renegotiate_mode configures how |ssl|, a client, reacts to
3197
+ // renegotiation attempts by a server. If |ssl| is a server, peer-initiated
3198
+ // renegotiations are *always* rejected and this function does nothing.
3199
+ //
3200
+ // The renegotiation mode defaults to |ssl_renegotiate_never|, but may be set
3201
+ // at any point in a connection's lifetime. Set it to |ssl_renegotiate_once| to
3202
+ // allow one renegotiation, |ssl_renegotiate_freely| to allow all
3203
+ // renegotiations or |ssl_renegotiate_ignore| to ignore HelloRequest messages.
3204
+ // Note that ignoring HelloRequest messages may cause the connection to stall
3205
+ // if the server waits for the renegotiation to complete.
3206
+ //
3207
+ // There is no support in BoringSSL for initiating renegotiations as a client
3208
+ // or server.
3209
+ OPENSSL_EXPORT void SSL_set_renegotiate_mode(SSL *ssl,
3210
+ enum ssl_renegotiate_mode_t mode);
3211
+
3212
+ // SSL_renegotiate_pending returns one if |ssl| is in the middle of a
3213
+ // renegotiation.
3214
+ OPENSSL_EXPORT int SSL_renegotiate_pending(SSL *ssl);
3215
+
3216
+ // SSL_total_renegotiations returns the total number of renegotiation handshakes
3217
+ // performed by |ssl|. This includes the pending renegotiation, if any.
3218
+ OPENSSL_EXPORT int SSL_total_renegotiations(const SSL *ssl);
3219
+
3220
+ enum tls13_variant_t {
3221
+ tls13_default = 0,
3222
+ tls13_experiment = 1,
3223
+ tls13_experiment2 = 2,
3224
+ tls13_experiment3 = 3,
3225
+ tls13_draft21 = 4,
3226
+ tls13_draft22 = 5,
3227
+ };
3228
+
3229
+ // SSL_CTX_set_tls13_variant sets which variant of TLS 1.3 we negotiate. On the
3230
+ // server, if |variant| is not |tls13_default|, all variants are enabled. On the
3231
+ // client, only the configured variant is enabled.
3232
+ OPENSSL_EXPORT void SSL_CTX_set_tls13_variant(SSL_CTX *ctx,
3233
+ enum tls13_variant_t variant);
3234
+
3235
+ // SSL_set_tls13_variant sets which variant of TLS 1.3 we negotiate. On the
3236
+ // server, if |variant| is not |tls13_default|, all variants are enabled. On the
3237
+ // client, only the configured variant is enabled.
3238
+ OPENSSL_EXPORT void SSL_set_tls13_variant(SSL *ssl,
3239
+ enum tls13_variant_t variant);
3240
+
3241
+ // SSL_MAX_CERT_LIST_DEFAULT is the default maximum length, in bytes, of a peer
3242
+ // certificate chain.
3243
+ #define SSL_MAX_CERT_LIST_DEFAULT (1024 * 100)
3244
+
3245
+ // SSL_CTX_get_max_cert_list returns the maximum length, in bytes, of a peer
3246
+ // certificate chain accepted by |ctx|.
3247
+ OPENSSL_EXPORT size_t SSL_CTX_get_max_cert_list(const SSL_CTX *ctx);
3248
+
3249
+ // SSL_CTX_set_max_cert_list sets the maximum length, in bytes, of a peer
3250
+ // certificate chain to |max_cert_list|. This affects how much memory may be
3251
+ // consumed during the handshake.
3252
+ OPENSSL_EXPORT void SSL_CTX_set_max_cert_list(SSL_CTX *ctx,
3253
+ size_t max_cert_list);
3254
+
3255
+ // SSL_get_max_cert_list returns the maximum length, in bytes, of a peer
3256
+ // certificate chain accepted by |ssl|.
3257
+ OPENSSL_EXPORT size_t SSL_get_max_cert_list(const SSL *ssl);
3258
+
3259
+ // SSL_set_max_cert_list sets the maximum length, in bytes, of a peer
3260
+ // certificate chain to |max_cert_list|. This affects how much memory may be
3261
+ // consumed during the handshake.
3262
+ OPENSSL_EXPORT void SSL_set_max_cert_list(SSL *ssl, size_t max_cert_list);
3263
+
3264
+ // SSL_CTX_set_max_send_fragment sets the maximum length, in bytes, of records
3265
+ // sent by |ctx|. Beyond this length, handshake messages and application data
3266
+ // will be split into multiple records. It returns one on success or zero on
3267
+ // error.
3268
+ OPENSSL_EXPORT int SSL_CTX_set_max_send_fragment(SSL_CTX *ctx,
3269
+ size_t max_send_fragment);
3270
+
3271
+ // SSL_set_max_send_fragment sets the maximum length, in bytes, of records sent
3272
+ // by |ssl|. Beyond this length, handshake messages and application data will
3273
+ // be split into multiple records. It returns one on success or zero on
3274
+ // error.
3275
+ OPENSSL_EXPORT int SSL_set_max_send_fragment(SSL *ssl,
3276
+ size_t max_send_fragment);
3277
+
3278
+ // ssl_early_callback_ctx (aka |SSL_CLIENT_HELLO|) is passed to certain
3279
+ // callbacks that are called very early on during the server handshake. At this
3280
+ // point, much of the SSL* hasn't been filled out and only the ClientHello can
3281
+ // be depended on.
3282
+ typedef struct ssl_early_callback_ctx {
3283
+ SSL *ssl;
3284
+ const uint8_t *client_hello;
3285
+ size_t client_hello_len;
3286
+ uint16_t version;
3287
+ const uint8_t *random;
3288
+ size_t random_len;
3289
+ const uint8_t *session_id;
3290
+ size_t session_id_len;
3291
+ const uint8_t *cipher_suites;
3292
+ size_t cipher_suites_len;
3293
+ const uint8_t *compression_methods;
3294
+ size_t compression_methods_len;
3295
+ const uint8_t *extensions;
3296
+ size_t extensions_len;
3297
+ } SSL_CLIENT_HELLO;
3298
+
3299
+ // ssl_select_cert_result_t enumerates the possible results from selecting a
3300
+ // certificate with |select_certificate_cb|.
3301
+ enum ssl_select_cert_result_t {
3302
+ // ssl_select_cert_success indicates that the certificate selection was
3303
+ // successful.
3304
+ ssl_select_cert_success = 1,
3305
+ // ssl_select_cert_retry indicates that the operation could not be
3306
+ // immediately completed and must be reattempted at a later point.
3307
+ ssl_select_cert_retry = 0,
3308
+ // ssl_select_cert_error indicates that a fatal error occured and the
3309
+ // handshake should be terminated.
3310
+ ssl_select_cert_error = -1,
3311
+ };
3312
+
3313
+ // SSL_early_callback_ctx_extension_get searches the extensions in
3314
+ // |client_hello| for an extension of the given type. If not found, it returns
3315
+ // zero. Otherwise it sets |out_data| to point to the extension contents (not
3316
+ // including the type and length bytes), sets |out_len| to the length of the
3317
+ // extension contents and returns one.
3318
+ OPENSSL_EXPORT int SSL_early_callback_ctx_extension_get(
3319
+ const SSL_CLIENT_HELLO *client_hello, uint16_t extension_type,
3320
+ const uint8_t **out_data, size_t *out_len);
3321
+
3322
+ // SSL_CTX_set_select_certificate_cb sets a callback that is called before most
3323
+ // ClientHello processing and before the decision whether to resume a session
3324
+ // is made. The callback may inspect the ClientHello and configure the
3325
+ // connection. See |ssl_select_cert_result_t| for details of the return values.
3326
+ //
3327
+ // In the case that a retry is indicated, |SSL_get_error| will return
3328
+ // |SSL_ERROR_PENDING_CERTIFICATE| and the caller should arrange for the
3329
+ // high-level operation on |ssl| to be retried at a later time, which will
3330
+ // result in another call to |cb|.
3331
+ //
3332
+ // Note: The |SSL_CLIENT_HELLO| is only valid for the duration of the callback
3333
+ // and is not valid while the handshake is paused.
3334
+ OPENSSL_EXPORT void SSL_CTX_set_select_certificate_cb(
3335
+ SSL_CTX *ctx,
3336
+ enum ssl_select_cert_result_t (*cb)(const SSL_CLIENT_HELLO *));
3337
+
3338
+ // SSL_CTX_set_dos_protection_cb sets a callback that is called once the
3339
+ // resumption decision for a ClientHello has been made. It can return one to
3340
+ // allow the handshake to continue or zero to cause the handshake to abort.
3341
+ OPENSSL_EXPORT void SSL_CTX_set_dos_protection_cb(
3342
+ SSL_CTX *ctx, int (*cb)(const SSL_CLIENT_HELLO *));
3343
+
3344
+ // SSL_ST_* are possible values for |SSL_state| and the bitmasks that make them
3345
+ // up.
3346
+ #define SSL_ST_CONNECT 0x1000
3347
+ #define SSL_ST_ACCEPT 0x2000
3348
+ #define SSL_ST_MASK 0x0FFF
3349
+ #define SSL_ST_INIT (SSL_ST_CONNECT | SSL_ST_ACCEPT)
3350
+ #define SSL_ST_OK 0x03
3351
+ #define SSL_ST_RENEGOTIATE (0x04 | SSL_ST_INIT)
3352
+
3353
+ // SSL_CB_* are possible values for the |type| parameter in the info
3354
+ // callback and the bitmasks that make them up.
3355
+ #define SSL_CB_LOOP 0x01
3356
+ #define SSL_CB_EXIT 0x02
3357
+ #define SSL_CB_READ 0x04
3358
+ #define SSL_CB_WRITE 0x08
3359
+ #define SSL_CB_ALERT 0x4000
3360
+ #define SSL_CB_READ_ALERT (SSL_CB_ALERT | SSL_CB_READ)
3361
+ #define SSL_CB_WRITE_ALERT (SSL_CB_ALERT | SSL_CB_WRITE)
3362
+ #define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT | SSL_CB_LOOP)
3363
+ #define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT | SSL_CB_EXIT)
3364
+ #define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT | SSL_CB_LOOP)
3365
+ #define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT | SSL_CB_EXIT)
3366
+ #define SSL_CB_HANDSHAKE_START 0x10
3367
+ #define SSL_CB_HANDSHAKE_DONE 0x20
3368
+
3369
+ // SSL_CTX_set_info_callback configures a callback to be run when various
3370
+ // events occur during a connection's lifetime. The |type| argument determines
3371
+ // the type of event and the meaning of the |value| argument. Callbacks must
3372
+ // ignore unexpected |type| values.
3373
+ //
3374
+ // |SSL_CB_READ_ALERT| is signaled for each alert received, warning or fatal.
3375
+ // The |value| argument is a 16-bit value where the alert level (either
3376
+ // |SSL3_AL_WARNING| or |SSL3_AL_FATAL|) is in the most-significant eight bits
3377
+ // and the alert type (one of |SSL_AD_*|) is in the least-significant eight.
3378
+ //
3379
+ // |SSL_CB_WRITE_ALERT| is signaled for each alert sent. The |value| argument
3380
+ // is constructed as with |SSL_CB_READ_ALERT|.
3381
+ //
3382
+ // |SSL_CB_HANDSHAKE_START| is signaled when a handshake begins. The |value|
3383
+ // argument is always one.
3384
+ //
3385
+ // |SSL_CB_HANDSHAKE_DONE| is signaled when a handshake completes successfully.
3386
+ // The |value| argument is always one. If a handshake False Starts, this event
3387
+ // may be used to determine when the Finished message is received.
3388
+ //
3389
+ // The following event types expose implementation details of the handshake
3390
+ // state machine. Consuming them is deprecated.
3391
+ //
3392
+ // |SSL_CB_ACCEPT_LOOP| (respectively, |SSL_CB_CONNECT_LOOP|) is signaled when
3393
+ // a server (respectively, client) handshake progresses. The |value| argument
3394
+ // is always one.
3395
+ //
3396
+ // |SSL_CB_ACCEPT_EXIT| (respectively, |SSL_CB_CONNECT_EXIT|) is signaled when
3397
+ // a server (respectively, client) handshake completes, fails, or is paused.
3398
+ // The |value| argument is one if the handshake succeeded and <= 0
3399
+ // otherwise.
3400
+ OPENSSL_EXPORT void SSL_CTX_set_info_callback(
3401
+ SSL_CTX *ctx, void (*cb)(const SSL *ssl, int type, int value));
3402
+
3403
+ // SSL_CTX_get_info_callback returns the callback set by
3404
+ // |SSL_CTX_set_info_callback|.
3405
+ OPENSSL_EXPORT void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl,
3406
+ int type,
3407
+ int value);
3408
+
3409
+ // SSL_set_info_callback configures a callback to be run at various events
3410
+ // during a connection's lifetime. See |SSL_CTX_set_info_callback|.
3411
+ OPENSSL_EXPORT void SSL_set_info_callback(
3412
+ SSL *ssl, void (*cb)(const SSL *ssl, int type, int value));
3413
+
3414
+ // SSL_get_info_callback returns the callback set by |SSL_set_info_callback|.
3415
+ OPENSSL_EXPORT void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,
3416
+ int type,
3417
+ int value);
3418
+
3419
+ // SSL_state_string_long returns the current state of the handshake state
3420
+ // machine as a string. This may be useful for debugging and logging.
3421
+ OPENSSL_EXPORT const char *SSL_state_string_long(const SSL *ssl);
3422
+
3423
+ #define SSL_SENT_SHUTDOWN 1
3424
+ #define SSL_RECEIVED_SHUTDOWN 2
3425
+
3426
+ // SSL_get_shutdown returns a bitmask with a subset of |SSL_SENT_SHUTDOWN| and
3427
+ // |SSL_RECEIVED_SHUTDOWN| to query whether close_notify was sent or received,
3428
+ // respectively.
3429
+ OPENSSL_EXPORT int SSL_get_shutdown(const SSL *ssl);
3430
+
3431
+ // SSL_get_peer_signature_algorithm returns the signature algorithm used by the
3432
+ // peer. If not applicable, it returns zero.
3433
+ OPENSSL_EXPORT uint16_t SSL_get_peer_signature_algorithm(const SSL *ssl);
3434
+
3435
+ // SSL_get_client_random writes up to |max_out| bytes of the most recent
3436
+ // handshake's client_random to |out| and returns the number of bytes written.
3437
+ // If |max_out| is zero, it returns the size of the client_random.
3438
+ OPENSSL_EXPORT size_t SSL_get_client_random(const SSL *ssl, uint8_t *out,
3439
+ size_t max_out);
3440
+
3441
+ // SSL_get_server_random writes up to |max_out| bytes of the most recent
3442
+ // handshake's server_random to |out| and returns the number of bytes written.
3443
+ // If |max_out| is zero, it returns the size of the server_random.
3444
+ OPENSSL_EXPORT size_t SSL_get_server_random(const SSL *ssl, uint8_t *out,
3445
+ size_t max_out);
3446
+
3447
+ // SSL_get_pending_cipher returns the cipher suite for the current handshake or
3448
+ // NULL if one has not been negotiated yet or there is no pending handshake.
3449
+ OPENSSL_EXPORT const SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl);
3450
+
3451
+ // SSL_set_retain_only_sha256_of_client_certs, on a server, sets whether only
3452
+ // the SHA-256 hash of peer's certificate should be saved in memory and in the
3453
+ // session. This can save memory, ticket size and session cache space. If
3454
+ // enabled, |SSL_get_peer_certificate| will return NULL after the handshake
3455
+ // completes. See the |peer_sha256| field of |SSL_SESSION| for the hash.
3456
+ OPENSSL_EXPORT void SSL_set_retain_only_sha256_of_client_certs(SSL *ssl,
3457
+ int enable);
3458
+
3459
+ // SSL_CTX_set_retain_only_sha256_of_client_certs, on a server, sets whether
3460
+ // only the SHA-256 hash of peer's certificate should be saved in memory and in
3461
+ // the session. This can save memory, ticket size and session cache space. If
3462
+ // enabled, |SSL_get_peer_certificate| will return NULL after the handshake
3463
+ // completes. See the |peer_sha256| field of |SSL_SESSION| for the hash.
3464
+ OPENSSL_EXPORT void SSL_CTX_set_retain_only_sha256_of_client_certs(SSL_CTX *ctx,
3465
+ int enable);
3466
+
3467
+ // SSL_CTX_set_grease_enabled configures whether sockets on |ctx| should enable
3468
+ // GREASE. See draft-davidben-tls-grease-01.
3469
+ OPENSSL_EXPORT void SSL_CTX_set_grease_enabled(SSL_CTX *ctx, int enabled);
3470
+
3471
+ // SSL_max_seal_overhead returns the maximum overhead, in bytes, of sealing a
3472
+ // record with |ssl|.
3473
+ OPENSSL_EXPORT size_t SSL_max_seal_overhead(const SSL *ssl);
3474
+
3475
+ // SSL_get_ticket_age_skew returns the difference, in seconds, between the
3476
+ // client-sent ticket age and the server-computed value in TLS 1.3 server
3477
+ // connections which resumed a session.
3478
+ OPENSSL_EXPORT int32_t SSL_get_ticket_age_skew(const SSL *ssl);
3479
+
3480
+
3481
+ // Deprecated functions.
3482
+
3483
+ // SSL_library_init calls |CRYPTO_library_init| and returns one.
3484
+ OPENSSL_EXPORT int SSL_library_init(void);
3485
+
3486
+ // SSL_CIPHER_description writes a description of |cipher| into |buf| and
3487
+ // returns |buf|. If |buf| is NULL, it returns a newly allocated string, to be
3488
+ // freed with |OPENSSL_free|, or NULL on error.
3489
+ //
3490
+ // The description includes a trailing newline and has the form:
3491
+ // AES128-SHA Kx=RSA Au=RSA Enc=AES(128) Mac=SHA1
3492
+ //
3493
+ // Consider |SSL_CIPHER_standard_name| or |SSL_CIPHER_get_name| instead.
3494
+ OPENSSL_EXPORT const char *SSL_CIPHER_description(const SSL_CIPHER *cipher,
3495
+ char *buf, int len);
3496
+
3497
+ // SSL_CIPHER_get_version returns the string "TLSv1/SSLv3".
3498
+ OPENSSL_EXPORT const char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher);
3499
+
3500
+ // SSL_CIPHER_get_rfc_name returns a newly-allocated string containing the
3501
+ // result of |SSL_CIPHER_standard_name| or NULL on error. The caller is
3502
+ // responsible for calling |OPENSSL_free| on the result.
3503
+ //
3504
+ // Use |SSL_CIPHER_standard_name| instead.
3505
+ OPENSSL_EXPORT char *SSL_CIPHER_get_rfc_name(const SSL_CIPHER *cipher);
3506
+
3507
+ typedef void COMP_METHOD;
3508
+
3509
+ // SSL_COMP_get_compression_methods returns NULL.
3510
+ OPENSSL_EXPORT STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
3511
+
3512
+ // SSL_COMP_add_compression_method returns one.
3513
+ OPENSSL_EXPORT int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);
3514
+
3515
+ // SSL_COMP_get_name returns NULL.
3516
+ OPENSSL_EXPORT const char *SSL_COMP_get_name(const COMP_METHOD *comp);
3517
+
3518
+ // SSL_COMP_free_compression_methods does nothing.
3519
+ OPENSSL_EXPORT void SSL_COMP_free_compression_methods(void);
3520
+
3521
+ // SSLv23_method calls |TLS_method|.
3522
+ OPENSSL_EXPORT const SSL_METHOD *SSLv23_method(void);
3523
+
3524
+ // These version-specific methods behave exactly like |TLS_method| and
3525
+ // |DTLS_method| except they also call |SSL_CTX_set_min_proto_version| and
3526
+ // |SSL_CTX_set_max_proto_version| to lock connections to that protocol
3527
+ // version.
3528
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_method(void);
3529
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_1_method(void);
3530
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_2_method(void);
3531
+ OPENSSL_EXPORT const SSL_METHOD *DTLSv1_method(void);
3532
+ OPENSSL_EXPORT const SSL_METHOD *DTLSv1_2_method(void);
3533
+
3534
+ // SSLv3_method returns an |SSL_METHOD| with no versions enabled.
3535
+ OPENSSL_EXPORT const SSL_METHOD *SSLv3_method(void);
3536
+
3537
+ // These client- and server-specific methods call their corresponding generic
3538
+ // methods.
3539
+ OPENSSL_EXPORT const SSL_METHOD *TLS_server_method(void);
3540
+ OPENSSL_EXPORT const SSL_METHOD *TLS_client_method(void);
3541
+ OPENSSL_EXPORT const SSL_METHOD *SSLv23_server_method(void);
3542
+ OPENSSL_EXPORT const SSL_METHOD *SSLv23_client_method(void);
3543
+ OPENSSL_EXPORT const SSL_METHOD *SSLv3_server_method(void);
3544
+ OPENSSL_EXPORT const SSL_METHOD *SSLv3_client_method(void);
3545
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_server_method(void);
3546
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_client_method(void);
3547
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_1_server_method(void);
3548
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_1_client_method(void);
3549
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_2_server_method(void);
3550
+ OPENSSL_EXPORT const SSL_METHOD *TLSv1_2_client_method(void);
3551
+ OPENSSL_EXPORT const SSL_METHOD *DTLS_server_method(void);
3552
+ OPENSSL_EXPORT const SSL_METHOD *DTLS_client_method(void);
3553
+ OPENSSL_EXPORT const SSL_METHOD *DTLSv1_server_method(void);
3554
+ OPENSSL_EXPORT const SSL_METHOD *DTLSv1_client_method(void);
3555
+ OPENSSL_EXPORT const SSL_METHOD *DTLSv1_2_server_method(void);
3556
+ OPENSSL_EXPORT const SSL_METHOD *DTLSv1_2_client_method(void);
3557
+
3558
+ // SSL_clear resets |ssl| to allow another connection and returns one on success
3559
+ // or zero on failure. It returns most configuration state but releases memory
3560
+ // associated with the current connection.
3561
+ //
3562
+ // Free |ssl| and create a new one instead.
3563
+ OPENSSL_EXPORT int SSL_clear(SSL *ssl);
3564
+
3565
+ // SSL_CTX_set_tmp_rsa_callback does nothing.
3566
+ OPENSSL_EXPORT void SSL_CTX_set_tmp_rsa_callback(
3567
+ SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int is_export, int keylength));
3568
+
3569
+ // SSL_set_tmp_rsa_callback does nothing.
3570
+ OPENSSL_EXPORT void SSL_set_tmp_rsa_callback(SSL *ssl,
3571
+ RSA *(*cb)(SSL *ssl, int is_export,
3572
+ int keylength));
3573
+
3574
+ // SSL_CTX_sess_connect returns zero.
3575
+ OPENSSL_EXPORT int SSL_CTX_sess_connect(const SSL_CTX *ctx);
3576
+
3577
+ // SSL_CTX_sess_connect_good returns zero.
3578
+ OPENSSL_EXPORT int SSL_CTX_sess_connect_good(const SSL_CTX *ctx);
3579
+
3580
+ // SSL_CTX_sess_connect_renegotiate returns zero.
3581
+ OPENSSL_EXPORT int SSL_CTX_sess_connect_renegotiate(const SSL_CTX *ctx);
3582
+
3583
+ // SSL_CTX_sess_accept returns zero.
3584
+ OPENSSL_EXPORT int SSL_CTX_sess_accept(const SSL_CTX *ctx);
3585
+
3586
+ // SSL_CTX_sess_accept_renegotiate returns zero.
3587
+ OPENSSL_EXPORT int SSL_CTX_sess_accept_renegotiate(const SSL_CTX *ctx);
3588
+
3589
+ // SSL_CTX_sess_accept_good returns zero.
3590
+ OPENSSL_EXPORT int SSL_CTX_sess_accept_good(const SSL_CTX *ctx);
3591
+
3592
+ // SSL_CTX_sess_hits returns zero.
3593
+ OPENSSL_EXPORT int SSL_CTX_sess_hits(const SSL_CTX *ctx);
3594
+
3595
+ // SSL_CTX_sess_cb_hits returns zero.
3596
+ OPENSSL_EXPORT int SSL_CTX_sess_cb_hits(const SSL_CTX *ctx);
3597
+
3598
+ // SSL_CTX_sess_misses returns zero.
3599
+ OPENSSL_EXPORT int SSL_CTX_sess_misses(const SSL_CTX *ctx);
3600
+
3601
+ // SSL_CTX_sess_timeouts returns zero.
3602
+ OPENSSL_EXPORT int SSL_CTX_sess_timeouts(const SSL_CTX *ctx);
3603
+
3604
+ // SSL_CTX_sess_cache_full returns zero.
3605
+ OPENSSL_EXPORT int SSL_CTX_sess_cache_full(const SSL_CTX *ctx);
3606
+
3607
+ // SSL_cutthrough_complete calls |SSL_in_false_start|.
3608
+ OPENSSL_EXPORT int SSL_cutthrough_complete(const SSL *ssl);
3609
+
3610
+ // SSL_num_renegotiations calls |SSL_total_renegotiations|.
3611
+ OPENSSL_EXPORT int SSL_num_renegotiations(const SSL *ssl);
3612
+
3613
+ // SSL_CTX_need_tmp_RSA returns zero.
3614
+ OPENSSL_EXPORT int SSL_CTX_need_tmp_RSA(const SSL_CTX *ctx);
3615
+
3616
+ // SSL_need_tmp_RSA returns zero.
3617
+ OPENSSL_EXPORT int SSL_need_tmp_RSA(const SSL *ssl);
3618
+
3619
+ // SSL_CTX_set_tmp_rsa returns one.
3620
+ OPENSSL_EXPORT int SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, const RSA *rsa);
3621
+
3622
+ // SSL_set_tmp_rsa returns one.
3623
+ OPENSSL_EXPORT int SSL_set_tmp_rsa(SSL *ssl, const RSA *rsa);
3624
+
3625
+ // SSL_CTX_get_read_ahead returns zero.
3626
+ OPENSSL_EXPORT int SSL_CTX_get_read_ahead(const SSL_CTX *ctx);
3627
+
3628
+ // SSL_CTX_set_read_ahead does nothing.
3629
+ OPENSSL_EXPORT void SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes);
3630
+
3631
+ // SSL_get_read_ahead returns zero.
3632
+ OPENSSL_EXPORT int SSL_get_read_ahead(const SSL *ssl);
3633
+
3634
+ // SSL_set_read_ahead does nothing.
3635
+ OPENSSL_EXPORT void SSL_set_read_ahead(SSL *ssl, int yes);
3636
+
3637
+ // SSL_renegotiate put an error on the error queue and returns zero.
3638
+ OPENSSL_EXPORT int SSL_renegotiate(SSL *ssl);
3639
+
3640
+ // SSL_set_state does nothing.
3641
+ OPENSSL_EXPORT void SSL_set_state(SSL *ssl, int state);
3642
+
3643
+ // SSL_get_shared_ciphers writes an empty string to |buf| and returns a
3644
+ // pointer to |buf|, or NULL if |len| is less than or equal to zero.
3645
+ OPENSSL_EXPORT char *SSL_get_shared_ciphers(const SSL *ssl, char *buf, int len);
3646
+
3647
+ // SSL_MODE_HANDSHAKE_CUTTHROUGH is the same as SSL_MODE_ENABLE_FALSE_START.
3648
+ #define SSL_MODE_HANDSHAKE_CUTTHROUGH SSL_MODE_ENABLE_FALSE_START
3649
+
3650
+ // i2d_SSL_SESSION serializes |in| to the bytes pointed to by |*pp|. On success,
3651
+ // it returns the number of bytes written and advances |*pp| by that many bytes.
3652
+ // On failure, it returns -1. If |pp| is NULL, no bytes are written and only the
3653
+ // length is returned.
3654
+ //
3655
+ // Use |SSL_SESSION_to_bytes| instead.
3656
+ OPENSSL_EXPORT int i2d_SSL_SESSION(SSL_SESSION *in, uint8_t **pp);
3657
+
3658
+ // d2i_SSL_SESSION parses a serialized session from the |length| bytes pointed
3659
+ // to by |*pp|. It returns the new |SSL_SESSION| and advances |*pp| by the
3660
+ // number of bytes consumed on success and NULL on failure. The caller takes
3661
+ // ownership of the new session and must call |SSL_SESSION_free| when done.
3662
+ //
3663
+ // If |a| is non-NULL, |*a| is released and set the new |SSL_SESSION|.
3664
+ //
3665
+ // Use |SSL_SESSION_from_bytes| instead.
3666
+ OPENSSL_EXPORT SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const uint8_t **pp,
3667
+ long length);
3668
+
3669
+ // i2d_SSL_SESSION_bio serializes |session| and writes the result to |bio|. It
3670
+ // returns the number of bytes written on success and <= 0 on error.
3671
+ OPENSSL_EXPORT int i2d_SSL_SESSION_bio(BIO *bio, const SSL_SESSION *session);
3672
+
3673
+ // d2i_SSL_SESSION_bio reads a serialized |SSL_SESSION| from |bio| and returns a
3674
+ // newly-allocated |SSL_SESSION| or NULL on error. If |out| is not NULL, it also
3675
+ // frees |*out| and sets |*out| to the new |SSL_SESSION|.
3676
+ OPENSSL_EXPORT SSL_SESSION *d2i_SSL_SESSION_bio(BIO *bio, SSL_SESSION **out);
3677
+
3678
+ // ERR_load_SSL_strings does nothing.
3679
+ OPENSSL_EXPORT void ERR_load_SSL_strings(void);
3680
+
3681
+ // SSL_load_error_strings does nothing.
3682
+ OPENSSL_EXPORT void SSL_load_error_strings(void);
3683
+
3684
+ // SSL_CTX_set_tlsext_use_srtp calls |SSL_CTX_set_srtp_profiles|. It returns
3685
+ // zero on success and one on failure.
3686
+ //
3687
+ // WARNING: this function is dangerous because it breaks the usual return value
3688
+ // convention. Use |SSL_CTX_set_srtp_profiles| instead.
3689
+ OPENSSL_EXPORT int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx,
3690
+ const char *profiles);
3691
+
3692
+ // SSL_set_tlsext_use_srtp calls |SSL_set_srtp_profiles|. It returns zero on
3693
+ // success and one on failure.
3694
+ //
3695
+ // WARNING: this function is dangerous because it breaks the usual return value
3696
+ // convention. Use |SSL_set_srtp_profiles| instead.
3697
+ OPENSSL_EXPORT int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles);
3698
+
3699
+ // SSL_get_current_compression returns NULL.
3700
+ OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_compression(SSL *ssl);
3701
+
3702
+ // SSL_get_current_expansion returns NULL.
3703
+ OPENSSL_EXPORT const COMP_METHOD *SSL_get_current_expansion(SSL *ssl);
3704
+
3705
+ // SSL_get_server_tmp_key returns zero.
3706
+ OPENSSL_EXPORT int *SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **out_key);
3707
+
3708
+ // SSL_CTX_set_tmp_dh returns 1.
3709
+ OPENSSL_EXPORT int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh);
3710
+
3711
+ // SSL_set_tmp_dh returns 1.
3712
+ OPENSSL_EXPORT int SSL_set_tmp_dh(SSL *ssl, const DH *dh);
3713
+
3714
+ // SSL_CTX_set_tmp_dh_callback does nothing.
3715
+ OPENSSL_EXPORT void SSL_CTX_set_tmp_dh_callback(
3716
+ SSL_CTX *ctx, DH *(*cb)(SSL *ssl, int is_export, int keylength));
3717
+
3718
+ // SSL_set_tmp_dh_callback does nothing.
3719
+ OPENSSL_EXPORT void SSL_set_tmp_dh_callback(SSL *ssl,
3720
+ DH *(*cb)(SSL *ssl, int is_export,
3721
+ int keylength));
3722
+
3723
+
3724
+ #define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char *)(arg)))
3725
+ #define SSL_get_app_data(s) (SSL_get_ex_data(s, 0))
3726
+ #define SSL_SESSION_set_app_data(s, a) \
3727
+ (SSL_SESSION_set_ex_data(s, 0, (char *)(a)))
3728
+ #define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s, 0))
3729
+ #define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx, 0))
3730
+ #define SSL_CTX_set_app_data(ctx, arg) \
3731
+ (SSL_CTX_set_ex_data(ctx, 0, (char *)(arg)))
3732
+
3733
+ #define OpenSSL_add_ssl_algorithms() SSL_library_init()
3734
+ #define SSLeay_add_ssl_algorithms() SSL_library_init()
3735
+
3736
+ #define SSL_get_cipher(ssl) SSL_CIPHER_get_name(SSL_get_current_cipher(ssl))
3737
+ #define SSL_get_cipher_bits(ssl, out_alg_bits) \
3738
+ SSL_CIPHER_get_bits(SSL_get_current_cipher(ssl), out_alg_bits)
3739
+ #define SSL_get_cipher_version(ssl) \
3740
+ SSL_CIPHER_get_version(SSL_get_current_cipher(ssl))
3741
+ #define SSL_get_cipher_name(ssl) \
3742
+ SSL_CIPHER_get_name(SSL_get_current_cipher(ssl))
3743
+ #define SSL_get_time(session) SSL_SESSION_get_time(session)
3744
+ #define SSL_set_time(session, time) SSL_SESSION_set_time((session), (time))
3745
+ #define SSL_get_timeout(session) SSL_SESSION_get_timeout(session)
3746
+ #define SSL_set_timeout(session, timeout) \
3747
+ SSL_SESSION_set_timeout((session), (timeout))
3748
+
3749
+ typedef struct ssl_comp_st SSL_COMP;
3750
+
3751
+ struct ssl_comp_st {
3752
+ int id;
3753
+ const char *name;
3754
+ char *method;
3755
+ };
3756
+
3757
+ DEFINE_STACK_OF(SSL_COMP)
3758
+
3759
+ // The following flags do nothing and are included only to make it easier to
3760
+ // compile code with BoringSSL.
3761
+ #define SSL_MODE_AUTO_RETRY 0
3762
+ #define SSL_MODE_RELEASE_BUFFERS 0
3763
+ #define SSL_MODE_SEND_CLIENTHELLO_TIME 0
3764
+ #define SSL_MODE_SEND_SERVERHELLO_TIME 0
3765
+ #define SSL_OP_ALL 0
3766
+ #define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0
3767
+ #define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0
3768
+ #define SSL_OP_EPHEMERAL_RSA 0
3769
+ #define SSL_OP_LEGACY_SERVER_CONNECT 0
3770
+ #define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0
3771
+ #define SSL_OP_MICROSOFT_SESS_ID_BUG 0
3772
+ #define SSL_OP_MSIE_SSLV2_RSA_PADDING 0
3773
+ #define SSL_OP_NETSCAPE_CA_DN_BUG 0
3774
+ #define SSL_OP_NETSCAPE_CHALLENGE_BUG 0
3775
+ #define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0
3776
+ #define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0
3777
+ #define SSL_OP_NO_COMPRESSION 0
3778
+ #define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0
3779
+ #define SSL_OP_NO_SSLv2 0
3780
+ #define SSL_OP_PKCS1_CHECK_1 0
3781
+ #define SSL_OP_PKCS1_CHECK_2 0
3782
+ #define SSL_OP_SINGLE_DH_USE 0
3783
+ #define SSL_OP_SINGLE_ECDH_USE 0
3784
+ #define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0
3785
+ #define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0
3786
+ #define SSL_OP_TLS_BLOCK_PADDING_BUG 0
3787
+ #define SSL_OP_TLS_D5_BUG 0
3788
+ #define SSL_OP_TLS_ROLLBACK_BUG 0
3789
+ #define SSL_VERIFY_CLIENT_ONCE 0
3790
+
3791
+ // SSL_cache_hit calls |SSL_session_reused|.
3792
+ OPENSSL_EXPORT int SSL_cache_hit(SSL *ssl);
3793
+
3794
+ // SSL_get_default_timeout returns |SSL_DEFAULT_SESSION_TIMEOUT|.
3795
+ OPENSSL_EXPORT long SSL_get_default_timeout(const SSL *ssl);
3796
+
3797
+ // SSL_get_version returns a string describing the TLS version used by |ssl|.
3798
+ // For example, "TLSv1.2" or "SSLv3".
3799
+ OPENSSL_EXPORT const char *SSL_get_version(const SSL *ssl);
3800
+
3801
+ // SSL_get_cipher_list returns the name of the |n|th cipher in the output of
3802
+ // |SSL_get_ciphers| or NULL if out of range. Use |SSL_get_ciphers| instead.
3803
+ OPENSSL_EXPORT const char *SSL_get_cipher_list(const SSL *ssl, int n);
3804
+
3805
+ // SSL_CTX_set_client_cert_cb sets a callback which is called on the client if
3806
+ // the server requests a client certificate and none is configured. On success,
3807
+ // the callback should return one and set |*out_x509| to |*out_pkey| to a leaf
3808
+ // certificate and private key, respectively, passing ownership. It should
3809
+ // return zero to send no certificate and -1 to fail or pause the handshake. If
3810
+ // the handshake is paused, |SSL_get_error| will return
3811
+ // |SSL_ERROR_WANT_X509_LOOKUP|.
3812
+ //
3813
+ // The callback may call |SSL_get0_certificate_types| and
3814
+ // |SSL_get_client_CA_list| for information on the server's certificate request.
3815
+ //
3816
+ // Use |SSL_CTX_set_cert_cb| instead. Configuring intermediate certificates with
3817
+ // this function is confusing. This callback may not be registered concurrently
3818
+ // with |SSL_CTX_set_cert_cb| or |SSL_set_cert_cb|.
3819
+ OPENSSL_EXPORT void SSL_CTX_set_client_cert_cb(
3820
+ SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **out_x509, EVP_PKEY **out_pkey));
3821
+
3822
+ #define SSL_NOTHING 1
3823
+ #define SSL_WRITING 2
3824
+ #define SSL_READING 3
3825
+ #define SSL_X509_LOOKUP 4
3826
+ #define SSL_CHANNEL_ID_LOOKUP 5
3827
+ #define SSL_PENDING_SESSION 7
3828
+ #define SSL_CERTIFICATE_SELECTION_PENDING 8
3829
+ #define SSL_PRIVATE_KEY_OPERATION 9
3830
+ #define SSL_PENDING_TICKET 10
3831
+ #define SSL_EARLY_DATA_REJECTED 11
3832
+ #define SSL_CERTIFICATE_VERIFY 12
3833
+
3834
+ // SSL_want returns one of the above values to determine what the most recent
3835
+ // operation on |ssl| was blocked on. Use |SSL_get_error| instead.
3836
+ OPENSSL_EXPORT int SSL_want(const SSL *ssl);
3837
+
3838
+ #define SSL_want_read(ssl) (SSL_want(ssl) == SSL_READING)
3839
+ #define SSL_want_write(ssl) (SSL_want(ssl) == SSL_WRITING)
3840
+
3841
+ // SSL_get_finished writes up to |count| bytes of the Finished message sent by
3842
+ // |ssl| to |buf|. It returns the total untruncated length or zero if none has
3843
+ // been sent yet. At SSL 3.0 or TLS 1.3 and later, it returns zero.
3844
+ //
3845
+ // Use |SSL_get_tls_unique| instead.
3846
+ OPENSSL_EXPORT size_t SSL_get_finished(const SSL *ssl, void *buf, size_t count);
3847
+
3848
+ // SSL_get_peer_finished writes up to |count| bytes of the Finished message
3849
+ // received from |ssl|'s peer to |buf|. It returns the total untruncated length
3850
+ // or zero if none has been received yet. At SSL 3.0 or TLS 1.3 and later, it
3851
+ // returns zero.
3852
+ //
3853
+ // Use |SSL_get_tls_unique| instead.
3854
+ OPENSSL_EXPORT size_t SSL_get_peer_finished(const SSL *ssl, void *buf,
3855
+ size_t count);
3856
+
3857
+ // SSL_alert_type_string returns "!". Use |SSL_alert_type_string_long|
3858
+ // instead.
3859
+ OPENSSL_EXPORT const char *SSL_alert_type_string(int value);
3860
+
3861
+ // SSL_alert_desc_string returns "!!". Use |SSL_alert_desc_string_long|
3862
+ // instead.
3863
+ OPENSSL_EXPORT const char *SSL_alert_desc_string(int value);
3864
+
3865
+ // SSL_state_string returns "!!!!!!". Use |SSL_state_string_long| for a more
3866
+ // intelligible string.
3867
+ OPENSSL_EXPORT const char *SSL_state_string(const SSL *ssl);
3868
+
3869
+ // SSL_TXT_* expand to strings.
3870
+ #define SSL_TXT_MEDIUM "MEDIUM"
3871
+ #define SSL_TXT_HIGH "HIGH"
3872
+ #define SSL_TXT_FIPS "FIPS"
3873
+ #define SSL_TXT_kRSA "kRSA"
3874
+ #define SSL_TXT_kDHE "kDHE"
3875
+ #define SSL_TXT_kEDH "kEDH"
3876
+ #define SSL_TXT_kECDHE "kECDHE"
3877
+ #define SSL_TXT_kEECDH "kEECDH"
3878
+ #define SSL_TXT_kPSK "kPSK"
3879
+ #define SSL_TXT_aRSA "aRSA"
3880
+ #define SSL_TXT_aECDSA "aECDSA"
3881
+ #define SSL_TXT_aPSK "aPSK"
3882
+ #define SSL_TXT_DH "DH"
3883
+ #define SSL_TXT_DHE "DHE"
3884
+ #define SSL_TXT_EDH "EDH"
3885
+ #define SSL_TXT_RSA "RSA"
3886
+ #define SSL_TXT_ECDH "ECDH"
3887
+ #define SSL_TXT_ECDHE "ECDHE"
3888
+ #define SSL_TXT_EECDH "EECDH"
3889
+ #define SSL_TXT_ECDSA "ECDSA"
3890
+ #define SSL_TXT_PSK "PSK"
3891
+ #define SSL_TXT_3DES "3DES"
3892
+ #define SSL_TXT_RC4 "RC4"
3893
+ #define SSL_TXT_AES128 "AES128"
3894
+ #define SSL_TXT_AES256 "AES256"
3895
+ #define SSL_TXT_AES "AES"
3896
+ #define SSL_TXT_AES_GCM "AESGCM"
3897
+ #define SSL_TXT_CHACHA20 "CHACHA20"
3898
+ #define SSL_TXT_MD5 "MD5"
3899
+ #define SSL_TXT_SHA1 "SHA1"
3900
+ #define SSL_TXT_SHA "SHA"
3901
+ #define SSL_TXT_SHA256 "SHA256"
3902
+ #define SSL_TXT_SHA384 "SHA384"
3903
+ #define SSL_TXT_SSLV3 "SSLv3"
3904
+ #define SSL_TXT_TLSV1 "TLSv1"
3905
+ #define SSL_TXT_TLSV1_1 "TLSv1.1"
3906
+ #define SSL_TXT_TLSV1_2 "TLSv1.2"
3907
+ #define SSL_TXT_TLSV1_3 "TLSv1.3"
3908
+ #define SSL_TXT_ALL "ALL"
3909
+ #define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT"
3910
+
3911
+ typedef struct ssl_conf_ctx_st SSL_CONF_CTX;
3912
+
3913
+ // SSL_state returns |SSL_ST_INIT| if a handshake is in progress and |SSL_ST_OK|
3914
+ // otherwise.
3915
+ //
3916
+ // Use |SSL_is_init| instead.
3917
+ OPENSSL_EXPORT int SSL_state(const SSL *ssl);
3918
+
3919
+ #define SSL_get_state(ssl) SSL_state(ssl)
3920
+
3921
+ // SSL_set_shutdown causes |ssl| to behave as if the shutdown bitmask (see
3922
+ // |SSL_get_shutdown|) were |mode|. This may be used to skip sending or
3923
+ // receiving close_notify in |SSL_shutdown| by causing the implementation to
3924
+ // believe the events already happened.
3925
+ //
3926
+ // It is an error to use |SSL_set_shutdown| to unset a bit that has already been
3927
+ // set. Doing so will trigger an |assert| in debug builds and otherwise be
3928
+ // ignored.
3929
+ //
3930
+ // Use |SSL_CTX_set_quiet_shutdown| instead.
3931
+ OPENSSL_EXPORT void SSL_set_shutdown(SSL *ssl, int mode);
3932
+
3933
+ // SSL_CTX_set_tmp_ecdh calls |SSL_CTX_set1_curves| with a one-element list
3934
+ // containing |ec_key|'s curve.
3935
+ OPENSSL_EXPORT int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key);
3936
+
3937
+ // SSL_set_tmp_ecdh calls |SSL_set1_curves| with a one-element list containing
3938
+ // |ec_key|'s curve.
3939
+ OPENSSL_EXPORT int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key);
3940
+
3941
+ // SSL_add_dir_cert_subjects_to_stack lists files in directory |dir|. It calls
3942
+ // |SSL_add_file_cert_subjects_to_stack| on each file and returns one on success
3943
+ // or zero on error. This function is only available from the libdecrepit
3944
+ // library.
3945
+ OPENSSL_EXPORT int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *out,
3946
+ const char *dir);
3947
+
3948
+ // SSL_set_verify_result calls |abort| unless |result| is |X509_V_OK|.
3949
+ //
3950
+ // TODO(davidben): Remove this function once it has been removed from
3951
+ // netty-tcnative.
3952
+ OPENSSL_EXPORT void SSL_set_verify_result(SSL *ssl, long result);
3953
+
3954
+ // SSL_CTX_enable_tls_channel_id calls |SSL_CTX_set_tls_channel_id_enabled|.
3955
+ OPENSSL_EXPORT int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx);
3956
+
3957
+ // SSL_enable_tls_channel_id calls |SSL_set_tls_channel_id_enabled|.
3958
+ OPENSSL_EXPORT int SSL_enable_tls_channel_id(SSL *ssl);
3959
+
3960
+ // BIO_f_ssl returns a |BIO_METHOD| that can wrap an |SSL*| in a |BIO*|. Note
3961
+ // that this has quite different behaviour from the version in OpenSSL (notably
3962
+ // that it doesn't try to auto renegotiate).
3963
+ //
3964
+ // IMPORTANT: if you are not curl, don't use this.
3965
+ OPENSSL_EXPORT const BIO_METHOD *BIO_f_ssl(void);
3966
+
3967
+ // BIO_set_ssl sets |ssl| as the underlying connection for |bio|, which must
3968
+ // have been created using |BIO_f_ssl|. If |take_owership| is true, |bio| will
3969
+ // call |SSL_free| on |ssl| when closed. It returns one on success or something
3970
+ // other than one on error.
3971
+ OPENSSL_EXPORT long BIO_set_ssl(BIO *bio, SSL *ssl, int take_owership);
3972
+
3973
+ // SSL_CTX_set_ecdh_auto returns one.
3974
+ #define SSL_CTX_set_ecdh_auto(ctx, onoff) 1
3975
+
3976
+ // SSL_set_ecdh_auto returns one.
3977
+ #define SSL_set_ecdh_auto(ssl, onoff) 1
3978
+
3979
+ // SSL_get_session returns a non-owning pointer to |ssl|'s session. For
3980
+ // historical reasons, which session it returns depends on |ssl|'s state.
3981
+ //
3982
+ // Prior to the start of the initial handshake, it returns the session the
3983
+ // caller set with |SSL_set_session|. After the initial handshake has finished
3984
+ // and if no additional handshakes are in progress, it returns the currently
3985
+ // active session. Its behavior is undefined while a handshake is in progress.
3986
+ //
3987
+ // If trying to add new sessions to an external session cache, use
3988
+ // |SSL_CTX_sess_set_new_cb| instead. In particular, using the callback is
3989
+ // required as of TLS 1.3. For compatibility, this function will return an
3990
+ // unresumable session which may be cached, but will never be resumed.
3991
+ //
3992
+ // If querying properties of the connection, use APIs on the |SSL| object.
3993
+ OPENSSL_EXPORT SSL_SESSION *SSL_get_session(const SSL *ssl);
3994
+
3995
+ // SSL_get0_session is an alias for |SSL_get_session|.
3996
+ #define SSL_get0_session SSL_get_session
3997
+
3998
+ // SSL_get1_session acts like |SSL_get_session| but returns a new reference to
3999
+ // the session.
4000
+ OPENSSL_EXPORT SSL_SESSION *SSL_get1_session(SSL *ssl);
4001
+
4002
+ #define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0
4003
+ #define OPENSSL_INIT_LOAD_SSL_STRINGS 0
4004
+ #define OPENSSL_INIT_SSL_DEFAULT 0
4005
+
4006
+ // OPENSSL_init_ssl calls |CRYPTO_library_init| and returns one.
4007
+ OPENSSL_EXPORT int OPENSSL_init_ssl(uint64_t opts,
4008
+ const OPENSSL_INIT_SETTINGS *settings);
4009
+
4010
+ #if !defined(BORINGSSL_NO_CXX)
4011
+ // SSL_CTX_sess_set_get_cb is a legacy C++ overload of |SSL_CTX_sess_set_get_cb|
4012
+ // which supports the old callback signature.
4013
+ //
4014
+ // TODO(davidben): Remove this once Node is compatible with OpenSSL 1.1.0.
4015
+ extern "C++" OPENSSL_EXPORT void SSL_CTX_sess_set_get_cb(
4016
+ SSL_CTX *ctx, SSL_SESSION *(*get_session_cb)(SSL *ssl, uint8_t *id,
4017
+ int id_len, int *out_copy));
4018
+ #endif
4019
+
4020
+
4021
+ // Private structures.
4022
+ //
4023
+ // This structures are exposed for historical reasons, but access to them is
4024
+ // deprecated.
4025
+
4026
+ // TODO(davidben): Remove this forward declaration when |SSL_SESSION| is opaque.
4027
+ typedef struct ssl_x509_method_st SSL_X509_METHOD;
4028
+
4029
+ #define SSL_MAX_SSL_SESSION_ID_LENGTH 32
4030
+ #define SSL_MAX_SID_CTX_LENGTH 32
4031
+ #define SSL_MAX_MASTER_KEY_LENGTH 48
4032
+
4033
+ struct ssl_session_st {
4034
+ CRYPTO_refcount_t references;
4035
+ uint16_t ssl_version; // what ssl version session info is being kept in here?
4036
+
4037
+ // group_id is the ID of the ECDH group used to establish this session or zero
4038
+ // if not applicable or unknown.
4039
+ uint16_t group_id;
4040
+
4041
+ // peer_signature_algorithm is the signature algorithm used to authenticate
4042
+ // the peer, or zero if not applicable or unknown.
4043
+ uint16_t peer_signature_algorithm;
4044
+
4045
+ // master_key, in TLS 1.2 and below, is the master secret associated with the
4046
+ // session. In TLS 1.3 and up, it is the resumption secret.
4047
+ int master_key_length;
4048
+ uint8_t master_key[SSL_MAX_MASTER_KEY_LENGTH];
4049
+
4050
+ // session_id - valid?
4051
+ unsigned int session_id_length;
4052
+ uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
4053
+ // this is used to determine whether the session is being reused in
4054
+ // the appropriate context. It is up to the application to set this,
4055
+ // via SSL_new
4056
+ uint8_t sid_ctx_length;
4057
+ uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH];
4058
+
4059
+ char *psk_identity;
4060
+
4061
+ // certs contains the certificate chain from the peer, starting with the leaf
4062
+ // certificate.
4063
+ STACK_OF(CRYPTO_BUFFER) *certs;
4064
+
4065
+ const SSL_X509_METHOD *x509_method;
4066
+
4067
+ // x509_peer is the peer's certificate.
4068
+ X509 *x509_peer;
4069
+
4070
+ // x509_chain is the certificate chain sent by the peer. NOTE: for historical
4071
+ // reasons, when a client (so the peer is a server), the chain includes
4072
+ // |peer|, but when a server it does not.
4073
+ STACK_OF(X509) *x509_chain;
4074
+
4075
+ // x509_chain_without_leaf is a lazily constructed copy of |x509_chain| that
4076
+ // omits the leaf certificate. This exists because OpenSSL, historically,
4077
+ // didn't include the leaf certificate in the chain for a server, but did for
4078
+ // a client. The |x509_chain| always includes it and, if an API call requires
4079
+ // a chain without, it is stored here.
4080
+ STACK_OF(X509) *x509_chain_without_leaf;
4081
+
4082
+ // verify_result is the result of certificate verification in the case of
4083
+ // non-fatal certificate errors.
4084
+ long verify_result;
4085
+
4086
+ // timeout is the lifetime of the session in seconds, measured from |time|.
4087
+ // This is renewable up to |auth_timeout|.
4088
+ uint32_t timeout;
4089
+
4090
+ // auth_timeout is the non-renewable lifetime of the session in seconds,
4091
+ // measured from |time|.
4092
+ uint32_t auth_timeout;
4093
+
4094
+ // time is the time the session was issued, measured in seconds from the UNIX
4095
+ // epoch.
4096
+ uint64_t time;
4097
+
4098
+ const SSL_CIPHER *cipher;
4099
+
4100
+ CRYPTO_EX_DATA ex_data; // application specific data
4101
+
4102
+ // These are used to make removal of session-ids more efficient and to
4103
+ // implement a maximum cache size.
4104
+ SSL_SESSION *prev, *next;
4105
+
4106
+ // RFC4507 info
4107
+ uint8_t *tlsext_tick; // Session ticket
4108
+ size_t tlsext_ticklen; // Session ticket length
4109
+
4110
+ CRYPTO_BUFFER *signed_cert_timestamp_list;
4111
+
4112
+ // The OCSP response that came with the session.
4113
+ CRYPTO_BUFFER *ocsp_response;
4114
+
4115
+ // peer_sha256 contains the SHA-256 hash of the peer's certificate if
4116
+ // |peer_sha256_valid| is true.
4117
+ uint8_t peer_sha256[SHA256_DIGEST_LENGTH];
4118
+
4119
+ // original_handshake_hash contains the handshake hash (either SHA-1+MD5 or
4120
+ // SHA-2, depending on TLS version) for the original, full handshake that
4121
+ // created a session. This is used by Channel IDs during resumption.
4122
+ uint8_t original_handshake_hash[EVP_MAX_MD_SIZE];
4123
+ uint8_t original_handshake_hash_len;
4124
+
4125
+ uint32_t tlsext_tick_lifetime_hint; // Session lifetime hint in seconds
4126
+
4127
+ uint32_t ticket_age_add;
4128
+
4129
+ // ticket_max_early_data is the maximum amount of data allowed to be sent as
4130
+ // early data. If zero, 0-RTT is disallowed.
4131
+ uint32_t ticket_max_early_data;
4132
+
4133
+ // early_alpn is the ALPN protocol from the initial handshake. This is only
4134
+ // stored for TLS 1.3 and above in order to enforce ALPN matching for 0-RTT
4135
+ // resumptions.
4136
+ uint8_t *early_alpn;
4137
+ size_t early_alpn_len;
4138
+
4139
+ // extended_master_secret is true if the master secret in this session was
4140
+ // generated using EMS and thus isn't vulnerable to the Triple Handshake
4141
+ // attack.
4142
+ unsigned extended_master_secret:1;
4143
+
4144
+ // peer_sha256_valid is non-zero if |peer_sha256| is valid.
4145
+ unsigned peer_sha256_valid:1; // Non-zero if peer_sha256 is valid
4146
+
4147
+ // not_resumable is used to indicate that session resumption is disallowed.
4148
+ unsigned not_resumable:1;
4149
+
4150
+ // ticket_age_add_valid is non-zero if |ticket_age_add| is valid.
4151
+ unsigned ticket_age_add_valid:1;
4152
+
4153
+ // is_server is true if this session was created by a server.
4154
+ unsigned is_server:1;
4155
+ };
4156
+
4157
+
4158
+ // Nodejs compatibility section (hidden).
4159
+ //
4160
+ // These defines exist for node.js, with the hope that we can eliminate the
4161
+ // need for them over time.
4162
+ #define SSLerr(function, reason) \
4163
+ ERR_put_error(ERR_LIB_SSL, 0, reason, __FILE__, __LINE__)
4164
+
4165
+
4166
+ // Preprocessor compatibility section (hidden).
4167
+ //
4168
+ // Historically, a number of APIs were implemented in OpenSSL as macros and
4169
+ // constants to 'ctrl' functions. To avoid breaking #ifdefs in consumers, this
4170
+ // section defines a number of legacy macros.
4171
+ //
4172
+ // Although using either the CTRL values or their wrapper macros in #ifdefs is
4173
+ // still supported, the CTRL values may not be passed to |SSL_ctrl| and
4174
+ // |SSL_CTX_ctrl|. Call the functions (previously wrapper macros) instead.
4175
+ //
4176
+ // See PORTING.md in the BoringSSL source tree for a table of corresponding
4177
+ // functions.
4178
+ // https://boringssl.googlesource.com/boringssl/+/master/PORTING.md#Replacements-for-values
4179
+
4180
+ #define DTLS_CTRL_GET_TIMEOUT doesnt_exist
4181
+ #define DTLS_CTRL_HANDLE_TIMEOUT doesnt_exist
4182
+ #define SSL_CTRL_CHAIN doesnt_exist
4183
+ #define SSL_CTRL_CHAIN_CERT doesnt_exist
4184
+ #define SSL_CTRL_CHANNEL_ID doesnt_exist
4185
+ #define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS doesnt_exist
4186
+ #define SSL_CTRL_CLEAR_MODE doesnt_exist
4187
+ #define SSL_CTRL_CLEAR_OPTIONS doesnt_exist
4188
+ #define SSL_CTRL_EXTRA_CHAIN_CERT doesnt_exist
4189
+ #define SSL_CTRL_GET_CHAIN_CERTS doesnt_exist
4190
+ #define SSL_CTRL_GET_CHANNEL_ID doesnt_exist
4191
+ #define SSL_CTRL_GET_CLIENT_CERT_TYPES doesnt_exist
4192
+ #define SSL_CTRL_GET_EXTRA_CHAIN_CERTS doesnt_exist
4193
+ #define SSL_CTRL_GET_MAX_CERT_LIST doesnt_exist
4194
+ #define SSL_CTRL_GET_NUM_RENEGOTIATIONS doesnt_exist
4195
+ #define SSL_CTRL_GET_READ_AHEAD doesnt_exist
4196
+ #define SSL_CTRL_GET_RI_SUPPORT doesnt_exist
4197
+ #define SSL_CTRL_GET_SESSION_REUSED doesnt_exist
4198
+ #define SSL_CTRL_GET_SESS_CACHE_MODE doesnt_exist
4199
+ #define SSL_CTRL_GET_SESS_CACHE_SIZE doesnt_exist
4200
+ #define SSL_CTRL_GET_TLSEXT_TICKET_KEYS doesnt_exist
4201
+ #define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS doesnt_exist
4202
+ #define SSL_CTRL_MODE doesnt_exist
4203
+ #define SSL_CTRL_NEED_TMP_RSA doesnt_exist
4204
+ #define SSL_CTRL_OPTIONS doesnt_exist
4205
+ #define SSL_CTRL_SESS_NUMBER doesnt_exist
4206
+ #define SSL_CTRL_SET_CURVES doesnt_exist
4207
+ #define SSL_CTRL_SET_CURVES_LIST doesnt_exist
4208
+ #define SSL_CTRL_SET_ECDH_AUTO doesnt_exist
4209
+ #define SSL_CTRL_SET_MAX_CERT_LIST doesnt_exist
4210
+ #define SSL_CTRL_SET_MAX_SEND_FRAGMENT doesnt_exist
4211
+ #define SSL_CTRL_SET_MSG_CALLBACK doesnt_exist
4212
+ #define SSL_CTRL_SET_MSG_CALLBACK_ARG doesnt_exist
4213
+ #define SSL_CTRL_SET_MTU doesnt_exist
4214
+ #define SSL_CTRL_SET_READ_AHEAD doesnt_exist
4215
+ #define SSL_CTRL_SET_SESS_CACHE_MODE doesnt_exist
4216
+ #define SSL_CTRL_SET_SESS_CACHE_SIZE doesnt_exist
4217
+ #define SSL_CTRL_SET_TLSEXT_HOSTNAME doesnt_exist
4218
+ #define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG doesnt_exist
4219
+ #define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB doesnt_exist
4220
+ #define SSL_CTRL_SET_TLSEXT_TICKET_KEYS doesnt_exist
4221
+ #define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB doesnt_exist
4222
+ #define SSL_CTRL_SET_TMP_DH doesnt_exist
4223
+ #define SSL_CTRL_SET_TMP_DH_CB doesnt_exist
4224
+ #define SSL_CTRL_SET_TMP_ECDH doesnt_exist
4225
+ #define SSL_CTRL_SET_TMP_ECDH_CB doesnt_exist
4226
+ #define SSL_CTRL_SET_TMP_RSA doesnt_exist
4227
+ #define SSL_CTRL_SET_TMP_RSA_CB doesnt_exist
4228
+
4229
+ #define DTLSv1_get_timeout DTLSv1_get_timeout
4230
+ #define DTLSv1_handle_timeout DTLSv1_handle_timeout
4231
+ #define SSL_CTX_add0_chain_cert SSL_CTX_add0_chain_cert
4232
+ #define SSL_CTX_add1_chain_cert SSL_CTX_add1_chain_cert
4233
+ #define SSL_CTX_add_extra_chain_cert SSL_CTX_add_extra_chain_cert
4234
+ #define SSL_CTX_clear_extra_chain_certs SSL_CTX_clear_extra_chain_certs
4235
+ #define SSL_CTX_clear_chain_certs SSL_CTX_clear_chain_certs
4236
+ #define SSL_CTX_clear_mode SSL_CTX_clear_mode
4237
+ #define SSL_CTX_clear_options SSL_CTX_clear_options
4238
+ #define SSL_CTX_get0_chain_certs SSL_CTX_get0_chain_certs
4239
+ #define SSL_CTX_get_extra_chain_certs SSL_CTX_get_extra_chain_certs
4240
+ #define SSL_CTX_get_max_cert_list SSL_CTX_get_max_cert_list
4241
+ #define SSL_CTX_get_mode SSL_CTX_get_mode
4242
+ #define SSL_CTX_get_options SSL_CTX_get_options
4243
+ #define SSL_CTX_get_read_ahead SSL_CTX_get_read_ahead
4244
+ #define SSL_CTX_get_session_cache_mode SSL_CTX_get_session_cache_mode
4245
+ #define SSL_CTX_get_tlsext_ticket_keys SSL_CTX_get_tlsext_ticket_keys
4246
+ #define SSL_CTX_need_tmp_RSA SSL_CTX_need_tmp_RSA
4247
+ #define SSL_CTX_sess_get_cache_size SSL_CTX_sess_get_cache_size
4248
+ #define SSL_CTX_sess_number SSL_CTX_sess_number
4249
+ #define SSL_CTX_sess_set_cache_size SSL_CTX_sess_set_cache_size
4250
+ #define SSL_CTX_set0_chain SSL_CTX_set0_chain
4251
+ #define SSL_CTX_set1_chain SSL_CTX_set1_chain
4252
+ #define SSL_CTX_set1_curves SSL_CTX_set1_curves
4253
+ #define SSL_CTX_set_max_cert_list SSL_CTX_set_max_cert_list
4254
+ #define SSL_CTX_set_max_send_fragment SSL_CTX_set_max_send_fragment
4255
+ #define SSL_CTX_set_mode SSL_CTX_set_mode
4256
+ #define SSL_CTX_set_msg_callback_arg SSL_CTX_set_msg_callback_arg
4257
+ #define SSL_CTX_set_options SSL_CTX_set_options
4258
+ #define SSL_CTX_set_read_ahead SSL_CTX_set_read_ahead
4259
+ #define SSL_CTX_set_session_cache_mode SSL_CTX_set_session_cache_mode
4260
+ #define SSL_CTX_set_tlsext_servername_arg SSL_CTX_set_tlsext_servername_arg
4261
+ #define SSL_CTX_set_tlsext_servername_callback \
4262
+ SSL_CTX_set_tlsext_servername_callback
4263
+ #define SSL_CTX_set_tlsext_ticket_key_cb SSL_CTX_set_tlsext_ticket_key_cb
4264
+ #define SSL_CTX_set_tlsext_ticket_keys SSL_CTX_set_tlsext_ticket_keys
4265
+ #define SSL_CTX_set_tmp_dh SSL_CTX_set_tmp_dh
4266
+ #define SSL_CTX_set_tmp_ecdh SSL_CTX_set_tmp_ecdh
4267
+ #define SSL_CTX_set_tmp_rsa SSL_CTX_set_tmp_rsa
4268
+ #define SSL_add0_chain_cert SSL_add0_chain_cert
4269
+ #define SSL_add1_chain_cert SSL_add1_chain_cert
4270
+ #define SSL_clear_chain_certs SSL_clear_chain_certs
4271
+ #define SSL_clear_mode SSL_clear_mode
4272
+ #define SSL_clear_options SSL_clear_options
4273
+ #define SSL_get0_certificate_types SSL_get0_certificate_types
4274
+ #define SSL_get0_chain_certs SSL_get0_chain_certs
4275
+ #define SSL_get_max_cert_list SSL_get_max_cert_list
4276
+ #define SSL_get_mode SSL_get_mode
4277
+ #define SSL_get_options SSL_get_options
4278
+ #define SSL_get_secure_renegotiation_support \
4279
+ SSL_get_secure_renegotiation_support
4280
+ #define SSL_need_tmp_RSA SSL_need_tmp_RSA
4281
+ #define SSL_num_renegotiations SSL_num_renegotiations
4282
+ #define SSL_session_reused SSL_session_reused
4283
+ #define SSL_set0_chain SSL_set0_chain
4284
+ #define SSL_set1_chain SSL_set1_chain
4285
+ #define SSL_set1_curves SSL_set1_curves
4286
+ #define SSL_set_max_cert_list SSL_set_max_cert_list
4287
+ #define SSL_set_max_send_fragment SSL_set_max_send_fragment
4288
+ #define SSL_set_mode SSL_set_mode
4289
+ #define SSL_set_msg_callback_arg SSL_set_msg_callback_arg
4290
+ #define SSL_set_mtu SSL_set_mtu
4291
+ #define SSL_set_options SSL_set_options
4292
+ #define SSL_set_tlsext_host_name SSL_set_tlsext_host_name
4293
+ #define SSL_set_tmp_dh SSL_set_tmp_dh
4294
+ #define SSL_set_tmp_ecdh SSL_set_tmp_ecdh
4295
+ #define SSL_set_tmp_rsa SSL_set_tmp_rsa
4296
+ #define SSL_total_renegotiations SSL_total_renegotiations
4297
+
4298
+
4299
+ #if defined(__cplusplus)
4300
+ } // extern C
4301
+
4302
+ #if !defined(BORINGSSL_NO_CXX)
4303
+
4304
+ extern "C++" {
4305
+
4306
+ namespace bssl {
4307
+
4308
+ BORINGSSL_MAKE_DELETER(SSL, SSL_free)
4309
+ BORINGSSL_MAKE_DELETER(SSL_CTX, SSL_CTX_free)
4310
+ BORINGSSL_MAKE_DELETER(SSL_SESSION, SSL_SESSION_free)
4311
+
4312
+ enum class OpenRecordResult {
4313
+ kOK,
4314
+ kDiscard,
4315
+ kIncompleteRecord,
4316
+ kAlertCloseNotify,
4317
+ kError,
4318
+ };
4319
+
4320
+ // *** EXPERIMENTAL -- DO NOT USE ***
4321
+ //
4322
+ // OpenRecord decrypts the first complete SSL record from |in| in-place, sets
4323
+ // |out| to the decrypted application data, and |out_record_len| to the length
4324
+ // of the encrypted record. Returns:
4325
+ // - kOK if an application-data record was successfully decrypted and verified.
4326
+ // - kDiscard if a record was sucessfully processed, but should be discarded.
4327
+ // - kIncompleteRecord if |in| did not contain a complete record.
4328
+ // - kAlertCloseNotify if a record was successfully processed but is a
4329
+ // close_notify alert.
4330
+ // - kError if an error occurred or the record is invalid. |*out_alert| will be
4331
+ // set to an alert to emit, or zero if no alert should be emitted.
4332
+ OPENSSL_EXPORT OpenRecordResult OpenRecord(SSL *ssl, Span<uint8_t> *out,
4333
+ size_t *out_record_len,
4334
+ uint8_t *out_alert,
4335
+ Span<uint8_t> in);
4336
+
4337
+ OPENSSL_EXPORT size_t SealRecordPrefixLen(const SSL *ssl, size_t plaintext_len);
4338
+
4339
+ // SealRecordSuffixLen returns the length of the suffix written by |SealRecord|.
4340
+ //
4341
+ // |plaintext_len| must be equal to the size of the plaintext passed to
4342
+ // |SealRecord|.
4343
+ //
4344
+ // |plaintext_len| must not exceed |SSL3_RT_MAX_PLAINTEXT_LENGTH|. The returned
4345
+ // suffix length will not exceed |SSL3_RT_MAX_ENCRYPTED_OVERHEAD|.
4346
+ OPENSSL_EXPORT size_t SealRecordSuffixLen(const SSL *ssl, size_t plaintext_len);
4347
+
4348
+ // *** EXPERIMENTAL -- DO NOT USE ***
4349
+ //
4350
+ // SealRecord encrypts the cleartext of |in| and scatters the resulting TLS
4351
+ // application data record between |out_prefix|, |out|, and |out_suffix|. It
4352
+ // returns true on success or false if an error occurred.
4353
+ //
4354
+ // The length of |out_prefix| must equal |SealRecordPrefixLen|. The length of
4355
+ // |out| must equal the length of |in|, which must not exceed
4356
+ // |SSL3_RT_MAX_PLAINTEXT_LENGTH|. The length of |out_suffix| must equal
4357
+ // |SealRecordSuffixLen|.
4358
+ //
4359
+ // If enabled, |SealRecord| may perform TLS 1.0 CBC 1/n-1 record splitting.
4360
+ // |SealRecordPrefixLen| accounts for the required overhead if that is the case.
4361
+ //
4362
+ // |out| may equal |in| to encrypt in-place but may not otherwise alias.
4363
+ // |out_prefix| and |out_suffix| may not alias anything.
4364
+ OPENSSL_EXPORT bool SealRecord(SSL *ssl, Span<uint8_t> out_prefix,
4365
+ Span<uint8_t> out, Span<uint8_t> out_suffix,
4366
+ Span<const uint8_t> in);
4367
+
4368
+ } // namespace bssl
4369
+
4370
+ } // extern C++
4371
+
4372
+ #endif // !defined(BORINGSSL_NO_CXX)
4373
+
4374
+ #endif
4375
+
4376
+ #define SSL_R_APP_DATA_IN_HANDSHAKE 100
4377
+ #define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 101
4378
+ #define SSL_R_BAD_ALERT 102
4379
+ #define SSL_R_BAD_CHANGE_CIPHER_SPEC 103
4380
+ #define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 104
4381
+ #define SSL_R_BAD_DH_P_LENGTH 105
4382
+ #define SSL_R_BAD_DIGEST_LENGTH 106
4383
+ #define SSL_R_BAD_ECC_CERT 107
4384
+ #define SSL_R_BAD_ECPOINT 108
4385
+ #define SSL_R_BAD_HANDSHAKE_RECORD 109
4386
+ #define SSL_R_BAD_HELLO_REQUEST 110
4387
+ #define SSL_R_BAD_LENGTH 111
4388
+ #define SSL_R_BAD_PACKET_LENGTH 112
4389
+ #define SSL_R_BAD_RSA_ENCRYPT 113
4390
+ #define SSL_R_BAD_SIGNATURE 114
4391
+ #define SSL_R_BAD_SRTP_MKI_VALUE 115
4392
+ #define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 116
4393
+ #define SSL_R_BAD_SSL_FILETYPE 117
4394
+ #define SSL_R_BAD_WRITE_RETRY 118
4395
+ #define SSL_R_BIO_NOT_SET 119
4396
+ #define SSL_R_BN_LIB 120
4397
+ #define SSL_R_BUFFER_TOO_SMALL 121
4398
+ #define SSL_R_CA_DN_LENGTH_MISMATCH 122
4399
+ #define SSL_R_CA_DN_TOO_LONG 123
4400
+ #define SSL_R_CCS_RECEIVED_EARLY 124
4401
+ #define SSL_R_CERTIFICATE_VERIFY_FAILED 125
4402
+ #define SSL_R_CERT_CB_ERROR 126
4403
+ #define SSL_R_CERT_LENGTH_MISMATCH 127
4404
+ #define SSL_R_CHANNEL_ID_NOT_P256 128
4405
+ #define SSL_R_CHANNEL_ID_SIGNATURE_INVALID 129
4406
+ #define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 130
4407
+ #define SSL_R_CLIENTHELLO_PARSE_FAILED 131
4408
+ #define SSL_R_CLIENTHELLO_TLSEXT 132
4409
+ #define SSL_R_CONNECTION_REJECTED 133
4410
+ #define SSL_R_CONNECTION_TYPE_NOT_SET 134
4411
+ #define SSL_R_CUSTOM_EXTENSION_ERROR 135
4412
+ #define SSL_R_DATA_LENGTH_TOO_LONG 136
4413
+ #define SSL_R_DECODE_ERROR 137
4414
+ #define SSL_R_DECRYPTION_FAILED 138
4415
+ #define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 139
4416
+ #define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 140
4417
+ #define SSL_R_DH_P_TOO_LONG 141
4418
+ #define SSL_R_DIGEST_CHECK_FAILED 142
4419
+ #define SSL_R_DTLS_MESSAGE_TOO_BIG 143
4420
+ #define SSL_R_ECC_CERT_NOT_FOR_SIGNING 144
4421
+ #define SSL_R_EMS_STATE_INCONSISTENT 145
4422
+ #define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 146
4423
+ #define SSL_R_ERROR_ADDING_EXTENSION 147
4424
+ #define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 148
4425
+ #define SSL_R_ERROR_PARSING_EXTENSION 149
4426
+ #define SSL_R_EXCESSIVE_MESSAGE_SIZE 150
4427
+ #define SSL_R_EXTRA_DATA_IN_MESSAGE 151
4428
+ #define SSL_R_FRAGMENT_MISMATCH 152
4429
+ #define SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION 153
4430
+ #define SSL_R_HANDSHAKE_FAILURE_ON_CLIENT_HELLO 154
4431
+ #define SSL_R_HTTPS_PROXY_REQUEST 155
4432
+ #define SSL_R_HTTP_REQUEST 156
4433
+ #define SSL_R_INAPPROPRIATE_FALLBACK 157
4434
+ #define SSL_R_INVALID_COMMAND 158
4435
+ #define SSL_R_INVALID_MESSAGE 159
4436
+ #define SSL_R_INVALID_SSL_SESSION 160
4437
+ #define SSL_R_INVALID_TICKET_KEYS_LENGTH 161
4438
+ #define SSL_R_LENGTH_MISMATCH 162
4439
+ #define SSL_R_MISSING_EXTENSION 164
4440
+ #define SSL_R_MISSING_RSA_CERTIFICATE 165
4441
+ #define SSL_R_MISSING_TMP_DH_KEY 166
4442
+ #define SSL_R_MISSING_TMP_ECDH_KEY 167
4443
+ #define SSL_R_MIXED_SPECIAL_OPERATOR_WITH_GROUPS 168
4444
+ #define SSL_R_MTU_TOO_SMALL 169
4445
+ #define SSL_R_NEGOTIATED_BOTH_NPN_AND_ALPN 170
4446
+ #define SSL_R_NESTED_GROUP 171
4447
+ #define SSL_R_NO_CERTIFICATES_RETURNED 172
4448
+ #define SSL_R_NO_CERTIFICATE_ASSIGNED 173
4449
+ #define SSL_R_NO_CERTIFICATE_SET 174
4450
+ #define SSL_R_NO_CIPHERS_AVAILABLE 175
4451
+ #define SSL_R_NO_CIPHERS_PASSED 176
4452
+ #define SSL_R_NO_CIPHER_MATCH 177
4453
+ #define SSL_R_NO_COMPRESSION_SPECIFIED 178
4454
+ #define SSL_R_NO_METHOD_SPECIFIED 179
4455
+ #define SSL_R_NO_P256_SUPPORT 180
4456
+ #define SSL_R_NO_PRIVATE_KEY_ASSIGNED 181
4457
+ #define SSL_R_NO_RENEGOTIATION 182
4458
+ #define SSL_R_NO_REQUIRED_DIGEST 183
4459
+ #define SSL_R_NO_SHARED_CIPHER 184
4460
+ #define SSL_R_NULL_SSL_CTX 185
4461
+ #define SSL_R_NULL_SSL_METHOD_PASSED 186
4462
+ #define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 187
4463
+ #define SSL_R_OLD_SESSION_VERSION_NOT_RETURNED 188
4464
+ #define SSL_R_OUTPUT_ALIASES_INPUT 189
4465
+ #define SSL_R_PARSE_TLSEXT 190
4466
+ #define SSL_R_PATH_TOO_LONG 191
4467
+ #define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 192
4468
+ #define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 193
4469
+ #define SSL_R_PROTOCOL_IS_SHUTDOWN 194
4470
+ #define SSL_R_PSK_IDENTITY_NOT_FOUND 195
4471
+ #define SSL_R_PSK_NO_CLIENT_CB 196
4472
+ #define SSL_R_PSK_NO_SERVER_CB 197
4473
+ #define SSL_R_READ_TIMEOUT_EXPIRED 198
4474
+ #define SSL_R_RECORD_LENGTH_MISMATCH 199
4475
+ #define SSL_R_RECORD_TOO_LARGE 200
4476
+ #define SSL_R_RENEGOTIATION_ENCODING_ERR 201
4477
+ #define SSL_R_RENEGOTIATION_MISMATCH 202
4478
+ #define SSL_R_REQUIRED_CIPHER_MISSING 203
4479
+ #define SSL_R_RESUMED_EMS_SESSION_WITHOUT_EMS_EXTENSION 204
4480
+ #define SSL_R_RESUMED_NON_EMS_SESSION_WITH_EMS_EXTENSION 205
4481
+ #define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 206
4482
+ #define SSL_R_SERVERHELLO_TLSEXT 207
4483
+ #define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 208
4484
+ #define SSL_R_SESSION_MAY_NOT_BE_CREATED 209
4485
+ #define SSL_R_SIGNATURE_ALGORITHMS_EXTENSION_SENT_BY_SERVER 210
4486
+ #define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 211
4487
+ #define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 212
4488
+ #define SSL_R_SSL3_EXT_INVALID_SERVERNAME 213
4489
+ #define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 214
4490
+ #define SSL_R_SSL_HANDSHAKE_FAILURE 215
4491
+ #define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 216
4492
+ #define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 217
4493
+ #define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 218
4494
+ #define SSL_R_TOO_MANY_EMPTY_FRAGMENTS 219
4495
+ #define SSL_R_TOO_MANY_WARNING_ALERTS 220
4496
+ #define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 221
4497
+ #define SSL_R_UNEXPECTED_EXTENSION 222
4498
+ #define SSL_R_UNEXPECTED_MESSAGE 223
4499
+ #define SSL_R_UNEXPECTED_OPERATOR_IN_GROUP 224
4500
+ #define SSL_R_UNEXPECTED_RECORD 225
4501
+ #define SSL_R_UNINITIALIZED 226
4502
+ #define SSL_R_UNKNOWN_ALERT_TYPE 227
4503
+ #define SSL_R_UNKNOWN_CERTIFICATE_TYPE 228
4504
+ #define SSL_R_UNKNOWN_CIPHER_RETURNED 229
4505
+ #define SSL_R_UNKNOWN_CIPHER_TYPE 230
4506
+ #define SSL_R_UNKNOWN_DIGEST 231
4507
+ #define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 232
4508
+ #define SSL_R_UNKNOWN_PROTOCOL 233
4509
+ #define SSL_R_UNKNOWN_SSL_VERSION 234
4510
+ #define SSL_R_UNKNOWN_STATE 235
4511
+ #define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 236
4512
+ #define SSL_R_UNSUPPORTED_CIPHER 237
4513
+ #define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 238
4514
+ #define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 239
4515
+ #define SSL_R_UNSUPPORTED_PROTOCOL 240
4516
+ #define SSL_R_WRONG_CERTIFICATE_TYPE 241
4517
+ #define SSL_R_WRONG_CIPHER_RETURNED 242
4518
+ #define SSL_R_WRONG_CURVE 243
4519
+ #define SSL_R_WRONG_MESSAGE_TYPE 244
4520
+ #define SSL_R_WRONG_SIGNATURE_TYPE 245
4521
+ #define SSL_R_WRONG_SSL_VERSION 246
4522
+ #define SSL_R_WRONG_VERSION_NUMBER 247
4523
+ #define SSL_R_X509_LIB 248
4524
+ #define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 249
4525
+ #define SSL_R_SHUTDOWN_WHILE_IN_INIT 250
4526
+ #define SSL_R_INVALID_OUTER_RECORD_TYPE 251
4527
+ #define SSL_R_UNSUPPORTED_PROTOCOL_FOR_CUSTOM_KEY 252
4528
+ #define SSL_R_NO_COMMON_SIGNATURE_ALGORITHMS 253
4529
+ #define SSL_R_DOWNGRADE_DETECTED 254
4530
+ #define SSL_R_BUFFERED_MESSAGES_ON_CIPHER_CHANGE 255
4531
+ #define SSL_R_INVALID_COMPRESSION_LIST 256
4532
+ #define SSL_R_DUPLICATE_EXTENSION 257
4533
+ #define SSL_R_MISSING_KEY_SHARE 258
4534
+ #define SSL_R_INVALID_ALPN_PROTOCOL 259
4535
+ #define SSL_R_TOO_MANY_KEY_UPDATES 260
4536
+ #define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 261
4537
+ #define SSL_R_NO_CIPHERS_SPECIFIED 262
4538
+ #define SSL_R_RENEGOTIATION_EMS_MISMATCH 263
4539
+ #define SSL_R_DUPLICATE_KEY_SHARE 264
4540
+ #define SSL_R_NO_GROUPS_SPECIFIED 265
4541
+ #define SSL_R_NO_SHARED_GROUP 266
4542
+ #define SSL_R_PRE_SHARED_KEY_MUST_BE_LAST 267
4543
+ #define SSL_R_OLD_SESSION_PRF_HASH_MISMATCH 268
4544
+ #define SSL_R_INVALID_SCT_LIST 269
4545
+ #define SSL_R_TOO_MUCH_SKIPPED_EARLY_DATA 270
4546
+ #define SSL_R_PSK_IDENTITY_BINDER_COUNT_MISMATCH 271
4547
+ #define SSL_R_CANNOT_PARSE_LEAF_CERT 272
4548
+ #define SSL_R_SERVER_CERT_CHANGED 273
4549
+ #define SSL_R_CERTIFICATE_AND_PRIVATE_KEY_MISMATCH 274
4550
+ #define SSL_R_CANNOT_HAVE_BOTH_PRIVKEY_AND_METHOD 275
4551
+ #define SSL_R_TICKET_ENCRYPTION_FAILED 276
4552
+ #define SSL_R_ALPN_MISMATCH_ON_EARLY_DATA 277
4553
+ #define SSL_R_WRONG_VERSION_ON_EARLY_DATA 278
4554
+ #define SSL_R_UNEXPECTED_EXTENSION_ON_EARLY_DATA 279
4555
+ #define SSL_R_NO_SUPPORTED_VERSIONS_ENABLED 280
4556
+ #define SSL_R_APPLICATION_DATA_INSTEAD_OF_HANDSHAKE 281
4557
+ #define SSL_R_EMPTY_HELLO_RETRY_REQUEST 282
4558
+ #define SSL_R_SSLV3_ALERT_CLOSE_NOTIFY 1000
4559
+ #define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010
4560
+ #define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020
4561
+ #define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021
4562
+ #define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022
4563
+ #define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030
4564
+ #define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040
4565
+ #define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041
4566
+ #define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042
4567
+ #define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043
4568
+ #define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044
4569
+ #define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045
4570
+ #define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046
4571
+ #define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047
4572
+ #define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048
4573
+ #define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049
4574
+ #define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050
4575
+ #define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051
4576
+ #define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060
4577
+ #define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070
4578
+ #define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071
4579
+ #define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080
4580
+ #define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086
4581
+ #define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090
4582
+ #define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100
4583
+ #define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110
4584
+ #define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111
4585
+ #define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112
4586
+ #define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113
4587
+ #define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114
4588
+ #define SSL_R_TLSV1_UNKNOWN_PSK_IDENTITY 1115
4589
+ #define SSL_R_TLSV1_CERTIFICATE_REQUIRED 1116
4590
+ #define SSL_R_TOO_MUCH_READ_EARLY_DATA 1117
4591
+
4592
+ #endif // OPENSSL_HEADER_SSL_H