diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-04-16 09:51:11 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-04-18 11:21:25 +0200 |
commit | b7829c954784e389e22f96a4f4715c0744cc7381 (patch) | |
tree | 3e432acba35d9cef1d9555846b01eabf7aa9ab32 | |
parent | 121e756afdcc58064e2fc2dfa5e93c1902643200 (diff) | |
download | gnutls-b7829c954784e389e22f96a4f4715c0744cc7381.tar.gz |
tests: tls12-rehandshake-cert*: run multiple rehandshake tests
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | tests/tls12-rehandshake-cert-2.c | 5 | ||||
-rw-r--r-- | tests/tls12-rehandshake-cert-3.c | 4 | ||||
-rw-r--r-- | tests/tls12-rehandshake-cert.c | 32 |
3 files changed, 22 insertions, 19 deletions
diff --git a/tests/tls12-rehandshake-cert-2.c b/tests/tls12-rehandshake-cert-2.c index ab48556110..f21f2cbd33 100644 --- a/tests/tls12-rehandshake-cert-2.c +++ b/tests/tls12-rehandshake-cert-2.c @@ -52,7 +52,8 @@ int main() static void terminate(void); -/* This program tests client and server initiated rehandshake. +/* This program tests client and server initiated rehandshake + * behavior when they are refused by the peer. */ static void server_log_func(int level, const char *str) @@ -395,7 +396,7 @@ void doit(void) signal(SIGCHLD, ch_handler); signal(SIGPIPE, SIG_IGN); -// start(0); + start(0); start(1); } diff --git a/tests/tls12-rehandshake-cert-3.c b/tests/tls12-rehandshake-cert-3.c index 94ab1126a0..5d609d882f 100644 --- a/tests/tls12-rehandshake-cert-3.c +++ b/tests/tls12-rehandshake-cert-3.c @@ -53,7 +53,7 @@ int main() static void terminate(void); -/* This program tests client and server initiated rehandshake. +/* This program tests client initiated rehandshake. * On the initial handshake a certificate is requested from the * client, while on the following up not. */ @@ -69,7 +69,7 @@ static void client_log_func(int level, const char *str) } #define MAX_BUF 1024 -#define MAX_REHANDSHAKES 32 +#define MAX_REHANDSHAKES 16 static void client(int fd) { diff --git a/tests/tls12-rehandshake-cert.c b/tests/tls12-rehandshake-cert.c index 00a7d381c5..36660cc15c 100644 --- a/tests/tls12-rehandshake-cert.c +++ b/tests/tls12-rehandshake-cert.c @@ -42,6 +42,8 @@ static void tls_log_func(int level, const char *str) fprintf(stderr, "%s|<%d>| %s", side, level, str); } +#define MAX_REHANDSHAKES 16 + void doit(void) { int exit_code = EXIT_SUCCESS; @@ -53,12 +55,13 @@ void doit(void) gnutls_certificate_credentials_t clientx509cred; gnutls_session_t client; int cret = GNUTLS_E_AGAIN; + unsigned i; /* General init. */ global_init(); gnutls_global_set_log_function(tls_log_func); if (debug) - gnutls_global_set_log_level(2); + gnutls_global_set_log_level(6); /* Init server */ gnutls_certificate_allocate_credentials(&serverx509cred); @@ -85,22 +88,21 @@ void doit(void) HANDSHAKE(client, server); - sret = gnutls_rehandshake(server); - if (debug) { - tls_log_func(0, "gnutls_rehandshake (server)...\n"); - tls_log_func(0, gnutls_strerror(sret)); - tls_log_func(0, "\n"); - } + for (i=0;i<MAX_REHANDSHAKES;i++) { + sret = gnutls_rehandshake(server); + if (debug) + success("gnutls_rehandshake %d (server)...\n", i); - { - ssize_t n; - char b[1]; - n = gnutls_record_recv(client, b, 1); - if (n != GNUTLS_E_REHANDSHAKE) - abort(); - } + { + ssize_t n; + char b[1]; + n = gnutls_record_recv(client, b, 1); + if (n != GNUTLS_E_REHANDSHAKE) + fail("client did not receive the expected rehandshake error code\n"); + } - HANDSHAKE(client, server); + HANDSHAKE(client, server); + } gnutls_bye(client, GNUTLS_SHUT_RDWR); gnutls_bye(server, GNUTLS_SHUT_RDWR); |