diff options
author | tb <> | 2020-07-03 04:51:59 +0000 |
---|---|---|
committer | tb <> | 2020-07-03 04:51:59 +0000 |
commit | 3bdf1d142785d4eeff0cb42832ae293d224cee7a (patch) | |
tree | 238426180d2f295ca9e775611e0c201ee369a042 | |
parent | dd32aaf237307de264cbc196e8825704c22c9b9e (diff) | |
download | openbsd-3bdf1d142785d4eeff0cb42832ae293d224cee7a.tar.gz openbsd-3bdf1d142785d4eeff0cb42832ae293d224cee7a.tar.bz2 openbsd-3bdf1d142785d4eeff0cb42832ae293d224cee7a.zip |
Make the message type available to the extension functions
Some TLS extensions need to be treated differently depending on the
handshake message they appear in. Over time, various workarounds and
hacks were used to deal with the unavailability of the message type
in these functions, but this is getting fragile and unwieldy. Having
the message type available will enable us to clean this code up and
will allow simple fixes for a number of bugs in our handling of the
status_request extension reported by Michael Forney.
This approach was suggested a while ago by jsing.
ok beck jsing
-rw-r--r-- | src/lib/libssl/ssl_tlsext.c | 174 | ||||
-rw-r--r-- | src/lib/libssl/ssl_tlsext.h | 174 |
2 files changed, 181 insertions, 167 deletions
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c index 2b91a087af..d291f1d0c4 100644 --- a/src/lib/libssl/ssl_tlsext.c +++ b/src/lib/libssl/ssl_tlsext.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_tlsext.c,v 1.76 2020/07/03 04:12:51 tb Exp $ */ | 1 | /* $OpenBSD: ssl_tlsext.c,v 1.77 2020/07/03 04:51:59 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
@@ -32,7 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | int | 34 | int |
35 | tlsext_alpn_client_needs(SSL *s) | 35 | tlsext_alpn_client_needs(SSL *s, uint16_t msg_type) |
36 | { | 36 | { |
37 | /* ALPN protos have been specified and this is the initial handshake */ | 37 | /* ALPN protos have been specified and this is the initial handshake */ |
38 | return s->internal->alpn_client_proto_list != NULL && | 38 | return s->internal->alpn_client_proto_list != NULL && |
@@ -40,7 +40,7 @@ tlsext_alpn_client_needs(SSL *s) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | int | 42 | int |
43 | tlsext_alpn_client_build(SSL *s, CBB *cbb) | 43 | tlsext_alpn_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
44 | { | 44 | { |
45 | CBB protolist; | 45 | CBB protolist; |
46 | 46 | ||
@@ -58,7 +58,7 @@ tlsext_alpn_client_build(SSL *s, CBB *cbb) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | int | 60 | int |
61 | tlsext_alpn_server_parse(SSL *s, CBS *cbs, int *alert) | 61 | tlsext_alpn_server_parse(SSL *s, uint16_t msg_types, CBS *cbs, int *alert) |
62 | { | 62 | { |
63 | CBS proto_name_list, alpn; | 63 | CBS proto_name_list, alpn; |
64 | const unsigned char *selected; | 64 | const unsigned char *selected; |
@@ -106,13 +106,13 @@ tlsext_alpn_server_parse(SSL *s, CBS *cbs, int *alert) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | int | 108 | int |
109 | tlsext_alpn_server_needs(SSL *s) | 109 | tlsext_alpn_server_needs(SSL *s, uint16_t msg_type) |
110 | { | 110 | { |
111 | return S3I(s)->alpn_selected != NULL; | 111 | return S3I(s)->alpn_selected != NULL; |
112 | } | 112 | } |
113 | 113 | ||
114 | int | 114 | int |
115 | tlsext_alpn_server_build(SSL *s, CBB *cbb) | 115 | tlsext_alpn_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
116 | { | 116 | { |
117 | CBB list, selected; | 117 | CBB list, selected; |
118 | 118 | ||
@@ -133,7 +133,7 @@ tlsext_alpn_server_build(SSL *s, CBB *cbb) | |||
133 | } | 133 | } |
134 | 134 | ||
135 | int | 135 | int |
136 | tlsext_alpn_client_parse(SSL *s, CBS *cbs, int *alert) | 136 | tlsext_alpn_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
137 | { | 137 | { |
138 | CBS list, proto; | 138 | CBS list, proto; |
139 | 139 | ||
@@ -170,14 +170,14 @@ tlsext_alpn_client_parse(SSL *s, CBS *cbs, int *alert) | |||
170 | * Supported Groups - RFC 7919 section 2 | 170 | * Supported Groups - RFC 7919 section 2 |
171 | */ | 171 | */ |
172 | int | 172 | int |
173 | tlsext_supportedgroups_client_needs(SSL *s) | 173 | tlsext_supportedgroups_client_needs(SSL *s, uint16_t msg_type) |
174 | { | 174 | { |
175 | return ssl_has_ecc_ciphers(s) || | 175 | return ssl_has_ecc_ciphers(s) || |
176 | (S3I(s)->hs_tls13.max_version >= TLS1_3_VERSION); | 176 | (S3I(s)->hs_tls13.max_version >= TLS1_3_VERSION); |
177 | } | 177 | } |
178 | 178 | ||
179 | int | 179 | int |
180 | tlsext_supportedgroups_client_build(SSL *s, CBB *cbb) | 180 | tlsext_supportedgroups_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
181 | { | 181 | { |
182 | const uint16_t *groups; | 182 | const uint16_t *groups; |
183 | size_t groups_len; | 183 | size_t groups_len; |
@@ -205,7 +205,8 @@ tlsext_supportedgroups_client_build(SSL *s, CBB *cbb) | |||
205 | } | 205 | } |
206 | 206 | ||
207 | int | 207 | int |
208 | tlsext_supportedgroups_server_parse(SSL *s, CBS *cbs, int *alert) | 208 | tlsext_supportedgroups_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
209 | int *alert) | ||
209 | { | 210 | { |
210 | CBS grouplist; | 211 | CBS grouplist; |
211 | size_t groups_len; | 212 | size_t groups_len; |
@@ -285,19 +286,20 @@ tlsext_supportedgroups_server_parse(SSL *s, CBS *cbs, int *alert) | |||
285 | 286 | ||
286 | /* This extension is never used by the server. */ | 287 | /* This extension is never used by the server. */ |
287 | int | 288 | int |
288 | tlsext_supportedgroups_server_needs(SSL *s) | 289 | tlsext_supportedgroups_server_needs(SSL *s, uint16_t msg_type) |
289 | { | 290 | { |
290 | return 0; | 291 | return 0; |
291 | } | 292 | } |
292 | 293 | ||
293 | int | 294 | int |
294 | tlsext_supportedgroups_server_build(SSL *s, CBB *cbb) | 295 | tlsext_supportedgroups_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
295 | { | 296 | { |
296 | return 0; | 297 | return 0; |
297 | } | 298 | } |
298 | 299 | ||
299 | int | 300 | int |
300 | tlsext_supportedgroups_client_parse(SSL *s, CBS *cbs, int *alert) | 301 | tlsext_supportedgroups_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
302 | int *alert) | ||
301 | { | 303 | { |
302 | /* | 304 | /* |
303 | * Servers should not send this extension per the RFC. | 305 | * Servers should not send this extension per the RFC. |
@@ -321,7 +323,7 @@ tlsext_supportedgroups_client_parse(SSL *s, CBS *cbs, int *alert) | |||
321 | * Supported Point Formats Extension - RFC 4492 section 5.1.2 | 323 | * Supported Point Formats Extension - RFC 4492 section 5.1.2 |
322 | */ | 324 | */ |
323 | static int | 325 | static int |
324 | tlsext_ecpf_build(SSL *s, CBB *cbb) | 326 | tlsext_ecpf_build(SSL *s, uint16_t msg_type, CBB *cbb) |
325 | { | 327 | { |
326 | CBB ecpf; | 328 | CBB ecpf; |
327 | size_t formats_len; | 329 | size_t formats_len; |
@@ -345,7 +347,7 @@ tlsext_ecpf_build(SSL *s, CBB *cbb) | |||
345 | } | 347 | } |
346 | 348 | ||
347 | static int | 349 | static int |
348 | tlsext_ecpf_parse(SSL *s, CBS *cbs, int *alert) | 350 | tlsext_ecpf_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
349 | { | 351 | { |
350 | CBS ecpf; | 352 | CBS ecpf; |
351 | 353 | ||
@@ -378,25 +380,25 @@ tlsext_ecpf_parse(SSL *s, CBS *cbs, int *alert) | |||
378 | } | 380 | } |
379 | 381 | ||
380 | int | 382 | int |
381 | tlsext_ecpf_client_needs(SSL *s) | 383 | tlsext_ecpf_client_needs(SSL *s, uint16_t msg_type) |
382 | { | 384 | { |
383 | return ssl_has_ecc_ciphers(s); | 385 | return ssl_has_ecc_ciphers(s); |
384 | } | 386 | } |
385 | 387 | ||
386 | int | 388 | int |
387 | tlsext_ecpf_client_build(SSL *s, CBB *cbb) | 389 | tlsext_ecpf_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
388 | { | 390 | { |
389 | return tlsext_ecpf_build(s, cbb); | 391 | return tlsext_ecpf_build(s, msg_type, cbb); |
390 | } | 392 | } |
391 | 393 | ||
392 | int | 394 | int |
393 | tlsext_ecpf_server_parse(SSL *s, CBS *cbs, int *alert) | 395 | tlsext_ecpf_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
394 | { | 396 | { |
395 | return tlsext_ecpf_parse(s, cbs, alert); | 397 | return tlsext_ecpf_parse(s, msg_type, cbs, alert); |
396 | } | 398 | } |
397 | 399 | ||
398 | int | 400 | int |
399 | tlsext_ecpf_server_needs(SSL *s) | 401 | tlsext_ecpf_server_needs(SSL *s, uint16_t msg_type) |
400 | { | 402 | { |
401 | if (s->version == DTLS1_VERSION) | 403 | if (s->version == DTLS1_VERSION) |
402 | return 0; | 404 | return 0; |
@@ -405,28 +407,28 @@ tlsext_ecpf_server_needs(SSL *s) | |||
405 | } | 407 | } |
406 | 408 | ||
407 | int | 409 | int |
408 | tlsext_ecpf_server_build(SSL *s, CBB *cbb) | 410 | tlsext_ecpf_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
409 | { | 411 | { |
410 | return tlsext_ecpf_build(s, cbb); | 412 | return tlsext_ecpf_build(s, msg_type, cbb); |
411 | } | 413 | } |
412 | 414 | ||
413 | int | 415 | int |
414 | tlsext_ecpf_client_parse(SSL *s, CBS *cbs, int *alert) | 416 | tlsext_ecpf_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
415 | { | 417 | { |
416 | return tlsext_ecpf_parse(s, cbs, alert); | 418 | return tlsext_ecpf_parse(s, msg_type, cbs, alert); |
417 | } | 419 | } |
418 | 420 | ||
419 | /* | 421 | /* |
420 | * Renegotiation Indication - RFC 5746. | 422 | * Renegotiation Indication - RFC 5746. |
421 | */ | 423 | */ |
422 | int | 424 | int |
423 | tlsext_ri_client_needs(SSL *s) | 425 | tlsext_ri_client_needs(SSL *s, uint16_t msg_type) |
424 | { | 426 | { |
425 | return (s->internal->renegotiate); | 427 | return (s->internal->renegotiate); |
426 | } | 428 | } |
427 | 429 | ||
428 | int | 430 | int |
429 | tlsext_ri_client_build(SSL *s, CBB *cbb) | 431 | tlsext_ri_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
430 | { | 432 | { |
431 | CBB reneg; | 433 | CBB reneg; |
432 | 434 | ||
@@ -442,7 +444,7 @@ tlsext_ri_client_build(SSL *s, CBB *cbb) | |||
442 | } | 444 | } |
443 | 445 | ||
444 | int | 446 | int |
445 | tlsext_ri_server_parse(SSL *s, CBS *cbs, int *alert) | 447 | tlsext_ri_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
446 | { | 448 | { |
447 | CBS reneg; | 449 | CBS reneg; |
448 | 450 | ||
@@ -470,13 +472,13 @@ tlsext_ri_server_parse(SSL *s, CBS *cbs, int *alert) | |||
470 | } | 472 | } |
471 | 473 | ||
472 | int | 474 | int |
473 | tlsext_ri_server_needs(SSL *s) | 475 | tlsext_ri_server_needs(SSL *s, uint16_t msg_type) |
474 | { | 476 | { |
475 | return (s->version < TLS1_3_VERSION && S3I(s)->send_connection_binding); | 477 | return (s->version < TLS1_3_VERSION && S3I(s)->send_connection_binding); |
476 | } | 478 | } |
477 | 479 | ||
478 | int | 480 | int |
479 | tlsext_ri_server_build(SSL *s, CBB *cbb) | 481 | tlsext_ri_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
480 | { | 482 | { |
481 | CBB reneg; | 483 | CBB reneg; |
482 | 484 | ||
@@ -495,7 +497,7 @@ tlsext_ri_server_build(SSL *s, CBB *cbb) | |||
495 | } | 497 | } |
496 | 498 | ||
497 | int | 499 | int |
498 | tlsext_ri_client_parse(SSL *s, CBS *cbs, int *alert) | 500 | tlsext_ri_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
499 | { | 501 | { |
500 | CBS reneg, prev_client, prev_server; | 502 | CBS reneg, prev_client, prev_server; |
501 | 503 | ||
@@ -552,13 +554,13 @@ tlsext_ri_client_parse(SSL *s, CBS *cbs, int *alert) | |||
552 | * Signature Algorithms - RFC 5246 section 7.4.1.4.1. | 554 | * Signature Algorithms - RFC 5246 section 7.4.1.4.1. |
553 | */ | 555 | */ |
554 | int | 556 | int |
555 | tlsext_sigalgs_client_needs(SSL *s) | 557 | tlsext_sigalgs_client_needs(SSL *s, uint16_t msg_type) |
556 | { | 558 | { |
557 | return (TLS1_get_client_version(s) >= TLS1_2_VERSION); | 559 | return (TLS1_get_client_version(s) >= TLS1_2_VERSION); |
558 | } | 560 | } |
559 | 561 | ||
560 | int | 562 | int |
561 | tlsext_sigalgs_client_build(SSL *s, CBB *cbb) | 563 | tlsext_sigalgs_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
562 | { | 564 | { |
563 | uint16_t *tls_sigalgs = tls12_sigalgs; | 565 | uint16_t *tls_sigalgs = tls12_sigalgs; |
564 | size_t tls_sigalgs_len = tls12_sigalgs_len; | 566 | size_t tls_sigalgs_len = tls12_sigalgs_len; |
@@ -583,7 +585,7 @@ tlsext_sigalgs_client_build(SSL *s, CBB *cbb) | |||
583 | } | 585 | } |
584 | 586 | ||
585 | int | 587 | int |
586 | tlsext_sigalgs_server_parse(SSL *s, CBS *cbs, int *alert) | 588 | tlsext_sigalgs_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
587 | { | 589 | { |
588 | CBS sigalgs; | 590 | CBS sigalgs; |
589 | 591 | ||
@@ -598,13 +600,13 @@ tlsext_sigalgs_server_parse(SSL *s, CBS *cbs, int *alert) | |||
598 | } | 600 | } |
599 | 601 | ||
600 | int | 602 | int |
601 | tlsext_sigalgs_server_needs(SSL *s) | 603 | tlsext_sigalgs_server_needs(SSL *s, uint16_t msg_type) |
602 | { | 604 | { |
603 | return (s->version >= TLS1_3_VERSION); | 605 | return (s->version >= TLS1_3_VERSION); |
604 | } | 606 | } |
605 | 607 | ||
606 | int | 608 | int |
607 | tlsext_sigalgs_server_build(SSL *s, CBB *cbb) | 609 | tlsext_sigalgs_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
608 | { | 610 | { |
609 | uint16_t *tls_sigalgs = tls12_sigalgs; | 611 | uint16_t *tls_sigalgs = tls12_sigalgs; |
610 | size_t tls_sigalgs_len = tls12_sigalgs_len; | 612 | size_t tls_sigalgs_len = tls12_sigalgs_len; |
@@ -628,7 +630,7 @@ tlsext_sigalgs_server_build(SSL *s, CBB *cbb) | |||
628 | } | 630 | } |
629 | 631 | ||
630 | int | 632 | int |
631 | tlsext_sigalgs_client_parse(SSL *s, CBS *cbs, int *alert) | 633 | tlsext_sigalgs_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
632 | { | 634 | { |
633 | CBS sigalgs; | 635 | CBS sigalgs; |
634 | 636 | ||
@@ -649,13 +651,13 @@ tlsext_sigalgs_client_parse(SSL *s, CBS *cbs, int *alert) | |||
649 | * Server Name Indication - RFC 6066, section 3. | 651 | * Server Name Indication - RFC 6066, section 3. |
650 | */ | 652 | */ |
651 | int | 653 | int |
652 | tlsext_sni_client_needs(SSL *s) | 654 | tlsext_sni_client_needs(SSL *s, uint16_t msg_type) |
653 | { | 655 | { |
654 | return (s->tlsext_hostname != NULL); | 656 | return (s->tlsext_hostname != NULL); |
655 | } | 657 | } |
656 | 658 | ||
657 | int | 659 | int |
658 | tlsext_sni_client_build(SSL *s, CBB *cbb) | 660 | tlsext_sni_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
659 | { | 661 | { |
660 | CBB server_name_list, host_name; | 662 | CBB server_name_list, host_name; |
661 | 663 | ||
@@ -724,7 +726,7 @@ tlsext_sni_is_valid_hostname(CBS *cbs) | |||
724 | } | 726 | } |
725 | 727 | ||
726 | int | 728 | int |
727 | tlsext_sni_server_parse(SSL *s, CBS *cbs, int *alert) | 729 | tlsext_sni_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
728 | { | 730 | { |
729 | CBS server_name_list, host_name; | 731 | CBS server_name_list, host_name; |
730 | uint8_t name_type; | 732 | uint8_t name_type; |
@@ -796,7 +798,7 @@ tlsext_sni_server_parse(SSL *s, CBS *cbs, int *alert) | |||
796 | } | 798 | } |
797 | 799 | ||
798 | int | 800 | int |
799 | tlsext_sni_server_needs(SSL *s) | 801 | tlsext_sni_server_needs(SSL *s, uint16_t msg_type) |
800 | { | 802 | { |
801 | if (s->internal->hit) | 803 | if (s->internal->hit) |
802 | return 0; | 804 | return 0; |
@@ -805,13 +807,13 @@ tlsext_sni_server_needs(SSL *s) | |||
805 | } | 807 | } |
806 | 808 | ||
807 | int | 809 | int |
808 | tlsext_sni_server_build(SSL *s, CBB *cbb) | 810 | tlsext_sni_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
809 | { | 811 | { |
810 | return 1; | 812 | return 1; |
811 | } | 813 | } |
812 | 814 | ||
813 | int | 815 | int |
814 | tlsext_sni_client_parse(SSL *s, CBS *cbs, int *alert) | 816 | tlsext_sni_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
815 | { | 817 | { |
816 | if (s->tlsext_hostname == NULL || CBS_len(cbs) != 0) { | 818 | if (s->tlsext_hostname == NULL || CBS_len(cbs) != 0) { |
817 | *alert = TLS1_AD_UNRECOGNIZED_NAME; | 819 | *alert = TLS1_AD_UNRECOGNIZED_NAME; |
@@ -849,14 +851,14 @@ tlsext_sni_client_parse(SSL *s, CBS *cbs, int *alert) | |||
849 | */ | 851 | */ |
850 | 852 | ||
851 | int | 853 | int |
852 | tlsext_ocsp_client_needs(SSL *s) | 854 | tlsext_ocsp_client_needs(SSL *s, uint16_t msg_type) |
853 | { | 855 | { |
854 | return (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp && | 856 | return (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp && |
855 | s->version != DTLS1_VERSION); | 857 | s->version != DTLS1_VERSION); |
856 | } | 858 | } |
857 | 859 | ||
858 | int | 860 | int |
859 | tlsext_ocsp_client_build(SSL *s, CBB *cbb) | 861 | tlsext_ocsp_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
860 | { | 862 | { |
861 | CBB respid_list, respid, exts; | 863 | CBB respid_list, respid, exts; |
862 | unsigned char *ext_data; | 864 | unsigned char *ext_data; |
@@ -900,7 +902,7 @@ tlsext_ocsp_client_build(SSL *s, CBB *cbb) | |||
900 | } | 902 | } |
901 | 903 | ||
902 | int | 904 | int |
903 | tlsext_ocsp_server_parse(SSL *s, CBS *cbs, int *alert) | 905 | tlsext_ocsp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
904 | { | 906 | { |
905 | int alert_desc = SSL_AD_DECODE_ERROR; | 907 | int alert_desc = SSL_AD_DECODE_ERROR; |
906 | CBS respid_list, respid, exts; | 908 | CBS respid_list, respid, exts; |
@@ -974,7 +976,7 @@ tlsext_ocsp_server_parse(SSL *s, CBS *cbs, int *alert) | |||
974 | } | 976 | } |
975 | 977 | ||
976 | int | 978 | int |
977 | tlsext_ocsp_server_needs(SSL *s) | 979 | tlsext_ocsp_server_needs(SSL *s, uint16_t msg_type) |
978 | { | 980 | { |
979 | if (s->version >= TLS1_3_VERSION && | 981 | if (s->version >= TLS1_3_VERSION && |
980 | s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp && | 982 | s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp && |
@@ -989,7 +991,7 @@ tlsext_ocsp_server_needs(SSL *s) | |||
989 | } | 991 | } |
990 | 992 | ||
991 | int | 993 | int |
992 | tlsext_ocsp_server_build(SSL *s, CBB *cbb) | 994 | tlsext_ocsp_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
993 | { | 995 | { |
994 | CBB ocsp_response; | 996 | CBB ocsp_response; |
995 | 997 | ||
@@ -1009,7 +1011,7 @@ tlsext_ocsp_server_build(SSL *s, CBB *cbb) | |||
1009 | } | 1011 | } |
1010 | 1012 | ||
1011 | int | 1013 | int |
1012 | tlsext_ocsp_client_parse(SSL *s, CBS *cbs, int *alert) | 1014 | tlsext_ocsp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1013 | { | 1015 | { |
1014 | CBS response; | 1016 | CBS response; |
1015 | uint16_t version = TLS1_get_client_version(s); | 1017 | uint16_t version = TLS1_get_client_version(s); |
@@ -1052,7 +1054,7 @@ tlsext_ocsp_client_parse(SSL *s, CBS *cbs, int *alert) | |||
1052 | * SessionTicket extension - RFC 5077 section 3.2 | 1054 | * SessionTicket extension - RFC 5077 section 3.2 |
1053 | */ | 1055 | */ |
1054 | int | 1056 | int |
1055 | tlsext_sessionticket_client_needs(SSL *s) | 1057 | tlsext_sessionticket_client_needs(SSL *s, uint16_t msg_type) |
1056 | { | 1058 | { |
1057 | /* | 1059 | /* |
1058 | * Send session ticket extension when enabled and not overridden. | 1060 | * Send session ticket extension when enabled and not overridden. |
@@ -1073,7 +1075,7 @@ tlsext_sessionticket_client_needs(SSL *s) | |||
1073 | } | 1075 | } |
1074 | 1076 | ||
1075 | int | 1077 | int |
1076 | tlsext_sessionticket_client_build(SSL *s, CBB *cbb) | 1078 | tlsext_sessionticket_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1077 | { | 1079 | { |
1078 | /* | 1080 | /* |
1079 | * Signal that we support session tickets by sending an empty | 1081 | * Signal that we support session tickets by sending an empty |
@@ -1116,7 +1118,8 @@ tlsext_sessionticket_client_build(SSL *s, CBB *cbb) | |||
1116 | } | 1118 | } |
1117 | 1119 | ||
1118 | int | 1120 | int |
1119 | tlsext_sessionticket_server_parse(SSL *s, CBS *cbs, int *alert) | 1121 | tlsext_sessionticket_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
1122 | int *alert) | ||
1120 | { | 1123 | { |
1121 | if (s->internal->tls_session_ticket_ext_cb) { | 1124 | if (s->internal->tls_session_ticket_ext_cb) { |
1122 | if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs), | 1125 | if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs), |
@@ -1137,21 +1140,22 @@ tlsext_sessionticket_server_parse(SSL *s, CBS *cbs, int *alert) | |||
1137 | } | 1140 | } |
1138 | 1141 | ||
1139 | int | 1142 | int |
1140 | tlsext_sessionticket_server_needs(SSL *s) | 1143 | tlsext_sessionticket_server_needs(SSL *s, uint16_t msg_type) |
1141 | { | 1144 | { |
1142 | return (s->internal->tlsext_ticket_expected && | 1145 | return (s->internal->tlsext_ticket_expected && |
1143 | !(SSL_get_options(s) & SSL_OP_NO_TICKET)); | 1146 | !(SSL_get_options(s) & SSL_OP_NO_TICKET)); |
1144 | } | 1147 | } |
1145 | 1148 | ||
1146 | int | 1149 | int |
1147 | tlsext_sessionticket_server_build(SSL *s, CBB *cbb) | 1150 | tlsext_sessionticket_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1148 | { | 1151 | { |
1149 | /* Empty ticket */ | 1152 | /* Empty ticket */ |
1150 | return 1; | 1153 | return 1; |
1151 | } | 1154 | } |
1152 | 1155 | ||
1153 | int | 1156 | int |
1154 | tlsext_sessionticket_client_parse(SSL *s, CBS *cbs, int *alert) | 1157 | tlsext_sessionticket_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
1158 | int *alert) | ||
1155 | { | 1159 | { |
1156 | if (s->internal->tls_session_ticket_ext_cb) { | 1160 | if (s->internal->tls_session_ticket_ext_cb) { |
1157 | if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs), | 1161 | if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs), |
@@ -1179,13 +1183,13 @@ tlsext_sessionticket_client_parse(SSL *s, CBS *cbs, int *alert) | |||
1179 | #ifndef OPENSSL_NO_SRTP | 1183 | #ifndef OPENSSL_NO_SRTP |
1180 | 1184 | ||
1181 | int | 1185 | int |
1182 | tlsext_srtp_client_needs(SSL *s) | 1186 | tlsext_srtp_client_needs(SSL *s, uint16_t msg_type) |
1183 | { | 1187 | { |
1184 | return SSL_IS_DTLS(s) && SSL_get_srtp_profiles(s) != NULL; | 1188 | return SSL_IS_DTLS(s) && SSL_get_srtp_profiles(s) != NULL; |
1185 | } | 1189 | } |
1186 | 1190 | ||
1187 | int | 1191 | int |
1188 | tlsext_srtp_client_build(SSL *s, CBB *cbb) | 1192 | tlsext_srtp_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1189 | { | 1193 | { |
1190 | CBB profiles, mki; | 1194 | CBB profiles, mki; |
1191 | int ct, i; | 1195 | int ct, i; |
@@ -1222,7 +1226,7 @@ tlsext_srtp_client_build(SSL *s, CBB *cbb) | |||
1222 | } | 1226 | } |
1223 | 1227 | ||
1224 | int | 1228 | int |
1225 | tlsext_srtp_server_parse(SSL *s, CBS *cbs, int *alert) | 1229 | tlsext_srtp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1226 | { | 1230 | { |
1227 | SRTP_PROTECTION_PROFILE *cprof, *sprof; | 1231 | SRTP_PROTECTION_PROFILE *cprof, *sprof; |
1228 | STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL, *srvr; | 1232 | STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = NULL, *srvr; |
@@ -1302,13 +1306,13 @@ tlsext_srtp_server_parse(SSL *s, CBS *cbs, int *alert) | |||
1302 | } | 1306 | } |
1303 | 1307 | ||
1304 | int | 1308 | int |
1305 | tlsext_srtp_server_needs(SSL *s) | 1309 | tlsext_srtp_server_needs(SSL *s, uint16_t msg_type) |
1306 | { | 1310 | { |
1307 | return SSL_IS_DTLS(s) && SSL_get_selected_srtp_profile(s) != NULL; | 1311 | return SSL_IS_DTLS(s) && SSL_get_selected_srtp_profile(s) != NULL; |
1308 | } | 1312 | } |
1309 | 1313 | ||
1310 | int | 1314 | int |
1311 | tlsext_srtp_server_build(SSL *s, CBB *cbb) | 1315 | tlsext_srtp_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1312 | { | 1316 | { |
1313 | SRTP_PROTECTION_PROFILE *profile; | 1317 | SRTP_PROTECTION_PROFILE *profile; |
1314 | CBB srtp, mki; | 1318 | CBB srtp, mki; |
@@ -1332,7 +1336,7 @@ tlsext_srtp_server_build(SSL *s, CBB *cbb) | |||
1332 | } | 1336 | } |
1333 | 1337 | ||
1334 | int | 1338 | int |
1335 | tlsext_srtp_client_parse(SSL *s, CBS *cbs, int *alert) | 1339 | tlsext_srtp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1336 | { | 1340 | { |
1337 | STACK_OF(SRTP_PROTECTION_PROFILE) *clnt; | 1341 | STACK_OF(SRTP_PROTECTION_PROFILE) *clnt; |
1338 | SRTP_PROTECTION_PROFILE *prof; | 1342 | SRTP_PROTECTION_PROFILE *prof; |
@@ -1386,7 +1390,7 @@ tlsext_srtp_client_parse(SSL *s, CBS *cbs, int *alert) | |||
1386 | * TLSv1.3 Key Share - RFC 8446 section 4.2.8. | 1390 | * TLSv1.3 Key Share - RFC 8446 section 4.2.8. |
1387 | */ | 1391 | */ |
1388 | int | 1392 | int |
1389 | tlsext_keyshare_client_needs(SSL *s) | 1393 | tlsext_keyshare_client_needs(SSL *s, uint16_t msg_type) |
1390 | { | 1394 | { |
1391 | /* XXX once this gets initialized when we get tls13_client.c */ | 1395 | /* XXX once this gets initialized when we get tls13_client.c */ |
1392 | if (S3I(s)->hs_tls13.max_version == 0) | 1396 | if (S3I(s)->hs_tls13.max_version == 0) |
@@ -1396,7 +1400,7 @@ tlsext_keyshare_client_needs(SSL *s) | |||
1396 | } | 1400 | } |
1397 | 1401 | ||
1398 | int | 1402 | int |
1399 | tlsext_keyshare_client_build(SSL *s, CBB *cbb) | 1403 | tlsext_keyshare_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1400 | { | 1404 | { |
1401 | CBB client_shares; | 1405 | CBB client_shares; |
1402 | 1406 | ||
@@ -1414,7 +1418,7 @@ tlsext_keyshare_client_build(SSL *s, CBB *cbb) | |||
1414 | } | 1418 | } |
1415 | 1419 | ||
1416 | int | 1420 | int |
1417 | tlsext_keyshare_server_parse(SSL *s, CBS *cbs, int *alert) | 1421 | tlsext_keyshare_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1418 | { | 1422 | { |
1419 | CBS client_shares, key_exchange; | 1423 | CBS client_shares, key_exchange; |
1420 | uint16_t group; | 1424 | uint16_t group; |
@@ -1465,7 +1469,7 @@ tlsext_keyshare_server_parse(SSL *s, CBS *cbs, int *alert) | |||
1465 | } | 1469 | } |
1466 | 1470 | ||
1467 | int | 1471 | int |
1468 | tlsext_keyshare_server_needs(SSL *s) | 1472 | tlsext_keyshare_server_needs(SSL *s, uint16_t msg_type) |
1469 | { | 1473 | { |
1470 | if (SSL_IS_DTLS(s) || s->version < TLS1_3_VERSION) | 1474 | if (SSL_IS_DTLS(s) || s->version < TLS1_3_VERSION) |
1471 | return 0; | 1475 | return 0; |
@@ -1474,7 +1478,7 @@ tlsext_keyshare_server_needs(SSL *s) | |||
1474 | } | 1478 | } |
1475 | 1479 | ||
1476 | int | 1480 | int |
1477 | tlsext_keyshare_server_build(SSL *s, CBB *cbb) | 1481 | tlsext_keyshare_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1478 | { | 1482 | { |
1479 | /* In the case of a HRR, we only send the server selected group. */ | 1483 | /* In the case of a HRR, we only send the server selected group. */ |
1480 | if (S3I(s)->hs_tls13.hrr) { | 1484 | if (S3I(s)->hs_tls13.hrr) { |
@@ -1493,7 +1497,7 @@ tlsext_keyshare_server_build(SSL *s, CBB *cbb) | |||
1493 | } | 1497 | } |
1494 | 1498 | ||
1495 | int | 1499 | int |
1496 | tlsext_keyshare_client_parse(SSL *s, CBS *cbs, int *alert) | 1500 | tlsext_keyshare_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1497 | { | 1501 | { |
1498 | CBS key_exchange; | 1502 | CBS key_exchange; |
1499 | uint16_t group; | 1503 | uint16_t group; |
@@ -1530,7 +1534,7 @@ tlsext_keyshare_client_parse(SSL *s, CBS *cbs, int *alert) | |||
1530 | * Supported Versions - RFC 8446 section 4.2.1. | 1534 | * Supported Versions - RFC 8446 section 4.2.1. |
1531 | */ | 1535 | */ |
1532 | int | 1536 | int |
1533 | tlsext_versions_client_needs(SSL *s) | 1537 | tlsext_versions_client_needs(SSL *s, uint16_t msg_type) |
1534 | { | 1538 | { |
1535 | if (SSL_IS_DTLS(s)) | 1539 | if (SSL_IS_DTLS(s)) |
1536 | return 0; | 1540 | return 0; |
@@ -1538,7 +1542,7 @@ tlsext_versions_client_needs(SSL *s) | |||
1538 | } | 1542 | } |
1539 | 1543 | ||
1540 | int | 1544 | int |
1541 | tlsext_versions_client_build(SSL *s, CBB *cbb) | 1545 | tlsext_versions_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1542 | { | 1546 | { |
1543 | uint16_t max, min; | 1547 | uint16_t max, min; |
1544 | uint16_t version; | 1548 | uint16_t version; |
@@ -1566,7 +1570,7 @@ tlsext_versions_client_build(SSL *s, CBB *cbb) | |||
1566 | } | 1570 | } |
1567 | 1571 | ||
1568 | int | 1572 | int |
1569 | tlsext_versions_server_parse(SSL *s, CBS *cbs, int *alert) | 1573 | tlsext_versions_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1570 | { | 1574 | { |
1571 | CBS versions; | 1575 | CBS versions; |
1572 | uint16_t version; | 1576 | uint16_t version; |
@@ -1613,13 +1617,13 @@ tlsext_versions_server_parse(SSL *s, CBS *cbs, int *alert) | |||
1613 | } | 1617 | } |
1614 | 1618 | ||
1615 | int | 1619 | int |
1616 | tlsext_versions_server_needs(SSL *s) | 1620 | tlsext_versions_server_needs(SSL *s, uint16_t msg_type) |
1617 | { | 1621 | { |
1618 | return (!SSL_IS_DTLS(s) && s->version >= TLS1_3_VERSION); | 1622 | return (!SSL_IS_DTLS(s) && s->version >= TLS1_3_VERSION); |
1619 | } | 1623 | } |
1620 | 1624 | ||
1621 | int | 1625 | int |
1622 | tlsext_versions_server_build(SSL *s, CBB *cbb) | 1626 | tlsext_versions_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1623 | { | 1627 | { |
1624 | if (!CBB_add_u16(cbb, TLS1_3_VERSION)) | 1628 | if (!CBB_add_u16(cbb, TLS1_3_VERSION)) |
1625 | return 0; | 1629 | return 0; |
@@ -1629,7 +1633,7 @@ tlsext_versions_server_build(SSL *s, CBB *cbb) | |||
1629 | } | 1633 | } |
1630 | 1634 | ||
1631 | int | 1635 | int |
1632 | tlsext_versions_client_parse(SSL *s, CBS *cbs, int *alert) | 1636 | tlsext_versions_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1633 | { | 1637 | { |
1634 | uint16_t selected_version; | 1638 | uint16_t selected_version; |
1635 | 1639 | ||
@@ -1655,7 +1659,7 @@ tlsext_versions_client_parse(SSL *s, CBS *cbs, int *alert) | |||
1655 | */ | 1659 | */ |
1656 | 1660 | ||
1657 | int | 1661 | int |
1658 | tlsext_cookie_client_needs(SSL *s) | 1662 | tlsext_cookie_client_needs(SSL *s, uint16_t msg_type) |
1659 | { | 1663 | { |
1660 | if (SSL_IS_DTLS(s)) | 1664 | if (SSL_IS_DTLS(s)) |
1661 | return 0; | 1665 | return 0; |
@@ -1666,7 +1670,7 @@ tlsext_cookie_client_needs(SSL *s) | |||
1666 | } | 1670 | } |
1667 | 1671 | ||
1668 | int | 1672 | int |
1669 | tlsext_cookie_client_build(SSL *s, CBB *cbb) | 1673 | tlsext_cookie_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1670 | { | 1674 | { |
1671 | CBB cookie; | 1675 | CBB cookie; |
1672 | 1676 | ||
@@ -1684,7 +1688,7 @@ tlsext_cookie_client_build(SSL *s, CBB *cbb) | |||
1684 | } | 1688 | } |
1685 | 1689 | ||
1686 | int | 1690 | int |
1687 | tlsext_cookie_server_parse(SSL *s, CBS *cbs, int *alert) | 1691 | tlsext_cookie_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1688 | { | 1692 | { |
1689 | CBS cookie; | 1693 | CBS cookie; |
1690 | 1694 | ||
@@ -1714,7 +1718,7 @@ tlsext_cookie_server_parse(SSL *s, CBS *cbs, int *alert) | |||
1714 | } | 1718 | } |
1715 | 1719 | ||
1716 | int | 1720 | int |
1717 | tlsext_cookie_server_needs(SSL *s) | 1721 | tlsext_cookie_server_needs(SSL *s, uint16_t msg_type) |
1718 | { | 1722 | { |
1719 | 1723 | ||
1720 | if (SSL_IS_DTLS(s)) | 1724 | if (SSL_IS_DTLS(s)) |
@@ -1730,7 +1734,7 @@ tlsext_cookie_server_needs(SSL *s) | |||
1730 | } | 1734 | } |
1731 | 1735 | ||
1732 | int | 1736 | int |
1733 | tlsext_cookie_server_build(SSL *s, CBB *cbb) | 1737 | tlsext_cookie_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
1734 | { | 1738 | { |
1735 | CBB cookie; | 1739 | CBB cookie; |
1736 | 1740 | ||
@@ -1750,7 +1754,7 @@ tlsext_cookie_server_build(SSL *s, CBB *cbb) | |||
1750 | } | 1754 | } |
1751 | 1755 | ||
1752 | int | 1756 | int |
1753 | tlsext_cookie_client_parse(SSL *s, CBS *cbs, int *alert) | 1757 | tlsext_cookie_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
1754 | { | 1758 | { |
1755 | CBS cookie; | 1759 | CBS cookie; |
1756 | 1760 | ||
@@ -1780,9 +1784,9 @@ tlsext_cookie_client_parse(SSL *s, CBS *cbs, int *alert) | |||
1780 | } | 1784 | } |
1781 | 1785 | ||
1782 | struct tls_extension_funcs { | 1786 | struct tls_extension_funcs { |
1783 | int (*needs)(SSL *s); | 1787 | int (*needs)(SSL *s, uint16_t msg_type); |
1784 | int (*build)(SSL *s, CBB *cbb); | 1788 | int (*build)(SSL *s, uint16_t msg_type, CBB *cbb); |
1785 | int (*parse)(SSL *s, CBS *cbs, int *alert); | 1789 | int (*parse)(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
1786 | }; | 1790 | }; |
1787 | 1791 | ||
1788 | struct tls_extension { | 1792 | struct tls_extension { |
@@ -2035,7 +2039,7 @@ tlsext_build(SSL *s, int is_server, uint16_t msg_type, CBB *cbb) | |||
2035 | !(tlsext->messages & msg_type)) | 2039 | !(tlsext->messages & msg_type)) |
2036 | continue; | 2040 | continue; |
2037 | 2041 | ||
2038 | if (!ext->needs(s)) | 2042 | if (!ext->needs(s, msg_type)) |
2039 | continue; | 2043 | continue; |
2040 | 2044 | ||
2041 | if (!CBB_add_u16(&extensions, tlsext->type)) | 2045 | if (!CBB_add_u16(&extensions, tlsext->type)) |
@@ -2043,7 +2047,7 @@ tlsext_build(SSL *s, int is_server, uint16_t msg_type, CBB *cbb) | |||
2043 | if (!CBB_add_u16_length_prefixed(&extensions, &extension_data)) | 2047 | if (!CBB_add_u16_length_prefixed(&extensions, &extension_data)) |
2044 | return 0; | 2048 | return 0; |
2045 | 2049 | ||
2046 | if (!ext->build(s, &extension_data)) | 2050 | if (!ext->build(s, msg_type, &extension_data)) |
2047 | return 0; | 2051 | return 0; |
2048 | 2052 | ||
2049 | extensions_present = 1; | 2053 | extensions_present = 1; |
@@ -2149,7 +2153,7 @@ tlsext_parse(SSL *s, int is_server, uint16_t msg_type, CBS *cbs, int *alert) | |||
2149 | S3I(s)->hs.extensions_seen |= (1 << idx); | 2153 | S3I(s)->hs.extensions_seen |= (1 << idx); |
2150 | 2154 | ||
2151 | ext = tlsext_funcs(tlsext, is_server); | 2155 | ext = tlsext_funcs(tlsext, is_server); |
2152 | if (!ext->parse(s, &extension_data, &alert_desc)) | 2156 | if (!ext->parse(s, msg_type, &extension_data, &alert_desc)) |
2153 | goto err; | 2157 | goto err; |
2154 | 2158 | ||
2155 | if (CBS_len(&extension_data) != 0) | 2159 | if (CBS_len(&extension_data) != 0) |
diff --git a/src/lib/libssl/ssl_tlsext.h b/src/lib/libssl/ssl_tlsext.h index e2aafa7815..d98b387c5f 100644 --- a/src/lib/libssl/ssl_tlsext.h +++ b/src/lib/libssl/ssl_tlsext.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_tlsext.h,v 1.24 2020/07/03 04:12:51 tb Exp $ */ | 1 | /* $OpenBSD: ssl_tlsext.h,v 1.25 2020/07/03 04:51:59 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
@@ -31,91 +31,101 @@ | |||
31 | 31 | ||
32 | __BEGIN_HIDDEN_DECLS | 32 | __BEGIN_HIDDEN_DECLS |
33 | 33 | ||
34 | int tlsext_alpn_client_needs(SSL *s); | 34 | int tlsext_alpn_client_needs(SSL *s, uint16_t msg_type); |
35 | int tlsext_alpn_client_build(SSL *s, CBB *cbb); | 35 | int tlsext_alpn_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
36 | int tlsext_alpn_client_parse(SSL *s, CBS *cbs, int *alert); | 36 | int tlsext_alpn_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
37 | int tlsext_alpn_server_needs(SSL *s); | 37 | int tlsext_alpn_server_needs(SSL *s, uint16_t msg_type); |
38 | int tlsext_alpn_server_build(SSL *s, CBB *cbb); | 38 | int tlsext_alpn_server_build(SSL *s, uint16_t msg_type, CBB *cbb); |
39 | int tlsext_alpn_server_parse(SSL *s, CBS *cbs, int *alert); | 39 | int tlsext_alpn_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
40 | 40 | ||
41 | int tlsext_ri_client_needs(SSL *s); | 41 | int tlsext_ri_client_needs(SSL *s, uint16_t msg_type); |
42 | int tlsext_ri_client_build(SSL *s, CBB *cbb); | 42 | int tlsext_ri_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
43 | int tlsext_ri_client_parse(SSL *s, CBS *cbs, int *alert); | 43 | int tlsext_ri_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
44 | int tlsext_ri_server_needs(SSL *s); | 44 | int tlsext_ri_server_needs(SSL *s, uint16_t msg_type); |
45 | int tlsext_ri_server_build(SSL *s, CBB *cbb); | 45 | int tlsext_ri_server_build(SSL *s, uint16_t msg_type, CBB *cbb); |
46 | int tlsext_ri_server_parse(SSL *s, CBS *cbs, int *alert); | 46 | int tlsext_ri_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
47 | 47 | ||
48 | int tlsext_sigalgs_client_needs(SSL *s); | 48 | int tlsext_sigalgs_client_needs(SSL *s, uint16_t msg_type); |
49 | int tlsext_sigalgs_client_build(SSL *s, CBB *cbb); | 49 | int tlsext_sigalgs_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
50 | int tlsext_sigalgs_client_parse(SSL *s, CBS *cbs, int *alert); | 50 | int tlsext_sigalgs_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
51 | int tlsext_sigalgs_server_needs(SSL *s); | 51 | int *alert); |
52 | int tlsext_sigalgs_server_build(SSL *s, CBB *cbb); | 52 | int tlsext_sigalgs_server_needs(SSL *s, uint16_t msg_type); |
53 | int tlsext_sigalgs_server_parse(SSL *s, CBS *cbs, int *alert); | 53 | int tlsext_sigalgs_server_build(SSL *s, uint16_t msg_type, CBB *cbb); |
54 | 54 | int tlsext_sigalgs_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, | |
55 | int tlsext_sni_client_needs(SSL *s); | 55 | int *alert); |
56 | int tlsext_sni_client_build(SSL *s, CBB *cbb); | 56 | |
57 | int tlsext_sni_client_parse(SSL *s, CBS *cbs, int *alert); | 57 | int tlsext_sni_client_needs(SSL *s, uint16_t msg_type); |
58 | int tlsext_sni_server_needs(SSL *s); | 58 | int tlsext_sni_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
59 | int tlsext_sni_server_build(SSL *s, CBB *cbb); | 59 | int tlsext_sni_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
60 | int tlsext_sni_server_parse(SSL *s, CBS *cbs, int *alert); | 60 | int tlsext_sni_server_needs(SSL *s, uint16_t msg_type); |
61 | int tlsext_sni_server_build(SSL *s, uint16_t msg_type, CBB *cbb); | ||
62 | int tlsext_sni_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); | ||
61 | int tlsext_sni_is_valid_hostname(CBS *cbs); | 63 | int tlsext_sni_is_valid_hostname(CBS *cbs); |
62 | 64 | ||
63 | int tlsext_supportedgroups_client_needs(SSL *s); | 65 | int tlsext_supportedgroups_client_needs(SSL *s, uint16_t msg_type); |
64 | int tlsext_supportedgroups_client_build(SSL *s, CBB *cbb); | 66 | int tlsext_supportedgroups_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
65 | int tlsext_supportedgroups_client_parse(SSL *s, CBS *cbs, int *alert); | 67 | int tlsext_supportedgroups_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
66 | int tlsext_supportedgroups_server_needs(SSL *s); | 68 | int *alert); |
67 | int tlsext_supportedgroups_server_build(SSL *s, CBB *cbb); | 69 | int tlsext_supportedgroups_server_needs(SSL *s, uint16_t msg_type); |
68 | int tlsext_supportedgroups_server_parse(SSL *s, CBS *cbs, int *alert); | 70 | int tlsext_supportedgroups_server_build(SSL *s, uint16_t msg_type, CBB *cbb); |
69 | 71 | int tlsext_supportedgroups_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, | |
70 | int tlsext_ecpf_client_needs(SSL *s); | 72 | int *alert); |
71 | int tlsext_ecpf_client_build(SSL *s, CBB *cbb); | 73 | |
72 | int tlsext_ecpf_client_parse(SSL *s, CBS *cbs, int *alert); | 74 | int tlsext_ecpf_client_needs(SSL *s, uint16_t msg_type); |
73 | int tlsext_ecpf_server_needs(SSL *s); | 75 | int tlsext_ecpf_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
74 | int tlsext_ecpf_server_build(SSL *s, CBB *cbb); | 76 | int tlsext_ecpf_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
75 | int tlsext_ecpf_server_parse(SSL *s, CBS *cbs, int *alert); | 77 | int tlsext_ecpf_server_needs(SSL *s, uint16_t msg_type); |
76 | 78 | int tlsext_ecpf_server_build(SSL *s, uint16_t msg_type, CBB *cbb); | |
77 | int tlsext_ocsp_client_needs(SSL *s); | 79 | int tlsext_ecpf_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
78 | int tlsext_ocsp_client_build(SSL *s, CBB *cbb); | 80 | |
79 | int tlsext_ocsp_client_parse(SSL *s, CBS *cbs, int *alert); | 81 | int tlsext_ocsp_client_needs(SSL *s, uint16_t msg_type); |
80 | int tlsext_ocsp_server_needs(SSL *s); | 82 | int tlsext_ocsp_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
81 | int tlsext_ocsp_server_build(SSL *s, CBB *cbb); | 83 | int tlsext_ocsp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
82 | int tlsext_ocsp_server_parse(SSL *s, CBS *cbs, int *alert); | 84 | int tlsext_ocsp_server_needs(SSL *s, uint16_t msg_type); |
83 | 85 | int tlsext_ocsp_server_build(SSL *s, uint16_t msg_type, CBB *cbb); | |
84 | int tlsext_sessionticket_client_needs(SSL *s); | 86 | int tlsext_ocsp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
85 | int tlsext_sessionticket_client_build(SSL *s, CBB *cbb); | 87 | |
86 | int tlsext_sessionticket_client_parse(SSL *s, CBS *cbs, int *alert); | 88 | int tlsext_sessionticket_client_needs(SSL *s, uint16_t msg_type); |
87 | int tlsext_sessionticket_server_needs(SSL *s); | 89 | int tlsext_sessionticket_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
88 | int tlsext_sessionticket_server_build(SSL *s, CBB *cbb); | 90 | int tlsext_sessionticket_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
89 | int tlsext_sessionticket_server_parse(SSL *s, CBS *cbs, int *alert); | 91 | int *alert); |
90 | 92 | int tlsext_sessionticket_server_needs(SSL *s, uint16_t msg_type); | |
91 | int tlsext_versions_client_needs(SSL *s); | 93 | int tlsext_sessionticket_server_build(SSL *s, uint16_t msg_type, CBB *cbb); |
92 | int tlsext_versions_client_build(SSL *s, CBB *cbb); | 94 | int tlsext_sessionticket_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
93 | int tlsext_versions_client_parse(SSL *s, CBS *cbs, int *alert); | 95 | int *alert); |
94 | int tlsext_versions_server_needs(SSL *s); | 96 | |
95 | int tlsext_versions_server_build(SSL *s, CBB *cbb); | 97 | int tlsext_versions_client_needs(SSL *s, uint16_t msg_type); |
96 | int tlsext_versions_server_parse(SSL *s, CBS *cbs, int *alert); | 98 | int tlsext_versions_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
97 | 99 | int tlsext_versions_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, | |
98 | int tlsext_keyshare_client_needs(SSL *s); | 100 | int *alert); |
99 | int tlsext_keyshare_client_build(SSL *s, CBB *cbb); | 101 | int tlsext_versions_server_needs(SSL *s, uint16_t msg_type); |
100 | int tlsext_keyshare_client_parse(SSL *s, CBS *cbs, int *alert); | 102 | int tlsext_versions_server_build(SSL *s, uint16_t msg_type, CBB *cbb); |
101 | int tlsext_keyshare_server_needs(SSL *s); | 103 | int tlsext_versions_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
102 | int tlsext_keyshare_server_build(SSL *s, CBB *cbb); | 104 | int *alert); |
103 | int tlsext_keyshare_server_parse(SSL *s, CBS *cbs, int *alert); | 105 | |
104 | 106 | int tlsext_keyshare_client_needs(SSL *s, uint16_t msg_type); | |
105 | int tlsext_cookie_client_needs(SSL *s); | 107 | int tlsext_keyshare_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
106 | int tlsext_cookie_client_build(SSL *s, CBB *cbb); | 108 | int tlsext_keyshare_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
107 | int tlsext_cookie_client_parse(SSL *s, CBS *cbs, int *alert); | 109 | int *alert); |
108 | int tlsext_cookie_server_needs(SSL *s); | 110 | int tlsext_keyshare_server_needs(SSL *s, uint16_t msg_type); |
109 | int tlsext_cookie_server_build(SSL *s, CBB *cbb); | 111 | int tlsext_keyshare_server_build(SSL *s, uint16_t msg_type, CBB *cbb); |
110 | int tlsext_cookie_server_parse(SSL *s, CBS *cbs, int *alert); | 112 | int tlsext_keyshare_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, |
113 | int *alert); | ||
114 | |||
115 | int tlsext_cookie_client_needs(SSL *s, uint16_t msg_type); | ||
116 | int tlsext_cookie_client_build(SSL *s, uint16_t msg_type, CBB *cbb); | ||
117 | int tlsext_cookie_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); | ||
118 | int tlsext_cookie_server_needs(SSL *s, uint16_t msg_type); | ||
119 | int tlsext_cookie_server_build(SSL *s, uint16_t msg_type, CBB *cbb); | ||
120 | int tlsext_cookie_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); | ||
111 | 121 | ||
112 | #ifndef OPENSSL_NO_SRTP | 122 | #ifndef OPENSSL_NO_SRTP |
113 | int tlsext_srtp_client_needs(SSL *s); | 123 | int tlsext_srtp_client_needs(SSL *s, uint16_t msg_type); |
114 | int tlsext_srtp_client_build(SSL *s, CBB *cbb); | 124 | int tlsext_srtp_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |
115 | int tlsext_srtp_client_parse(SSL *s, CBS *cbs, int *alert); | 125 | int tlsext_srtp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
116 | int tlsext_srtp_server_needs(SSL *s); | 126 | int tlsext_srtp_server_needs(SSL *s, uint16_t msg_type); |
117 | int tlsext_srtp_server_build(SSL *s, CBB *cbb); | 127 | int tlsext_srtp_server_build(SSL *s, uint16_t msg_type, CBB *cbb); |
118 | int tlsext_srtp_server_parse(SSL *s, CBS *cbs, int *alert); | 128 | int tlsext_srtp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert); |
119 | #endif | 129 | #endif |
120 | 130 | ||
121 | int tlsext_client_build(SSL *s, uint16_t msg_type, CBB *cbb); | 131 | int tlsext_client_build(SSL *s, uint16_t msg_type, CBB *cbb); |