summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-03-20 09:35:51 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2015-03-20 09:35:51 +0100
commitec3ff806ebd33deb1b695afe4c0890682771df97 (patch)
tree61da6bc766fe77897532792ec4bdb161446b4175 /tests
parent9e0ba3b45b1fc3be6631ebcea7a878758090e09b (diff)
downloadgnutls-ec3ff806ebd33deb1b695afe4c0890682771df97.tar.gz
tests: fixed buffers in mini-dtls0-9
Diffstat (limited to 'tests')
-rw-r--r--tests/mini-dtls0-9.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/mini-dtls0-9.c b/tests/mini-dtls0-9.c
index a54fcc4f5a..eea54f22d2 100644
--- a/tests/mini-dtls0-9.c
+++ b/tests/mini-dtls0-9.c
@@ -63,7 +63,7 @@ static void client_log_func(int level, const char *str)
fprintf(stderr, "client|<%d>| %s", level, str);
}
-/* A very basic TLS client, with anonymous authentication.
+/* A very basic DTLS client handling DTLS 0.9 which sets premaster secret.
*/
#define MAX_BUF 1024
@@ -77,7 +77,7 @@ push(gnutls_transport_ptr_t tr, const void *data, size_t len)
}
static gnutls_datum_t master =
- { (void*)"\x44\x66\x44\xa9\xb6\x29\xed\x6e\xd6\x93\x15\xdb\xf0\x7d\x4b\x2e\x18\xb1\x9d\xed\xff\x6a\x86\x76\xc9\x0e\x16\xab\xc2\x10\xbb\x17\x99\x24\xb1\xd9\xb9\x95\xe7\xea", 48};
+ { (void*)"\x44\x66\x44\xa9\xb6\x29\xed\x6e\xd6\x93\x15\xdb\xf0\x7d\x4b\x2e\x18\xb1\x9d\xed\xff\x6a\x86\x76\xc9\x0e\x16\xab\xc2\x10\xbb\x17\x99\x24\xb1\xd9\xb9\x95\xe7\xea\xea\xea\xea\xea\xff\xaa\xac", 48};
static gnutls_datum_t sess_id =
{ (void*)"\xd9\xb9\x95\xe7\xea", 5};
@@ -87,7 +87,6 @@ static void client(int fd)
char buffer[MAX_BUF + 1];
gnutls_certificate_credentials_t xcred;
gnutls_session_t session;
- /* Need to enable anonymous KX specifically. */
global_init();
@@ -118,8 +117,6 @@ static void client(int fd)
exit(1);
}
- /* put the anonymous credentials to the current session
- */
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
gnutls_transport_set_int(session, fd);
@@ -147,7 +144,7 @@ static void client(int fd)
(gnutls_protocol_get_version(session)));
do {
- ret = gnutls_record_recv(session, buffer, MAX_BUF);
+ ret = gnutls_record_recv(session, buffer, sizeof(buffer)-1);
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
if (ret == 0) {
@@ -251,8 +248,9 @@ static void server(int fd)
/* see the Getting peer's information example */
/* print_info(session); */
+ memset(buffer, 1, sizeof(buffer));
do {
- ret = gnutls_record_send(session, buffer, sizeof(buffer));
+ ret = gnutls_record_send(session, buffer, sizeof(buffer)-1);
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
if (ret < 0) {