bool SSLSocket::onAccept() { if (getFd() >= 0 && m_data->m_enable_on_connect) { switch (m_data->m_method) { case CryptoMethod::ClientSSLv23: m_data->m_method = CryptoMethod::ServerSSLv23; break; case CryptoMethod::ClientSSLv2: m_data->m_method = CryptoMethod::ServerSSLv2; break; case CryptoMethod::ClientSSLv3: m_data->m_method = CryptoMethod::ServerSSLv3; break; case CryptoMethod::ClientTLS: m_data->m_method = CryptoMethod::ServerTLS; break; default: assert(false); } if (setupCrypto() && enableCrypto()) { return true; } raise_warning("Failed to enable crypto"); close(); } return false; }
bool SSLSocket::enableCrypto(CryptoMethod method) { if (this->m_data->m_method != CryptoMethod::NoCrypto) { raise_warning("SSL/TLS already set-up for this stream"); return false; } this->m_data->m_method = method; return setupCrypto() && enableCrypto(); }
bool SSLSocket::onConnect() { return setupCrypto() && enableCrypto(); }
bool SSLSocket::onConnect() { if (this->m_data->m_method == CryptoMethod::NoCrypto) { return true; } return setupCrypto() && enableCrypto(); }