statem_locl.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. /*
  2. * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. /*****************************************************************************
  10. * *
  11. * The following definitions are PRIVATE to the state machine. They should *
  12. * NOT be used outside of the state machine. *
  13. * *
  14. *****************************************************************************/
  15. /* Max message length definitions */
  16. /* The spec allows for a longer length than this, but we limit it */
  17. #define HELLO_VERIFY_REQUEST_MAX_LENGTH 258
  18. #define END_OF_EARLY_DATA_MAX_LENGTH 0
  19. #define SERVER_HELLO_MAX_LENGTH 20000
  20. #define HELLO_RETRY_REQUEST_MAX_LENGTH 20000
  21. #define ENCRYPTED_EXTENSIONS_MAX_LENGTH 20000
  22. #define SERVER_KEY_EXCH_MAX_LENGTH 102400
  23. #define SERVER_HELLO_DONE_MAX_LENGTH 0
  24. #define KEY_UPDATE_MAX_LENGTH 1
  25. #define CCS_MAX_LENGTH 1
  26. /* Max should actually be 36 but we are generous */
  27. #define FINISHED_MAX_LENGTH 64
  28. /* The maximum number of incoming KeyUpdate messages we will accept */
  29. #define MAX_KEY_UPDATE_MESSAGES 32
  30. /* Dummy message type */
  31. #define SSL3_MT_DUMMY -1
  32. /* Message processing return codes */
  33. typedef enum {
  34. /* Something bad happened */
  35. MSG_PROCESS_ERROR,
  36. /* We've finished reading - swap to writing */
  37. MSG_PROCESS_FINISHED_READING,
  38. /*
  39. * We've completed the main processing of this message but there is some
  40. * post processing to be done.
  41. */
  42. MSG_PROCESS_CONTINUE_PROCESSING,
  43. /* We've finished this message - read the next message */
  44. MSG_PROCESS_CONTINUE_READING
  45. } MSG_PROCESS_RETURN;
  46. /* Flush the write BIO */
  47. int statem_flush(SSL *s);
  48. typedef int (*confunc_f) (SSL *s, WPACKET *pkt);
  49. #define GET_GROUP_ID(group, idx) \
  50. (unsigned int)(((group)[(idx) * 2] << 8) | (group)[((idx) * 2) + 1])
  51. int check_in_list(SSL *s, unsigned int group_id, const unsigned char *groups,
  52. size_t num_groups, int checkallow);
  53. int create_synthetic_message_hash(SSL *s);
  54. int parse_ca_names(SSL *s, PACKET *pkt, int *al);
  55. int construct_ca_names(SSL *s, WPACKET *pkt);
  56. size_t construct_key_exchange_tbs(const SSL *s, unsigned char **ptbs,
  57. const void *param, size_t paramlen);
  58. /*
  59. * TLS/DTLS client state machine functions
  60. */
  61. int ossl_statem_client_read_transition(SSL *s, int mt);
  62. WRITE_TRAN ossl_statem_client_write_transition(SSL *s);
  63. WORK_STATE ossl_statem_client_pre_work(SSL *s, WORK_STATE wst);
  64. WORK_STATE ossl_statem_client_post_work(SSL *s, WORK_STATE wst);
  65. int ossl_statem_client_construct_message(SSL *s, WPACKET *pkt,
  66. confunc_f *confunc, int *mt);
  67. size_t ossl_statem_client_max_message_size(SSL *s);
  68. MSG_PROCESS_RETURN ossl_statem_client_process_message(SSL *s, PACKET *pkt);
  69. WORK_STATE ossl_statem_client_post_process_message(SSL *s, WORK_STATE wst);
  70. /*
  71. * TLS/DTLS server state machine functions
  72. */
  73. int ossl_statem_server_read_transition(SSL *s, int mt);
  74. WRITE_TRAN ossl_statem_server_write_transition(SSL *s);
  75. WORK_STATE ossl_statem_server_pre_work(SSL *s, WORK_STATE wst);
  76. WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst);
  77. int ossl_statem_server_construct_message(SSL *s, WPACKET *pkt,
  78. confunc_f *confunc,int *mt);
  79. size_t ossl_statem_server_max_message_size(SSL *s);
  80. MSG_PROCESS_RETURN ossl_statem_server_process_message(SSL *s, PACKET *pkt);
  81. WORK_STATE ossl_statem_server_post_process_message(SSL *s, WORK_STATE wst);
  82. /* Functions for getting new message data */
  83. __owur int tls_get_message_header(SSL *s, int *mt);
  84. __owur int tls_get_message_body(SSL *s, size_t *len);
  85. __owur int dtls_get_message(SSL *s, int *mt, size_t *len);
  86. /* Message construction and processing functions */
  87. __owur int tls_process_initial_server_flight(SSL *s, int *al);
  88. __owur MSG_PROCESS_RETURN tls_process_change_cipher_spec(SSL *s, PACKET *pkt);
  89. __owur MSG_PROCESS_RETURN tls_process_finished(SSL *s, PACKET *pkt);
  90. __owur int tls_construct_change_cipher_spec(SSL *s, WPACKET *pkt);
  91. __owur int dtls_construct_change_cipher_spec(SSL *s, WPACKET *pkt);
  92. __owur int tls_construct_finished(SSL *s, WPACKET *pkt);
  93. __owur int tls_construct_key_update(SSL *s, WPACKET *pkt);
  94. __owur MSG_PROCESS_RETURN tls_process_key_update(SSL *s, PACKET *pkt);
  95. __owur WORK_STATE tls_finish_handshake(SSL *s, WORK_STATE wst, int clearbufs);
  96. __owur WORK_STATE dtls_wait_for_dry(SSL *s);
  97. /* some client-only functions */
  98. __owur int tls_construct_client_hello(SSL *s, WPACKET *pkt);
  99. __owur MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt);
  100. __owur MSG_PROCESS_RETURN tls_process_certificate_request(SSL *s, PACKET *pkt);
  101. __owur MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL *s, PACKET *pkt);
  102. __owur int tls_process_cert_status_body(SSL *s, PACKET *pkt, int *al);
  103. __owur MSG_PROCESS_RETURN tls_process_cert_status(SSL *s, PACKET *pkt);
  104. __owur MSG_PROCESS_RETURN tls_process_server_done(SSL *s, PACKET *pkt);
  105. __owur int tls_construct_cert_verify(SSL *s, WPACKET *pkt);
  106. __owur WORK_STATE tls_prepare_client_certificate(SSL *s, WORK_STATE wst);
  107. __owur int tls_construct_client_certificate(SSL *s, WPACKET *pkt);
  108. __owur int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey);
  109. __owur int tls_construct_client_key_exchange(SSL *s, WPACKET *pkt);
  110. __owur int tls_client_key_exchange_post_work(SSL *s);
  111. __owur int tls_construct_cert_status_body(SSL *s, WPACKET *pkt);
  112. __owur int tls_construct_cert_status(SSL *s, WPACKET *pkt);
  113. __owur MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt);
  114. __owur MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt);
  115. __owur int ssl3_check_cert_and_algorithm(SSL *s);
  116. #ifndef OPENSSL_NO_NEXTPROTONEG
  117. __owur int tls_construct_next_proto(SSL *s, WPACKET *pkt);
  118. #endif
  119. __owur MSG_PROCESS_RETURN tls_process_hello_req(SSL *s, PACKET *pkt);
  120. __owur MSG_PROCESS_RETURN dtls_process_hello_verify(SSL *s, PACKET *pkt);
  121. __owur int tls_construct_end_of_early_data(SSL *s, WPACKET *pkt);
  122. /* some server-only functions */
  123. __owur MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt);
  124. __owur WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst);
  125. __owur int tls_construct_server_hello(SSL *s, WPACKET *pkt);
  126. __owur int dtls_construct_hello_verify_request(SSL *s, WPACKET *pkt);
  127. __owur int tls_construct_server_certificate(SSL *s, WPACKET *pkt);
  128. __owur int tls_construct_server_key_exchange(SSL *s, WPACKET *pkt);
  129. __owur int tls_construct_certificate_request(SSL *s, WPACKET *pkt);
  130. __owur int tls_construct_server_done(SSL *s, WPACKET *pkt);
  131. __owur MSG_PROCESS_RETURN tls_process_client_certificate(SSL *s, PACKET *pkt);
  132. __owur MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL *s, PACKET *pkt);
  133. __owur WORK_STATE tls_post_process_client_key_exchange(SSL *s, WORK_STATE wst);
  134. __owur MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt);
  135. #ifndef OPENSSL_NO_NEXTPROTONEG
  136. __owur MSG_PROCESS_RETURN tls_process_next_proto(SSL *s, PACKET *pkt);
  137. #endif
  138. __owur int tls_construct_new_session_ticket(SSL *s, WPACKET *pkt);
  139. MSG_PROCESS_RETURN tls_process_end_of_early_data(SSL *s, PACKET *pkt);
  140. /* Extension processing */
  141. typedef enum ext_return_en {
  142. EXT_RETURN_FAIL,
  143. EXT_RETURN_SENT,
  144. EXT_RETURN_NOT_SENT
  145. } EXT_RETURN;
  146. __owur int extension_is_relevant(SSL *s, unsigned int extctx,
  147. unsigned int thisctx);
  148. __owur int tls_collect_extensions(SSL *s, PACKET *packet, unsigned int context,
  149. RAW_EXTENSION **res, int *al, size_t *len,
  150. int init);
  151. __owur int tls_parse_extension(SSL *s, TLSEXT_INDEX idx, int context,
  152. RAW_EXTENSION *exts, X509 *x, size_t chainidx,
  153. int *al);
  154. __owur int tls_parse_all_extensions(SSL *s, int context, RAW_EXTENSION *exts,
  155. X509 *x, size_t chainidx, int *al, int fin);
  156. __owur int should_add_extension(SSL *s, unsigned int extctx,
  157. unsigned int thisctx, int max_version);
  158. __owur int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context,
  159. X509 *x, size_t chainidx, int *al);
  160. __owur int tls_psk_do_binder(SSL *s, const EVP_MD *md,
  161. const unsigned char *msgstart,
  162. size_t binderoffset, const unsigned char *binderin,
  163. unsigned char *binderout,
  164. SSL_SESSION *sess, int sign, int external);
  165. /* Server Extension processing */
  166. int tls_parse_ctos_renegotiate(SSL *s, PACKET *pkt, unsigned int context,
  167. X509 *x, size_t chainidx, int *al);
  168. int tls_parse_ctos_server_name(SSL *s, PACKET *pkt, unsigned int context,
  169. X509 *x, size_t chainidx, int *al);
  170. #ifndef OPENSSL_NO_SRP
  171. int tls_parse_ctos_srp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  172. size_t chainidx, int *al);
  173. #endif
  174. int tls_parse_ctos_early_data(SSL *s, PACKET *pkt, unsigned int context,
  175. X509 *x, size_t chainidx, int *al);
  176. #ifndef OPENSSL_NO_EC
  177. int tls_parse_ctos_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
  178. X509 *x, size_t chainidx, int *al);
  179. int tls_parse_ctos_supported_groups(SSL *s, PACKET *pkt, unsigned int context,
  180. X509 *x, size_t chainidx, int *al);
  181. #endif
  182. int tls_parse_ctos_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
  183. X509 *x, size_t chainidx, int *al);
  184. int tls_parse_ctos_sig_algs(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  185. size_t chainidx, int *al);
  186. #ifndef OPENSSL_NO_OCSP
  187. int tls_parse_ctos_status_request(SSL *s, PACKET *pkt, unsigned int context,
  188. X509 *x, size_t chainidx, int *al);
  189. #endif
  190. #ifndef OPENSSL_NO_NEXTPROTONEG
  191. int tls_parse_ctos_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  192. size_t chainidx, int *al);
  193. #endif
  194. int tls_parse_ctos_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  195. size_t chainidx, int *al);
  196. #ifndef OPENSSL_NO_SRTP
  197. int tls_parse_ctos_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  198. size_t chainidx, int *al);
  199. #endif
  200. int tls_parse_ctos_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  201. size_t chainidx, int *al);
  202. int tls_parse_ctos_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  203. size_t chainidx, int *al);
  204. int tls_parse_ctos_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  205. size_t chainidx, int *al);
  206. int tls_parse_ctos_psk_kex_modes(SSL *s, PACKET *pkt, unsigned int context,
  207. X509 *x, size_t chainidx, int *al);
  208. int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  209. size_t chainidx, int *al);
  210. EXT_RETURN tls_construct_stoc_renegotiate(SSL *s, WPACKET *pkt,
  211. unsigned int context, X509 *x,
  212. size_t chainidx, int *al);
  213. EXT_RETURN tls_construct_stoc_server_name(SSL *s, WPACKET *pkt,
  214. unsigned int context, X509 *x,
  215. size_t chainidx, int *al);
  216. EXT_RETURN tls_construct_stoc_early_data(SSL *s, WPACKET *pkt,
  217. unsigned int context, X509 *x,
  218. size_t chainidx, int *al);
  219. #ifndef OPENSSL_NO_EC
  220. EXT_RETURN tls_construct_stoc_ec_pt_formats(SSL *s, WPACKET *pkt,
  221. unsigned int context, X509 *x,
  222. size_t chainidx, int *al);
  223. #endif
  224. EXT_RETURN tls_construct_stoc_supported_groups(SSL *s, WPACKET *pkt,
  225. unsigned int context, X509 *x,
  226. size_t chainidx, int *al);
  227. EXT_RETURN tls_construct_stoc_session_ticket(SSL *s, WPACKET *pkt,
  228. unsigned int context, X509 *x,
  229. size_t chainidx, int *al);
  230. #ifndef OPENSSL_NO_OCSP
  231. EXT_RETURN tls_construct_stoc_status_request(SSL *s, WPACKET *pkt,
  232. unsigned int context, X509 *x,
  233. size_t chainidx, int *al);
  234. #endif
  235. #ifndef OPENSSL_NO_NEXTPROTONEG
  236. EXT_RETURN tls_construct_stoc_next_proto_neg(SSL *s, WPACKET *pkt,
  237. unsigned int context, X509 *x,
  238. size_t chainidx, int *al);
  239. #endif
  240. EXT_RETURN tls_construct_stoc_alpn(SSL *s, WPACKET *pkt, unsigned int context,
  241. X509 *x, size_t chainidx, int *al);
  242. #ifndef OPENSSL_NO_SRTP
  243. EXT_RETURN tls_construct_stoc_use_srtp(SSL *s, WPACKET *pkt, unsigned int context,
  244. X509 *x, size_t chainidx, int *al);
  245. #endif
  246. EXT_RETURN tls_construct_stoc_etm(SSL *s, WPACKET *pkt, unsigned int context,
  247. X509 *x, size_t chainidx, int *al);
  248. EXT_RETURN tls_construct_stoc_ems(SSL *s, WPACKET *pkt, unsigned int context,
  249. X509 *x, size_t chainidx, int *al);
  250. EXT_RETURN tls_construct_stoc_key_share(SSL *s, WPACKET *pkt,
  251. unsigned int context, X509 *x,
  252. size_t chainidx, int *al);
  253. /*
  254. * Not in public headers as this is not an official extension. Only used when
  255. * SSL_OP_CRYPTOPRO_TLSEXT_BUG is set.
  256. */
  257. #define TLSEXT_TYPE_cryptopro_bug 0xfde8
  258. EXT_RETURN tls_construct_stoc_cryptopro_bug(SSL *s, WPACKET *pkt,
  259. unsigned int context, X509 *x,
  260. size_t chainidx, int *al);
  261. EXT_RETURN tls_construct_stoc_psk(SSL *s, WPACKET *pkt, unsigned int context,
  262. X509 *x, size_t chainidx, int *al);
  263. /* Client Extension processing */
  264. EXT_RETURN tls_construct_ctos_renegotiate(SSL *s, WPACKET *pkt, unsigned int context,
  265. X509 *x, size_t chainidx, int *al);
  266. EXT_RETURN tls_construct_ctos_server_name(SSL *s, WPACKET *pkt, unsigned int context,
  267. X509 *x, size_t chainidx, int *al);
  268. #ifndef OPENSSL_NO_SRP
  269. EXT_RETURN tls_construct_ctos_srp(SSL *s, WPACKET *pkt, unsigned int context, X509 *x,
  270. size_t chainidx, int *al);
  271. #endif
  272. #ifndef OPENSSL_NO_EC
  273. EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,
  274. unsigned int context, X509 *x,
  275. size_t chainidx, int *al);
  276. EXT_RETURN tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt,
  277. unsigned int context, X509 *x,
  278. size_t chainidx, int *al);
  279. #endif
  280. EXT_RETURN tls_construct_ctos_early_data(SSL *s, WPACKET *pkt,
  281. unsigned int context, X509 *x,
  282. size_t chainidx, int *al);
  283. EXT_RETURN tls_construct_ctos_session_ticket(SSL *s, WPACKET *pkt,
  284. unsigned int context, X509 *x,
  285. size_t chainidx, int *al);
  286. EXT_RETURN tls_construct_ctos_sig_algs(SSL *s, WPACKET *pkt,
  287. unsigned int context, X509 *x,
  288. size_t chainidx, int *al);
  289. #ifndef OPENSSL_NO_OCSP
  290. EXT_RETURN tls_construct_ctos_status_request(SSL *s, WPACKET *pkt,
  291. unsigned int context, X509 *x,
  292. size_t chainidx, int *al);
  293. #endif
  294. #ifndef OPENSSL_NO_NEXTPROTONEG
  295. EXT_RETURN tls_construct_ctos_npn(SSL *s, WPACKET *pkt, unsigned int context,
  296. X509 *x, size_t chainidx, int *al);
  297. #endif
  298. EXT_RETURN tls_construct_ctos_alpn(SSL *s, WPACKET *pkt, unsigned int context,
  299. X509 *x, size_t chainidx, int *al);
  300. #ifndef OPENSSL_NO_SRTP
  301. EXT_RETURN tls_construct_ctos_use_srtp(SSL *s, WPACKET *pkt, unsigned int context,
  302. X509 *x, size_t chainidx, int *al);
  303. #endif
  304. EXT_RETURN tls_construct_ctos_etm(SSL *s, WPACKET *pkt, unsigned int context,
  305. X509 *x, size_t chainidx, int *al);
  306. #ifndef OPENSSL_NO_CT
  307. EXT_RETURN tls_construct_ctos_sct(SSL *s, WPACKET *pkt, unsigned int context,
  308. X509 *x, size_t chainidx, int *al);
  309. #endif
  310. EXT_RETURN tls_construct_ctos_ems(SSL *s, WPACKET *pkt, unsigned int context,
  311. X509 *x, size_t chainidx, int *al);
  312. EXT_RETURN tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt,
  313. unsigned int context, X509 *x,
  314. size_t chainidx, int *al);
  315. EXT_RETURN tls_construct_ctos_key_share(SSL *s, WPACKET *pkt,
  316. unsigned int context, X509 *x,
  317. size_t chainidx, int *al);
  318. EXT_RETURN tls_construct_ctos_psk_kex_modes(SSL *s, WPACKET *pkt,
  319. unsigned int context, X509 *x,
  320. size_t chainidx, int *al);
  321. EXT_RETURN tls_construct_ctos_cookie(SSL *s, WPACKET *pkt, unsigned int context,
  322. X509 *x, size_t chainidx, int *al);
  323. EXT_RETURN tls_construct_ctos_padding(SSL *s, WPACKET *pkt,
  324. unsigned int context, X509 *x,
  325. size_t chainidx, int *al);
  326. EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
  327. X509 *x, size_t chainidx, int *al);
  328. int tls_parse_stoc_renegotiate(SSL *s, PACKET *pkt, unsigned int context,
  329. X509 *x, size_t chainidx, int *al);
  330. int tls_parse_stoc_server_name(SSL *s, PACKET *pkt, unsigned int context,
  331. X509 *x, size_t chainidx, int *al);
  332. int tls_parse_stoc_early_data(SSL *s, PACKET *pkt, unsigned int context,
  333. X509 *x, size_t chainidx, int *al);
  334. #ifndef OPENSSL_NO_EC
  335. int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
  336. X509 *x, size_t chainidx, int *al);
  337. #endif
  338. int tls_parse_stoc_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
  339. X509 *x, size_t chainidx, int *al);
  340. #ifndef OPENSSL_NO_OCSP
  341. int tls_parse_stoc_status_request(SSL *s, PACKET *pkt, unsigned int context,
  342. X509 *x, size_t chainidx, int *al);
  343. #endif
  344. #ifndef OPENSSL_NO_CT
  345. int tls_parse_stoc_sct(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  346. size_t chainidx, int *al);
  347. #endif
  348. #ifndef OPENSSL_NO_NEXTPROTONEG
  349. int tls_parse_stoc_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  350. size_t chainidx, int *al);
  351. #endif
  352. int tls_parse_stoc_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  353. size_t chainidx, int *al);
  354. #ifndef OPENSSL_NO_SRTP
  355. int tls_parse_stoc_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  356. size_t chainidx, int *al);
  357. #endif
  358. int tls_parse_stoc_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  359. size_t chainidx, int *al);
  360. int tls_parse_stoc_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  361. size_t chainidx, int *al);
  362. int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  363. size_t chainidx, int *al);
  364. int tls_parse_stoc_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  365. size_t chainidx, int *al);
  366. int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  367. size_t chainidx, int *al);