From 4aae040b1a8aecddcd0e1e959c77bb262fe6b850 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 20 May 2021 10:55:18 +0000 Subject: Add an x509 engine wrapping minimal. NOT FUNCTIONAL, FOR TESTING. --- src/tls/s6-tlsc-io.c | 8 +++++--- src/tls/s6-tlsd-io.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/tls') diff --git a/src/tls/s6-tlsc-io.c b/src/tls/s6-tlsc-io.c index 7c92d96..3c9df58 100644 --- a/src/tls/s6-tlsc-io.c +++ b/src/tls/s6-tlsc-io.c @@ -43,11 +43,11 @@ static inline void doit (int *fds, tain_t const *tto, uint32_t preoptions, uint3 #include -static int handshake_cb (br_ssl_engine_context *ctx, sbearssl_handshake_cb_context_t *cbarg) +static int handshake_cb (br_ssl_engine_context *ctx, sbearssl_handshake_cbarg *cbarg) { if (cbarg->notif) { - if (!sbearssl_send_environment(ctx, cbarg->notif)) return 0 ; + if (!sbearssl_send_environment(ctx, cbarg)) return 0 ; fd_close(cbarg->notif) ; } return 1 ; @@ -55,8 +55,10 @@ static int handshake_cb (br_ssl_engine_context *ctx, sbearssl_handshake_cb_conte static inline void doit (int *fds, tain_t const *tto, uint32_t preoptions, uint32_t options, unsigned int verbosity, char const *servername, unsigned int notif) { + sbearssl_handshake_cbarg cbarg = SBEARSSL_HANDSHAKE_CBARG_ZERO ; if (!random_init()) strerr_diefu1sys(111, "initialize random device") ; - sbearssl_client_init_and_run(fds, tto, preoptions, options, verbosity, servername, &handshake_cb, notif) ; + cbarg.notif = notif ; + sbearssl_client_init_and_run(fds, tto, preoptions, options, verbosity, servername, &handshake_cb, &cbarg) ; } #else diff --git a/src/tls/s6-tlsd-io.c b/src/tls/s6-tlsd-io.c index 01f0d74..060537a 100644 --- a/src/tls/s6-tlsd-io.c +++ b/src/tls/s6-tlsd-io.c @@ -41,11 +41,11 @@ static inline void doit (int *fds, tain_t const *tto, uint32_t preoptions, uint3 #include -static int handshake_cb (br_ssl_engine_context *ctx, sbearssl_handshake_cb_context_t *cbarg) +static int handshake_cb (br_ssl_engine_context *ctx, sbearssl_handshake_cbarg *cbarg) { if (cbarg->notif) { - if (!sbearssl_send_environment(ctx, cbarg->notif)) return 0 ; + if (!sbearssl_send_environment(ctx, cbarg)) return 0 ; fd_close(cbarg->notif) ; } return 1 ; @@ -53,8 +53,10 @@ static int handshake_cb (br_ssl_engine_context *ctx, sbearssl_handshake_cb_conte static inline void doit (int *fds, tain_t const *tto, uint32_t preoptions, uint32_t options, unsigned int verbosity, unsigned int notif) { + sbearssl_handshake_cbarg cbarg = SBEARSSL_HANDSHAKE_CBARG_ZERO ; if (!random_init()) strerr_diefu1sys(111, "initialize random device") ; - sbearssl_server_init_and_run(fds, tto, preoptions, options, verbosity, &handshake_cb, notif) ; + cbarg.notif = notif ; + sbearssl_server_init_and_run(fds, tto, preoptions, options, verbosity, &handshake_cb, &cbarg) ; } #else -- cgit v1.2.3