diff options
| author | tb <> | 2020-07-03 04:12:51 +0000 |
|---|---|---|
| committer | tb <> | 2020-07-03 04:12:51 +0000 |
| commit | 3634005e8a2051a239211f692a45371c14e9d8e4 (patch) | |
| tree | ccbfc5a18a8593e33c9c504671e7d32e7f8e6c1a /src/lib/libssl/ssl_tlsext.c | |
| parent | 310bee1edf5b91769a0ac118970281584681c964 (diff) | |
| download | openbsd-3634005e8a2051a239211f692a45371c14e9d8e4.tar.gz openbsd-3634005e8a2051a239211f692a45371c14e9d8e4.tar.bz2 openbsd-3634005e8a2051a239211f692a45371c14e9d8e4.zip | |
Improve argument order for the internal tlsext API
Move is_server and msg_type right after the SSL object so that CBS
and CBB and alert come last. This brings these functions more in
line with other internal functions and separates state from data.
requested by jsing
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/ssl_tlsext.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c index f6943c83ae..2b91a087af 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.75 2020/06/06 01:40:09 beck Exp $ */ | 1 | /* $OpenBSD: ssl_tlsext.c,v 1.76 2020/07/03 04:12:51 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> |
| @@ -2009,7 +2009,7 @@ tlsext_funcs(struct tls_extension *tlsext, int is_server) | |||
| 2009 | } | 2009 | } |
| 2010 | 2010 | ||
| 2011 | static int | 2011 | static int |
| 2012 | tlsext_build(SSL *s, CBB *cbb, int is_server, uint16_t msg_type) | 2012 | tlsext_build(SSL *s, int is_server, uint16_t msg_type, CBB *cbb) |
| 2013 | { | 2013 | { |
| 2014 | struct tls_extension_funcs *ext; | 2014 | struct tls_extension_funcs *ext; |
| 2015 | struct tls_extension *tlsext; | 2015 | struct tls_extension *tlsext; |
| @@ -2087,7 +2087,7 @@ tlsext_clienthello_hash_extension(SSL *s, uint16_t type, CBS *cbs) | |||
| 2087 | } | 2087 | } |
| 2088 | 2088 | ||
| 2089 | static int | 2089 | static int |
| 2090 | tlsext_parse(SSL *s, CBS *cbs, int *alert, int is_server, uint16_t msg_type) | 2090 | tlsext_parse(SSL *s, int is_server, uint16_t msg_type, CBS *cbs, int *alert) |
| 2091 | { | 2091 | { |
| 2092 | struct tls_extension_funcs *ext; | 2092 | struct tls_extension_funcs *ext; |
| 2093 | struct tls_extension *tlsext; | 2093 | struct tls_extension *tlsext; |
| @@ -2175,19 +2175,19 @@ tlsext_server_reset_state(SSL *s) | |||
| 2175 | } | 2175 | } |
| 2176 | 2176 | ||
| 2177 | int | 2177 | int |
| 2178 | tlsext_server_build(SSL *s, CBB *cbb, uint16_t msg_type) | 2178 | tlsext_server_build(SSL *s, uint16_t msg_type, CBB *cbb) |
| 2179 | { | 2179 | { |
| 2180 | return tlsext_build(s, cbb, 1, msg_type); | 2180 | return tlsext_build(s, 1, msg_type, cbb); |
| 2181 | } | 2181 | } |
| 2182 | 2182 | ||
| 2183 | int | 2183 | int |
| 2184 | tlsext_server_parse(SSL *s, CBS *cbs, int *alert, uint16_t msg_type) | 2184 | tlsext_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
| 2185 | { | 2185 | { |
| 2186 | /* XXX - this should be done by the caller... */ | 2186 | /* XXX - this should be done by the caller... */ |
| 2187 | if (msg_type == SSL_TLSEXT_MSG_CH) | 2187 | if (msg_type == SSL_TLSEXT_MSG_CH) |
| 2188 | tlsext_server_reset_state(s); | 2188 | tlsext_server_reset_state(s); |
| 2189 | 2189 | ||
| 2190 | return tlsext_parse(s, cbs, alert, 1, msg_type); | 2190 | return tlsext_parse(s, 1, msg_type, cbs, alert); |
| 2191 | } | 2191 | } |
| 2192 | 2192 | ||
| 2193 | static void | 2193 | static void |
| @@ -2199,17 +2199,17 @@ tlsext_client_reset_state(SSL *s) | |||
| 2199 | } | 2199 | } |
| 2200 | 2200 | ||
| 2201 | int | 2201 | int |
| 2202 | tlsext_client_build(SSL *s, CBB *cbb, uint16_t msg_type) | 2202 | tlsext_client_build(SSL *s, uint16_t msg_type, CBB *cbb) |
| 2203 | { | 2203 | { |
| 2204 | return tlsext_build(s, cbb, 0, msg_type); | 2204 | return tlsext_build(s, 0, msg_type, cbb); |
| 2205 | } | 2205 | } |
| 2206 | 2206 | ||
| 2207 | int | 2207 | int |
| 2208 | tlsext_client_parse(SSL *s, CBS *cbs, int *alert, uint16_t msg_type) | 2208 | tlsext_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) |
| 2209 | { | 2209 | { |
| 2210 | /* XXX - this should be done by the caller... */ | 2210 | /* XXX - this should be done by the caller... */ |
| 2211 | if (msg_type == SSL_TLSEXT_MSG_SH) | 2211 | if (msg_type == SSL_TLSEXT_MSG_SH) |
| 2212 | tlsext_client_reset_state(s); | 2212 | tlsext_client_reset_state(s); |
| 2213 | 2213 | ||
| 2214 | return tlsext_parse(s, cbs, alert, 0, msg_type); | 2214 | return tlsext_parse(s, 0, msg_type, cbs, alert); |
| 2215 | } | 2215 | } |
