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/x509-cert-callback-legacy.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/x509-cert-callback-legacy.c')
-rw-r--r-- | tests/x509-cert-callback-legacy.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/x509-cert-callback-legacy.c b/tests/x509-cert-callback-legacy.c index caf515f711..98ae7dbd9c 100644 --- a/tests/x509-cert-callback-legacy.c +++ b/tests/x509-cert-callback-legacy.c @@ -28,6 +28,7 @@ #include <stdlib.h> #include <string.h> #include <errno.h> +#include <assert.h> #include <gnutls/gnutls.h> #include <gnutls/abstract.h> #include <gnutls/x509.h> @@ -133,7 +134,7 @@ server_cert_callback(gnutls_session_t session, return 0; } -void doit(void) +static void start(const char *prio) { int exit_code = EXIT_SUCCESS; int ret; @@ -146,6 +147,8 @@ void doit(void) gnutls_session_t client; int cret = GNUTLS_E_AGAIN; + success("testing %s\n", prio); + /* General init. */ global_init(); gnutls_global_set_log_function(tls_log_func); @@ -160,8 +163,7 @@ void doit(void) gnutls_init(&server, GNUTLS_SERVER); gnutls_credentials_set(server, GNUTLS_CRD_CERTIFICATE, serverx509cred); - gnutls_priority_set_direct(server, - "NORMAL:-CIPHER-ALL:+AES-128-GCM", NULL); + assert(gnutls_priority_set_direct(server, prio, NULL) >= 0); gnutls_transport_set_push_function(server, server_push); gnutls_transport_set_pull_function(server, server_pull); gnutls_transport_set_ptr(server, server); @@ -191,7 +193,7 @@ void doit(void) if (ret < 0) exit(1); - gnutls_priority_set_direct(client, "NORMAL", NULL); + assert(gnutls_priority_set_direct(client, prio, NULL) >= 0); gnutls_transport_set_push_function(client, client_push); gnutls_transport_set_pull_function(client, client_pull); gnutls_transport_set_ptr(client, client); @@ -376,10 +378,13 @@ void doit(void) gnutls_global_deinit(); - if (debug > 0) { - if (exit_code == 0) - puts("Self-test successful"); - else - puts("Self-test failed"); - } + reset_buffers(); +} + +void doit(void) +{ + start("NORMAL:-VERS-TLS-ALL:+VERS-TLS1.3"); + start("NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2"); + start("NORMAL:-VERS-TLS-ALL:+VERS-TLS1.1"); + start("NORMAL"); } |