summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
authorAlfredo Pironti <alfredo@pironti.eu>2013-01-22 20:05:08 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-01-23 20:31:17 +0100
commit4968dd090ecf9c88a105a2c805cf97638bcca75d (patch)
treec30b8e7516dfa5dffe16912abd4e9f2217258307 /src/socket.c
parente5b8398af0361b7803e7c97cf43a45044bd68414 (diff)
downloadgnutls-4968dd090ecf9c88a105a2c805cf97638bcca75d.tar.gz
GnuTLS Length Hiding patch.
- Remove random padding; use minimal padding with legacy interface - With new interface, use LH when possible, that is in CBC mode or with the new padding extension - Rename priority to "NEW_PADDING" - gnutls-cli: add command line switch --ranges using LH when possible. - Update documentation Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index 20c366f788..a0c8d64505 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -73,12 +73,23 @@ socket_recv (const socket_st * socket, void *buffer, int buffer_size)
ssize_t
socket_send (const socket_st * socket, const void *buffer, int buffer_size)
{
+ return socket_send_range(socket, buffer, buffer_size, NULL);
+}
+
+
+ssize_t
+socket_send_range (const socket_st * socket, const void *buffer, int buffer_size, gnutls_range_st *range)
+{
int ret;
if (socket->secure)
do
{
- ret = gnutls_record_send (socket->session, buffer, buffer_size);
+ if (range == NULL) {
+ ret = gnutls_record_send (socket->session, buffer, buffer_size);
+ } else {
+ ret = gnutls_range_send_message(socket->session, buffer, buffer_size, *range);
+ }
}
while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
else