summaryrefslogtreecommitdiff
path: root/tests/dtls-client-with-seccomp.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2018-03-13 15:46:16 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2018-03-19 17:19:18 +0100
commit80f182e8c205d3b25fedbc629d71abcd2483739e (patch)
tree4958e8376546928ee63f8181fcf8a0342b399927 /tests/dtls-client-with-seccomp.c
parent671826acc0893f05712266a49dac4851c6523bb7 (diff)
downloadgnutls-80f182e8c205d3b25fedbc629d71abcd2483739e.tar.gz
tests: updated for TLS1.3 inclusion
This moves the test to use a specific version or test multiple TLS versions if applicable. Resolves #413 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests/dtls-client-with-seccomp.c')
-rw-r--r--tests/dtls-client-with-seccomp.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/tests/dtls-client-with-seccomp.c b/tests/dtls-client-with-seccomp.c
index 45d7f29899..34b2409b46 100644
--- a/tests/dtls-client-with-seccomp.c
+++ b/tests/dtls-client-with-seccomp.c
@@ -46,6 +46,7 @@ int main()
#include <signal.h>
#include <gnutls/gnutls.h>
#include <gnutls/dtls.h>
+#include <assert.h>
#include "cert-common.h"
#include "utils.h"
@@ -72,7 +73,7 @@ push(gnutls_transport_ptr_t tr, const void *data, size_t len)
return send(fd, data, len, 0);
}
-static void client(int fd)
+static void client(int fd, const char *prio)
{
int ret;
char buffer[MAX_BUF + 1];
@@ -101,9 +102,9 @@ static void client(int fd)
gnutls_handshake_set_timeout(session, 20 * 1000);
/* Use default priorities */
- gnutls_priority_set_direct(session,
- "NORMAL:-KX-ALL:+ECDHE-RSA",
- NULL);
+ assert(gnutls_priority_set_direct(session,
+ prio,
+ NULL) >= 0);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
@@ -174,7 +175,7 @@ static void terminate(void)
exit(1);
}
-static void server(int fd)
+static void server(int fd, const char *prio)
{
int ret;
gnutls_certificate_credentials_t xcred;
@@ -205,9 +206,9 @@ static void server(int fd)
/* avoid calling all the priority functions, since the defaults
* are adequate.
*/
- gnutls_priority_set_direct(session,
- "NORMAL:-KX-ALL:+ECDHE-RSA",
- NULL);
+ assert(gnutls_priority_set_direct(session,
+ prio,
+ NULL)>=0);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
@@ -265,11 +266,13 @@ static void server(int fd)
success("server: finished\n");
}
-void doit(void)
+static
+void run(const char *name, const char *prio)
{
int fd[2];
int ret;
+ success("testing seccomp with %s\n", name);
signal(SIGPIPE, SIG_IGN);
ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
@@ -290,15 +293,19 @@ void doit(void)
/* parent */
close(fd[1]);
- server(fd[0]);
+ server(fd[0], prio);
wait(&status);
check_wait_status(status);
} else {
close(fd[0]);
- client(fd[1]);
+ client(fd[1], prio);
exit(0);
}
}
+void doit(void)
+{
+ run("dtls1.2", "NORMAL:-KX-ALL:+ECDHE-RSA:-VERS-ALL:+VERS-DTLS1.2");
+}
#endif /* _WIN32 */