summaryrefslogtreecommitdiffstats
path: root/src/PolarSSL++/BlockingSslClientSocket.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:45:45 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:50:18 +0100
commitca6ef58b1ee8521e4b940ee4883dee714960e413 (patch)
tree8532add455224b07c07a759e3d906f50c0695888 /src/PolarSSL++/BlockingSslClientSocket.cpp
parentMerge pull request #2972 from marvinkopf/PlayerAutoComplete (diff)
downloadcuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip
Diffstat (limited to 'src/PolarSSL++/BlockingSslClientSocket.cpp')
-rw-r--r--src/PolarSSL++/BlockingSslClientSocket.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/PolarSSL++/BlockingSslClientSocket.cpp b/src/PolarSSL++/BlockingSslClientSocket.cpp
index 61aee211d..7d7fc4ccf 100644
--- a/src/PolarSSL++/BlockingSslClientSocket.cpp
+++ b/src/PolarSSL++/BlockingSslClientSocket.cpp
@@ -106,7 +106,7 @@ bool cBlockingSslClientSocket::Connect(const AString & a_ServerName, UInt16 a_Po
m_LastErrorText = "Already connected";
return false;
}
-
+
// Connect the underlying socket:
m_ServerName = a_ServerName;
if (!cNetwork::Connect(a_ServerName, a_Port,
@@ -123,7 +123,7 @@ bool cBlockingSslClientSocket::Connect(const AString & a_ServerName, UInt16 a_Po
{
return false;
}
-
+
// Initialize the SSL:
int ret = m_Ssl.Initialize(true);
if (ret != 0)
@@ -131,20 +131,20 @@ bool cBlockingSslClientSocket::Connect(const AString & a_ServerName, UInt16 a_Po
Printf(m_LastErrorText, "SSL initialization failed: -0x%x", -ret);
return false;
}
-
+
// If we have been assigned a trusted CA root cert store, push it into the SSL context:
if (m_CACerts.get() != nullptr)
{
m_Ssl.SetCACerts(m_CACerts, m_ExpectedPeerName);
}
-
+
ret = m_Ssl.Handshake();
if (ret != 0)
{
Printf(m_LastErrorText, "SSL handshake failed: -0x%x", -ret);
return false;
}
-
+
return true;
}
@@ -163,7 +163,7 @@ bool cBlockingSslClientSocket::SetTrustedRootCertsFromString(const AString & a_C
a_ExpectedPeerName.c_str()
);
}
-
+
// Parse the cert:
m_CACerts.reset(new cX509Cert);
int ret = m_CACerts->Parse(a_CACerts.data(), a_CACerts.size());
@@ -173,7 +173,7 @@ bool cBlockingSslClientSocket::SetTrustedRootCertsFromString(const AString & a_C
return false;
}
m_ExpectedPeerName = a_ExpectedPeerName;
-
+
return true;
}
@@ -188,7 +188,7 @@ bool cBlockingSslClientSocket::Send(const void * a_Data, size_t a_NumBytes)
m_LastErrorText = "Socket is closed";
return false;
}
-
+
// Keep sending the data until all of it is sent:
const char * Data = reinterpret_cast<const char *>(a_Data);
size_t NumBytes = a_NumBytes;
@@ -241,7 +241,7 @@ void cBlockingSslClientSocket::Disconnect(void)
{
return;
}
-
+
m_Ssl.NotifyClose();
m_IsConnected = false;