Use this from the TLSv1.3 code.
ok tb@
-/* $OpenBSD: ssl_lib.c,v 1.304 2022/08/21 19:42:15 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.305 2022/09/10 15:29:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ssl_msg_callback(SSL *s, int is_write, int content_type,
const void *msg_buf, size_t msg_len)
{
- if (s->internal->msg_callback != NULL)
- s->internal->msg_callback(is_write, s->version, content_type,
- msg_buf, msg_len, s, s->internal->msg_callback_arg);
+ if (s->internal->msg_callback == NULL)
+ return;
+
+ s->internal->msg_callback(is_write, s->version, content_type,
+ msg_buf, msg_len, s, s->internal->msg_callback_arg);
+}
+
+void
+ssl_msg_callback_cbs(SSL *s, int is_write, int content_type, CBS *cbs)
+{
+ ssl_msg_callback(s, is_write, content_type, CBS_data(cbs), CBS_len(cbs));
}
/* Fix this function so that it takes an optional type parameter */
-/* $OpenBSD: ssl_locl.h,v 1.424 2022/08/21 19:39:44 jsing Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.425 2022/09/10 15:29:33 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
void ssl_info_callback(const SSL *s, int type, int value);
void ssl_msg_callback(SSL *s, int is_write, int content_type,
const void *msg_buf, size_t msg_len);
+void ssl_msg_callback_cbs(SSL *s, int is_write, int content_type, CBS *cbs);
SSL_CERT *ssl_cert_new(void);
SSL_CERT *ssl_cert_dup(SSL_CERT *cert);
-/* $OpenBSD: tls13_lib.c,v 1.70 2022/07/24 14:28:16 jsing Exp $ */
+/* $OpenBSD: tls13_lib.c,v 1.71 2022/09/10 15:29:33 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2019 Bob Beck <beck@openbsd.org>
return;
tls13_handshake_msg_data(ctx->hs_msg, &cbs);
- ssl_msg_callback(s, 0, SSL3_RT_HANDSHAKE, CBS_data(&cbs), CBS_len(&cbs));
+ ssl_msg_callback_cbs(s, 0, SSL3_RT_HANDSHAKE, &cbs);
}
static void
return;
tls13_handshake_msg_data(ctx->hs_msg, &cbs);
- ssl_msg_callback(s, 1, SSL3_RT_HANDSHAKE, CBS_data(&cbs), CBS_len(&cbs));
+ ssl_msg_callback_cbs(s, 1, SSL3_RT_HANDSHAKE, &cbs);
}
static void