statem_local.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. /*
  2. * Copyright 2015-2018 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. /* 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 tls_validate_all_contexts(SSL *s, unsigned int thisctx,
  147. RAW_EXTENSION *exts);
  148. __owur int extension_is_relevant(SSL *s, unsigned int extctx,
  149. unsigned int thisctx);
  150. __owur int tls_collect_extensions(SSL *s, PACKET *packet, unsigned int context,
  151. RAW_EXTENSION **res, size_t *len, int init);
  152. __owur int tls_parse_extension(SSL *s, TLSEXT_INDEX idx, int context,
  153. RAW_EXTENSION *exts, X509 *x, size_t chainidx);
  154. __owur int tls_parse_all_extensions(SSL *s, int context, RAW_EXTENSION *exts,
  155. X509 *x, size_t chainidx, 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);
  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);
  168. int tls_parse_ctos_server_name(SSL *s, PACKET *pkt, unsigned int context,
  169. X509 *x, size_t chainidx);
  170. int tls_parse_ctos_maxfragmentlen(SSL *s, PACKET *pkt, unsigned int context,
  171. X509 *x, size_t chainidx);
  172. #ifndef OPENSSL_NO_SRP
  173. int tls_parse_ctos_srp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  174. size_t chainidx);
  175. #endif
  176. int tls_parse_ctos_early_data(SSL *s, PACKET *pkt, unsigned int context,
  177. X509 *x, size_t chainidx);
  178. #ifndef OPENSSL_NO_EC
  179. int tls_parse_ctos_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
  180. X509 *x, size_t chainidx);
  181. #endif
  182. int tls_parse_ctos_supported_groups(SSL *s, PACKET *pkt, unsigned int context,
  183. X509 *x, size_t chainidxl);
  184. int tls_parse_ctos_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
  185. X509 *x, size_t chainidx);
  186. int tls_parse_ctos_sig_algs_cert(SSL *s, PACKET *pkt, unsigned int context,
  187. X509 *x, size_t chainidx);
  188. int tls_parse_ctos_sig_algs(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  189. size_t chainidx);
  190. #ifndef OPENSSL_NO_OCSP
  191. int tls_parse_ctos_status_request(SSL *s, PACKET *pkt, unsigned int context,
  192. X509 *x, size_t chainidx);
  193. #endif
  194. #ifndef OPENSSL_NO_NEXTPROTONEG
  195. int tls_parse_ctos_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  196. size_t chainidx);
  197. #endif
  198. int tls_parse_ctos_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  199. size_t chainidx);
  200. #ifndef OPENSSL_NO_SRTP
  201. int tls_parse_ctos_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  202. size_t chainidx);
  203. #endif
  204. int tls_parse_ctos_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  205. size_t chainidx);
  206. int tls_parse_ctos_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  207. size_t chainidx);
  208. int tls_parse_ctos_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  209. size_t chainidx);
  210. int tls_parse_ctos_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  211. size_t chainidx);
  212. int tls_parse_ctos_psk_kex_modes(SSL *s, PACKET *pkt, unsigned int context,
  213. X509 *x, size_t chainidx);
  214. int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  215. size_t chainidx);
  216. int tls_parse_ctos_post_handshake_auth(SSL *, PACKET *pkt, unsigned int context,
  217. X509 *x, size_t chainidx);
  218. EXT_RETURN tls_construct_stoc_renegotiate(SSL *s, WPACKET *pkt,
  219. unsigned int context, X509 *x,
  220. size_t chainidx);
  221. EXT_RETURN tls_construct_stoc_server_name(SSL *s, WPACKET *pkt,
  222. unsigned int context, X509 *x,
  223. size_t chainidx);
  224. EXT_RETURN tls_construct_stoc_early_data(SSL *s, WPACKET *pkt,
  225. unsigned int context, X509 *x,
  226. size_t chainidx);
  227. EXT_RETURN tls_construct_stoc_maxfragmentlen(SSL *s, WPACKET *pkt,
  228. unsigned int context, X509 *x,
  229. size_t chainidx);
  230. #ifndef OPENSSL_NO_EC
  231. EXT_RETURN tls_construct_stoc_ec_pt_formats(SSL *s, WPACKET *pkt,
  232. unsigned int context, X509 *x,
  233. size_t chainidx);
  234. #endif
  235. EXT_RETURN tls_construct_stoc_supported_groups(SSL *s, WPACKET *pkt,
  236. unsigned int context, X509 *x,
  237. size_t chainidx);
  238. EXT_RETURN tls_construct_stoc_session_ticket(SSL *s, WPACKET *pkt,
  239. unsigned int context, X509 *x,
  240. size_t chainidx);
  241. #ifndef OPENSSL_NO_OCSP
  242. EXT_RETURN tls_construct_stoc_status_request(SSL *s, WPACKET *pkt,
  243. unsigned int context, X509 *x,
  244. size_t chainidx);
  245. #endif
  246. #ifndef OPENSSL_NO_NEXTPROTONEG
  247. EXT_RETURN tls_construct_stoc_next_proto_neg(SSL *s, WPACKET *pkt,
  248. unsigned int context, X509 *x,
  249. size_t chainidx);
  250. #endif
  251. EXT_RETURN tls_construct_stoc_alpn(SSL *s, WPACKET *pkt, unsigned int context,
  252. X509 *x, size_t chainidx);
  253. #ifndef OPENSSL_NO_SRTP
  254. EXT_RETURN tls_construct_stoc_use_srtp(SSL *s, WPACKET *pkt, unsigned int context,
  255. X509 *x, size_t chainidx);
  256. #endif
  257. EXT_RETURN tls_construct_stoc_etm(SSL *s, WPACKET *pkt, unsigned int context,
  258. X509 *x, size_t chainidx);
  259. EXT_RETURN tls_construct_stoc_ems(SSL *s, WPACKET *pkt, unsigned int context,
  260. X509 *x, size_t chainidx);
  261. EXT_RETURN tls_construct_stoc_supported_versions(SSL *s, WPACKET *pkt,
  262. unsigned int context, X509 *x,
  263. size_t chainidx);
  264. EXT_RETURN tls_construct_stoc_key_share(SSL *s, WPACKET *pkt,
  265. unsigned int context, X509 *x,
  266. size_t chainidx);
  267. EXT_RETURN tls_construct_stoc_cookie(SSL *s, WPACKET *pkt, unsigned int context,
  268. X509 *x, size_t chainidx);
  269. /*
  270. * Not in public headers as this is not an official extension. Only used when
  271. * SSL_OP_CRYPTOPRO_TLSEXT_BUG is set.
  272. */
  273. #define TLSEXT_TYPE_cryptopro_bug 0xfde8
  274. EXT_RETURN tls_construct_stoc_cryptopro_bug(SSL *s, WPACKET *pkt,
  275. unsigned int context, X509 *x,
  276. size_t chainidx);
  277. EXT_RETURN tls_construct_stoc_psk(SSL *s, WPACKET *pkt, unsigned int context,
  278. X509 *x, size_t chainidx);
  279. /* Client Extension processing */
  280. EXT_RETURN tls_construct_ctos_renegotiate(SSL *s, WPACKET *pkt, unsigned int context,
  281. X509 *x, size_t chainidx);
  282. EXT_RETURN tls_construct_ctos_server_name(SSL *s, WPACKET *pkt, unsigned int context,
  283. X509 *x, size_t chainidx);
  284. EXT_RETURN tls_construct_ctos_maxfragmentlen(SSL *s, WPACKET *pkt, unsigned int context,
  285. X509 *x, size_t chainidx);
  286. #ifndef OPENSSL_NO_SRP
  287. EXT_RETURN tls_construct_ctos_srp(SSL *s, WPACKET *pkt, unsigned int context, X509 *x,
  288. size_t chainidx);
  289. #endif
  290. #ifndef OPENSSL_NO_EC
  291. EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,
  292. unsigned int context, X509 *x,
  293. size_t chainidx);
  294. #endif
  295. EXT_RETURN tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt,
  296. unsigned int context, X509 *x,
  297. size_t chainidx);
  298. EXT_RETURN tls_construct_ctos_early_data(SSL *s, WPACKET *pkt,
  299. unsigned int context, X509 *x,
  300. size_t chainidx);
  301. EXT_RETURN tls_construct_ctos_session_ticket(SSL *s, WPACKET *pkt,
  302. unsigned int context, X509 *x,
  303. size_t chainidx);
  304. EXT_RETURN tls_construct_ctos_sig_algs(SSL *s, WPACKET *pkt,
  305. unsigned int context, X509 *x,
  306. size_t chainidx);
  307. #ifndef OPENSSL_NO_OCSP
  308. EXT_RETURN tls_construct_ctos_status_request(SSL *s, WPACKET *pkt,
  309. unsigned int context, X509 *x,
  310. size_t chainidx);
  311. #endif
  312. #ifndef OPENSSL_NO_NEXTPROTONEG
  313. EXT_RETURN tls_construct_ctos_npn(SSL *s, WPACKET *pkt, unsigned int context,
  314. X509 *x, size_t chainidx);
  315. #endif
  316. EXT_RETURN tls_construct_ctos_alpn(SSL *s, WPACKET *pkt, unsigned int context,
  317. X509 *x, size_t chainidx);
  318. #ifndef OPENSSL_NO_SRTP
  319. EXT_RETURN tls_construct_ctos_use_srtp(SSL *s, WPACKET *pkt, unsigned int context,
  320. X509 *x, size_t chainidx);
  321. #endif
  322. EXT_RETURN tls_construct_ctos_etm(SSL *s, WPACKET *pkt, unsigned int context,
  323. X509 *x, size_t chainidx);
  324. #ifndef OPENSSL_NO_CT
  325. EXT_RETURN tls_construct_ctos_sct(SSL *s, WPACKET *pkt, unsigned int context,
  326. X509 *x, size_t chainidx);
  327. #endif
  328. EXT_RETURN tls_construct_ctos_ems(SSL *s, WPACKET *pkt, unsigned int context,
  329. X509 *x, size_t chainidx);
  330. EXT_RETURN tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt,
  331. unsigned int context, X509 *x,
  332. size_t chainidx);
  333. EXT_RETURN tls_construct_ctos_key_share(SSL *s, WPACKET *pkt,
  334. unsigned int context, X509 *x,
  335. size_t chainidx);
  336. EXT_RETURN tls_construct_ctos_psk_kex_modes(SSL *s, WPACKET *pkt,
  337. unsigned int context, X509 *x,
  338. size_t chainidx);
  339. EXT_RETURN tls_construct_ctos_cookie(SSL *s, WPACKET *pkt, unsigned int context,
  340. X509 *x, size_t chainidx);
  341. EXT_RETURN tls_construct_ctos_padding(SSL *s, WPACKET *pkt,
  342. unsigned int context, X509 *x,
  343. size_t chainidx);
  344. EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,
  345. X509 *x, size_t chainidx);
  346. EXT_RETURN tls_construct_ctos_post_handshake_auth(SSL *s, WPACKET *pkt, unsigned int context,
  347. X509 *x, size_t chainidx);
  348. int tls_parse_stoc_renegotiate(SSL *s, PACKET *pkt, unsigned int context,
  349. X509 *x, size_t chainidx);
  350. int tls_parse_stoc_server_name(SSL *s, PACKET *pkt, unsigned int context,
  351. X509 *x, size_t chainidx);
  352. int tls_parse_stoc_early_data(SSL *s, PACKET *pkt, unsigned int context,
  353. X509 *x, size_t chainidx);
  354. int tls_parse_stoc_maxfragmentlen(SSL *s, PACKET *pkt, unsigned int context,
  355. X509 *x, size_t chainidx);
  356. #ifndef OPENSSL_NO_EC
  357. int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
  358. X509 *x, size_t chainidx);
  359. #endif
  360. int tls_parse_stoc_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
  361. X509 *x, size_t chainidx);
  362. #ifndef OPENSSL_NO_OCSP
  363. int tls_parse_stoc_status_request(SSL *s, PACKET *pkt, unsigned int context,
  364. X509 *x, size_t chainidx);
  365. #endif
  366. #ifndef OPENSSL_NO_CT
  367. int tls_parse_stoc_sct(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  368. size_t chainidx);
  369. #endif
  370. #ifndef OPENSSL_NO_NEXTPROTONEG
  371. int tls_parse_stoc_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  372. size_t chainidx);
  373. #endif
  374. int tls_parse_stoc_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  375. size_t chainidx);
  376. #ifndef OPENSSL_NO_SRTP
  377. int tls_parse_stoc_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  378. size_t chainidx);
  379. #endif
  380. int tls_parse_stoc_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  381. size_t chainidx);
  382. int tls_parse_stoc_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  383. size_t chainidx);
  384. int tls_parse_stoc_supported_versions(SSL *s, PACKET *pkt, unsigned int context,
  385. X509 *x, size_t chainidx);
  386. int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  387. size_t chainidx);
  388. int tls_parse_stoc_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  389. size_t chainidx);
  390. int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
  391. size_t chainidx);
  392. int tls_handle_alpn(SSL *s);
  393. int tls13_save_handshake_digest_for_pha(SSL *s);
  394. int tls13_restore_handshake_digest_for_pha(SSL *s);