From: Nikos Mavrogiannopoulos Date: Wed, 27 Jun 2018 13:00:13 +0000 (+0200) Subject: tests: check for GNUTLS_E_GOT_APPLICATION_DATA on post-handshake auth X-Git-Tag: gnutls_3_6_3~47^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee16068f67d4d69f139cfdd2675c79dacb15dfcf;p=thirdparty%2Fgnutls.git tests: check for GNUTLS_E_GOT_APPLICATION_DATA on post-handshake auth That is, check whether GNUTLS_E_GOT_APPLICATION_DATA is received as documented, and whether post-handshake auth can complete while this is being sent. Resolves #490 Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/tests/tls13/post-handshake-with-cert-ticket.c b/tests/tls13/post-handshake-with-cert-ticket.c index edac74b30f..87b3ea4ea3 100644 --- a/tests/tls13/post-handshake-with-cert-ticket.c +++ b/tests/tls13/post-handshake-with-cert-ticket.c @@ -331,6 +331,7 @@ void doit(void) pid_t child; signal(SIGCHLD, ch_handler); + signal(SIGPIPE, SIG_IGN); ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd); if (ret < 0) { diff --git a/tests/tls13/post-handshake-with-cert.c b/tests/tls13/post-handshake-with-cert.c index e9940e79cb..803a77b196 100644 --- a/tests/tls13/post-handshake-with-cert.c +++ b/tests/tls13/post-handshake-with-cert.c @@ -70,6 +70,7 @@ static void client_log_func(int level, const char *str) } #define MAX_BUF 1024 +#define MAX_APP_DATA 3 static void client(int fd, unsigned send_cert, unsigned max_auths) { @@ -77,7 +78,7 @@ static void client(int fd, unsigned send_cert, unsigned max_auths) gnutls_certificate_credentials_t x509_cred; gnutls_session_t session; char buf[64]; - unsigned i; + unsigned i, j; global_init(); @@ -105,8 +106,6 @@ static void client(int fd, unsigned send_cert, unsigned max_auths) GNUTLS_X509_FMT_PEM)>=0); } - /* put the anonymous credentials to the current session - */ gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred); gnutls_transport_set_int(session, fd); @@ -124,7 +123,12 @@ static void client(int fd, unsigned send_cert, unsigned max_auths) if (debug) success("client handshake completed\n"); + gnutls_record_set_timeout(session, 20 * 1000); + for (i=0;i=0); + } + } + if (debug) success("received reauth request\n"); do { @@ -194,7 +209,7 @@ static void server(int fd, int err, int type, unsigned max_auths) char buffer[MAX_BUF + 1]; gnutls_session_t session; gnutls_certificate_credentials_t x509_cred; - unsigned i; + unsigned i, retries; /* this must be called once in the program */ @@ -203,7 +218,7 @@ static void server(int fd, int err, int type, unsigned max_auths) if (debug) { gnutls_global_set_log_function(server_log_func); - gnutls_global_set_log_level(4711); + gnutls_global_set_log_level(6); } gnutls_certificate_allocate_credentials(&x509_cred); @@ -252,7 +267,40 @@ static void server(int fd, int err, int type, unsigned max_auths) gnutls_certificate_server_set_request(session, type); - for (i=0;i