File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1615,6 +1615,7 @@ class OpenSSLContext : public SSLFactoryAPI
16151615
16161616 void set_openssl_tls_groups (const std::string &tls_groups)
16171617 {
1618+ #if OPENSSL_VERSION_NUMBER < 0x30000000L
16181619 auto num_groups = std::count (tls_groups.begin (), tls_groups.end (), ' :' ) + 1 ;
16191620
16201621 std::unique_ptr<int []> glist (new int [num_groups]);
@@ -1648,6 +1649,10 @@ class OpenSSLContext : public SSLFactoryAPI
16481649
16491650 if (!SSL_CTX_set1_groups (ctx.get (), glist.get (), glistlen))
16501651 OPENVPN_THROW (ssl_context_error, " OpenSSLContext: SSL_CTX_set1_groups failed" );
1652+ #else
1653+ if (!SSL_CTX_set1_groups_list (ctx.get (), tls_groups.c_str ()))
1654+ OPENVPN_THROW (ssl_context_error, " OpenSSLContext: SSL_CTX_set1_groups_list failed" );
1655+ #endif
16511656 }
16521657
16531658 // remote-cert-ku verification
Original file line number Diff line number Diff line change @@ -86,14 +86,22 @@ TEST(Ssl, TlsGroups)
8686 sslcfg->set_tls_groups (" secp521r1:secp384r1:greenhell" );
8787
8888 testLog->startCollecting ();
89+ #if defined(USE_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
90+ OVPN_EXPECT_THROW (
91+ f = sslcfg->new_factory (),
92+ openvpn::SSLFactoryAPI::ssl_context_error,
93+ " OpenSSLContext: SSL_CTX_set1_groups_list failed" );
94+ #else
8995 f = sslcfg->new_factory ();
9096 f->set_log_level (logging::LOG_LEVEL_INFO);
9197 f->ssl ();
98+
9299#ifdef USE_OPENSSL
93100 EXPECT_EQ (" OpenSSL -- warning ignoring unknown group 'greenhell' in tls-groups\n " , testLog->stopCollecting ());
94101#else
95102 EXPECT_EQ (" mbed TLS -- warning ignoring unknown group 'greenhell' in tls-groups\n " , testLog->stopCollecting ());
96103#endif
104+ #endif
97105}
98106
99107#ifdef USE_OPENSSL
You can’t perform that action at this time.
0 commit comments