summaryrefslogtreecommitdiff
path: root/src/cli.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/cli.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/cli.c')
-rw-r--r--src/cli.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cli.c b/src/cli.c
index 142c8831d2..deacb6b418 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -68,7 +68,7 @@
#define MAX_BUF 4096
/* global stuff here */
-int resume, starttls, insecure, rehandshake, udp, mtu;
+int resume, starttls, insecure, ranges, rehandshake, udp, mtu;
const char *hostname = NULL;
const char *service = NULL;
int record_max_size;
@@ -1030,8 +1030,14 @@ after_handshake:
bytes++;
}
}
-
- ret = socket_send (&hd, buffer, bytes);
+ if (ranges && gnutls_range_can_use_length_hiding(hd.session)) {
+ gnutls_range_st range;
+ range.low = 0;
+ range.high = MAX_BUF;
+ ret = socket_send_range (&hd, buffer, bytes, &range);
+ } else {
+ ret = socket_send(&hd, buffer, bytes);
+ }
if (ret > 0)
{
@@ -1129,6 +1135,7 @@ const char* rest = NULL;
resume = HAVE_OPT(RESUME);
rehandshake = HAVE_OPT(REHANDSHAKE);
insecure = HAVE_OPT(INSECURE);
+ ranges = HAVE_OPT(RANGES);
udp = HAVE_OPT(UDP);
mtu = OPT_VALUE_MTU;