aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/tls/tls_engine.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-06-21 18:29:24 -0700
committerGarrett D'Amore <garrett@damore.org>2025-06-21 21:11:18 -0700
commit258ae680ca0db3471bbf7345472ff92a030c13a0 (patch)
treecc0b0067a589b7f174715fad50932a3d31437bbb /src/supplemental/tls/tls_engine.h
parent39b86ba0a4f77ba1aa32586a782354f7505409ee (diff)
downloadnng-258ae680ca0db3471bbf7345472ff92a030c13a0.tar.gz
nng-258ae680ca0db3471bbf7345472ff92a030c13a0.tar.bz2
nng-258ae680ca0db3471bbf7345472ff92a030c13a0.zip
TLS: Remove support for dynamic engine initialization.
This saves some atomic lookups, and avoids possible races when the engine is not yet initialized or being torn down.
Diffstat (limited to 'src/supplemental/tls/tls_engine.h')
-rw-r--r--src/supplemental/tls/tls_engine.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/supplemental/tls/tls_engine.h b/src/supplemental/tls/tls_engine.h
index 66d40826..431048df 100644
--- a/src/supplemental/tls/tls_engine.h
+++ b/src/supplemental/tls/tls_engine.h
@@ -174,7 +174,8 @@ typedef enum nng_tls_engine_version_e {
NNG_TLS_ENGINE_V0 = 0,
NNG_TLS_ENGINE_V1 = 1, // adds FIPS, TLS 1.3 support
NNG_TLS_ENGINE_V2 = 2, // adds PSK support
- NNG_TLS_ENGINE_VERSION = NNG_TLS_ENGINE_V2,
+ NNG_TLS_ENGINE_V3 = 3, // refactored API
+ NNG_TLS_ENGINE_VERSION = NNG_TLS_ENGINE_V3,
} nng_tls_engine_version;
typedef struct nng_tls_engine_s {
@@ -202,10 +203,16 @@ typedef struct nng_tls_engine_s {
// It is expected that this will be enabled either at compile
// time, or via environment variables at engine initialization.
// FIPS mode cannot be changed once the engine is registered.
- bool fips_mode;
+ bool (*fips_mode)(void);
+
+ nng_err (*init)(void);
+
+ void (*fini)(void);
+
} nng_tls_engine;
-extern int nng_tls_engine_register(const nng_tls_engine *);
+// Implementation supplies this ops vector.
+extern nng_tls_engine nng_tls_engine_ops;
// nng_tls_engine_send is called by the engine to send data over the
// underlying connection. It returns zero on success, NNG_EAGAIN if