Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a default ntci::EncryptionDriver implemented using OpenSSL #233

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmake/templates/ntccfg_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ namespace ntccfg {
// driver for a proactor. This driver is available on Linux.
#define NTC_BUILD_WITH_IORING @NTF_BUILD_WITH_IORING@

// Build with support for OpenSSL as the driver for TLS.
#define NTC_BUILD_WITH_OPENSSL @NTF_BUILD_WITH_OPENSSL@

// Build with support for being able to configure a processing model where
// any thread can process I/O for a socket, rather than just a particular
// thread chosen at the time the socket was created.
Expand Down
14 changes: 14 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ else
NTF_CONFIGURE_WITH_IORING=0
fi

if [[ -z "${NTF_CONFIGURE_WITH_OPENSSL}" ]]; then
NTF_CONFIGURE_WITH_OPENSSL=1
fi

if [[ -z "${NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING}" ]]; then
NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=1
fi
Expand Down Expand Up @@ -477,6 +481,8 @@ usage()
echo " --with-iocp Enable the proactor driver implemented with I/O completion ports (Windows only) [${NTF_CONFIGURE_WITH_IOCP}]"
echo " --with-ioring Enable the proactor driver implemented with 'io_uring' (Linux only) [${NTF_CONFIGURE_WITH_IORING}]"

echo " --with-openssl Enable the encryption driver implemented with OpenSSL [${NTF_CONFIGURE_WITH_OPENSSL}]"

echo " --with-dynamic-load-balancing Enable processing I/O on any thread, rather than a single thread [${NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING}]"
echo " --with-thread-scaling Enable automatic scaling of thread pools [${NTF_CONFIGURE_WITH_THREAD_SCALING}]"
echo " --with-deprecated-features Enable deprecated features [${NTF_CONFIGURE_WITH_DEPRECATED_FEATURES}]"
Expand Down Expand Up @@ -648,6 +654,9 @@ while true ; do
--with-ioring)
NTF_CONFIGURE_WITH_IORING=1 ; shift ;;

--with-openssl)
NTF_CONFIGURE_WITH_OPENSSL=1 ; shift ;;

--with-dynamic-load-balancing)
NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=1 ; shift ;;
--with-thread-scaling)
Expand Down Expand Up @@ -757,6 +766,9 @@ while true ; do
--without-ioring)
NTF_CONFIGURE_WITH_IORING=0 ; shift ;;

--without-openssl)
NTF_CONFIGURE_WITH_OPENSSL=0 ; shift ;;

--without-dynamic-load-balancing)
NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=0 ; shift ;;
--without-thread-scaling)
Expand Down Expand Up @@ -879,6 +891,8 @@ export NTF_CONFIGURE_WITH_KQUEUE
export NTF_CONFIGURE_WITH_IOCP
export NTF_CONFIGURE_WITH_IORING

export NTF_CONFIGURE_WITH_OPENSSL

export NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING
export NTF_CONFIGURE_WITH_THREAD_SCALING
export NTF_CONFIGURE_WITH_DEPRECATED_FEATURES
Expand Down
14 changes: 14 additions & 0 deletions configure.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ IF NOT DEFINED NTF_CONFIGURE_WITH_IOCP (
set NTF_CONFIGURE_WITH_IOCP=1
)

IF NOT DEFINED NTF_CONFIGURE_WITH_OPENSSL (
set NTF_CONFIGURE_WITH_OPENSSL=1
)

IF NOT DEFINED NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING (
set NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=1
)
Expand Down Expand Up @@ -322,6 +326,10 @@ if not "%1"=="" (
set NTF_CONFIGURE_WITH_IOCP=1
)

if "%1"=="--with-openssl" (
set NTF_CONFIGURE_WITH_OPENSSL=1
)

if "%1"=="--with-dynamic-load-balancing" (
set NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=1
)
Expand Down Expand Up @@ -450,6 +458,10 @@ if not "%1"=="" (
set NTF_CONFIGURE_WITH_IOCP=0
)

if "%1"=="--without-openssl" (
set NTF_CONFIGURE_WITH_OPENSSL=0
)

if "%1"=="--without-dynamic-load-balancing" (
set NTF_CONFIGURE_WITH_DYNAMIC_LOAD_BALANCING=0
)
Expand Down Expand Up @@ -840,6 +852,8 @@ echo --with-select Enable the reactor driver implemented
echo --with-poll Enable the reactor driver implemented with 'poll'
echo --with-iocp Enable the proactor driver that depends on I/O completion ports

echo --with-openssl Enable the encryption driver implemented with OpenSSL

