summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_tlsext.c
diff options
context:
space:
mode:
authortb <>2020-07-03 04:12:51 +0000
committertb <>2020-07-03 04:12:51 +0000
commit3634005e8a2051a239211f692a45371c14e9d8e4 (patch)
treeccbfc5a18a8593e33c9c504671e7d32e7f8e6c1a /src/lib/libssl/ssl_tlsext.c
parent310bee1edf5b91769a0ac118970281584681c964 (diff)
downloadopenbsd-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.c22
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
2011static int 2011static int
2012tlsext_build(SSL *s, CBB *cbb, int is_server, uint16_t msg_type) 2012tlsext_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
2089static int 2089static int
2090tlsext_parse(SSL *s, CBS *cbs, int *alert, int is_server, uint16_t msg_type) 2090tlsext_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
2177int 2177int
2178tlsext_server_build(SSL *s, CBB *cbb, uint16_t msg_type) 2178tlsext_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
2183int 2183int
2184tlsext_server_parse(SSL *s, CBS *cbs, int *alert, uint16_t msg_type) 2184tlsext_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
2193static void 2193static void
@@ -2199,17 +2199,17 @@ tlsext_client_reset_state(SSL *s)
2199} 2199}
2200 2200
2201int 2201int
2202tlsext_client_build(SSL *s, CBB *cbb, uint16_t msg_type) 2202tlsext_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
2207int 2207int
2208tlsext_client_parse(SSL *s, CBS *cbs, int *alert, uint16_t msg_type) 2208tlsext_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}