diff --git a/CMakeLists.txt b/CMakeLists.txt index fcd8b2eef13..55d212fc1a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -550,6 +550,22 @@ check_symbol_exists(MD5_Init "openssl/md5.h" HAVE_MD5_INIT) check_symbol_exists(ENGINE_load_dynamic "openssl/engine.h" HAVE_ENGINE_LOAD_DYNAMIC) check_symbol_exists(ENGINE_get_default_RSA "openssl/engine.h" HAVE_ENGINE_GET_DEFAULT_RSA) check_symbol_exists(ENGINE_load_private_key "openssl/engine.h" HAVE_ENGINE_LOAD_PRIVATE_KEY) +check_source_compiles( + C + "#include + #if defined(OPENSSL_NO_ENGINE) || defined(OPENSSL_NO_DYNAMIC_ENGINE) + #error OpenSSL dynamic engine support unavailable + #endif + int main(void) { + ENGINE_load_dynamic(); + ENGINE *engine = ENGINE_new(); + if (engine) { + ENGINE_free(engine); + } + return 0; + }" + HAVE_OPENSSL_DYNAMIC_ENGINE +) check_symbol_exists(sysctlbyname "sys/sysctl.h" HAVE_SYSCTLBYNAME) if(SSLLIB_IS_OPENSSL3) diff --git a/tests/gold_tests/tls/tls_engine.test.py b/tests/gold_tests/tls/tls_engine.test.py index eadc8e87c76..fcea829e6a0 100644 --- a/tests/gold_tests/tls/tls_engine.test.py +++ b/tests/gold_tests/tls/tls_engine.test.py @@ -25,16 +25,19 @@ Test tls via the async interface with the sample async_engine ''' +async_engine = os.path.join(Test.Variables.AtsTestPluginsDir, 'async_engine.so') + Test.SkipUnless( Condition.HasOpenSSLVersion('1.1.1'), Condition.IsOpenSSL(), + Condition(lambda: os.path.isfile(async_engine), async_engine + " not found."), ) # Define default ATS ts = Test.MakeATSProcess("ts", enable_tls=True) server = Test.MakeOriginServer("server") -ts.Setup.Copy(os.path.join(Test.Variables.AtsTestPluginsDir, 'async_engine.so'), Test.RunDirectory) +ts.Setup.Copy(async_engine, Test.RunDirectory) # Add info the origin server responses server.addResponse( diff --git a/tests/tools/plugins/CMakeLists.txt b/tests/tools/plugins/CMakeLists.txt index 05a4d3d6e1e..1b3c4d7dfe7 100644 --- a/tests/tools/plugins/CMakeLists.txt +++ b/tests/tools/plugins/CMakeLists.txt @@ -34,7 +34,6 @@ target_link_libraries(test_cppapi PRIVATE ts::tscppapi) add_autest_plugin(test_hooks test_hooks.cc) add_autest_plugin(test_log_interface test_log_interface.cc) add_autest_plugin(user_args user_args.cc) -add_autest_plugin(async_engine async_engine.c) add_autest_plugin(hook_tunnel_plugin hook_tunnel_plugin.cc) add_autest_plugin(tunnel_transform tunnel_transform.cc) add_autest_plugin(http2_close_connection http2_close_connection.cc) @@ -44,4 +43,7 @@ target_link_libraries(ssl_client_verify_test PRIVATE OpenSSL::SSL) target_link_libraries(ssl_hook_test PRIVATE OpenSSL::SSL) target_link_libraries(ssl_secret_load_test PRIVATE OpenSSL::SSL) target_link_libraries(ssl_verify_test PRIVATE OpenSSL::SSL) -target_link_libraries(async_engine PRIVATE OpenSSL::SSL) +if(TS_USE_TLS_ASYNC AND HAVE_OPENSSL_DYNAMIC_ENGINE) + add_autest_plugin(async_engine async_engine.c) + target_link_libraries(async_engine PRIVATE OpenSSL::SSL) +endif()