statem_locl.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. /*
  2. * Copyright 2015-2018 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. extern const unsigned char hrrrandom[];
  33. /* Message processing return codes */
  34. typedef enum {
  35. /* Something bad happened */
  36. MSG_PROCESS_ERROR,
  37. /* We've finished reading - swap to writing */
  38. MSG_PROCESS_FINISHED_READING,
  39. /*
  40. * We've completed the main processing of this message but there is some
  41. * post processing to be done.
  42. */
  43. MSG_PROCESS_CONTINUE_PROCESSING,
  44. /* We've finished this message - read the next message */
  45. MSG_PROCESS_CONTINUE_READING
  46. } MSG_PROCESS_RETURN;
  47. typedef int (*confunc_f) (SSL *s, WPACKET *pkt);
  48. int ssl3_take_mac(SSL *s);
  49. int check_in_list(SSL *s, uint16_t group_id, const uint16_t *groups,
  50. size_t num_groups, int checkallow);
  51. int create_synthetic_message_hash(SSL *s, const unsigned char *hashval,
  52. size_t hashlen, const unsigned char *hrr,
  53. size_t hrrlen);
  54. int parse_ca_names(SSL *s, PACKET *pkt);
  55. int construct_ca_names(SSL *s, WPACKET *pkt);
  56. size_t construct_key_exchange_tbs(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);
  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. int stop);
  97. __owur WORK_STATE dtls_wait_for_dry(SSL *s);
  98. /* some client-only functions */
  99. __owur int tls_construct_client_hello(SSL *s, WPACKET *pkt);
  100. __owur MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt);
  101. __owur MSG_PROCESS_RETURN tls_process_certificate_request(SSL *s, PACKET *pkt);
  102. __owur MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL *s, PACKET *pkt);
  103. __owur int tls_process_cert_status_body(SSL *s, PACKET *pkt);
  104. __owur MSG_PROCESS_RETURN tls_process_cert_status(SSL *s, PACKET *pkt);
  105. __owur MSG_PROCESS_RETURN tls_process_server_done(SSL *s, PACKET *pkt);
  106. __owur int tls_construct_cert_verify(SSL *s, WPACKET *pkt);
  107. __owur WORK_STATE tls_prepare_client_certificate(SSL *s, WORK_STATE wst);
  108. __owur int tls_construct_client_certificate(SSL *s, WPACKET *pkt);
  109. __owur int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey);
  110. __owur int tls_construct_client_key_exchange(SSL *s, WPACKET *pkt);
  111. __owur int tls_client_key_exchange_post_work(SSL *s);
  112. __owur int tls_construct_cert_status_body(SSL *s, WPACKET *pkt);
  113. __owur int tls_construct_cert_status(SSL *s, WPACKET *pkt);
  114. __owur MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt);
  115. __owur MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt);
  116. __owur int ssl3_check_cert_and_algorithm(SSL *s);
  117. #ifndef OPENSSL_NO_NEXTPROTONEG
  118. __owur int tls_construct_next_proto(SSL *s, WPACKET *pkt);
  119. #endif
  120. __owur MSG_PROCESS_RETURN tls_process_hello_req(SSL *s, PACKET *pkt);
  121. __owur MSG_PROCESS_RETURN dtls_process_hello_verify(SSL *s, PACKET *pkt);
  122. __owur int tls_construct_end_of_early_data(SSL *s, WPACKET *pkt);
  123. /* some server-only functions */
  124. __owur MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt);
  125. __owur WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst);
  126. __owur int tls_construct_server_hello(SSL *s, WPACKET *pkt);
  127. __owur int dtls_construct_hello_verify_request(SSL *s, WPACKET *pkt);
  128. __owur int tls_construct_server_certificate(SSL *s, WPACKET *pkt);
  129. __owur int tls_construct_server_key_exchange(SSL *s, WPACKET *pkt);
  130. __owur int tls_construct_certificate_request(SSL *s, WPACKET *pkt);
  131. __owur int tls_construct_server_done(SSL *s, WPACKET *pkt);
  132. __owur MSG_PROCESS_RETURN tls_process_client_certificate(SSL *s, PACKET *pkt);
  133. __owur MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL *s, PACKET *pkt);
  134. __owur WORK_STATE tls_post_process_client_key_exchange(SSL *s, WORK_STATE wst);
  135. __owur MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt);
  136. #ifndef OPENSSL_NO_NEXTPROTONEG
  137. __owur MSG_PROCESS_RETURN tls_process_next_proto(SSL *s, PACKET *pkt);
  138. #endif
  139. __owur int tls_construct_new_session_ticket(SSL *s, WPACKET *pkt);
  140. MSG_PROCESS_RETURN tls_process_end_of_early_data(SSL *s, PACKET *pkt);
  141. /* Extension processing */
  142. typedef enum ext_return_en {
  143. EXT_RETURN_FAIL,
  144. EXT_RETURN_SENT,
  145. EXT_RETURN_NOT_SENT
  146. } EXT_RETURN;
  147. __owur int tls_validate_all_contexts(SSL *s, unsigned int thisctx,
  148. RAW_EXTENSION *exts);
  149. __owur int extension_is_relevant(SSL *s, unsigned int extctx,
  150. unsigned int thisctx);
  151. __owur int tls_collect_extensions(SSL *s, PACKET *packet, unsigned int context,
  152. RAW_EXTENSION **res, size_t *len, int init);
  153. __owur int tls_parse_extension(SSL *s, TLSEXT_INDEX idx, int context,
  154. RAW_EXTENSION *exts, X509 *x, size_t chainidx);
  155. __owur int tls_parse_all_extensions(SSL *s, int context, RAW_EXTENSION *exts,
  156. X509 *x, size_t chainidx, int fin);
  157. __owur int should_add_extension(SSL *s, unsigned int extctx,
  158. unsigned int thisctx, int max_version);
  159. __owur int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context,
  160. X509 *x, size_t chainidx);
  161. __owur int tls_psk_do_binder(SSL *s, const EVP_MD *md,
  162. const unsigned char *msgstart,
  163. size_t binderoffset, const unsigned char *binderin,
  164. unsigned char *binderout,
  165. SSL_SESSION *sess, int sign, int external);
  166. /* Server Extension processing */
  167. int tls_parse_ctos_renegotiate(SSL *s, PACKET *pkt, unsigned int context,
  168. X509 *x, size_t chainidx);
  169. int tls_parse_ctos_server_name(SSL *s, PACKET *pkt, unsigned int context,
  170. X509 *x, size_t chainidx);
  171. int tls_parse_ctos_maxfragmentlen(SSL *s, PACKET *pkt, unsigned int context,
  172. X509 *x, size_t chainidx);
  173. #ifndef OPENSSL_NO_SRP
  174. int tls_parse_ctos_srp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  175. size_t chainidx);
  176. #endif
  177. int tls_parse_ctos_early_data(SSL *s, PACKET *pkt, unsigned int context,
  178. X509 *x, size_t chainidx);
  179. #ifndef OPENSSL_NO_EC
  180. int tls_parse_ctos_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
  181. X509 *x, size_t chainidx);
  182. int tls_parse_ctos_supported_groups(SSL *s, PACKET *pkt, unsigned int context,
  183. X509 *x, size_t chainidxl);
  184. #endif
  185. int tls_parse_ctos_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
  186. X509 *x, size_t chainidx);
  187. int tls_parse_ctos_sig_algs_cert(SSL *s, PACKET *pkt, unsigned int context,
  188. X509 *x, size_t chainidx);
  189. int tls_parse_ctos_sig_algs(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  190. size_t chainidx);
  191. #ifndef OPENSSL_NO_OCSP
  192. int tls_parse_ctos_status_request(SSL *s, PACKET *pkt, unsigned int context,
  193. X509 *x, size_t chainidx);
  194. #endif
  195. #ifndef OPENSSL_NO_NEXTPROTONEG
  196. int tls_parse_ctos_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  197. size_t chainidx);
  198. #endif
  199. int tls_parse_ctos_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  200. size_t chainidx);
  201. #ifndef OPENSSL_NO_SRTP
  202. int tls_parse_ctos_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  203. size_t chainidx);
  204. #endif
  205. int tls_parse_ctos_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  206. size_t chainidx);
  207. int tls_parse_ctos_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  208. size_t chainidx);
  209. int tls_parse_ctos_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  210. size_t chainidx);
  211. int tls_parse_ctos_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  212. size_t chainidx);
  213. int tls_parse_ctos_psk_kex_modes(SSL *s, PACKET *pkt, unsigned int context,
  214. X509 *x, size_t chainidx);
  215. int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  216. size_t chainidx);
  217. int tls_parse_ctos_post_handshake_auth(SSL *, PACKET *pkt, unsigned int context,
  218. X509 *x, size_t chainidx);
  219. EXT_RETURN tls_construct_stoc_renegotiate(SSL *s, WPACKET *pkt,
  220. unsigned int context, X509 *x,
  221. size_t chainidx);
  222. EXT_RETURN tls_construct_stoc_server_name(SSL *s, WPACKET *pkt,
  223. unsigned int context, X509 *x,
  224. size_t chainidx);
  225. EXT_RETURN tls_construct_stoc_early_data(SSL *s, WPACKET *pkt,
  226. unsigned int context, X509 *x,
  227. size_t chainidx);
  228. EXT_RETURN tls_construct_stoc_maxfragmentlen(SSL *s, WPACKET *pkt,
  229. unsigned int context, X509 *x,
  230. size_t chainidx);
  231. #ifndef OPENSSL_NO_EC
  232. EXT_RETURN tls_construct_stoc_ec_pt_formats(SSL *s, WPACKET *pkt,
  233. unsigned int context, X509 *x,
  234. size_t chainidx);
  235. #endif
  236. EXT_RETURN tls_construct_stoc_supported_groups(SSL *s, WPACKET *pkt,
  237. unsigned int context, X509 *x,
  238. size_t chainidx);
  239. EXT_RETURN tls_construct_stoc_session_ticket(SSL *s, WPACKET *pkt,
  240. unsigned int context, X509 *x,
  241. size_t chainidx);
  242. #ifndef OPENSSL_NO_OCSP
  243. EXT_RETURN tls_construct_stoc_status_request(SSL *s, WPACKET *pkt,
  244. unsigned int context, X509 *x,
  245. size_t chainidx);
  246. #endif
  247. #ifndef OPENSSL_NO_NEXTPROTONEG
  248. EXT_RETURN tls_construct_stoc_next_proto_neg(SSL *s, WPACKET *pkt,
  249. unsigned int context, X509 *x,
  250. size_t chainidx);
  251. #endif
  252. EXT_RETURN tls_construct_stoc_alpn(SSL *s, WPACKET *pkt, unsigned int context,
  253. X509 *x, size_t chainidx);
  254. #ifndef OPENSSL_NO_SRTP
  255. EXT_RETURN tls_construct_stoc_use_srtp(SSL *s, WPACKET *pkt, unsigned int context,
  256. X509 *x, size_t chainidx);
  257. #endif
  258. EXT_RETURN tls_construct_stoc_etm(SSL *s, WPACKET *pkt, unsigned int context,
  259. X509 *x, size_t chainidx);
  260. EXT_RETURN tls_construct_stoc_ems(SSL *s, WPACKET *pkt, unsigned int context,
  261. X509 *x, size_t chainidx);
  262. EXT_RETURN tls_construct_stoc_supported_versions(SSL *s, WPACKET *pkt,
  263. unsigned int context, X509 *x,
  264. size_t chainidx);
  265. EXT_RETURN tls_construct_stoc_key_share(SSL *s, WPACKET *pkt,
  266. unsigned int context, X509 *x,
  267. size_t chainidx);
  268. EXT_RETURN tls_construct_stoc_cookie(SSL *s, WPACKET *pkt, unsigned int context,
  269. X509 *x, size_t chainidx);
  270. /*
  271. * Not in public headers as this is not an official extension. Only used when
  272. * SSL_OP_CRYPTOPRO_TLSEXT_BUG is set.
  273. */
  274. #define TLSEXT_TYPE_cryptopro_bug 0xfde8
  275. EXT_RETURN tls_construct_stoc_cryptopro_bug(SSL *s, WPACKET *pkt,
  276. unsigned int context, X509 *x,
  277. size_t chainidx);
  278. EXT_RETURN tls_construct_stoc_psk(SSL *s, WPACKET *pkt, unsigned int context,
  279. X509 *x, size_t chainidx);
  280. /* Client Extension processing */
  281. EXT_RETURN tls_construct_ctos_renegotiate(SSL *s, WPACKET *pkt, unsigned int context,
  282. X509 *x, size_t chainidx);
  283. EXT_RETURN tls_construct_ctos_server_name(SSL *s, WPACKET *pkt, unsigned int context,
  284. X509 *x, size_t chainidx);
  285. EXT_RETURN tls_construct_ctos_maxfragmentlen(SSL *s, WPACKET *pkt, unsigned int context,
  286. X509 *x, size_t chainidx);
  287. #ifndef OPENSSL_NO_SRP
  288. EXT_RETURN tls_construct_ctos_srp(SSL *s, WPACKET *pkt, unsigned int context, X509 *x,
  289. size_t chainidx);
  290. #endif
  291. #ifndef OPENSSL_NO_EC
  292. EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,
  293. unsigned int context, X509 *x,
  294. size_t chainidx);
  295. EXT_RETURN tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt,
  296. unsigned int context, X509 *x,
  297. size_t chainidx);
  298. #endif
  299. EXT_RETURN tls_construct_ctos_early_data(SSL *s, WPACKET *pkt,
  300. unsigned int context, X509 *x,
  301. size_t chainidx);
  302. EXT_RETURN tls_construct_ctos_session_ticket(SSL *s, WPACKET *pkt,
  303. unsigned int context, X509 *x,
  304. size_t chainidx);
  305. EXT_RETURN tls_construct_ctos_sig_algs(SSL *s, WPACKET *pkt,
  306. unsigned int context, X509 *x,
  307. size_t chainidx);
  308. #ifndef OPENSSL_NO_OCSP
  309. EXT_RETURN tls_construct_ctos_status_request(SSL *s, WPACKET *pkt,
  310. unsigned int context, X509 *x,
  311. size_t chainidx);
  312. #endif
  313. #ifndef OPENSSL_NO_NEXTPROTONEG
  314. EXT_RETURN tls_construct_ctos_npn(SSL *s, WPACKET *pkt, unsigned int context,
  315. X509 *x, size_t chainidx);
  316. #endif
  317. EXT_RETURN tls_construct_ctos_alpn(SSL *s, WPACKET *pkt, unsigned int context,
  318. X509 *x, size_t chainidx);
  319. #ifndef OPENSSL_NO_SRTP
  320. EXT_RETURN tls_construct_ctos_use_srtp(SSL *s, WPACKET *pkt, unsigned int context,
  321. X509 *x, size_t chainidx);
  322. #endif
  323. EXT_RETURN tls_construct_ctos_etm(SSL *s, WPACKET *pkt, unsigned int context,
  324. X509 *x, size_t chainidx);
  325. #ifndef OPENSSL_NO_CT
  326. EXT_RETURN tls_construct_ctos_sct(SSL *s, WPACKET *pkt, unsigned int context,
  327. X509 *x, size_t chainidx);
  328. #endif
  329. EXT_RETURN tls_construct_ctos_ems(SSL *s, WPACKET *pkt, unsigned int context,
  330. X509 *x, size_t chainidx);
  331. EXT_RETURN tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt,
  332. unsigned int context, X509 *x,
  333. size_t chainidx);
  334. EXT_RETURN tls_construct_ctos_key_share(SSL *s, WPACKET *pkt,
  335. unsigned int context, X509 *x,
  336. size_t chainidx);
  337. EXT_RETURN tls_construct_ctos_psk_kex_modes(SSL *s, WPACKET *pkt,
  338. unsigned int context, X509 *x,
  339. size_t chainidx);
  340. EXT_RETURN tls_construct_ctos_cookie(SSL *s, WPACKET *pkt, unsigned int context,
  341. X509 *x, size_t chainidx);
  342. EXT_RETURN tls_construct_ctos_padding(SSL *s, WPACKET *pkt,
  343. unsigned int context, X509 *x,
  344. size_t chainidx);
  345. EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
  346. X509 *x, size_t chainidx);
  347. EXT_RETURN tls_construct_ctos_post_handshake_auth(SSL *s, WPACKET *pkt, unsigned int context,
  348. X509 *x, size_t chainidx);
  349. int tls_parse_stoc_renegotiate(SSL *s, PACKET *pkt, unsigned int context,
  350. X509 *x, size_t chainidx);
  351. int tls_parse_stoc_server_name(SSL *s, PACKET *pkt, unsigned int context,
  352. X509 *x, size_t chainidx);
  353. int tls_parse_stoc_early_data(SSL *s, PACKET *pkt, unsigned int context,
  354. X509 *x, size_t chainidx);
  355. int tls_parse_stoc_maxfragmentlen(SSL *s, PACKET *pkt, unsigned int context,
  356. X509 *x, size_t chainidx);
  357. #ifndef OPENSSL_NO_EC
  358. int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
  359. X509 *x, size_t chainidx);
  360. #endif
  361. int tls_parse_stoc_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
  362. X509 *x, size_t chainidx);
  363. #ifndef OPENSSL_NO_OCSP
  364. int tls_parse_stoc_status_request(SSL *s, PACKET *pkt, unsigned int context,
  365. X509 *x, size_t chainidx);
  366. #endif
  367. #ifndef OPENSSL_NO_CT
  368. int tls_parse_stoc_sct(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  369. size_t chainidx);
  370. #endif
  371. #ifndef OPENSSL_NO_NEXTPROTONEG
  372. int tls_parse_stoc_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  373. size_t chainidx);
  374. #endif
  375. int tls_parse_stoc_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  376. size_t chainidx);
  377. #ifndef OPENSSL_NO_SRTP
  378. int tls_parse_stoc_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  379. size_t chainidx);
  380. #endif
  381. int tls_parse_stoc_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  382. size_t chainidx);
  383. int tls_parse_stoc_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  384. size_t chainidx);
  385. int tls_parse_stoc_supported_versions(SSL *s, PACKET *pkt, unsigned int context,
  386. X509 *x, size_t chainidx);
  387. int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  388. size_t chainidx);
  389. int tls_parse_stoc_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  390. size_t chainidx);
  391. int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  392. size_t chainidx);
  393. int tls_handle_alpn(SSL *s);
  394. int tls13_save_handshake_digest_for_pha(SSL *s);
  395. int tls13_restore_handshake_digest_for_pha(SSL *s);