diff options
author | jsing <> | 2021-08-30 19:25:43 +0000 |
---|---|---|
committer | jsing <> | 2021-08-30 19:25:43 +0000 |
commit | a376b9cd8ffd396f270e597131a83af4f639bd93 (patch) | |
tree | 8e3bea79ab1dea102b95252a7e2c36c06522e41d /src/lib/libssl/tls13_lib.c | |
parent | cedbde20c0ecfb870c00ce4fe4401f89a9397b6d (diff) | |
download | openbsd-a376b9cd8ffd396f270e597131a83af4f639bd93.tar.gz openbsd-a376b9cd8ffd396f270e597131a83af4f639bd93.tar.bz2 openbsd-a376b9cd8ffd396f270e597131a83af4f639bd93.zip |
Clean up and simplify info and msg callbacks.
The info and msg callbacks result in duplication - both for code that
refers to the function pointers and for the call sites. Avoid this by
providing typedefs for the function pointers and pulling the calling
sequences into their own functions.
ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/tls13_lib.c')
-rw-r--r-- | src/lib/libssl/tls13_lib.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c index f064521c8b..77b4364f56 100644 --- a/src/lib/libssl/tls13_lib.c +++ b/src/lib/libssl/tls13_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_lib.c,v 1.59 2021/04/07 21:48:23 tb Exp $ */ | 1 | /* $OpenBSD: tls13_lib.c,v 1.60 2021/08/30 19:25:43 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> |
@@ -162,8 +162,7 @@ tls13_legacy_handshake_message_recv_cb(void *arg) | |||
162 | return; | 162 | return; |
163 | 163 | ||
164 | tls13_handshake_msg_data(ctx->hs_msg, &cbs); | 164 | tls13_handshake_msg_data(ctx->hs_msg, &cbs); |
165 | s->internal->msg_callback(0, TLS1_3_VERSION, SSL3_RT_HANDSHAKE, | 165 | ssl_msg_callback(s, 0, SSL3_RT_HANDSHAKE, CBS_data(&cbs), CBS_len(&cbs)); |
166 | CBS_data(&cbs), CBS_len(&cbs), s, s->internal->msg_callback_arg); | ||
167 | } | 166 | } |
168 | 167 | ||
169 | static void | 168 | static void |
@@ -177,8 +176,7 @@ tls13_legacy_handshake_message_sent_cb(void *arg) | |||
177 | return; | 176 | return; |
178 | 177 | ||
179 | tls13_handshake_msg_data(ctx->hs_msg, &cbs); | 178 | tls13_handshake_msg_data(ctx->hs_msg, &cbs); |
180 | s->internal->msg_callback(1, TLS1_3_VERSION, SSL3_RT_HANDSHAKE, | 179 | ssl_msg_callback(s, 1, SSL3_RT_HANDSHAKE, CBS_data(&cbs), CBS_len(&cbs)); |
181 | CBS_data(&cbs), CBS_len(&cbs), s, s->internal->msg_callback_arg); | ||
182 | } | 180 | } |
183 | 181 | ||
184 | static void | 182 | static void |
@@ -186,12 +184,8 @@ tls13_legacy_info_cb(void *arg, int state, int ret) | |||
186 | { | 184 | { |
187 | struct tls13_ctx *ctx = arg; | 185 | struct tls13_ctx *ctx = arg; |
188 | SSL *s = ctx->ssl; | 186 | SSL *s = ctx->ssl; |
189 | void (*cb)(const SSL *, int, int); | ||
190 | 187 | ||
191 | if ((cb = s->internal->info_callback) == NULL) | 188 | ssl_info_callback(s, state, ret); |
192 | cb = s->ctx->internal->info_callback; | ||
193 | if (cb != NULL) | ||
194 | cb(s, state, ret); | ||
195 | } | 189 | } |
196 | 190 | ||
197 | static int | 191 | static int |