diff options
author | Jose <jose@zeroc.com> | 2016-12-20 20:31:31 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-12-20 20:31:31 +0100 |
commit | 821e58e0ed84d67ac36c580dd255a67d29bdeb45 (patch) | |
tree | 0303ae900c40f76b53d12effee069d8111694654 /cpp/test | |
parent | Support for specifying Java args with test scripts (diff) | |
download | ice-821e58e0ed84d67ac36c580dd255a67d29bdeb45.tar.bz2 ice-821e58e0ed84d67ac36c580dd255a67d29bdeb45.tar.xz ice-821e58e0ed84d67ac36c580dd255a67d29bdeb45.zip |
Add getEngineName & getEngineVersion methods to IceSSL C++ Plugin
The methods can be use to retrieve the engine name and versions
used at runtime, getEngineVersion will return 0 if the engine does
not provide a relevant version number.
Diffstat (limited to 'cpp/test')
-rw-r--r-- | cpp/test/IceSSL/configuration/AllTests.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp index 735db704c75..812e27643d8 100644 --- a/cpp/test/IceSSL/configuration/AllTests.cpp +++ b/cpp/test/IceSSL/configuration/AllTests.cpp @@ -9,9 +9,6 @@ #include <Ice/Ice.h> #include <IceSSL/Plugin.h> -#if ICE_USE_OPENSSL -# include <openssl/ssl.h> // Required for OPENSSL_VERSION_NUMBER -#endif #include <TestCommon.h> #include <Test.h> #include <fstream> @@ -43,17 +40,6 @@ using namespace Windows::Security::Cryptography::Certificates; using namespace std; using namespace Ice; -#ifdef ICE_USE_OPENSSL -// -// With OpenSSL 1.1.0 we need to set SECLEVEL=0 to allow ADH ciphers -// -# if OPENSSL_VERSION_NUMBER >= 0x10100000L -const string anonCiphers = "ADH:@SECLEVEL=0"; -# else -const string anonCiphers = "ADH"; -# endif -#endif - void readFile(const string& file, vector<char>& buffer) { @@ -717,6 +703,29 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12) #else string sep = ":"; #endif + + string engineName; + Ice::Long engineVersion; + { + // + // Get the IceSSL engine name and version + // + InitializationData initData; + initData.properties = createClientProps(defaultProps, defaultDir, defaultHost, p12); + CommunicatorPtr comm = initialize(initData); + IceSSL::PluginPtr plugin = ICE_DYNAMIC_CAST(IceSSL::Plugin, comm->getPluginManager()->getPlugin("IceSSL")); + test(plugin); + engineName = plugin->getEngineName(); + engineVersion = plugin->getEngineVersion(); + comm->destroy(); + } + +#ifdef ICE_USE_OPENSSL + // + // Parse OpenSSL version from engineName "OpenSSLEngine@OpenSSL 1.0.2g 1 Mar 2016" + // + const string anonCiphers = engineVersion >= 0x10100000L ? "ADH:@SECLEVEL=0" : "ADH"; +#endif IceSSL::NativeConnectionInfoPtr info; @@ -1719,13 +1728,14 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12) catch(const LocalException& ex) { // - // OpenSSL < 1.0 doesn't support tls 1.1 so it will also fail, we ignore in this - // case. + // OpenSSL < 1.0 doesn't support tls 1.1 so it will fail, we ignore the error in this case. // -# if defined(ICE_USE_SCHANNEL) || (defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10000000L) - cerr << ex << endl; - test(false); -# endif + if((engineName.find("OpenSSLEngine") != string::npos && engineVersion < 0x10000000L) || + engineName.find("OpenSSLEngine") == string::npos) + { + cerr << ex << endl; + test(false); + } } fact->destroyServer(server); comm->destroy(); |