@@ -103,8 +103,6 @@ void SecureSocketImpl::acceptSSL()
103103 std::lock_guard<std::recursive_mutex> lock (_mutex);
104104 poco_assert (!_pSSL);
105105
106- LockT l (_ssl_mutex);
107-
108106 BIO* pBIO = BIO_new (BIO_s_socket ());
109107 if (!pBIO) throw SSLException (" Cannot create BIO object" );
110108 BIO_set_fd (pBIO, static_cast <int >(_pSocket->sockfd ()), BIO_NOCLOSE);
@@ -171,8 +169,6 @@ void SecureSocketImpl::connectSSL(bool performHandshake)
171169 poco_assert (!_pSSL);
172170 poco_assert (_pSocket->initialized ());
173171
174- LockT l (_ssl_mutex);
175-
176172 BIO* pBIO = BIO_new (BIO_s_socket ());
177173 if (!pBIO) throw SSLException (" Cannot create SSL BIO object" );
178174 BIO_set_fd (pBIO, static_cast <int >(_pSocket->sockfd ()), BIO_NOCLOSE);
@@ -250,8 +246,6 @@ void SecureSocketImpl::shutdown()
250246 std::lock_guard<std::recursive_mutex> lock (_mutex);
251247 if (_pSSL)
252248 {
253- UnLockT l (_ssl_mutex);
254-
255249 // Don't shut down the socket more than once.
256250 int shutdownState = SSL_get_shutdown (_pSSL);
257251 bool shutdownSent = (shutdownState & SSL_SENT_SHUTDOWN) == SSL_SENT_SHUTDOWN;
@@ -266,7 +260,6 @@ void SecureSocketImpl::shutdown()
266260 // done with it.
267261 int rc = SSL_shutdown (_pSSL);
268262 if (rc < 0 ) handleError (rc);
269- l.unlock ();
270263 if (_pSocket->getBlocking ())
271264 {
272265 _pSocket->shutdown ();
@@ -297,9 +290,6 @@ int SecureSocketImpl::sendBytes(const void* buffer, int length, int flags)
297290 poco_check_ptr (_pSSL);
298291
299292 int rc;
300-
301- LockT l (_ssl_mutex);
302-
303293 if (_needHandshake)
304294 {
305295 rc = completeHandshake ();
@@ -341,8 +331,6 @@ int SecureSocketImpl::receiveBytes(void* buffer, int length, int flags)
341331 poco_assert (_pSocket->initialized ());
342332 poco_check_ptr (_pSSL);
343333
344- LockT l (_ssl_mutex);
345-
346334 // / Special case: just check that we can read from socket
347335 if ((flags & MSG_DONTWAIT) && (flags & MSG_PEEK))
348336 return _pSocket->receiveBytes (buffer, length, flags);
@@ -380,8 +368,6 @@ int SecureSocketImpl::available() const
380368 std::lock_guard<std::recursive_mutex> lock (_mutex);
381369 poco_check_ptr (_pSSL);
382370
383- LockT l (_ssl_mutex);
384-
385371 return SSL_pending (_pSSL);
386372}
387373
@@ -478,20 +464,10 @@ bool SecureSocketImpl::isLocalHost(const std::string& hostName)
478464X509* SecureSocketImpl::peerCertificate () const
479465{
480466 std::lock_guard<std::recursive_mutex> lock (_mutex);
481- LockT l (_ssl_mutex);
482-
483- X509* pCert = nullptr ;
484-
485467 if (_pSSL)
486- {
487- pCert = ::SSL_get_peer_certificate (_pSSL);
488-
489- if (X509_V_OK != SSL_get_verify_result (_pSSL))
490- throw CertificateValidationException (" SecureSocketImpl::peerCertificate(): "
491- " Certificate verification error " + Utility::getLastError ());
492- }
493-
494- return pCert;
468+ return SSL_get1_peer_certificate (_pSSL);
469+ else
470+ return 0 ;
495471}
496472
497473Poco::Timespan SecureSocketImpl::getMaxTimeoutOrLimit ()
@@ -632,8 +608,6 @@ void SecureSocketImpl::reset()
632608 close ();
633609 if (_pSSL)
634610 {
635- LockT l (_ssl_mutex);
636-
637611 SSL_free (_pSSL);
638612 _pSSL = nullptr ;
639613 }
@@ -678,12 +652,9 @@ bool SecureSocketImpl::sessionWasReused()
678652{
679653 std::lock_guard<std::recursive_mutex> lock (_mutex);
680654 if (_pSSL)
681- {
682- LockT l (_ssl_mutex);
683- return ::SSL_session_reused (_pSSL) != 0 ;
684- }
685-
686- return false ;
655+ return SSL_session_reused (_pSSL) != 0 ;
656+ else
657+ return false ;
687658}
688659
689660void SecureSocketImpl::setBlocking (bool flag)
0 commit comments