diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-04-27 18:40:40 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-06-01 22:49:00 -0700 |
| commit | 8bcb82d245a5fce1bd519e2f99250dedf11e763d (patch) | |
| tree | 4d663bedbb043b9d599f061d7f2b5f9509c8f390 /src/sp/transport/tls | |
| parent | 08400bd437149c4fb31af9b2abece2ae44041283 (diff) | |
| download | nng-8bcb82d245a5fce1bd519e2f99250dedf11e763d.tar.gz nng-8bcb82d245a5fce1bd519e2f99250dedf11e763d.tar.bz2 nng-8bcb82d245a5fce1bd519e2f99250dedf11e763d.zip | |
Introduce DTLS transport for NNG.
This introduces a new experimental transport for DTLS, that
provides encryption over UDP. It has a simpler protocol than
the current UDP SP protocol (but we intend to fix that by making
the UDP transport simpler in a follow up!)
There are a few other fixes in the TLS layer itself, and in
the build, that were needed to accomplish this work.
Also there was an endianness bug in the UDP protocol handling, which
is fixed here.
Diffstat (limited to 'src/sp/transport/tls')
| -rw-r--r-- | src/sp/transport/tls/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/sp/transport/tls/tls.c | 8 | ||||
| -rw-r--r-- | src/sp/transport/tls/tls_tran_test.c | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/sp/transport/tls/CMakeLists.txt b/src/sp/transport/tls/CMakeLists.txt index f55340a9..0ba9a235 100644 --- a/src/sp/transport/tls/CMakeLists.txt +++ b/src/sp/transport/tls/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +# Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> # Copyright 2018 Capitar IT Group BV <info@capitar.com> # # This software is supplied under the terms of the MIT License, a @@ -11,6 +11,8 @@ # TLS transport nng_directory(tls) -nng_sources_if(NNG_TRANSPORT_TLS tls.c) -nng_defines_if(NNG_TRANSPORT_TLS NNG_TRANSPORT_TLS) -nng_test_if(NNG_ENABLE_TLS tls_tran_test) +if (NNG_TRANSPORT_TLS) + nng_sources(tls.c) + nng_defines(NNG_TRANSPORT_TLS) + nng_test(tls_tran_test) +endif() diff --git a/src/sp/transport/tls/tls.c b/src/sp/transport/tls/tls.c index 5c567692..fd983c67 100644 --- a/src/sp/transport/tls/tls.c +++ b/src/sp/transport/tls/tls.c @@ -952,8 +952,14 @@ tlstran_pipe_getopt( return (rv); } +static size_t +tlstran_pipe_size(void) +{ + return (sizeof(tlstran_pipe)); // TODO add engine data size +} + static nni_sp_pipe_ops tlstran_pipe_ops = { - .p_size = sizeof(tlstran_pipe), + .p_size = tlstran_pipe_size, .p_init = tlstran_pipe_init, .p_fini = tlstran_pipe_fini, .p_stop = tlstran_pipe_stop, diff --git a/src/sp/transport/tls/tls_tran_test.c b/src/sp/transport/tls/tls_tran_test.c index 5b38d733..3c43b36e 100644 --- a/src/sp/transport/tls/tls_tran_test.c +++ b/src/sp/transport/tls/tls_tran_test.c @@ -35,6 +35,7 @@ tls_server_config_ecdsa(void) return (c); } +#ifdef NNG_SUPP_TLS_PSK static nng_tls_config * tls_config_psk(nng_tls_mode mode, const char *name, uint8_t *key, size_t len) { @@ -43,6 +44,7 @@ tls_config_psk(nng_tls_mode mode, const char *name, uint8_t *key, size_t len) NUTS_PASS(nng_tls_config_psk(c, name, key, len)); return (c); } +#endif static nng_tls_config * tls_client_config(void) |
