#define QUIC_OPENSSL_COMPAT_CLIENT_APPLICATION "CLIENT_TRAFFIC_SECRET_0"
#define QUIC_OPENSSL_COMPAT_SERVER_APPLICATION "SERVER_TRAFFIC_SECRET_0"
+void quic_tls_compat_msg_callback(struct connection *conn,
+ int write_p, int version, int content_type,
+ const void *buf, size_t len, SSL *ssl);
int quic_tls_compat_init(struct bind_conf *bind_conf, SSL_CTX *ctx);
void quic_tls_compat_keylog_callback(const SSL *ssl, const char *line);
}
/* Callback use to parse TLS messages for <ssl> TLS session. */
-static void quic_tls_compat_msg_callback(int write_p, int version, int content_type,
- const void *buf, size_t len, SSL *ssl, void *arg)
+void quic_tls_compat_msg_callback(struct connection *conn,
+ int write_p, int version, int content_type,
+ const void *buf, size_t len, SSL *ssl)
{
unsigned int alert;
enum ssl_encryption_level_t level;
struct quic_conn *qc = SSL_get_ex_data(ssl, ssl_qc_app_data_index);
- struct quic_openssl_compat *com = &qc->openssl_compat;
+ struct quic_openssl_compat *com;
- TRACE_ENTER(QUIC_EV_CONN_SSL_COMPAT, qc);
- if (!write_p)
+ if (!write_p || !qc)
goto leave;
- level = qc->openssl_compat.write_level;
+ TRACE_ENTER(QUIC_EV_CONN_SSL_COMPAT, qc);
+
+ com = &qc->openssl_compat;
+ level = com->write_level;
switch (content_type) {
case SSL3_RT_HANDSHAKE:
com->method->add_handshake_data(ssl, level, buf, len);
goto err;
SSL_set_bio(ssl, rbio, wbio);
- SSL_set_msg_callback(ssl, quic_tls_compat_msg_callback);
/* No ealy data support */
SSL_set_max_early_data(ssl, 0);
#include <haproxy/pattern-t.h>
#include <haproxy/proto_tcp.h>
#include <haproxy/proxy.h>
-#include <haproxy/sample.h>
-#include <haproxy/sc_strm.h>
#include <haproxy/quic_conn.h>
+#include <haproxy/quic_openssl_compat.h>
#include <haproxy/quic_tp.h>
+#include <haproxy/sample.h>
+#include <haproxy/sc_strm.h>
#include <haproxy/server.h>
#include <haproxy/shctx.h>
#include <haproxy/ssl_ckch.h>
return ERR_ABORT;
}
#endif
+#ifdef USE_QUIC_OPENSSL_COMPAT
+ if (!ssl_sock_register_msg_callback(quic_tls_compat_msg_callback))
+ return ERR_ABORT;
+#endif
return ERR_NONE;
}