statem_local.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. /*
  2. * Copyright 2015-2022 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 HELLO_RETRY_REQUEST_MAX_LENGTH 20000
  20. #define ENCRYPTED_EXTENSIONS_MAX_LENGTH 20000
  21. #define SESSION_TICKET_MAX_LENGTH_TLS13 131338
  22. #define SESSION_TICKET_MAX_LENGTH_TLS12 65541
  23. #define SERVER_KEY_EXCH_MAX_LENGTH 102400
  24. #define SERVER_HELLO_DONE_MAX_LENGTH 0
  25. #define KEY_UPDATE_MAX_LENGTH 1
  26. #define CCS_MAX_LENGTH 1
  27. /* Max ServerHello size permitted by RFC 8446 */
  28. #define SERVER_HELLO_MAX_LENGTH 65607
  29. /* Max should actually be 36 but we are generous */
  30. #define FINISHED_MAX_LENGTH 64
  31. /* Dummy message type */
  32. #define SSL3_MT_DUMMY -1
  33. extern const unsigned char hrrrandom[];
  34. /* Message processing return codes */
  35. typedef enum {
  36. /* Something bad happened */
  37. MSG_PROCESS_ERROR,
  38. /* We've finished reading - swap to writing */
  39. MSG_PROCESS_FINISHED_READING,
  40. /*
  41. * We've completed the main processing of this message but there is some
  42. * post processing to be done.
  43. */
  44. MSG_PROCESS_CONTINUE_PROCESSING,
  45. /* We've finished this message - read the next message */
  46. MSG_PROCESS_CONTINUE_READING
  47. } MSG_PROCESS_RETURN;
  48. typedef int (*confunc_f) (SSL_CONNECTION *s, WPACKET *pkt);
  49. int ssl3_take_mac(SSL_CONNECTION *s);
  50. int check_in_list(SSL_CONNECTION *s, uint16_t group_id, const uint16_t *groups,
  51. size_t num_groups, int checkallow);
  52. int create_synthetic_message_hash(SSL_CONNECTION *s,
  53. const unsigned char *hashval,
  54. size_t hashlen, const unsigned char *hrr,
  55. size_t hrrlen);
  56. int parse_ca_names(SSL_CONNECTION *s, PACKET *pkt);
  57. const STACK_OF(X509_NAME) *get_ca_names(SSL_CONNECTION *s);
  58. int construct_ca_names(SSL_CONNECTION *s, const STACK_OF(X509_NAME) *ca_sk,
  59. WPACKET *pkt);
  60. size_t construct_key_exchange_tbs(SSL_CONNECTION *s, unsigned char **ptbs,
  61. const void *param, size_t paramlen);
  62. /*
  63. * TLS/DTLS client state machine functions
  64. */
  65. int ossl_statem_client_read_transition(SSL_CONNECTION *s, int mt);
  66. WRITE_TRAN ossl_statem_client_write_transition(SSL_CONNECTION *s);
  67. WORK_STATE ossl_statem_client_pre_work(SSL_CONNECTION *s, WORK_STATE wst);
  68. WORK_STATE ossl_statem_client_post_work(SSL_CONNECTION *s, WORK_STATE wst);
  69. int ossl_statem_client_construct_message(SSL_CONNECTION *s,
  70. confunc_f *confunc, int *mt);
  71. size_t ossl_statem_client_max_message_size(SSL_CONNECTION *s);
  72. MSG_PROCESS_RETURN ossl_statem_client_process_message(SSL_CONNECTION *s,
  73. PACKET *pkt);
  74. WORK_STATE ossl_statem_client_post_process_message(SSL_CONNECTION *s,
  75. WORK_STATE wst);
  76. /*
  77. * TLS/DTLS server state machine functions
  78. */
  79. int ossl_statem_server_read_transition(SSL_CONNECTION *s, int mt);
  80. WRITE_TRAN ossl_statem_server_write_transition(SSL_CONNECTION *s);
  81. WORK_STATE ossl_statem_server_pre_work(SSL_CONNECTION *s, WORK_STATE wst);
  82. WORK_STATE ossl_statem_server_post_work(SSL_CONNECTION *s, WORK_STATE wst);
  83. int ossl_statem_server_construct_message(SSL_CONNECTION *s,
  84. confunc_f *confunc,int *mt);
  85. size_t ossl_statem_server_max_message_size(SSL_CONNECTION *s);
  86. MSG_PROCESS_RETURN ossl_statem_server_process_message(SSL_CONNECTION *s,
  87. PACKET *pkt);
  88. WORK_STATE ossl_statem_server_post_process_message(SSL_CONNECTION *s,
  89. WORK_STATE wst);
  90. /* Functions for getting new message data */
  91. __owur int tls_get_message_header(SSL_CONNECTION *s, int *mt);
  92. __owur int tls_get_message_body(SSL_CONNECTION *s, size_t *len);
  93. __owur int dtls_get_message(SSL_CONNECTION *s, int *mt);
  94. __owur int dtls_get_message_body(SSL_CONNECTION *s, size_t *len);
  95. /* Message construction and processing functions */
  96. __owur int tls_process_initial_server_flight(SSL_CONNECTION *s);
  97. __owur MSG_PROCESS_RETURN tls_process_change_cipher_spec(SSL_CONNECTION *s,
  98. PACKET *pkt);
  99. __owur MSG_PROCESS_RETURN tls_process_finished(SSL_CONNECTION *s, PACKET *pkt);
  100. __owur int tls_construct_change_cipher_spec(SSL_CONNECTION *s, WPACKET *pkt);
  101. __owur int dtls_construct_change_cipher_spec(SSL_CONNECTION *s, WPACKET *pkt);
  102. __owur int tls_construct_finished(SSL_CONNECTION *s, WPACKET *pkt);
  103. __owur int tls_construct_key_update(SSL_CONNECTION *s, WPACKET *pkt);
  104. __owur MSG_PROCESS_RETURN tls_process_key_update(SSL_CONNECTION *s,
  105. PACKET *pkt);
  106. __owur WORK_STATE tls_finish_handshake(SSL_CONNECTION *s, WORK_STATE wst,
  107. int clearbufs, int stop);
  108. __owur WORK_STATE dtls_wait_for_dry(SSL_CONNECTION *s);
  109. /* some client-only functions */
  110. __owur int tls_construct_client_hello(SSL_CONNECTION *s, WPACKET *pkt);
  111. __owur MSG_PROCESS_RETURN tls_process_server_hello(SSL_CONNECTION *s,
  112. PACKET *pkt);
  113. __owur MSG_PROCESS_RETURN tls_process_certificate_request(SSL_CONNECTION *s,
  114. PACKET *pkt);
  115. __owur MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL_CONNECTION *s,
  116. PACKET *pkt);
  117. __owur int tls_process_cert_status_body(SSL_CONNECTION *s, PACKET *pkt);
  118. __owur MSG_PROCESS_RETURN tls_process_cert_status(SSL_CONNECTION *s,
  119. PACKET *pkt);
  120. __owur MSG_PROCESS_RETURN tls_process_server_done(SSL_CONNECTION *s,
  121. PACKET *pkt);
  122. __owur int tls_construct_cert_verify(SSL_CONNECTION *s, WPACKET *pkt);
  123. __owur WORK_STATE tls_prepare_client_certificate(SSL_CONNECTION *s,
  124. WORK_STATE wst);
  125. __owur int tls_construct_client_certificate(SSL_CONNECTION *s, WPACKET *pkt);
  126. __owur int ssl_do_client_cert_cb(SSL_CONNECTION *s, X509 **px509,
  127. EVP_PKEY **ppkey);
  128. __owur int tls_construct_client_key_exchange(SSL_CONNECTION *s, WPACKET *pkt);
  129. __owur int tls_client_key_exchange_post_work(SSL_CONNECTION *s);
  130. __owur int tls_construct_cert_status_body(SSL_CONNECTION *s, WPACKET *pkt);
  131. __owur int tls_construct_cert_status(SSL_CONNECTION *s, WPACKET *pkt);
  132. __owur MSG_PROCESS_RETURN tls_process_key_exchange(SSL_CONNECTION *s,
  133. PACKET *pkt);
  134. __owur MSG_PROCESS_RETURN tls_process_server_certificate(SSL_CONNECTION *s,
  135. PACKET *pkt);
  136. __owur WORK_STATE tls_post_process_server_certificate(SSL_CONNECTION *s,
  137. WORK_STATE wst);
  138. __owur int ssl3_check_cert_and_algorithm(SSL_CONNECTION *s);
  139. #ifndef OPENSSL_NO_NEXTPROTONEG
  140. __owur int tls_construct_next_proto(SSL_CONNECTION *s, WPACKET *pkt);
  141. #endif
  142. __owur MSG_PROCESS_RETURN tls_process_hello_req(SSL_CONNECTION *s, PACKET *pkt);
  143. __owur MSG_PROCESS_RETURN dtls_process_hello_verify(SSL_CONNECTION *s, PACKET *pkt);
  144. __owur int tls_construct_end_of_early_data(SSL_CONNECTION *s, WPACKET *pkt);
  145. /* some server-only functions */
  146. __owur MSG_PROCESS_RETURN tls_process_client_hello(SSL_CONNECTION *s,
  147. PACKET *pkt);
  148. __owur WORK_STATE tls_post_process_client_hello(SSL_CONNECTION *s,
  149. WORK_STATE wst);
  150. __owur int tls_construct_server_hello(SSL_CONNECTION *s, WPACKET *pkt);
  151. __owur int dtls_construct_hello_verify_request(SSL_CONNECTION *s, WPACKET *pkt);
  152. __owur int tls_construct_server_certificate(SSL_CONNECTION *s, WPACKET *pkt);
  153. __owur int tls_construct_server_key_exchange(SSL_CONNECTION *s, WPACKET *pkt);
  154. __owur int tls_construct_certificate_request(SSL_CONNECTION *s, WPACKET *pkt);
  155. __owur int tls_construct_server_done(SSL_CONNECTION *s, WPACKET *pkt);
  156. __owur MSG_PROCESS_RETURN tls_process_client_certificate(SSL_CONNECTION *s,
  157. PACKET *pkt);
  158. __owur MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL_CONNECTION *s,
  159. PACKET *pkt);
  160. __owur WORK_STATE tls_post_process_client_key_exchange(SSL_CONNECTION *s,
  161. WORK_STATE wst);
  162. __owur MSG_PROCESS_RETURN tls_process_cert_verify(SSL_CONNECTION *s,
  163. PACKET *pkt);
  164. #ifndef OPENSSL_NO_NEXTPROTONEG
  165. __owur MSG_PROCESS_RETURN tls_process_next_proto(SSL_CONNECTION *s,
  166. PACKET *pkt);
  167. #endif
  168. __owur int tls_construct_new_session_ticket(SSL_CONNECTION *s, WPACKET *pkt);
  169. MSG_PROCESS_RETURN tls_process_end_of_early_data(SSL_CONNECTION *s,
  170. PACKET *pkt);
  171. #ifndef OPENSSL_NO_GOST
  172. /* These functions are used in GOST18 CKE, both for client and server */
  173. int ossl_gost18_cke_cipher_nid(const SSL_CONNECTION *s);
  174. int ossl_gost_ukm(const SSL_CONNECTION *s, unsigned char *dgst_buf);
  175. #endif
  176. /* Extension processing */
  177. typedef enum ext_return_en {
  178. EXT_RETURN_FAIL,
  179. EXT_RETURN_SENT,
  180. EXT_RETURN_NOT_SENT
  181. } EXT_RETURN;
  182. __owur int tls_validate_all_contexts(SSL_CONNECTION *s, unsigned int thisctx,
  183. RAW_EXTENSION *exts);
  184. __owur int extension_is_relevant(SSL_CONNECTION *s, unsigned int extctx,
  185. unsigned int thisctx);
  186. __owur int tls_collect_extensions(SSL_CONNECTION *s, PACKET *packet,
  187. unsigned int context,
  188. RAW_EXTENSION **res, size_t *len, int init);
  189. __owur int tls_parse_extension(SSL_CONNECTION *s, TLSEXT_INDEX idx, int context,
  190. RAW_EXTENSION *exts, X509 *x, size_t chainidx);
  191. __owur int tls_parse_all_extensions(SSL_CONNECTION *s, int context,
  192. RAW_EXTENSION *exts,
  193. X509 *x, size_t chainidx, int fin);
  194. __owur int should_add_extension(SSL_CONNECTION *s, unsigned int extctx,
  195. unsigned int thisctx, int max_version);
  196. __owur int tls_construct_extensions(SSL_CONNECTION *s, WPACKET *pkt,
  197. unsigned int context,
  198. X509 *x, size_t chainidx);
  199. __owur int tls_psk_do_binder(SSL_CONNECTION *s, const EVP_MD *md,
  200. const unsigned char *msgstart,
  201. size_t binderoffset, const unsigned char *binderin,
  202. unsigned char *binderout,
  203. SSL_SESSION *sess, int sign, int external);
  204. /* Server Extension processing */
  205. int tls_parse_ctos_renegotiate(SSL_CONNECTION *s, PACKET *pkt,
  206. unsigned int context,
  207. X509 *x, size_t chainidx);
  208. int tls_parse_ctos_server_name(SSL_CONNECTION *s, PACKET *pkt,
  209. unsigned int context,
  210. X509 *x, size_t chainidx);
  211. int tls_parse_ctos_maxfragmentlen(SSL_CONNECTION *s, PACKET *pkt,
  212. unsigned int context,
  213. X509 *x, size_t chainidx);
  214. #ifndef OPENSSL_NO_SRP
  215. int tls_parse_ctos_srp(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  216. X509 *x, size_t chainidx);
  217. #endif
  218. int tls_parse_ctos_early_data(SSL_CONNECTION *s, PACKET *pkt,
  219. unsigned int context,
  220. X509 *x, size_t chainidx);
  221. int tls_parse_ctos_ec_pt_formats(SSL_CONNECTION *s, PACKET *pkt,
  222. unsigned int context,
  223. X509 *x, size_t chainidx);
  224. int tls_parse_ctos_supported_groups(SSL_CONNECTION *s, PACKET *pkt,
  225. unsigned int context,
  226. X509 *x, size_t chainidxl);
  227. int tls_parse_ctos_session_ticket(SSL_CONNECTION *s, PACKET *pkt,
  228. unsigned int context,
  229. X509 *x, size_t chainidx);
  230. int tls_parse_ctos_sig_algs_cert(SSL_CONNECTION *s, PACKET *pkt,
  231. unsigned int context,
  232. X509 *x, size_t chainidx);
  233. int tls_parse_ctos_sig_algs(SSL_CONNECTION *s, PACKET *pkt,
  234. unsigned int context, X509 *x, size_t chainidx);
  235. #ifndef OPENSSL_NO_OCSP
  236. int tls_parse_ctos_status_request(SSL_CONNECTION *s, PACKET *pkt,
  237. unsigned int context,
  238. X509 *x, size_t chainidx);
  239. #endif
  240. #ifndef OPENSSL_NO_NEXTPROTONEG
  241. int tls_parse_ctos_npn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  242. X509 *x, size_t chainidx);
  243. #endif
  244. int tls_parse_ctos_alpn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  245. X509 *x, size_t chainidx);
  246. #ifndef OPENSSL_NO_SRTP
  247. int tls_parse_ctos_use_srtp(SSL_CONNECTION *s, PACKET *pkt,
  248. unsigned int context, X509 *x, size_t chainidx);
  249. #endif
  250. int tls_parse_ctos_etm(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  251. X509 *x, size_t chainidx);
  252. int tls_parse_ctos_key_share(SSL_CONNECTION *s, PACKET *pkt,
  253. unsigned int context, X509 *x, size_t chainidx);
  254. int tls_parse_ctos_cookie(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  255. X509 *x, size_t chainidx);
  256. int tls_parse_ctos_ems(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  257. X509 *x, size_t chainidx);
  258. int tls_parse_ctos_psk_kex_modes(SSL_CONNECTION *s, PACKET *pkt,
  259. unsigned int context,
  260. X509 *x, size_t chainidx);
  261. int tls_parse_ctos_psk(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  262. X509 *x, size_t chainidx);
  263. int tls_parse_ctos_post_handshake_auth(SSL_CONNECTION *, PACKET *pkt,
  264. unsigned int context,
  265. X509 *x, size_t chainidx);
  266. EXT_RETURN tls_construct_stoc_renegotiate(SSL_CONNECTION *s, WPACKET *pkt,
  267. unsigned int context, X509 *x,
  268. size_t chainidx);
  269. EXT_RETURN tls_construct_stoc_server_name(SSL_CONNECTION *s, WPACKET *pkt,
  270. unsigned int context, X509 *x,
  271. size_t chainidx);
  272. EXT_RETURN tls_construct_stoc_early_data(SSL_CONNECTION *s, WPACKET *pkt,
  273. unsigned int context, X509 *x,
  274. size_t chainidx);
  275. EXT_RETURN tls_construct_stoc_maxfragmentlen(SSL_CONNECTION *s, WPACKET *pkt,
  276. unsigned int context, X509 *x,
  277. size_t chainidx);
  278. EXT_RETURN tls_construct_stoc_ec_pt_formats(SSL_CONNECTION *s, WPACKET *pkt,
  279. unsigned int context, X509 *x,
  280. size_t chainidx);
  281. EXT_RETURN tls_construct_stoc_supported_groups(SSL_CONNECTION *s, WPACKET *pkt,
  282. unsigned int context, X509 *x,
  283. size_t chainidx);
  284. EXT_RETURN tls_construct_stoc_session_ticket(SSL_CONNECTION *s, WPACKET *pkt,
  285. unsigned int context, X509 *x,
  286. size_t chainidx);
  287. #ifndef OPENSSL_NO_OCSP
  288. EXT_RETURN tls_construct_stoc_status_request(SSL_CONNECTION *s, WPACKET *pkt,
  289. unsigned int context, X509 *x,
  290. size_t chainidx);
  291. #endif
  292. #ifndef OPENSSL_NO_NEXTPROTONEG
  293. EXT_RETURN tls_construct_stoc_next_proto_neg(SSL_CONNECTION *s, WPACKET *pkt,
  294. unsigned int context, X509 *x,
  295. size_t chainidx);
  296. #endif
  297. EXT_RETURN tls_construct_stoc_alpn(SSL_CONNECTION *s, WPACKET *pkt,
  298. unsigned int context,
  299. X509 *x, size_t chainidx);
  300. #ifndef OPENSSL_NO_SRTP
  301. EXT_RETURN tls_construct_stoc_use_srtp(SSL_CONNECTION *s, WPACKET *pkt,
  302. unsigned int context,
  303. X509 *x, size_t chainidx);
  304. #endif
  305. EXT_RETURN tls_construct_stoc_etm(SSL_CONNECTION *s, WPACKET *pkt,
  306. unsigned int context,
  307. X509 *x, size_t chainidx);
  308. EXT_RETURN tls_construct_stoc_ems(SSL_CONNECTION *s, WPACKET *pkt,
  309. unsigned int context,
  310. X509 *x, size_t chainidx);
  311. EXT_RETURN tls_construct_stoc_supported_versions(SSL_CONNECTION *s, WPACKET *pkt,
  312. unsigned int context, X509 *x,
  313. size_t chainidx);
  314. EXT_RETURN tls_construct_stoc_key_share(SSL_CONNECTION *s, WPACKET *pkt,
  315. unsigned int context, X509 *x,
  316. size_t chainidx);
  317. EXT_RETURN tls_construct_stoc_cookie(SSL_CONNECTION *s, WPACKET *pkt,
  318. unsigned int context,
  319. X509 *x, size_t chainidx);
  320. /*
  321. * Not in public headers as this is not an official extension. Only used when
  322. * SSL_OP_CRYPTOPRO_TLSEXT_BUG is set.
  323. */
  324. #define TLSEXT_TYPE_cryptopro_bug 0xfde8
  325. EXT_RETURN tls_construct_stoc_cryptopro_bug(SSL_CONNECTION *s, WPACKET *pkt,
  326. unsigned int context, X509 *x,
  327. size_t chainidx);
  328. EXT_RETURN tls_construct_stoc_psk(SSL_CONNECTION *s, WPACKET *pkt,
  329. unsigned int context,
  330. X509 *x, size_t chainidx);
  331. /* Client Extension processing */
  332. EXT_RETURN tls_construct_ctos_renegotiate(SSL_CONNECTION *s, WPACKET *pkt,
  333. unsigned int context,
  334. X509 *x, size_t chainidx);
  335. EXT_RETURN tls_construct_ctos_server_name(SSL_CONNECTION *s, WPACKET *pkt,
  336. unsigned int context,
  337. X509 *x, size_t chainidx);
  338. EXT_RETURN tls_construct_ctos_maxfragmentlen(SSL_CONNECTION *s, WPACKET *pkt,
  339. unsigned int context,
  340. X509 *x, size_t chainidx);
  341. #ifndef OPENSSL_NO_SRP
  342. EXT_RETURN tls_construct_ctos_srp(SSL_CONNECTION *s, WPACKET *pkt,
  343. unsigned int context, X509 *x,
  344. size_t chainidx);
  345. #endif
  346. EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL_CONNECTION *s, WPACKET *pkt,
  347. unsigned int context, X509 *x,
  348. size_t chainidx);
  349. EXT_RETURN tls_construct_ctos_supported_groups(SSL_CONNECTION *s, WPACKET *pkt,
  350. unsigned int context, X509 *x,
  351. size_t chainidx);
  352. EXT_RETURN tls_construct_ctos_early_data(SSL_CONNECTION *s, WPACKET *pkt,
  353. unsigned int context, X509 *x,
  354. size_t chainidx);
  355. EXT_RETURN tls_construct_ctos_session_ticket(SSL_CONNECTION *s, WPACKET *pkt,
  356. unsigned int context, X509 *x,
  357. size_t chainidx);
  358. EXT_RETURN tls_construct_ctos_sig_algs(SSL_CONNECTION *s, WPACKET *pkt,
  359. unsigned int context, X509 *x,
  360. size_t chainidx);
  361. #ifndef OPENSSL_NO_OCSP
  362. EXT_RETURN tls_construct_ctos_status_request(SSL_CONNECTION *s, WPACKET *pkt,
  363. unsigned int context, X509 *x,
  364. size_t chainidx);
  365. #endif
  366. #ifndef OPENSSL_NO_NEXTPROTONEG
  367. EXT_RETURN tls_construct_ctos_npn(SSL_CONNECTION *s, WPACKET *pkt,
  368. unsigned int context,
  369. X509 *x, size_t chainidx);
  370. #endif
  371. EXT_RETURN tls_construct_ctos_alpn(SSL_CONNECTION *s, WPACKET *pkt,
  372. unsigned int context,
  373. X509 *x, size_t chainidx);
  374. #ifndef OPENSSL_NO_SRTP
  375. EXT_RETURN tls_construct_ctos_use_srtp(SSL_CONNECTION *s, WPACKET *pkt,
  376. unsigned int context,
  377. X509 *x, size_t chainidx);
  378. #endif
  379. EXT_RETURN tls_construct_ctos_etm(SSL_CONNECTION *s, WPACKET *pkt,
  380. unsigned int context,
  381. X509 *x, size_t chainidx);
  382. #ifndef OPENSSL_NO_CT
  383. EXT_RETURN tls_construct_ctos_sct(SSL_CONNECTION *s, WPACKET *pkt,
  384. unsigned int context,
  385. X509 *x, size_t chainidx);
  386. #endif
  387. EXT_RETURN tls_construct_ctos_ems(SSL_CONNECTION *s, WPACKET *pkt,
  388. unsigned int context,
  389. X509 *x, size_t chainidx);
  390. EXT_RETURN tls_construct_ctos_supported_versions(SSL_CONNECTION *s, WPACKET *pkt,
  391. unsigned int context, X509 *x,
  392. size_t chainidx);
  393. EXT_RETURN tls_construct_ctos_key_share(SSL_CONNECTION *s, WPACKET *pkt,
  394. unsigned int context, X509 *x,
  395. size_t chainidx);
  396. EXT_RETURN tls_construct_ctos_psk_kex_modes(SSL_CONNECTION *s, WPACKET *pkt,
  397. unsigned int context, X509 *x,
  398. size_t chainidx);
  399. EXT_RETURN tls_construct_ctos_cookie(SSL_CONNECTION *s, WPACKET *pkt,
  400. unsigned int context,
  401. X509 *x, size_t chainidx);
  402. EXT_RETURN tls_construct_ctos_padding(SSL_CONNECTION *s, WPACKET *pkt,
  403. unsigned int context, X509 *x,
  404. size_t chainidx);
  405. EXT_RETURN tls_construct_ctos_psk(SSL_CONNECTION *s, WPACKET *pkt,
  406. unsigned int context,
  407. X509 *x, size_t chainidx);
  408. EXT_RETURN tls_construct_ctos_post_handshake_auth(SSL_CONNECTION *s, WPACKET *pkt,
  409. unsigned int context,
  410. X509 *x, size_t chainidx);
  411. int tls_parse_stoc_renegotiate(SSL_CONNECTION *s, PACKET *pkt,
  412. unsigned int context,
  413. X509 *x, size_t chainidx);
  414. int tls_parse_stoc_server_name(SSL_CONNECTION *s, PACKET *pkt,
  415. unsigned int context,
  416. X509 *x, size_t chainidx);
  417. int tls_parse_stoc_early_data(SSL_CONNECTION *s, PACKET *pkt,
  418. unsigned int context,
  419. X509 *x, size_t chainidx);
  420. int tls_parse_stoc_maxfragmentlen(SSL_CONNECTION *s, PACKET *pkt,
  421. unsigned int context,
  422. X509 *x, size_t chainidx);
  423. int tls_parse_stoc_ec_pt_formats(SSL_CONNECTION *s, PACKET *pkt,
  424. unsigned int context,
  425. X509 *x, size_t chainidx);
  426. int tls_parse_stoc_session_ticket(SSL_CONNECTION *s, PACKET *pkt,
  427. unsigned int context,
  428. X509 *x, size_t chainidx);
  429. #ifndef OPENSSL_NO_OCSP
  430. int tls_parse_stoc_status_request(SSL_CONNECTION *s, PACKET *pkt,
  431. unsigned int context,
  432. X509 *x, size_t chainidx);
  433. #endif
  434. #ifndef OPENSSL_NO_CT
  435. int tls_parse_stoc_sct(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  436. X509 *x, size_t chainidx);
  437. #endif
  438. #ifndef OPENSSL_NO_NEXTPROTONEG
  439. int tls_parse_stoc_npn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  440. X509 *x, size_t chainidx);
  441. #endif
  442. int tls_parse_stoc_alpn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  443. X509 *x, size_t chainidx);
  444. #ifndef OPENSSL_NO_SRTP
  445. int tls_parse_stoc_use_srtp(SSL_CONNECTION *s, PACKET *pkt,
  446. unsigned int context, X509 *x, size_t chainidx);
  447. #endif
  448. int tls_parse_stoc_etm(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  449. X509 *x, size_t chainidx);
  450. int tls_parse_stoc_ems(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  451. X509 *x, size_t chainidx);
  452. int tls_parse_stoc_supported_versions(SSL_CONNECTION *s, PACKET *pkt,
  453. unsigned int context,
  454. X509 *x, size_t chainidx);
  455. int tls_parse_stoc_key_share(SSL_CONNECTION *s, PACKET *pkt,
  456. unsigned int context, X509 *x, size_t chainidx);
  457. int tls_parse_stoc_cookie(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  458. X509 *x, size_t chainidx);
  459. int tls_parse_stoc_psk(SSL_CONNECTION *s, PACKET *pkt, unsigned int context,
  460. X509 *x, size_t chainidx);
  461. int tls_handle_alpn(SSL_CONNECTION *s);
  462. int tls13_save_handshake_digest_for_pha(SSL_CONNECTION *s);
  463. int tls13_restore_handshake_digest_for_pha(SSL_CONNECTION *s);