aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtls/tls_socket.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-03-22 11:36:48 +0100
committerTobias Brunner <tobias@strongswan.org>2013-03-22 11:40:57 +0100
commit79306b7e6e8210c68d26ccfaf987b24bfb11623d (patch)
treea85ffd7631a1fc8e7828aad4abe7d6abcc953953 /src/libtls/tls_socket.c
parent03237238b8c3d4a00f5414adeb02390548b1710b (diff)
downloadstrongswan-79306b7e6e8210c68d26ccfaf987b24bfb11623d.tar.bz2
strongswan-79306b7e6e8210c68d26ccfaf987b24bfb11623d.tar.xz
Use proper integer types when handling TLS exchanges
tls_t.build takes a size_t argument not a ssize_t.
Diffstat (limited to 'src/libtls/tls_socket.c')
-rw-r--r--src/libtls/tls_socket.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libtls/tls_socket.c b/src/libtls/tls_socket.c
index 58b511809..9a494c6da 100644
--- a/src/libtls/tls_socket.c
+++ b/src/libtls/tls_socket.c
@@ -156,7 +156,8 @@ METHOD(tls_application_t, build, status_t,
static bool exchange(private_tls_socket_t *this, bool wr, bool block)
{
char buf[CRYPTO_BUF_SIZE], *pos;
- ssize_t len, out;
+ ssize_t in, out;
+ size_t len;
int round = 0, flags;
for (round = 0; TRUE; round++)
@@ -214,8 +215,8 @@ static bool exchange(private_tls_socket_t *this, bool wr, bool block)
flags |= MSG_DONTWAIT;
}
}
- len = recv(this->fd, buf, sizeof(buf), flags);
- if (len < 0)
+ in = recv(this->fd, buf, sizeof(buf), flags);
+ if (in < 0)
{
if (errno == EAGAIN || errno == EWOULDBLOCK)
{
@@ -229,11 +230,11 @@ static bool exchange(private_tls_socket_t *this, bool wr, bool block)
}
return FALSE;
}
- if (len == 0)
+ if (in == 0)
{ /* EOF */
return TRUE;
}
- switch (this->tls->process(this->tls, buf, len))
+ switch (this->tls->process(this->tls, buf, in))
{
case NEED_MORE:
break;