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 /src/lib/libssl/ssl_tlsext.h | |
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
Diffstat (limited to 'src/lib/libssl/ssl_tlsext.h')
-rw-r--r-- | src/lib/libssl/ssl_tlsext.h | 174 |
1 files changed, 92 insertions, 82 deletions
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); |