echo --with-dynamic-load-balancing Enable processing I/O on any thread, rather than a single thread
echo --with-thread-scaling Enable automatic scaling of thread pools
echo --with-deprecated-features Enable deprecated features
Expand Down
2 changes: 1 addition & 1 deletion groups/ntc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ add_library(ntc STATIC)
bbs_setup_target_uor(
ntc
NO_EMIT_PKG_CONFIG_FILE
PRIVATE_PACKAGES ntcm ntcs ntcq ntcd ntcdns ntcu ntcr ntcp ntco)
PRIVATE_PACKAGES ntcm ntcs ntcq ntcd ntcdns ntctls ntcu ntcr ntcp ntco)

target_include_directories(
ntc
Expand Down
1 change: 1 addition & 0 deletions groups/ntc/group/ntc.dep
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ nts
bal
bdl
bsl
openssl
1 change: 1 addition & 0 deletions groups/ntc/group/ntc.mem
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ ntcu
ntcr
ntcp
ntco
ntctls
ntcf
30 changes: 30 additions & 0 deletions groups/ntc/ntcf/ntcf_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ BSLS_IDENT_RCSID(ntcf_system_cpp, "$Id$ $CSID$")
#include <ntco_pollset.h>
#include <ntco_select.h>

#include <ntctls_plugin.h>

#include <bdlbb_pooledblobbufferfactory.h>

#include <bslma_allocator.h>
Expand Down Expand Up @@ -1339,6 +1341,10 @@ ntsa::Error System::createEncryptionClient(
error = ntcf::System::initialize();
BSLS_ASSERT_OPT(!error);

#if NTC_BUILD_WITH_OPENSSL
ntctls::Plugin::initialize();
#endif

bsl::shared_ptr<ntci::EncryptionDriver> encryptionDriver;
error = ntcs::Plugin::lookupEncryptionDriver(&encryptionDriver);
if (error) {
Expand All @@ -1361,6 +1367,10 @@ ntsa::Error System::createEncryptionClient(
error = ntcf::System::initialize();
BSLS_ASSERT_OPT(!error);

#if NTC_BUILD_WITH_OPENSSL
ntctls::Plugin::initialize();
#endif

bsl::shared_ptr<ntci::EncryptionDriver> encryptionDriver;
error = ntcs::Plugin::lookupEncryptionDriver(&encryptionDriver);
if (error) {
Expand All @@ -1384,6 +1394,10 @@ ntsa::Error System::createEncryptionClient(
error = ntcf::System::initialize();
BSLS_ASSERT_OPT(!error);

#if NTC_BUILD_WITH_OPENSSL
ntctls::Plugin::initialize();
#endif

bsl::shared_ptr<ntci::EncryptionDriver> encryptionDriver;
error = ntcs::Plugin::lookupEncryptionDriver(&encryptionDriver);
if (error) {
Expand All @@ -1406,6 +1420,10 @@ ntsa::Error System::createEncryptionServer(
error = ntcf::System::initialize();
BSLS_ASSERT_OPT(!error);

#if NTC_BUILD_WITH_OPENSSL
ntctls::Plugin::initialize();
#endif

bsl::shared_ptr<ntci::EncryptionDriver> encryptionDriver;
error = ntcs::Plugin::lookupEncryptionDriver(&encryptionDriver);
if (error) {
Expand All @@ -1426,6 +1444,10 @@ ntsa::Error System::createEncryptionResource(
error = ntcf::System::initialize();
BSLS_ASSERT_OPT(!error);

#if NTC_BUILD_WITH_OPENSSL
ntctls::Plugin::initialize();
#endif

bsl::shared_ptr<ntci::EncryptionDriver> encryptionDriver;
error = ntcs::Plugin::lookupEncryptionDriver(&encryptionDriver);
if (error) {
Expand All @@ -1446,6 +1468,10 @@ ntsa::Error System::createEncryptionServer(
error = ntcf::System::initialize();
BSLS_ASSERT_OPT(!error);

#if NTC_BUILD_WITH_OPENSSL
ntctls::Plugin::initialize();
#endif

bsl::shared_ptr<ntci::EncryptionDriver> encryptionDriver;
error = ntcs::Plugin::lookupEncryptionDriver(&encryptionDriver);
if (error) {
Expand All @@ -1469,6 +1495,10 @@ ntsa::Error System::createEncryptionServer(
error = ntcf::System::initialize();
BSLS_ASSERT_OPT(!error);

#if NTC_BUILD_WITH_OPENSSL
ntctls::Plugin::initialize();
#endif

bsl::shared_ptr<ntci::EncryptionDriver> encryptionDriver;
error = ntcs::Plugin::lookupEncryptionDriver(&encryptionDriver);
if (error) {
Expand Down
Loading
Loading