From bae11b88357db72b19413cd05c62ac9242b9b597 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 22 Nov 2020 21:49:58 +0000 Subject: Fix a few bugs. sbearssl appears to be working. --- src/stls/stls_client_init_and_handshake.c | 2 ++ src/stls/stls_run.c | 6 ++++++ src/stls/stls_server_init_and_handshake.c | 2 ++ 3 files changed, 10 insertions(+) (limited to 'src/stls') diff --git a/src/stls/stls_client_init_and_handshake.c b/src/stls/stls_client_init_and_handshake.c index 50898ea..173942f 100644 --- a/src/stls/stls_client_init_and_handshake.c +++ b/src/stls/stls_client_init_and_handshake.c @@ -75,6 +75,8 @@ struct tls *stls_client_init_and_handshake (int const *fds, uint32_t preoptions, if (tls_connect_fds(ctx, fds[0], fds[1], servername) < 0) diectx(97, ctx, "tls_connect_fds") ; tls_config_free(cfg) ; + strerr_warn1x("before handshake") ; if (tls_handshake(ctx) < 0) diectx(97, ctx, "perform SSL handshake") ; + strerr_warn1x("after handshake") ; return ctx ; } diff --git a/src/stls/stls_run.c b/src/stls/stls_run.c index e6ab609..e8305bf 100644 --- a/src/stls/stls_run.c +++ b/src/stls/stls_run.c @@ -118,6 +118,12 @@ void stls_run (struct tls *ctx, int *fds, tain_t const *tto, uint32_t options, u iopause_fd x[4] ; unsigned int xindex[4] ; + if (ndelay_on(fds[0]) < 0 + || ndelay_on(fds[1]) < 0 + || ndelay_on(fds[2]) < 0 + || ndelay_on(fds[3]) < 0) + strerr_diefu1sys(111, "set fds non-blocking") ; + buffer_init(&b[0].b, &buffer_read, fds[0], b[0].buf, STLS_BUFSIZE) ; buffer_init(&b[1].b, &buffer_write, fds[1], b[1].buf, STLS_BUFSIZE) ; diff --git a/src/stls/stls_server_init_and_handshake.c b/src/stls/stls_server_init_and_handshake.c index 5d9c25c..5dd5284 100644 --- a/src/stls/stls_server_init_and_handshake.c +++ b/src/stls/stls_server_init_and_handshake.c @@ -77,7 +77,9 @@ struct tls *stls_server_init_and_handshake (int const *fds, uint32_t preoptions) if (tls_accept_fds(ctx, &cctx, fds[0], fds[1]) < 0) diectx(97, ctx, "tls_accept_fds") ; tls_free(ctx) ; + strerr_warni1x("before handshake") ; if (tls_handshake(cctx) < 0) diectx(97, cctx, "perform SSL handshake") ; + strerr_warni1x("after handshake") ; return cctx ; } -- cgit v1.2.3