Skip to content

Commit c24760f

Browse files
authored
Merge pull request #1169 from KamilSoko/OpenSSL_3.0_support
Added version check for deprecated function in OpenSSL 3.0
2 parents 9097c56 + 570bea8 commit c24760f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

ACE/ace/SSL/SSL_Context.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,12 @@ ACE_SSL_Context::check_host (const ACE_INET_Addr &host, SSL *peerssl)
366366
return false;
367367
}
368368

369-
X509* cert = ::SSL_get_peer_certificate (peerssl);
369+
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
370+
X509* cert = ::SSL_get1_peer_certificate(peerssl);
371+
#else
372+
X509* cert = ::SSL_get_peer_certificate(peerssl);
373+
#endif
374+
370375
if (cert == 0)
371376
{
372377
return false;

TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Current_Impl.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ TAO::SSLIOP::Current_Impl::~Current_Impl (void)
2020
SecurityLevel3::ClientCredentials_ptr
2121
TAO::SSLIOP::Current_Impl::client_credentials ()
2222
{
23-
TAO::SSLIOP::X509_var cert = ::SSL_get_peer_certificate (this->ssl_);
23+
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
24+
TAO::SSLIOP::X509_var cert = ::SSL_get1_peer_certificate(this->ssl_);
25+
#else
26+
TAO::SSLIOP::X509_var cert = ::SSL_get_peer_certificate(this->ssl_);
27+
#endif
2428
if (cert.ptr () == 0)
2529
throw CORBA::BAD_OPERATION ();
2630

@@ -51,7 +55,11 @@ TAO::SSLIOP::Current_Impl::get_peer_certificate (
5155
if (this->ssl_ == 0)
5256
return;
5357

54-
TAO::SSLIOP::X509_var cert = ::SSL_get_peer_certificate (this->ssl_);
58+
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
59+
TAO::SSLIOP::X509_var cert = ::SSL_get1_peer_certificate(this->ssl_);
60+
#else
61+
TAO::SSLIOP::X509_var cert = ::SSL_get_peer_certificate(this->ssl_);
62+
#endif
5563
if (cert.ptr () == 0)
5664
return;
5765

0 commit comments

Comments
 (0)