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