diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-05-10 13:38:32 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-05-10 13:43:03 +0200 |
commit | 01574b9c01024ad6a0e83cf06412a3816d360469 (patch) | |
tree | c4e0c398cbad1f14f439e25b682822f35f6b1084 | |
parent | 63758e38bead5679a582c4ec03badde19dabd67f (diff) | |
download | gnutls-01574b9c01024ad6a0e83cf06412a3816d360469.tar.gz |
tests: mini-record-timing: updated to work under newer gnutls [ci skip]
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | tests/suite/mini-record-timing.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/tests/suite/mini-record-timing.c b/tests/suite/mini-record-timing.c index 215c0933d5..712386178d 100644 --- a/tests/suite/mini-record-timing.c +++ b/tests/suite/mini-record-timing.c @@ -45,6 +45,7 @@ int main() #include <unistd.h> #include <gnutls/gnutls.h> #include <signal.h> +#include <assert.h> #include <errno.h> #include "../utils.h" @@ -102,10 +103,6 @@ const gnutls_datum_t server_key = { server_key_pem, }; -/* A very basic TLS client, with anonymous authentication. - */ - - #define MAX_PER_POINT (684*1024) #define MAX_MEASUREMENTS(np) (MAX_PER_POINT*(np)) #define MAX_BUF 1024 @@ -314,8 +311,7 @@ client(int fd, const char *prio, unsigned int text_size, while (ret < 0 && gnutls_error_is_fatal(ret) == 0); if (ret < 0) { - fprintf(stderr, "client: Handshake failed\n"); - gnutls_perror(ret); + fprintf(stderr, "client: Handshake failed: %s\n", gnutls_strerror(ret)); exit(1); } @@ -470,20 +466,19 @@ static void server(int fd, const char *prio) gnutls_global_set_log_function(server_log_func); gnutls_global_set_log_level(6); #endif - - gnutls_certificate_allocate_credentials(&x509_cred); + assert(gnutls_certificate_allocate_credentials(&x509_cred)>=0); ret = gnutls_certificate_set_x509_key_mem(x509_cred, &server_cert, &server_key, GNUTLS_X509_FMT_PEM); if (ret < 0) { - fprintf(stderr, "Could not set certificate\n"); + fprintf(stderr, "Could not set certificate: %s\n", gnutls_strerror(ret)); return; } #ifdef REHANDSHAKE restart: #endif - gnutls_init(&session, GNUTLS_SERVER); + assert(gnutls_init(&session, GNUTLS_SERVER)>=0); /* avoid calling all the priority functions, since the defaults * are adequate. @@ -491,7 +486,7 @@ static void server(int fd, const char *prio) if ((ret = gnutls_priority_set_direct(session, prio, &err)) < 0) { fprintf(stderr, "Error in priority string %s: %s\n", gnutls_strerror(ret), err); - return; + exit(1); } gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred); @@ -512,6 +507,7 @@ static void server(int fd, const char *prio) fprintf(stderr, "server: Handshake has failed (%s)\n\n", gnutls_strerror(ret)); + exit(1); } goto finish; } @@ -546,7 +542,6 @@ static void server(int fd, const char *prio) } else if (ret < 0) fprintf(stderr, "err: %s\n", gnutls_strerror(ret)); - /* do not wait for the peer to close the connection. */ gnutls_bye(session, GNUTLS_SHUT_WR); @@ -741,7 +736,7 @@ int main(int argc, char **argv) remove(test->file); snprintf(prio, sizeof(prio), - "NONE:+COMP-NULL:+AES-128-CBC:+%s:+RSA:%%COMPAT:+VERS-TLS1.2:+VERS-TLS1.1", + "NONE:+COMP-NULL:+AES-128-CBC:+%s:+RSA:%%COMPAT:+VERS-TLS1.2:+VERS-TLS1.1:+SIGN-ALL", hash); printf("\nAES-%s (calculating different padding timings)\n", hash); |