diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-11-09 09:36:52 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-11-10 05:26:05 -0800 |
| commit | c9e4b41e109b03ca9ffcf789f8278705451026c7 (patch) | |
| tree | 335fcfc1218cda1344de8031ea9b352bece525ed /src/supplemental/tls/openssl/openssl.c | |
| parent | fcd1adbb6d4d0307aacdd56034695a6083429163 (diff) | |
| download | nng-c9e4b41e109b03ca9ffcf789f8278705451026c7.tar.gz nng-c9e4b41e109b03ca9ffcf789f8278705451026c7.tar.bz2 nng-c9e4b41e109b03ca9ffcf789f8278705451026c7.zip | |
refactor/dtls: Use message oriented send/receive for DTLS.
The protocol here needs to know and respect message boundaries.
Diffstat (limited to 'src/supplemental/tls/openssl/openssl.c')
| -rw-r--r-- | src/supplemental/tls/openssl/openssl.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/supplemental/tls/openssl/openssl.c b/src/supplemental/tls/openssl/openssl.c index 69364dd1..1095bb2f 100644 --- a/src/supplemental/tls/openssl/openssl.c +++ b/src/supplemental/tls/openssl/openssl.c @@ -25,6 +25,7 @@ #include "../../../core/list.h" #include "../../../core/strs.h" #include "../tls_engine.h" +#include "nng/nng.h" // library code for openssl static int ossl_libcode; @@ -116,8 +117,8 @@ tls_log_err(const char *msgid, const char *context, int errnum) static int ossl_net_send(BIO *bio, const char *buf, size_t len, size_t *lenp) { - void *ctx = BIO_get_data(bio); - int rv; + void *ctx = BIO_get_data(bio); + nng_err rv; switch (rv = nng_tls_engine_send(ctx, (const uint8_t *) buf, &len)) { case NNG_OK: @@ -135,8 +136,8 @@ ossl_net_send(BIO *bio, const char *buf, size_t len, size_t *lenp) static int ossl_net_recv(BIO *bio, char *buf, size_t len, size_t *lenp) { - void *ctx = BIO_get_data(bio); - int rv; + void *ctx = BIO_get_data(bio); + nng_err rv; switch (rv = nng_tls_engine_recv(ctx, (uint8_t *) buf, &len)) { case NNG_OK: @@ -348,7 +349,8 @@ ossl_conn_handshake(nng_tls_engine_conn *ec) rv = SSL_do_handshake(ec->ssl); if (rv == 1) { - nng_log_debug("NNG-TLS-HS", "TLS handshake complete"); + nng_log_debug("NNG-TLS-HS", "TLS handshake complete %s", + ec->mode == NNG_TLS_MODE_CLIENT ? "client" : "server"); return (NNG_OK); } rv = SSL_get_error(ec->ssl, rv); |
