diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-03-13 15:46:16 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-03-19 17:19:18 +0100 |
commit | 80f182e8c205d3b25fedbc629d71abcd2483739e (patch) | |
tree | 4958e8376546928ee63f8181fcf8a0342b399927 /tests/mini-dtls-discard.c | |
parent | 671826acc0893f05712266a49dac4851c6523bb7 (diff) | |
download | gnutls-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/mini-dtls-discard.c')
-rw-r--r-- | tests/mini-dtls-discard.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/tests/mini-dtls-discard.c b/tests/mini-dtls-discard.c index 4e5110be16..e9201acaea 100644 --- a/tests/mini-dtls-discard.c +++ b/tests/mini-dtls-discard.c @@ -46,6 +46,7 @@ int main() #include <errno.h> #include <gnutls/gnutls.h> #include <gnutls/dtls.h> +#include <assert.h> #include "utils.h" @@ -57,9 +58,6 @@ int main() static void terminate(void); -/* This program tests the client hello verify in DTLS - */ - static void server_log_func(int level, const char *str) { fprintf(stderr, "server|<%d>| %s", level, str); @@ -70,9 +68,6 @@ 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. - */ - #define MAX_BUF 1024 static ssize_t @@ -89,7 +84,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; gnutls_anon_client_credentials_t anoncred; @@ -112,9 +107,7 @@ static void client(int fd) gnutls_handshake_set_timeout(session, 20 * 1000); /* Use default priorities */ - gnutls_priority_set_direct(session, - "NONE:+VERS-DTLS-ALL:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-ECDH:+CURVE-ALL", - NULL); + assert(gnutls_priority_set_direct(session, prio, NULL) >= 0); /* put the anonymous credentials to the current session */ @@ -181,7 +174,7 @@ static void terminate(void) exit(1); } -static void server(int fd) +static void server(int fd, const char *prio) { int ret; gnutls_anon_server_credentials_t anoncred; @@ -206,9 +199,7 @@ static void server(int fd) /* avoid calling all the priority functions, since the defaults * are adequate. */ - gnutls_priority_set_direct(session, - "NONE:+VERS-DTLS1.0:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-ECDH:+CURVE-ALL", - NULL); + assert(gnutls_priority_set_direct(session, prio, NULL) >= 0); gnutls_credentials_set(session, GNUTLS_CRD_ANON, anoncred); @@ -269,7 +260,8 @@ static void server(int fd) success("server: finished\n"); } -void doit(void) +static +void start(const char *prio) { int fd[2]; int ret; @@ -291,14 +283,20 @@ void doit(void) int status; /* parent */ - 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) +{ + start("NONE:+VERS-DTLS1.0:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-ECDH:+CURVE-ALL"); + start("NONE:+VERS-DTLS1.2:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-ECDH:+CURVE-ALL"); +} + #endif /* _WIN32 */ |