summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2018-07-02 20:25:40 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2018-07-11 15:20:28 +0000
commitc8224ea701cd470bb4643e8d8d86115f2befaa66 (patch)
treeace36effa1d0ce99a03bbdd4d5b89a96cc1cf776
parent9b69b3e9690021456ab1086aeb1125a9753f9ae0 (diff)
downloadgnutls-c8224ea701cd470bb4643e8d8d86115f2befaa66.tar.gz
tests: corrected priority strings in session-tickets-ok and other cleanups
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--tests/session-tickets-ok.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/tests/session-tickets-ok.c b/tests/session-tickets-ok.c
index f33e1967c4..56aae5063c 100644
--- a/tests/session-tickets-ok.c
+++ b/tests/session-tickets-ok.c
@@ -74,7 +74,8 @@ static int handshake_callback(gnutls_session_t session, unsigned int htype,
if (htype != GNUTLS_HANDSHAKE_NEW_SESSION_TICKET)
return 0;
- success("sent session ticket\n");
+ if (debug)
+ success("sent session ticket\n");
sent = 1;
return 0;
}
@@ -86,7 +87,6 @@ static void client(int fd, const char *prio)
int ret;
gnutls_certificate_credentials_t x509_cred;
gnutls_session_t session;
- /* Need to enable anonymous KX specifically. */
global_init();
@@ -97,31 +97,19 @@ static void client(int fd, const char *prio)
gnutls_certificate_allocate_credentials(&x509_cred);
- /* Initialize TLS session
- */
- gnutls_init(&session, GNUTLS_CLIENT);
+ assert(gnutls_init(&session, GNUTLS_CLIENT)>=0);
- /* Use default priorities */
- gnutls_priority_set_direct(session, "NORMAL:-KX-ALL:+ECDHE-RSA", NULL);
+ assert(gnutls_priority_set_direct(session, prio, NULL)>=0);
- /* put the anonymous credentials to the current session
- */
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred);
gnutls_transport_set_int(session, fd);
- /* Perform the TLS handshake
- */
do {
ret = gnutls_handshake(session);
}
while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
- if (ret == GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM) {
- /* success */
- goto end;
- }
-
if (ret < 0) {
fail("client: Handshake failed: %s\n", gnutls_strerror(ret));
terminate();
@@ -137,8 +125,6 @@ static void client(int fd, const char *prio)
gnutls_bye(session, GNUTLS_SHUT_WR);
- end:
-
close(fd);
gnutls_deinit(session);
@@ -193,7 +179,7 @@ static void server(int fd, const char *prio)
/* avoid calling all the priority functions, since the defaults
* are adequate.
*/
- assert(gnutls_priority_set_direct(session, "NORMAL", NULL)>=0);
+ assert(gnutls_priority_set_direct(session, prio, NULL)>=0);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred);