2
0

statem_local.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. /*
  2. * Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (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. /* Dummy message type */
  29. #define SSL3_MT_DUMMY -1
  30. extern const unsigned char hrrrandom[];
  31. /* Message processing return codes */
  32. typedef enum {
  33. /* Something bad happened */
  34. MSG_PROCESS_ERROR,
  35. /* We've finished reading - swap to writing */
  36. MSG_PROCESS_FINISHED_READING,
  37. /*
  38. * We've completed the main processing of this message but there is some
  39. * post processing to be done.
  40. */
  41. MSG_PROCESS_CONTINUE_PROCESSING,
  42. /* We've finished this message - read the next message */
  43. MSG_PROCESS_CONTINUE_READING
  44. } MSG_PROCESS_RETURN;
  45. typedef int (*confunc_f) (SSL *s, WPACKET *pkt);
  46. int ssl3_take_mac(SSL *s);
  47. int check_in_list(SSL *s, uint16_t group_id, const uint16_t *groups,
  48. size_t num_groups, int checkallow);
  49. int create_synthetic_message_hash(SSL *s, const unsigned char *hashval,
  50. size_t hashlen, const unsigned char *hrr,
  51. size_t hrrlen);
  52. int parse_ca_names(SSL *s, PACKET *pkt);
  53. const STACK_OF(X509_NAME) *get_ca_names(SSL *s);
  54. int construct_ca_names(SSL *s, const STACK_OF(X509_NAME) *ca_sk, WPACKET *pkt);
  55. size_t construct_key_exchange_tbs(SSL *s, unsigned char **ptbs,
  56. const void *param, size_t paramlen);
  57. /*
  58. * TLS/DTLS client state machine functions
  59. */
  60. int ossl_statem_client_read_transition(SSL *s, int mt);
  61. WRITE_TRAN ossl_statem_client_write_transition(SSL *s);
  62. WORK_STATE ossl_statem_client_pre_work(SSL *s, WORK_STATE wst);
  63. WORK_STATE ossl_statem_client_post_work(SSL *s, WORK_STATE wst);
  64. int ossl_statem_client_construct_message(SSL *s, WPACKET *pkt,
  65. confunc_f *confunc, int *mt);
  66. size_t ossl_statem_client_max_message_size(SSL *s);
  67. MSG_PROCESS_RETURN ossl_statem_client_process_message(SSL *s, PACKET *pkt);
  68. WORK_STATE ossl_statem_client_post_process_message(SSL *s, WORK_STATE wst);
  69. /*
  70. * TLS/DTLS server state machine functions
  71. */
  72. int ossl_statem_server_read_transition(SSL *s, int mt);
  73. WRITE_TRAN ossl_statem_server_write_transition(SSL *s);
  74. WORK_STATE ossl_statem_server_pre_work(SSL *s, WORK_STATE wst);
  75. WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst);
  76. int ossl_statem_server_construct_message(SSL *s, WPACKET *pkt,
  77. confunc_f *confunc,int *mt);
  78. size_t ossl_statem_server_max_message_size(SSL *s);
  79. MSG_PROCESS_RETURN ossl_statem_server_process_message(SSL *s, PACKET *pkt);
  80. WORK_STATE ossl_statem_server_post_process_message(SSL *s, WORK_STATE wst);
  81. /* Functions for getting new message data */
  82. __owur int tls_get_message_header(SSL *s, int *mt);
  83. __owur int tls_get_message_body(SSL *s, size_t *len);
  84. __owur int dtls_get_message(SSL *s, int *mt, size_t *len);
  85. /* Message construction and processing functions */
  86. __owur int tls_process_initial_server_flight(SSL *s);
  87. __owur MSG_PROCESS_RETURN tls_process_change_cipher_spec(SSL *s, PACKET *pkt);
  88. __owur MSG_PROCESS_RETURN tls_process_finished(SSL *s, PACKET *pkt);
  89. __owur int tls_construct_change_cipher_spec(SSL *s, WPACKET *pkt);
  90. __owur int dtls_construct_change_cipher_spec(SSL *s, WPACKET *pkt);
  91. __owur int tls_construct_finished(SSL *s, WPACKET *pkt);
  92. __owur int tls_construct_key_update(SSL *s, WPACKET *pkt);
  93. __owur MSG_PROCESS_RETURN tls_process_key_update(SSL *s, PACKET *pkt);
  94. __owur WORK_STATE tls_finish_handshake(SSL *s, WORK_STATE wst, int clearbufs,
  95. int stop);
  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);
  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. #ifndef OPENSSL_NO_GOST
  141. /* These functions are used in GOST18 CKE, both for client and server */
  142. int gost18_cke_cipher_nid(const SSL *s);
  143. int gost_ukm(const SSL *s, unsigned char *dgst_buf);
  144. #endif
  145. /* Extension processing */
  146. typedef enum ext_return_en {
  147. EXT_RETURN_FAIL,
  148. EXT_RETURN_SENT,
  149. EXT_RETURN_NOT_SENT
  150. } EXT_RETURN;
  151. __owur int tls_validate_all_contexts(SSL *s, unsigned int thisctx,
  152. RAW_EXTENSION *exts);
  153. __owur int extension_is_relevant(SSL *s, unsigned int extctx,
  154. unsigned int thisctx);
  155. __owur int tls_collect_extensions(SSL *s, PACKET *packet, unsigned int context,
  156. RAW_EXTENSION **res, size_t *len, int init);
  157. __owur int tls_parse_extension(SSL *s, TLSEXT_INDEX idx, int context,
  158. RAW_EXTENSION *exts, X509 *x, size_t chainidx);
  159. __owur int tls_parse_all_extensions(SSL *s, int context, RAW_EXTENSION *exts,
  160. X509 *x, size_t chainidx, int fin);
  161. __owur int should_add_extension(SSL *s, unsigned int extctx,
  162. unsigned int thisctx, int max_version);
  163. __owur int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context,
  164. X509 *x, size_t chainidx);
  165. __owur int tls_psk_do_binder(SSL *s, const EVP_MD *md,
  166. const unsigned char *msgstart,
  167. size_t binderoffset, const unsigned char *binderin,
  168. unsigned char *binderout,
  169. SSL_SESSION *sess, int sign, int external);
  170. /* Server Extension processing */
  171. int tls_parse_ctos_renegotiate(SSL *s, PACKET *pkt, unsigned int context,
  172. X509 *x, size_t chainidx);
  173. int tls_parse_ctos_server_name(SSL *s, PACKET *pkt, unsigned int context,
  174. X509 *x, size_t chainidx);
  175. int tls_parse_ctos_maxfragmentlen(SSL *s, PACKET *pkt, unsigned int context,
  176. X509 *x, size_t chainidx);
  177. #ifndef OPENSSL_NO_SRP
  178. int tls_parse_ctos_srp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  179. size_t chainidx);
  180. #endif
  181. int tls_parse_ctos_early_data(SSL *s, PACKET *pkt, unsigned int context,
  182. X509 *x, size_t chainidx);
  183. #ifndef OPENSSL_NO_EC
  184. int tls_parse_ctos_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
  185. X509 *x, size_t chainidx);
  186. #endif
  187. int tls_parse_ctos_supported_groups(SSL *s, PACKET *pkt, unsigned int context,
  188. X509 *x, size_t chainidxl);
  189. int tls_parse_ctos_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
  190. X509 *x, size_t chainidx);
  191. int tls_parse_ctos_sig_algs_cert(SSL *s, PACKET *pkt, unsigned int context,
  192. X509 *x, size_t chainidx);
  193. int tls_parse_ctos_sig_algs(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  194. size_t chainidx);
  195. #ifndef OPENSSL_NO_OCSP
  196. int tls_parse_ctos_status_request(SSL *s, PACKET *pkt, unsigned int context,
  197. X509 *x, size_t chainidx);
  198. #endif
  199. #ifndef OPENSSL_NO_NEXTPROTONEG
  200. int tls_parse_ctos_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  201. size_t chainidx);
  202. #endif
  203. int tls_parse_ctos_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  204. size_t chainidx);
  205. #ifndef OPENSSL_NO_SRTP
  206. int tls_parse_ctos_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  207. size_t chainidx);
  208. #endif
  209. int tls_parse_ctos_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  210. size_t chainidx);
  211. int tls_parse_ctos_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  212. size_t chainidx);
  213. int tls_parse_ctos_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  214. size_t chainidx);
  215. int tls_parse_ctos_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  216. size_t chainidx);
  217. int tls_parse_ctos_psk_kex_modes(SSL *s, PACKET *pkt, unsigned int context,
  218. X509 *x, size_t chainidx);
  219. int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  220. size_t chainidx);
  221. int tls_parse_ctos_post_handshake_auth(SSL *, PACKET *pkt, unsigned int context,
  222. X509 *x, size_t chainidx);
  223. EXT_RETURN tls_construct_stoc_renegotiate(SSL *s, WPACKET *pkt,
  224. unsigned int context, X509 *x,
  225. size_t chainidx);
  226. EXT_RETURN tls_construct_stoc_server_name(SSL *s, WPACKET *pkt,
  227. unsigned int context, X509 *x,
  228. size_t chainidx);
  229. EXT_RETURN tls_construct_stoc_early_data(SSL *s, WPACKET *pkt,
  230. unsigned int context, X509 *x,
  231. size_t chainidx);
  232. EXT_RETURN tls_construct_stoc_maxfragmentlen(SSL *s, WPACKET *pkt,
  233. unsigned int context, X509 *x,
  234. size_t chainidx);
  235. #ifndef OPENSSL_NO_EC
  236. EXT_RETURN tls_construct_stoc_ec_pt_formats(SSL *s, WPACKET *pkt,
  237. unsigned int context, X509 *x,
  238. size_t chainidx);
  239. #endif
  240. EXT_RETURN tls_construct_stoc_supported_groups(SSL *s, WPACKET *pkt,
  241. unsigned int context, X509 *x,
  242. size_t chainidx);
  243. EXT_RETURN tls_construct_stoc_session_ticket(SSL *s, WPACKET *pkt,
  244. unsigned int context, X509 *x,
  245. size_t chainidx);
  246. #ifndef OPENSSL_NO_OCSP
  247. EXT_RETURN tls_construct_stoc_status_request(SSL *s, WPACKET *pkt,
  248. unsigned int context, X509 *x,
  249. size_t chainidx);
  250. #endif
  251. #ifndef OPENSSL_NO_NEXTPROTONEG
  252. EXT_RETURN tls_construct_stoc_next_proto_neg(SSL *s, WPACKET *pkt,
  253. unsigned int context, X509 *x,
  254. size_t chainidx);
  255. #endif
  256. EXT_RETURN tls_construct_stoc_alpn(SSL *s, WPACKET *pkt, unsigned int context,
  257. X509 *x, size_t chainidx);
  258. #ifndef OPENSSL_NO_SRTP
  259. EXT_RETURN tls_construct_stoc_use_srtp(SSL *s, WPACKET *pkt, unsigned int context,
  260. X509 *x, size_t chainidx);
  261. #endif
  262. EXT_RETURN tls_construct_stoc_etm(SSL *s, WPACKET *pkt, unsigned int context,
  263. X509 *x, size_t chainidx);
  264. EXT_RETURN tls_construct_stoc_ems(SSL *s, WPACKET *pkt, unsigned int context,
  265. X509 *x, size_t chainidx);
  266. EXT_RETURN tls_construct_stoc_supported_versions(SSL *s, WPACKET *pkt,
  267. unsigned int context, X509 *x,
  268. size_t chainidx);
  269. EXT_RETURN tls_construct_stoc_key_share(SSL *s, WPACKET *pkt,
  270. unsigned int context, X509 *x,
  271. size_t chainidx);
  272. EXT_RETURN tls_construct_stoc_cookie(SSL *s, WPACKET *pkt, unsigned int context,
  273. X509 *x, size_t chainidx);
  274. /*
  275. * Not in public headers as this is not an official extension. Only used when
  276. * SSL_OP_CRYPTOPRO_TLSEXT_BUG is set.
  277. */
  278. #define TLSEXT_TYPE_cryptopro_bug 0xfde8
  279. EXT_RETURN tls_construct_stoc_cryptopro_bug(SSL *s, WPACKET *pkt,
  280. unsigned int context, X509 *x,
  281. size_t chainidx);
  282. EXT_RETURN tls_construct_stoc_psk(SSL *s, WPACKET *pkt, unsigned int context,
  283. X509 *x, size_t chainidx);
  284. /* Client Extension processing */
  285. EXT_RETURN tls_construct_ctos_renegotiate(SSL *s, WPACKET *pkt, unsigned int context,
  286. X509 *x, size_t chainidx);
  287. EXT_RETURN tls_construct_ctos_server_name(SSL *s, WPACKET *pkt, unsigned int context,
  288. X509 *x, size_t chainidx);
  289. EXT_RETURN tls_construct_ctos_maxfragmentlen(SSL *s, WPACKET *pkt, unsigned int context,
  290. X509 *x, size_t chainidx);
  291. #ifndef OPENSSL_NO_SRP
  292. EXT_RETURN tls_construct_ctos_srp(SSL *s, WPACKET *pkt, unsigned int context, X509 *x,
  293. size_t chainidx);
  294. #endif
  295. #ifndef OPENSSL_NO_EC
  296. EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,
  297. unsigned int context, X509 *x,
  298. size_t chainidx);
  299. #endif
  300. EXT_RETURN tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt,
  301. unsigned int context, X509 *x,
  302. size_t chainidx);
  303. EXT_RETURN tls_construct_ctos_early_data(SSL *s, WPACKET *pkt,
  304. unsigned int context, X509 *x,
  305. size_t chainidx);
  306. EXT_RETURN tls_construct_ctos_session_ticket(SSL *s, WPACKET *pkt,
  307. unsigned int context, X509 *x,
  308. size_t chainidx);
  309. EXT_RETURN tls_construct_ctos_sig_algs(SSL *s, WPACKET *pkt,
  310. unsigned int context, X509 *x,
  311. size_t chainidx);
  312. #ifndef OPENSSL_NO_OCSP
  313. EXT_RETURN tls_construct_ctos_status_request(SSL *s, WPACKET *pkt,
  314. unsigned int context, X509 *x,
  315. size_t chainidx);
  316. #endif
  317. #ifndef OPENSSL_NO_NEXTPROTONEG
  318. EXT_RETURN tls_construct_ctos_npn(SSL *s, WPACKET *pkt, unsigned int context,
  319. X509 *x, size_t chainidx);
  320. #endif
  321. EXT_RETURN tls_construct_ctos_alpn(SSL *s, WPACKET *pkt, unsigned int context,
  322. X509 *x, size_t chainidx);
  323. #ifndef OPENSSL_NO_SRTP
  324. EXT_RETURN tls_construct_ctos_use_srtp(SSL *s, WPACKET *pkt, unsigned int context,
  325. X509 *x, size_t chainidx);
  326. #endif
  327. EXT_RETURN tls_construct_ctos_etm(SSL *s, WPACKET *pkt, unsigned int context,
  328. X509 *x, size_t chainidx);
  329. #ifndef OPENSSL_NO_CT
  330. EXT_RETURN tls_construct_ctos_sct(SSL *s, WPACKET *pkt, unsigned int context,
  331. X509 *x, size_t chainidx);
  332. #endif
  333. EXT_RETURN tls_construct_ctos_ems(SSL *s, WPACKET *pkt, unsigned int context,
  334. X509 *x, size_t chainidx);
  335. EXT_RETURN tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt,
  336. unsigned int context, X509 *x,
  337. size_t chainidx);
  338. EXT_RETURN tls_construct_ctos_key_share(SSL *s, WPACKET *pkt,
  339. unsigned int context, X509 *x,
  340. size_t chainidx);
  341. EXT_RETURN tls_construct_ctos_psk_kex_modes(SSL *s, WPACKET *pkt,
  342. unsigned int context, X509 *x,
  343. size_t chainidx);
  344. EXT_RETURN tls_construct_ctos_cookie(SSL *s, WPACKET *pkt, unsigned int context,
  345. X509 *x, size_t chainidx);
  346. EXT_RETURN tls_construct_ctos_padding(SSL *s, WPACKET *pkt,
  347. unsigned int context, X509 *x,
  348. size_t chainidx);
  349. EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
  350. X509 *x, size_t chainidx);
  351. EXT_RETURN tls_construct_ctos_post_handshake_auth(SSL *s, WPACKET *pkt, unsigned int context,
  352. X509 *x, size_t chainidx);
  353. int tls_parse_stoc_renegotiate(SSL *s, PACKET *pkt, unsigned int context,
  354. X509 *x, size_t chainidx);
  355. int tls_parse_stoc_server_name(SSL *s, PACKET *pkt, unsigned int context,
  356. X509 *x, size_t chainidx);
  357. int tls_parse_stoc_early_data(SSL *s, PACKET *pkt, unsigned int context,
  358. X509 *x, size_t chainidx);
  359. int tls_parse_stoc_maxfragmentlen(SSL *s, PACKET *pkt, unsigned int context,
  360. X509 *x, size_t chainidx);
  361. #ifndef OPENSSL_NO_EC
  362. int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
  363. X509 *x, size_t chainidx);
  364. #endif
  365. int tls_parse_stoc_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
  366. X509 *x, size_t chainidx);
  367. #ifndef OPENSSL_NO_OCSP
  368. int tls_parse_stoc_status_request(SSL *s, PACKET *pkt, unsigned int context,
  369. X509 *x, size_t chainidx);
  370. #endif
  371. #ifndef OPENSSL_NO_CT
  372. int tls_parse_stoc_sct(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  373. size_t chainidx);
  374. #endif
  375. #ifndef OPENSSL_NO_NEXTPROTONEG
  376. int tls_parse_stoc_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  377. size_t chainidx);
  378. #endif
  379. int tls_parse_stoc_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  380. size_t chainidx);
  381. #ifndef OPENSSL_NO_SRTP
  382. int tls_parse_stoc_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  383. size_t chainidx);
  384. #endif
  385. int tls_parse_stoc_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  386. size_t chainidx);
  387. int tls_parse_stoc_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  388. size_t chainidx);
  389. int tls_parse_stoc_supported_versions(SSL *s, PACKET *pkt, unsigned int context,
  390. X509 *x, size_t chainidx);
  391. int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  392. size_t chainidx);
  393. int tls_parse_stoc_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  394. size_t chainidx);
  395. int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  396. size_t chainidx);
  397. int tls_handle_alpn(SSL *s);
  398. int tls13_save_handshake_digest_for_pha(SSL *s);
  399. int tls13_restore_handshake_digest_for_pha(SSL *s);