summaryrefslogtreecommitdiff
path: root/extra/yassl/src/handshake.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'extra/yassl/src/handshake.cpp')
-rw-r--r--extra/yassl/src/handshake.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp
index 12b62f26e14..e93f5385b3d 100644
--- a/extra/yassl/src/handshake.cpp
+++ b/extra/yassl/src/handshake.cpp
@@ -9,6 +9,10 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
* yaSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -880,7 +884,7 @@ int sendData(SSL& ssl, const void* buffer, int sz)
ssl.SetError(no_error);
ssl.verfiyHandShakeComplete();
- if (ssl.GetError()) return 0;
+ if (ssl.GetError()) return -1;
int sent = 0;
for (;;) {
@@ -891,7 +895,7 @@ int sendData(SSL& ssl, const void* buffer, int sz)
buildMessage(ssl, out, data);
ssl.Send(out.get_buffer(), out.get_size());
- if (ssl.GetError()) return 0;
+ if (ssl.GetError()) return -1;
sent += len;
if (sent == sz) break;
}
@@ -912,20 +916,24 @@ int sendAlert(SSL& ssl, const Alert& alert)
// process input data
-int receiveData(SSL& ssl, Data& data)
+int receiveData(SSL& ssl, Data& data, bool peek)
{
if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ))
ssl.SetError(no_error);
ssl.verfiyHandShakeComplete();
- if (ssl.GetError()) return 0;
+ if (ssl.GetError()) return -1;
if (!ssl.bufferedData())
processReply(ssl);
+
+ if (peek)
+ ssl.PeekData(data);
+ else
ssl.fillData(data);
- ssl.useLog().ShowData(data.get_length());
- if (ssl.GetError()) return 0;
+ ssl.useLog().ShowData(data.get_length());
+ if (ssl.GetError()) return -1;
if (data.get_length() == 0 && ssl.getSocket().WouldBlock()) {
ssl.SetError(YasslError(SSL_ERROR_WANT_READ));