summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2010-04-14 14:51:01 +0200
committerSimon Josefsson <simon@josefsson.org>2010-04-14 14:51:01 +0200
commita23f37448755d89924f791999432b76f490cb2bf (patch)
tree188c331f124e69d62fc7e9be2d8d5cab90469b24 /tests
parent705aa8cd3da09abedd6eb5d0d55610b644e4f98d (diff)
downloadgnutls-a23f37448755d89924f791999432b76f490cb2bf.tar.gz
Indent code.
Diffstat (limited to 'tests')
-rw-r--r--tests/anonself.c46
-rw-r--r--tests/certder.c3
-rw-r--r--tests/chainverify.c51
-rw-r--r--tests/crq_apis.c10
-rw-r--r--tests/crq_key_id.c5
-rw-r--r--tests/cve-2008-4989.c8
-rw-r--r--tests/dhepskself.c33
-rw-r--r--tests/dn.c3
-rw-r--r--tests/dn2.c5
-rw-r--r--tests/finished.c43
-rw-r--r--tests/gc.c19
-rw-r--r--tests/hostname-check.c33
-rw-r--r--tests/init_roundtrip.c3
-rw-r--r--tests/mini-eagain.c12
-rw-r--r--tests/mini.c36
-rw-r--r--tests/netconf-psk.c6
-rw-r--r--tests/nul-in-x509-names.c27
-rw-r--r--tests/openpgp-keyring.c3
-rw-r--r--tests/openpgpself.c63
-rw-r--r--tests/parse_ca.c3
-rw-r--r--tests/pkcs12_encode.c6
-rw-r--r--tests/pkcs12_s2k.c15
-rw-r--r--tests/pkcs12_s2k_pem.c2
-rw-r--r--tests/pskself.c31
-rw-r--r--tests/resume.c58
-rw-r--r--tests/set_pkcs12_cred.c16
-rw-r--r--tests/simple.c23
-rw-r--r--tests/tlsia.c60
-rw-r--r--tests/utils.c2
-rw-r--r--tests/x509_altname.c3
-rw-r--r--tests/x509dn.c64
-rw-r--r--tests/x509self.c63
-rw-r--r--tests/x509sign-verify.c3
-rw-r--r--tests/x509signself.c52
34 files changed, 505 insertions, 305 deletions
diff --git a/tests/anonself.c b/tests/anonself.c
index 9b0753e8e4..51eb885de3 100644
--- a/tests/anonself.c
+++ b/tests/anonself.c
@@ -102,18 +102,22 @@ client (void)
}
else
{
- if (debug) success ("client: Handshake was completed\n");
+ if (debug)
+ success ("client: Handshake was completed\n");
}
- if (debug) success ("client: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("client: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
gnutls_record_send (session, MSG, strlen (MSG));
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -126,9 +130,9 @@ client (void)
{
printf ("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++)
- {
- fputc (buffer[ii], stdout);
- }
+ {
+ fputc (buffer[ii], stdout);
+ }
fputs ("\n", stdout);
}
@@ -239,7 +243,8 @@ server_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'.\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'.\n", PORT);
}
static void
@@ -255,7 +260,8 @@ server (void)
gnutls_anon_allocate_server_credentials (&anoncred);
- if (debug) success ("Launched, generating DH parameters...\n");
+ if (debug)
+ success ("Launched, generating DH parameters...\n");
generate_dh_params ();
@@ -267,9 +273,10 @@ server (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
ret = gnutls_handshake (session);
@@ -280,10 +287,13 @@ server (void)
fail ("server: Handshake has failed (%s)\n\n", gnutls_strerror (ret));
return;
}
- if (debug) success ("server: Handshake was completed\n");
+ if (debug)
+ success ("server: Handshake was completed\n");
- if (debug) success ("server: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("server: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
/* see the Getting peer's information example */
/* print_info(session); */
@@ -296,7 +306,8 @@ server (void)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -326,7 +337,8 @@ server (void)
gnutls_global_deinit ();
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}
void
diff --git a/tests/certder.c b/tests/certder.c
index 3baa22d72f..054aa51c0b 100644
--- a/tests/certder.c
+++ b/tests/certder.c
@@ -325,7 +325,8 @@ doit (void)
if (ret != GNUTLS_E_ASN1_DER_ERROR)
fail ("crt3_import %d\n", ret);
- if (debug) success ("done\n");
+ if (debug)
+ success ("done\n");
gnutls_x509_crt_deinit (cert);
diff --git a/tests/chainverify.c b/tests/chainverify.c
index 60bd0361e6..6a31220b8c 100644
--- a/tests/chainverify.c
+++ b/tests/chainverify.c
@@ -756,7 +756,8 @@ tls_log_func (int level, const char *str)
fprintf (stderr, "|<%d>| %s", level, str);
}
-void doit (void)
+void
+doit (void)
{
int exit_val = 0;
size_t i;
@@ -766,7 +767,7 @@ void doit (void)
if (ret != 0)
{
fail ("%d: %s\n", ret, gnutls_strerror (ret));
- exit(EXIT_FAILURE);
+ exit (EXIT_FAILURE);
}
gnutls_global_set_log_function (tls_log_func);
@@ -781,11 +782,13 @@ void doit (void)
gnutls_datum_t tmp;
size_t j;
- if (debug) printf ("Chain '%s' (%d)...\n", chains[i].name, (int) i);
+ if (debug)
+ printf ("Chain '%s' (%d)...\n", chains[i].name, (int) i);
for (j = 0; chains[i].chain[j]; j++)
{
- if (debug) printf ("\tAdding certificate %d...", (int) j);
+ if (debug)
+ printf ("\tAdding certificate %d...", (int) j);
ret = gnutls_x509_crt_init (&certs[j]);
if (ret < 0)
@@ -796,17 +799,20 @@ void doit (void)
tmp.size = strlen (chains[i].chain[j]);
ret = gnutls_x509_crt_import (certs[j], &tmp, GNUTLS_X509_FMT_PEM);
- if (debug) printf ("done\n");
+ if (debug)
+ printf ("done\n");
if (ret < 0)
error (EXIT_FAILURE, 0, "gnutls_x509_crt_import[%d,%d]: %s",
(int) i, (int) j, gnutls_strerror (ret));
gnutls_x509_crt_print (certs[j], GNUTLS_CRT_PRINT_ONELINE, &tmp);
- if (debug) printf ("\tCertificate %d: %.*s\n", (int) j, tmp.size, tmp.data);
+ if (debug)
+ printf ("\tCertificate %d: %.*s\n", (int) j, tmp.size, tmp.data);
gnutls_free (tmp.data);
}
- if (debug) printf ("\tAdding CA certificate...");
+ if (debug)
+ printf ("\tAdding CA certificate...");
ret = gnutls_x509_crt_init (&ca);
if (ret < 0)
@@ -821,13 +827,16 @@ void doit (void)
error (EXIT_FAILURE, 0, "gnutls_x509_crt_import: %s",
gnutls_strerror (ret));
- if (debug) printf ("done\n");
+ if (debug)
+ printf ("done\n");
gnutls_x509_crt_print (ca, GNUTLS_CRT_PRINT_ONELINE, &tmp);
- if (debug) printf ("\tCA Certificate: %.*s\n", tmp.size, tmp.data);
+ if (debug)
+ printf ("\tCA Certificate: %.*s\n", tmp.size, tmp.data);
gnutls_free (tmp.data);
- if (debug) printf ("\tVerifying...");
+ if (debug)
+ printf ("\tVerifying...");
ret = gnutls_x509_crt_list_verify (certs, j,
&ca, 1, NULL, 0,
@@ -835,29 +844,33 @@ void doit (void)
&verify_status);
if (ret < 0)
error (EXIT_FAILURE, 0, "gnutls_x509_crt_list_verify[%d,%d]: %s",
- (int)i, (int)j, gnutls_strerror (ret));
+ (int) i, (int) j, gnutls_strerror (ret));
if (verify_status != chains[i].expected_verify_result)
{
- fail("verify_status: %d expected: %d",
- verify_status, chains[i].expected_verify_result);
-
- if (debug) exit(1);
+ fail ("verify_status: %d expected: %d",
+ verify_status, chains[i].expected_verify_result);
+
+ if (debug)
+ exit (1);
}
else if (debug)
printf ("done\n");
- if (debug) printf ("\tCleanup...");
+ if (debug)
+ printf ("\tCleanup...");
gnutls_x509_crt_deinit (ca);
for (j = 0; chains[i].chain[j]; j++)
gnutls_x509_crt_deinit (certs[j]);
- if (debug) printf ("done\n");
+ if (debug)
+ printf ("done\n");
}
gnutls_global_deinit ();
- if (debug) printf ("Exit status...%d\n", exit_val);
+ if (debug)
+ printf ("Exit status...%d\n", exit_val);
- exit(exit_val);
+ exit (exit_val);
}
diff --git a/tests/crq_apis.c b/tests/crq_apis.c
index bc71544a0e..d1b8dec00e 100644
--- a/tests/crq_apis.c
+++ b/tests/crq_apis.c
@@ -127,13 +127,13 @@ doit (void)
s = 0;
ret = gnutls_x509_crq_get_challenge_password (crq, NULL, &s);
if (ret != 0 || s != 3)
- fail ("gnutls_x509_crq_get_challenge_password2 %d/%d\n", ret, (int)s);
+ fail ("gnutls_x509_crq_get_challenge_password2 %d/%d\n", ret, (int) s);
s = 10;
ret = gnutls_x509_crq_get_challenge_password (crq, smallbuf, &s);
if (ret != 0 || s != 3 || strcmp (smallbuf, "foo") != 0)
fail ("gnutls_x509_crq_get_challenge_password3 %d/%d/%s\n",
- ret,(int) s, smallbuf);
+ ret, (int) s, smallbuf);
s = 0;
ret = gnutls_x509_crq_get_extension_info (crq, 0, NULL, &s, NULL);
@@ -190,7 +190,8 @@ doit (void)
ret = gnutls_x509_crq_print (crq, GNUTLS_CRT_PRINT_FULL, &out);
if (ret != 0)
fail ("gnutls_x509_crq_print\n");
- if (debug) printf ("crq: %.*s\n", out.size, out.data);
+ if (debug)
+ printf ("crq: %.*s\n", out.size, out.data);
gnutls_free (out.data);
ret = gnutls_x509_crt_set_version (crt, 3);
@@ -204,7 +205,8 @@ doit (void)
ret = gnutls_x509_crt_print (crt, GNUTLS_CRT_PRINT_FULL, &out);
if (ret != 0)
fail ("gnutls_x509_crt_print\n");
- if (debug) printf ("crt: %.*s\n", out.size, out.data);
+ if (debug)
+ printf ("crt: %.*s\n", out.size, out.data);
gnutls_free (out.data);
gnutls_x509_crq_deinit (crq);
diff --git a/tests/crq_key_id.c b/tests/crq_key_id.c
index 7f28ef6496..16db47defa 100644
--- a/tests/crq_key_id.c
+++ b/tests/crq_key_id.c
@@ -150,7 +150,8 @@ doit (void)
ret = memcmp (crq_key_id, pkey_key_id, crq_key_id_len);
if (ret == 0)
{
- if (debug) success ("Key ids are identical. OK.\n");
+ if (debug)
+ success ("Key ids are identical. OK.\n");
}
else
{
@@ -160,7 +161,7 @@ doit (void)
else
{
fail ("Key_id lengths differ incorrectly: %d - %d\n",
- (int)crq_key_id_len, (int)pkey_key_id_len);
+ (int) crq_key_id_len, (int) pkey_key_id_len);
}
diff --git a/tests/cve-2008-4989.c b/tests/cve-2008-4989.c
index ca38db53e0..16a9fd121e 100644
--- a/tests/cve-2008-4989.c
+++ b/tests/cve-2008-4989.c
@@ -165,7 +165,7 @@ main (int argc, char *argv[])
{
ret = gnutls_x509_crt_init (&certs[i]);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_init[%d]: %s", (int)i,
+ error (EXIT_FAILURE, 0, "gnutls_x509_crt_init[%d]: %s", (int) i,
gnutls_strerror (ret));
tmp.data = (char *) pem_certs[i];
@@ -173,7 +173,7 @@ main (int argc, char *argv[])
ret = gnutls_x509_crt_import (certs[i], &tmp, GNUTLS_X509_FMT_PEM);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_import[%d]: %s", (int)i,
+ error (EXIT_FAILURE, 0, "gnutls_x509_crt_import[%d]: %s", (int) i,
gnutls_strerror (ret));
}
@@ -196,7 +196,7 @@ main (int argc, char *argv[])
GNUTLS_VERIFY_DISABLE_TIME_CHECKS,
&verify_status);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_list_verify[%d]: %s", (int)i,
+ error (EXIT_FAILURE, 0, "gnutls_x509_crt_list_verify[%d]: %s", (int) i,
gnutls_strerror (ret));
if (verify_status != (GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID))
@@ -228,7 +228,7 @@ main (int argc, char *argv[])
GNUTLS_VERIFY_DISABLE_TIME_CHECKS,
&verify_status);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_list_verify[%d]: %s", (int)i,
+ error (EXIT_FAILURE, 0, "gnutls_x509_crt_list_verify[%d]: %s", (int) i,
gnutls_strerror (ret));
if (verify_status != 0)
diff --git a/tests/dhepskself.c b/tests/dhepskself.c
index d3493f2d8a..5b65119174 100644
--- a/tests/dhepskself.c
+++ b/tests/dhepskself.c
@@ -102,7 +102,8 @@ client (void)
}
else
{
- if (debug) success ("client: Handshake was completed\n");
+ if (debug)
+ success ("client: Handshake was completed\n");
}
gnutls_record_send (session, MSG, strlen (MSG));
@@ -110,7 +111,8 @@ client (void)
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -123,7 +125,7 @@ client (void)
{
printf ("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++)
- fputc (buffer[ii], stdout);
+ fputc (buffer[ii], stdout);
fputs ("\n", stdout);
}
@@ -185,7 +187,8 @@ generate_dh_params (void)
static int
pskfunc (gnutls_session_t session, const char *username, gnutls_datum_t * key)
{
- if (debug) printf ("psk callback to get %s's password\n", username);
+ if (debug)
+ printf ("psk callback to get %s's password\n", username);
key->data = gnutls_malloc (4);
key->data[0] = 0xDE;
key->data[1] = 0xAD;
@@ -208,7 +211,8 @@ int optval = 1;
static void
server_start (void)
{
- if (debug) success ("Launched, generating DH parameters...\n");
+ if (debug)
+ success ("Launched, generating DH parameters...\n");
/* Socket operations
*/
@@ -244,7 +248,8 @@ server_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'.\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'.\n", PORT);
}
static void
@@ -270,9 +275,10 @@ server (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
ret = gnutls_handshake (session);
@@ -283,7 +289,8 @@ server (void)
fail ("server: Handshake has failed (%s)\n\n", gnutls_strerror (ret));
return;
}
- if (debug) success ("server: Handshake was completed\n");
+ if (debug)
+ success ("server: Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
@@ -296,7 +303,8 @@ server (void)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -326,7 +334,8 @@ server (void)
gnutls_global_deinit ();
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}
void
diff --git a/tests/dn.c b/tests/dn.c
index 66ac122a17..5500e690c4 100644
--- a/tests/dn.c
+++ b/tests/dn.c
@@ -126,7 +126,8 @@ doit (void)
print_dn (xdn);
}
- if (debug) success ("done\n");
+ if (debug)
+ success ("done\n");
gnutls_x509_crt_deinit (cert);
gnutls_global_deinit ();
diff --git a/tests/dn2.c b/tests/dn2.c
index 9b21690ec9..f9493b9077 100644
--- a/tests/dn2.c
+++ b/tests/dn2.c
@@ -92,11 +92,12 @@ doit (void)
if (out.size != strlen (info) || strcmp (out.data, info) != 0)
fail ("comparison fail (%d/%d)\nexpect: %s\n got: %.*s\n",
- out.size, (int)strlen (info), info, out.size, out.data);
+ out.size, (int) strlen (info), info, out.size, out.data);
gnutls_x509_crt_deinit (cert);
gnutls_global_deinit ();
gnutls_free (out.data);
- if (debug) success ("done\n");
+ if (debug)
+ success ("done\n");
}
diff --git a/tests/finished.c b/tests/finished.c
index 58df1afeba..1b2ad94fea 100644
--- a/tests/finished.c
+++ b/tests/finished.c
@@ -49,7 +49,8 @@ size_t to_client_len;
static ssize_t
client_pull (gnutls_transport_ptr_t tr, void *data, size_t len)
{
- if (debug) success ("client_pull len %d has %d\n", (int)len, (int)to_client_len);
+ if (debug)
+ success ("client_pull len %d has %d\n", (int) len, (int) to_client_len);
if (to_client_len < len)
{
@@ -71,9 +72,9 @@ client_push (gnutls_transport_ptr_t tr, const void *data, size_t len)
size_t newlen = to_server_len + len;
char *tmp;
- if (debug)
+ if (debug)
{
- success ("client_push len %d has %d\n", (int)len, (int)to_server_len);
+ success ("client_push len %d has %d\n", (int) len, (int) to_server_len);
hexprint (data, len);
}
@@ -94,7 +95,8 @@ client_push (gnutls_transport_ptr_t tr, const void *data, size_t len)
static ssize_t
server_pull (gnutls_transport_ptr_t tr, void *data, size_t len)
{
- if (debug) success ("server_pull len %d has %d\n", (int)len, (int)to_server_len);
+ if (debug)
+ success ("server_pull len %d has %d\n", (int) len, (int) to_server_len);
if (to_server_len < len)
{
@@ -116,9 +118,9 @@ server_push (gnutls_transport_ptr_t tr, const void *data, size_t len)
size_t newlen = to_client_len + len;
char *tmp;
- if (debug)
+ if (debug)
{
- success ("server_push len %d has %d\n", (int)len, (int)to_client_len);
+ success ("server_push len %d has %d\n", (int) len, (int) to_client_len);
hexprint (data, len);
}
@@ -140,9 +142,9 @@ static void
client_finished_callback (gnutls_session_t session,
const void *finished, size_t len)
{
- if (debug)
+ if (debug)
{
- success ("client finished (length %d)\n", (int)len);
+ success ("client finished (length %d)\n", (int) len);
hexprint (finished, len);
}
}
@@ -151,9 +153,9 @@ static void
server_finished_callback (gnutls_session_t session,
const void *finished, size_t len)
{
- if (debug)
+ if (debug)
{
- success ("server finished (length %d)\n", (int)len);
+ success ("server finished (length %d)\n", (int) len);
hexprint (finished, len);
}
}
@@ -214,24 +216,30 @@ doit (void)
{
if (cret == GNUTLS_E_AGAIN)
{
- if (debug) success ("loop invoking client:\n");
+ if (debug)
+ success ("loop invoking client:\n");
cret = gnutls_handshake (client);
- if (debug) success ("client %d: %s\n", cret, gnutls_strerror (cret));
+ if (debug)
+ success ("client %d: %s\n", cret, gnutls_strerror (cret));
}
if (sret == GNUTLS_E_AGAIN)
{
- if (debug) success ("loop invoking server:\n");
+ if (debug)
+ success ("loop invoking server:\n");
sret = gnutls_handshake (server);
- if (debug) success ("server %d: %s\n", sret, gnutls_strerror (sret));
+ if (debug)
+ success ("server %d: %s\n", sret, gnutls_strerror (sret));
}
}
while (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN);
- if (debug) success ("Handshake established\n");
+ if (debug)
+ success ("Handshake established\n");
ns = gnutls_record_send (client, MSG, strlen (MSG));
- if (debug) success ("client: sent %d\n", (int)ns);
+ if (debug)
+ success ("client: sent %d\n", (int) ns);
ret = gnutls_record_recv (server, buffer, MAX_BUF);
if (ret == 0)
@@ -247,7 +255,8 @@ doit (void)
}
ns = gnutls_record_send (server, MSG, strlen (MSG));
- if (debug) success ("server: sent %d\n", (int)ns);
+ if (debug)
+ success ("server: sent %d\n", (int) ns);
ret = gnutls_record_recv (client, buffer, MAX_BUF);
if (ret == 0)
diff --git a/tests/gc.c b/tests/gc.c
index 47c927b8de..b0aaed8145 100644
--- a/tests/gc.c
+++ b/tests/gc.c
@@ -49,9 +49,10 @@ doit (void)
{
if (memcmp (digest, "\x3c\xb0\x9d\x83\x28\x01\xef\xc0"
"\x7b\xb3\xaf\x42\x69\xe5\x93\x9a", 16) == 0)
- {
- if (debug) success ("_gnutls_hmac_fast(MD5) OK\n");
- }
+ {
+ if (debug)
+ success ("_gnutls_hmac_fast(MD5) OK\n");
+ }
else
{
hexprint (digest, 16);
@@ -69,9 +70,10 @@ doit (void)
if (memcmp (digest, "\x58\x93\x7a\x58\xfe\xea\x82\xf8"
"\x0e\x64\x62\x01\x40\x2b\x2c\xed\x5d\x54\xc1\xfa",
20) == 0)
- {
- if (debug) success ("_gnutls_hmac_fast(SHA1) OK\n");
- }
+ {
+ if (debug)
+ success ("_gnutls_hmac_fast(SHA1) OK\n");
+ }
else
{
hexprint (digest, 20);
@@ -87,8 +89,9 @@ doit (void)
if (memcmp (digest, "\x09\xb7\x85\x57\xdd\xf6\x07\x15"
"\x1c\x52\x34\xde\xba\x5c\xdc\x59", 16) == 0)
{
- if (debug) success ("_gnutls_pkcs5_pbkdf2_sha1() OK\n");
- }
+ if (debug)
+ success ("_gnutls_pkcs5_pbkdf2_sha1() OK\n");
+ }
else
{
hexprint (digest, 16);
diff --git a/tests/hostname-check.c b/tests/hostname-check.c
index 5e9328d807..29d6278c20 100644
--- a/tests/hostname-check.c
+++ b/tests/hostname-check.c
@@ -693,7 +693,8 @@ doit (void)
fail ("gnutls_openpgp_crt_init: %d\n", ret);
#endif
- if (debug) success ("Testing pem1...\n");
+ if (debug)
+ success ("Testing pem1...\n");
data.data = pem1;
data.size = strlen (pem1);
@@ -705,7 +706,8 @@ doit (void)
if (ret)
fail ("Hostname incorrectly matches (%d)\n", ret);
- if (debug) success ("Testing pem2...\n");
+ if (debug)
+ success ("Testing pem2...\n");
data.data = pem2;
data.size = strlen (pem2);
@@ -725,7 +727,8 @@ doit (void)
if (ret)
fail ("Hostname incorrectly matches (%d)\n", ret);
- if (debug) success ("Testing pem3...\n");
+ if (debug)
+ success ("Testing pem3...\n");
data.data = pem3;
data.size = strlen (pem3);
@@ -745,7 +748,8 @@ doit (void)
if (ret)
fail ("Hostname incorrectly matches (%d)\n", ret);
- if (debug) success ("Testing pem4...\n");
+ if (debug)
+ success ("Testing pem4...\n");
data.data = pem4;
data.size = strlen (pem4);
@@ -769,7 +773,8 @@ doit (void)
if (ret)
fail ("Hostname incorrectly matches (%d)\n", ret);
- if (debug) success ("Testing pem5...\n");
+ if (debug)
+ success ("Testing pem5...\n");
data.data = pem5;
data.size = strlen (pem5);
@@ -789,7 +794,8 @@ doit (void)
if (ret)
fail ("Hostname incorrectly matches (%d)\n", ret);
- if (debug) success ("Testing pem6...\n");
+ if (debug)
+ success ("Testing pem6...\n");
data.data = pem6;
data.size = strlen (pem6);
@@ -805,7 +811,8 @@ doit (void)
if (!ret)
fail ("Hostname incorrectly does not match (%d)\n", ret);
- if (debug) success ("Testing pem7...\n");
+ if (debug)
+ success ("Testing pem7...\n");
data.data = pem7;
data.size = strlen (pem7);
@@ -829,7 +836,8 @@ doit (void)
if (!ret)
fail ("Hostname incorrectly does not match (%d)\n", ret);
- if (debug) success ("Testing pem8...\n");
+ if (debug)
+ success ("Testing pem8...\n");
data.data = pem8;
data.size = strlen (pem8);
@@ -853,7 +861,8 @@ doit (void)
if (ret)
fail ("Hostname incorrectly matches (%d)\n", ret);
- if (debug) success ("Testing pem9...\n");
+ if (debug)
+ success ("Testing pem9...\n");
data.data = pem9;
data.size = strlen (pem9);
@@ -869,7 +878,8 @@ doit (void)
if (!ret)
fail ("Hostname incorrectly does not match (%d)\n", ret);
- if (debug) success ("Testing pem10...\n");
+ if (debug)
+ success ("Testing pem10...\n");
data.data = pem10;
data.size = strlen (pem10);
@@ -882,7 +892,8 @@ doit (void)
fail ("Hostname incorrectly matches (%d)\n", ret);
#ifdef ENABLE_OPENPGP
- if (debug) success ("Testing pem11...\n");
+ if (debug)
+ success ("Testing pem11...\n");
data.data = pem11;
data.size = strlen (pem11);
diff --git a/tests/init_roundtrip.c b/tests/init_roundtrip.c
index e232f8de89..29e3a844d1 100644
--- a/tests/init_roundtrip.c
+++ b/tests/init_roundtrip.c
@@ -48,5 +48,6 @@ doit (void)
gnutls_global_deinit ();
- if (debug) success ("init-deinit round-trip success\n");
+ if (debug)
+ success ("init-deinit round-trip success\n");
}
diff --git a/tests/mini-eagain.c b/tests/mini-eagain.c
index 872a16bd95..b7240703f6 100644
--- a/tests/mini-eagain.c
+++ b/tests/mini-eagain.c
@@ -225,7 +225,8 @@ doit (void)
}
while (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN);
handshake = 0;
- if (debug) success ("Handshake established\n");
+ if (debug)
+ success ("Handshake established\n");
ns = gnutls_record_send (client, MSG, strlen (MSG));
//success ("client: sent %d\n", ns);
@@ -248,7 +249,8 @@ doit (void)
else
{
transferred += ret;
- if (debug) fputs ("*", stdout);
+ if (debug)
+ fputs ("*", stdout);
}
ns = gnutls_record_send (server, MSG, strlen (MSG));
@@ -270,11 +272,13 @@ doit (void)
else
{
transferred += ret;
- if (debug) fputs (".", stdout);
+ if (debug)
+ fputs (".", stdout);
}
}
while (transferred < 7000);
- if (debug) fputs ("\n", stdout);
+ if (debug)
+ fputs ("\n", stdout);
gnutls_bye (client, GNUTLS_SHUT_RDWR);
gnutls_bye (server, GNUTLS_SHUT_RDWR);
diff --git a/tests/mini.c b/tests/mini.c
index c415f5e0b8..315bbfec35 100644
--- a/tests/mini.c
+++ b/tests/mini.c
@@ -48,7 +48,7 @@ static ssize_t
client_pull (gnutls_transport_ptr_t tr, void *data, size_t len)
{
if (debug)
- success ("client_pull len %d has %d\n", (int)len, (int)to_client_len);
+ success ("client_pull len %d has %d\n", (int) len, (int) to_client_len);
if (to_client_len < len)
{
@@ -72,7 +72,7 @@ client_push (gnutls_transport_ptr_t tr, const void *data, size_t len)
if (debug)
{
- success ("client_push len %d has %d\n", (int)len, (int)to_server_len);
+ success ("client_push len %d has %d\n", (int) len, (int) to_server_len);
hexprint (data, len);
}
@@ -94,7 +94,7 @@ static ssize_t
server_pull (gnutls_transport_ptr_t tr, void *data, size_t len)
{
if (debug)
- success ("server_pull len %d has %d\n", (int)len, (int)to_server_len);
+ success ("server_pull len %d has %d\n", (int) len, (int) to_server_len);
if (to_server_len < len)
{
@@ -118,7 +118,7 @@ server_push (gnutls_transport_ptr_t tr, const void *data, size_t len)
if (debug)
{
- success ("server_push len %d has %d\n", (int)len, (int)to_client_len);
+ success ("server_push len %d has %d\n", (int) len, (int) to_client_len);
hexprint (data, len);
}
@@ -193,22 +193,27 @@ doit (void)
if (debug)
success ("loop invoking client:\n");
cret = gnutls_handshake (client);
- if (debug) success ("client %d: %s\n", cret, gnutls_strerror (cret));
+ if (debug)
+ success ("client %d: %s\n", cret, gnutls_strerror (cret));
}
if (sret == GNUTLS_E_AGAIN)
{
- if (debug) success ("loop invoking server:\n");
+ if (debug)
+ success ("loop invoking server:\n");
sret = gnutls_handshake (server);
- if (debug) success ("server %d: %s\n", sret, gnutls_strerror (sret));
+ if (debug)
+ success ("server %d: %s\n", sret, gnutls_strerror (sret));
}
}
while (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN);
- if (debug) success ("Handshake established\n");
+ if (debug)
+ success ("Handshake established\n");
ns = gnutls_record_send (client, MSG, strlen (MSG));
- if (debug) success ("client: sent %d\n", (int)ns);
+ if (debug)
+ success ("client: sent %d\n", (int) ns);
ret = gnutls_record_recv (server, buffer, MAX_BUF);
if (ret == 0)
@@ -227,7 +232,8 @@ doit (void)
}
ns = gnutls_record_send (server, MSG, strlen (MSG));
- if (debug) success ("server: sent %d\n", (int)ns);
+ if (debug)
+ success ("server: sent %d\n", (int) ns);
ret = gnutls_record_recv (client, buffer, MAX_BUF);
if (ret == 0)
@@ -241,12 +247,12 @@ doit (void)
else
{
if (debug)
- {
- printf ("client: received %d: ", ret);
- for (n = 0; n < ret; n++)
+ {
+ printf ("client: received %d: ", ret);
+ for (n = 0; n < ret; n++)
fputc (buffer[n], stdout);
- fputs ("\n", stdout);
- }
+ fputs ("\n", stdout);
+ }
}
gnutls_bye (client, GNUTLS_SHUT_RDWR);
diff --git a/tests/netconf-psk.c b/tests/netconf-psk.c
index 6b03257ac2..604f4d91e0 100644
--- a/tests/netconf-psk.c
+++ b/tests/netconf-psk.c
@@ -57,7 +57,8 @@ doit (void)
if (gnutls_psk_netconf_derive_key ("password", "psk_identity",
"psk_identity_hint", &key) == 0)
{
- if (debug) success ("success: gnutls_psk_netconf_derive_key\n");
+ if (debug)
+ success ("success: gnutls_psk_netconf_derive_key\n");
}
else
fail ("gnutls_psk_netconf_derive_key failure\n");
@@ -67,7 +68,8 @@ doit (void)
if (key.size == 20 && memcmp (key.data, known, 20) == 0)
{
- if (debug) success ("success: match.\n");
+ if (debug)
+ success ("success: match.\n");
}
else
fail ("FAIL: key differ.\n");
diff --git a/tests/nul-in-x509-names.c b/tests/nul-in-x509-names.c
index c4b85f7a6b..6995826c4f 100644
--- a/tests/nul-in-x509-names.c
+++ b/tests/nul-in-x509-names.c
@@ -30,7 +30,7 @@
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
-#include "utils.h"
+#include "utils.h"
/* Thanks to Tomas Hoger <thoger@redhat.com> for generating the two
certs that trigger this bug. */
@@ -90,7 +90,8 @@ const gnutls_datum_t badguy_nul_san = {
badguy_nul_san_data, sizeof (badguy_nul_san_data)
};
-void doit(void)
+void
+doit (void)
{
gnutls_x509_crt_t crt;
int ret;
@@ -99,48 +100,50 @@ void doit(void)
if (ret < 0)
{
fail ("gnutls_global_init");
- exit(1);
+ exit (1);
}
ret = gnutls_x509_crt_init (&crt);
if (ret != 0)
{
- fail("gnutls_x509_crt_init");
- exit(1);
+ fail ("gnutls_x509_crt_init");
+ exit (1);
}
ret = gnutls_x509_crt_import (crt, &badguy_nul_cn, GNUTLS_X509_FMT_PEM);
if (ret < 0)
{
- fail("gnutls_x509_crt_import");
- exit(1);
+ fail ("gnutls_x509_crt_import");
+ exit (1);
}
ret = gnutls_x509_crt_check_hostname (crt, "www.bank.com");
if (ret == 0)
{
- if (debug) success("gnutls_x509_crt_check_hostname OK (NUL-IN-CN)");
+ if (debug)
+ success ("gnutls_x509_crt_check_hostname OK (NUL-IN-CN)");
}
else
{
- fail("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-CN)");
+ fail ("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-CN)");
}
ret = gnutls_x509_crt_import (crt, &badguy_nul_san, GNUTLS_X509_FMT_PEM);
if (ret < 0)
{
fail ("gnutls_x509_crt_import");
- exit(1);
+ exit (1);
}
ret = gnutls_x509_crt_check_hostname (crt, "www.bank.com");
if (ret == 0)
{
- if (debug) success("gnutls_x509_crt_check_hostname OK (NUL-IN-SAN)");
+ if (debug)
+ success ("gnutls_x509_crt_check_hostname OK (NUL-IN-SAN)");
}
else
{
- fail("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-SAN)");
+ fail ("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-SAN)");
}
gnutls_x509_crt_deinit (crt);
diff --git a/tests/openpgp-keyring.c b/tests/openpgp-keyring.c
index df69ad1a4e..2ddd0edcfc 100644
--- a/tests/openpgp-keyring.c
+++ b/tests/openpgp-keyring.c
@@ -229,7 +229,8 @@ doit (void)
if (ret != 0)
fail ("keyring-check-id second key %d\n", ret);
- if (debug) success ("done\n");
+ if (debug)
+ success ("done\n");
gnutls_openpgp_keyring_deinit (keyring);
gnutls_global_deinit ();
diff --git a/tests/openpgpself.c b/tests/openpgpself.c
index edc42425ac..c9ebbb78b6 100644
--- a/tests/openpgpself.c
+++ b/tests/openpgpself.c
@@ -120,7 +120,8 @@ client (void)
/* sets the trusted cas file
*/
- if (debug) success ("Setting key files...\n");
+ if (debug)
+ success ("Setting key files...\n");
ret = gnutls_certificate_set_openpgp_key_mem (xcred, &cert, &key,
GNUTLS_OPENPGP_FMT_BASE64);
@@ -142,7 +143,8 @@ client (void)
/* connect to the peer
*/
- if (debug) success ("Connecting...\n");
+ if (debug)
+ success ("Connecting...\n");
sd = tcp_connect ();
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
@@ -157,23 +159,27 @@ client (void)
gnutls_perror (ret);
goto end;
}
- else if (debug)
+ else if (debug)
{
success ("client: Handshake was completed\n");
}
- if (debug) success ("client: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("client: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
/* see the Getting peer's information example */
- if (debug) print_info (session);
+ if (debug)
+ print_info (session);
gnutls_record_send (session, MSG, strlen (MSG));
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -184,12 +190,12 @@ client (void)
if (debug)
{
- printf ("- Received %d bytes: ", ret);
- for (ii = 0; ii < ret; ii++)
- {
- fputc (buffer[ii], stdout);
- }
- fputs ("\n", stdout);
+ printf ("- Received %d bytes: ", ret);
+ for (ii = 0; ii < ret; ii++)
+ {
+ fputc (buffer[ii], stdout);
+ }
+ fputs ("\n", stdout);
}
gnutls_bye (session, GNUTLS_SHUT_RDWR);
@@ -376,7 +382,8 @@ server_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'.\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'.\n", PORT);
}
static void
@@ -400,7 +407,8 @@ server (void)
fail ("Could not set server key files...\n");
}
- if (debug) success ("Launched, setting DH parameters...\n");
+ if (debug)
+ success ("Launched, setting DH parameters...\n");
generate_dh_params ();
@@ -412,9 +420,10 @@ server (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
ret = gnutls_handshake (session);
@@ -425,13 +434,17 @@ server (void)
fail ("server: Handshake has failed (%s)\n\n", gnutls_strerror (ret));
return;
}
- if (debug) success ("server: Handshake was completed\n");
+ if (debug)
+ success ("server: Handshake was completed\n");
- if (debug) success ("server: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("server: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
/* see the Getting peer's information example */
- if (debug) print_info (session);
+ if (debug)
+ print_info (session);
i = 0;
for (;;)
@@ -441,7 +454,8 @@ server (void)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -471,7 +485,8 @@ server (void)
gnutls_global_deinit ();
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}
diff --git a/tests/parse_ca.c b/tests/parse_ca.c
index c02124a43f..18bb4b394f 100644
--- a/tests/parse_ca.c
+++ b/tests/parse_ca.c
@@ -76,5 +76,6 @@ doit (void)
gnutls_global_deinit ();
- if (debug) success ("import ok\n");
+ if (debug)
+ success ("import ok\n");
}
diff --git a/tests/pkcs12_encode.c b/tests/pkcs12_encode.c
index 18c3fe8684..6558b56ec2 100644
--- a/tests/pkcs12_encode.c
+++ b/tests/pkcs12_encode.c
@@ -65,7 +65,8 @@ static char ca_pem[] =
"PfqUpIhz5Bbm7J4=\n" "-----END CERTIFICATE-----\n";
const gnutls_datum_t ca_dat = { ca_pem, sizeof (ca_pem) };
-void doit(void)
+void
+doit (void)
{
gnutls_pkcs12_t pkcs12;
gnutls_x509_crt_t client;
@@ -158,7 +159,8 @@ void doit(void)
if (ret < 0)
error (EXIT_FAILURE, 0, "pkcs12_export: %d", ret);
- if (debug) fwrite (outbuf, size, 1, stdout);
+ if (debug)
+ fwrite (outbuf, size, 1, stdout);
/* Cleanup. */
gnutls_pkcs12_deinit (pkcs12);
diff --git a/tests/pkcs12_s2k.c b/tests/pkcs12_s2k.c
index 447d628359..4136f2b599 100644
--- a/tests/pkcs12_s2k.c
+++ b/tests/pkcs12_s2k.c
@@ -138,11 +138,12 @@ doit (void)
if (debug)
printf ("ij: %d.%d: %s\n", i, j,
- _gnutls_bin2hex (key, sizeof (key), tmp, sizeof (tmp)));
+ _gnutls_bin2hex (key, sizeof (key), tmp, sizeof (tmp)));
x++;
}
}
- if (debug) printf ("\n");
+ if (debug)
+ printf ("\n");
for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
{
@@ -158,12 +159,14 @@ doit (void)
fail ("_gnutls_pkcs12_string_to_key failed[3]\n");
if (debug)
- printf ("tv[%d]: %s\n", i,
- _gnutls_bin2hex (key, tv[i].keylen, tmp, sizeof (tmp)));
+ printf ("tv[%d]: %s\n", i,
+ _gnutls_bin2hex (key, tv[i].keylen, tmp, sizeof (tmp)));
}
- if (debug) printf ("\n");
+ if (debug)
+ printf ("\n");
gnutls_global_deinit ();
- if (debug) success ("_gnutls_pkcs12_string_to_key ok\n");
+ if (debug)
+ success ("_gnutls_pkcs12_string_to_key ok\n");
}
diff --git a/tests/pkcs12_s2k_pem.c b/tests/pkcs12_s2k_pem.c
index 1970111c0d..b9b7a0b5e4 100644
--- a/tests/pkcs12_s2k_pem.c
+++ b/tests/pkcs12_s2k_pem.c
@@ -284,7 +284,7 @@ main (void)
keys[i].password, 0);
if (ret != keys[i].expected_result)
{
- printf ("fail[%d]: %d: %s\n", (int)i, ret, gnutls_strerror (ret));
+ printf ("fail[%d]: %d: %s\n", (int) i, ret, gnutls_strerror (ret));
return 1;
}
diff --git a/tests/pskself.c b/tests/pskself.c
index b4181188ed..6ef343dfb2 100644
--- a/tests/pskself.c
+++ b/tests/pskself.c
@@ -94,7 +94,8 @@ client (void)
}
else
{
- if (debug) success ("client: Handshake was completed\n");
+ if (debug)
+ success ("client: Handshake was completed\n");
}
gnutls_record_send (session, MSG, strlen (MSG));
@@ -102,7 +103,8 @@ client (void)
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -166,7 +168,8 @@ initialize_tls_session (void)
static int
pskfunc (gnutls_session_t session, const char *username, gnutls_datum_t * key)
{
- if (debug) printf ("psk: username %s\n", username);
+ if (debug)
+ printf ("psk: username %s\n", username);
key->data = gnutls_malloc (4);
key->data[0] = 0xDE;
key->data[1] = 0xAD;
@@ -189,7 +192,8 @@ int optval = 1;
static void
server_start (void)
{
- if (debug) success ("Launched...\n");
+ if (debug)
+ success ("Launched...\n");
/* Socket operations
*/
@@ -225,7 +229,8 @@ server_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'.\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'.\n", PORT);
}
static void
@@ -244,9 +249,10 @@ server (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
ret = gnutls_handshake (session);
@@ -257,7 +263,8 @@ server (void)
fail ("server: Handshake has failed (%s)\n\n", gnutls_strerror (ret));
return;
}
- if (debug) success ("server: Handshake was completed\n");
+ if (debug)
+ success ("server: Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
@@ -270,7 +277,8 @@ server (void)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -298,7 +306,8 @@ server (void)
gnutls_global_deinit ();
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}
void
diff --git a/tests/resume.c b/tests/resume.c
index 1faf0b17d7..8486f18a23 100644
--- a/tests/resume.c
+++ b/tests/resume.c
@@ -153,7 +153,8 @@ client (struct params_res *params)
}
else
{
- if (debug) success ("client: Handshake was completed\n");
+ if (debug)
+ success ("client: Handshake was completed\n");
}
if (t == 0)
@@ -170,9 +171,10 @@ client (struct params_res *params)
if (gnutls_session_is_resumed (session) != 0)
{
if (params->expect_resume)
- {
- if (debug) success ("- Previous session was resumed\n");
- }
+ {
+ if (debug)
+ success ("- Previous session was resumed\n");
+ }
else
fail ("- Previous session was resumed\n");
}
@@ -181,9 +183,11 @@ client (struct params_res *params)
if (params->expect_resume)
fail ("*** Previous session was NOT resumed\n");
else
- {
- if (debug) success ("*** Previous session was NOT resumed (expected)\n");
- }
+ {
+ if (debug)
+ success
+ ("*** Previous session was NOT resumed (expected)\n");
+ }
}
}
@@ -192,7 +196,8 @@ client (struct params_res *params)
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -330,13 +335,15 @@ global_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'.\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'.\n", PORT);
}
static void
global_stop (void)
{
- if (debug) success ("global stop\n");
+ if (debug)
+ success ("global stop\n");
gnutls_anon_free_server_credentials (anoncred);
@@ -363,7 +370,8 @@ server (struct params_res *params)
gnutls_global_init ();
gnutls_anon_allocate_server_credentials (&anoncred);
- if (debug) success ("Launched, generating DH parameters...\n");
+ if (debug)
+ success ("Launched, generating DH parameters...\n");
generate_dh_params ();
@@ -386,9 +394,10 @@ server (struct params_res *params)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
ret = gnutls_handshake (session);
@@ -400,7 +409,8 @@ server (struct params_res *params)
gnutls_strerror (ret));
return;
}
- if (debug) success ("server: Handshake was completed\n");
+ if (debug)
+ success ("server: Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
@@ -413,7 +423,8 @@ server (struct params_res *params)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -447,7 +458,8 @@ server (struct params_res *params)
gnutls_free (session_ticket_key.data);
session_ticket_key.data = NULL;
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}
void
@@ -457,7 +469,8 @@ doit (void)
for (i = 0; resume_tests[i].desc; i++)
{
- if (debug) printf ("%s\n", resume_tests[i].desc);
+ if (debug)
+ printf ("%s\n", resume_tests[i].desc);
global_start ();
if (error_count)
@@ -527,7 +540,8 @@ wrap_db_deinit (void)
static int
wrap_db_store (void *dbf, gnutls_datum_t key, gnutls_datum_t data)
{
- if (debug) success ("resume db storing... (%d-%d)\n", key.size, data.size);
+ if (debug)
+ success ("resume db storing... (%d-%d)\n", key.size, data.size);
if (debug)
{
@@ -576,7 +590,8 @@ wrap_db_fetch (void *dbf, gnutls_datum_t key)
gnutls_datum_t res = { NULL, 0 };
int i;
- if (debug) success ("resume db fetch... (%d)\n", key.size);
+ if (debug)
+ success ("resume db fetch... (%d)\n", key.size);
if (debug)
{
unsigned int i;
@@ -598,7 +613,8 @@ wrap_db_fetch (void *dbf, gnutls_datum_t key)
if (key.size == cache_db[i].session_id_size &&
memcmp (key.data, cache_db[i].session_id, key.size) == 0)
{
- if (debug) success ("resume db fetch... return info\n");
+ if (debug)
+ success ("resume db fetch... return info\n");
res.size = cache_db[i].session_data_size;
diff --git a/tests/set_pkcs12_cred.c b/tests/set_pkcs12_cred.c
index 200f8b661a..69b54896cc 100644
--- a/tests/set_pkcs12_cred.c
+++ b/tests/set_pkcs12_cred.c
@@ -51,8 +51,9 @@ doit (void)
if (!password)
password = "foobar";
- if (debug) success ("Reading PKCS#12 blob from `%s' using password `%s'.\n",
- file, password);
+ if (debug)
+ success ("Reading PKCS#12 blob from `%s' using password `%s'.\n",
+ file, password);
ret = gnutls_certificate_set_x509_simple_pkcs12_file (x509cred,
file,
GNUTLS_X509_FMT_DER,
@@ -60,7 +61,8 @@ doit (void)
if (ret < 0)
fail ("x509_pkcs12 failed %d: %s\n", ret, gnutls_strerror (ret));
- if (debug) success ("Read file OK\n");
+ if (debug)
+ success ("Read file OK\n");
gnutls_certificate_free_credentials (x509cred);
@@ -79,8 +81,9 @@ doit (void)
if (!password)
password = "";
- if (debug) success ("Reading PKCS#12 blob from `%s' using password `%s'.\n",
- file, password);
+ if (debug)
+ success ("Reading PKCS#12 blob from `%s' using password `%s'.\n",
+ file, password);
ret = gnutls_certificate_set_x509_simple_pkcs12_file (x509cred,
file,
GNUTLS_X509_FMT_DER,
@@ -88,7 +91,8 @@ doit (void)
if (ret < 0)
fail ("x509_pkcs12 failed %d: %s\n", ret, gnutls_strerror (ret));
- if (debug) success ("Read file OK\n");
+ if (debug)
+ success ("Read file OK\n");
gnutls_certificate_free_credentials (x509cred);
diff --git a/tests/simple.c b/tests/simple.c
index 3449de1a28..f0981afb1e 100644
--- a/tests/simple.c
+++ b/tests/simple.c
@@ -32,7 +32,7 @@
void
doit (void)
{
- if (debug)
+ if (debug)
{
printf ("GnuTLS header version %s.\n", GNUTLS_VERSION);
printf ("GnuTLS library version %s.\n", gnutls_check_version (NULL));
@@ -52,9 +52,10 @@ doit (void)
for (i = 0; algs[i]; i++)
{
- if (debug) printf ("pk_list[%d] = %d = %s = %d\n", (int)i, algs[i],
- gnutls_pk_algorithm_get_name (algs[i]),
- gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i])));
+ if (debug)
+ printf ("pk_list[%d] = %d = %s = %d\n", (int) i, algs[i],
+ gnutls_pk_algorithm_get_name (algs[i]),
+ gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i])));
if (gnutls_pk_get_id (gnutls_pk_algorithm_get_name (algs[i]))
!= algs[i])
fail ("gnutls_pk id's doesn't match\n");
@@ -64,7 +65,8 @@ doit (void)
if (pk != GNUTLS_PK_UNKNOWN)
fail ("gnutls_pk unknown test failed (%d)\n", pk);
- if (debug) success ("gnutls_pk_list ok\n");
+ if (debug)
+ success ("gnutls_pk_list ok\n");
}
{
@@ -79,10 +81,10 @@ doit (void)
for (i = 0; algs[i]; i++)
{
if (debug)
- printf ("sign_list[%d] = %d = %s = %d\n", (int)i, algs[i],
- gnutls_sign_algorithm_get_name (algs[i]),
- gnutls_sign_get_id (gnutls_sign_algorithm_get_name
- (algs[i])));
+ printf ("sign_list[%d] = %d = %s = %d\n", (int) i, algs[i],
+ gnutls_sign_algorithm_get_name (algs[i]),
+ gnutls_sign_get_id (gnutls_sign_algorithm_get_name
+ (algs[i])));
if (gnutls_sign_get_id (gnutls_sign_algorithm_get_name (algs[i])) !=
algs[i])
fail ("gnutls_sign id's doesn't match\n");
@@ -92,6 +94,7 @@ doit (void)
if (pk != GNUTLS_PK_UNKNOWN)
fail ("gnutls_sign unknown test failed (%d)\n", pk);
- if (debug) success ("gnutls_sign_list ok\n");
+ if (debug)
+ success ("gnutls_sign_list ok\n");
}
}
diff --git a/tests/tlsia.c b/tests/tlsia.c
index 9e6bd6c785..8e1778c0c5 100644
--- a/tests/tlsia.c
+++ b/tests/tlsia.c
@@ -61,10 +61,10 @@ client_avp (gnutls_session_t session, void *ptr,
if (debug)
{
if (last)
- printf ("client: received %d bytes AVP: `%.*s'\n",
- (int)lastlen, (int) lastlen, last);
+ printf ("client: received %d bytes AVP: `%.*s'\n",
+ (int) lastlen, (int) lastlen, last);
else
- printf ("client: new application phase\n");
+ printf ("client: new application phase\n");
}
switch (iter)
@@ -97,7 +97,8 @@ client_avp (gnutls_session_t session, void *ptr,
return -1;
*newlen = strlen (*new);
- if (debug) printf ("client: sending %d bytes AVP: `%s'\n", (int)*newlen, *new);
+ if (debug)
+ printf ("client: sending %d bytes AVP: `%s'\n", (int) *newlen, *new);
gnutls_ia_permute_inner_secret (session, 3, "foo");
@@ -159,7 +160,8 @@ client (void)
}
else
{
- if (debug) success ("client: Handshake was completed\n");
+ if (debug)
+ success ("client: Handshake was completed\n");
}
/*
@@ -173,7 +175,8 @@ client (void)
fail ("client: No TLS/IA negotiation\n");
else
{
- if (debug) success ("client: TLS/IA handshake\n");
+ if (debug)
+ success ("client: TLS/IA handshake\n");
ret = gnutls_ia_handshake (session);
@@ -185,7 +188,8 @@ client (void)
}
else
{
- if (debug) success ("client: TLS/IA Handshake was completed\n");
+ if (debug)
+ success ("client: TLS/IA Handshake was completed\n");
}
}
@@ -194,7 +198,8 @@ client (void)
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -295,7 +300,7 @@ server_avp (gnutls_session_t session, void *ptr,
if (last && debug)
printf ("server: received %d bytes AVP: `%.*s'\n",
- (int)lastlen, (int) lastlen, last);
+ (int) lastlen, (int) lastlen, last);
gnutls_ia_permute_inner_secret (session, 3, "foo");
@@ -344,13 +349,15 @@ server_avp (gnutls_session_t session, void *ptr,
if (strcmp (p, "1") == 0)
{
- if (debug) success ("server: Sending IntermediatePhaseFinished...\n");
+ if (debug)
+ success ("server: Sending IntermediatePhaseFinished...\n");
return 1;
}
if (strcmp (p, "2") == 0)
{
- if (debug) success ("server: Sending FinalPhaseFinished...\n");
+ if (debug)
+ success ("server: Sending FinalPhaseFinished...\n");
return 2;
}
@@ -359,7 +366,8 @@ server_avp (gnutls_session_t session, void *ptr,
return -1;
*newlen = strlen (*new);
- if (debug) printf ("server: sending %d bytes AVP: `%s'\n", (int)*newlen, *new);
+ if (debug)
+ printf ("server: sending %d bytes AVP: `%s'\n", (int) *newlen, *new);
return 0;
}
@@ -401,7 +409,8 @@ server_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'\n", PORT);
}
static void
@@ -419,7 +428,8 @@ server (void)
gnutls_anon_allocate_server_credentials (&anoncred);
gnutls_ia_allocate_server_credentials (&iacred);
- if (debug) success ("Launched, generating DH parameters...\n");
+ if (debug)
+ success ("Launched, generating DH parameters...\n");
generate_dh_params ();
@@ -431,9 +441,10 @@ server (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
@@ -449,13 +460,15 @@ server (void)
fail ("server: Handshake has failed (%s)\n\n", gnutls_strerror (ret));
return;
}
- if (debug) success ("server: Handshake was completed\n");
+ if (debug)
+ success ("server: Handshake was completed\n");
if (!gnutls_ia_handshake_p (session))
fail ("server: No TLS/IA negotiation\n");
else
{
- if (debug) success ("server: TLS/IA handshake\n");
+ if (debug)
+ success ("server: TLS/IA handshake\n");
ret = gnutls_ia_handshake (session);
@@ -467,7 +480,8 @@ server (void)
}
else
{
- if (debug) success ("server: TLS/IA Handshake was completed\n");
+ if (debug)
+ success ("server: TLS/IA Handshake was completed\n");
}
}
@@ -482,7 +496,8 @@ server (void)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -524,7 +539,8 @@ server (void)
gnutls_global_deinit ();
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}
void
diff --git a/tests/utils.c b/tests/utils.c
index 7e39dff439..6d6c352352 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -69,7 +69,7 @@ escapeprint (const char *str, size_t len)
{
size_t i;
- printf (" (length %d bytes):\n\t", (int)len);
+ printf (" (length %d bytes):\n\t", (int) len);
for (i = 0; i < len; i++)
{
if (((str[i] & 0xFF) >= 'A' && (str[i] & 0xFF) <= 'Z') ||
diff --git a/tests/x509_altname.c b/tests/x509_altname.c
index 569aca96d2..8dbc8932c7 100644
--- a/tests/x509_altname.c
+++ b/tests/x509_altname.c
@@ -122,7 +122,8 @@ doit (void)
fail ("unexpected number of alt names: %i\n", alt_name_count);
}
- if (debug) success ("done\n");
+ if (debug)
+ success ("done\n");
gnutls_x509_crt_deinit (cert);
gnutls_global_deinit ();
diff --git a/tests/x509dn.c b/tests/x509dn.c
index 08e7954bc3..eabad48a89 100644
--- a/tests/x509dn.c
+++ b/tests/x509dn.c
@@ -124,7 +124,8 @@ cert_callback (gnutls_session_t session,
return -1;
}
- if (debug) success ("client: invoked to provide client cert.\n");
+ if (debug)
+ success ("client: invoked to provide client cert.\n");
result = gnutls_x509_dn_init (&dn);
if (result < 0)
@@ -138,16 +139,19 @@ cert_callback (gnutls_session_t session,
{
gnutls_x509_ava_st val;
- if (debug) success ("client: imported DN.\n");
+ if (debug)
+ success ("client: imported DN.\n");
if (gnutls_x509_dn_get_rdn_ava (dn, 0, 0, &val) == 0)
{
- if (debug) success ("client: got RDN 0.\n");
+ if (debug)
+ success ("client: got RDN 0.\n");
if (val.value.size == strlen (EXPECT_RDN0)
&& strncmp (val.value.data, EXPECT_RDN0, val.value.size) == 0)
{
- if (debug) success ("client: RND 0 correct.\n");
+ if (debug)
+ success ("client: RND 0 correct.\n");
}
else
{
@@ -224,21 +228,26 @@ client (void)
}
else
{
- if (debug) success ("client: Handshake was completed\n");
+ if (debug)
+ success ("client: Handshake was completed\n");
}
- if (debug) success ("client: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("client: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
/* see the Getting peer's information example */
- if (debug) print_info (session);
+ if (debug)
+ print_info (session);
gnutls_record_send (session, MSG, strlen (MSG));
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -251,9 +260,9 @@ client (void)
{
printf ("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++)
- {
- fputc (buffer[ii], stdout);
- }
+ {
+ fputc (buffer[ii], stdout);
+ }
fputs ("\n", stdout);
}
@@ -408,7 +417,8 @@ server_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'.\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'.\n", PORT);
}
static void
@@ -428,7 +438,8 @@ server (void)
gnutls_certificate_set_x509_key_mem (x509_cred, &server_cert, &server_key,
GNUTLS_X509_FMT_PEM);
- if (debug) success ("Launched, generating DH parameters...\n");
+ if (debug)
+ success ("Launched, generating DH parameters...\n");
generate_dh_params ();
@@ -440,9 +451,10 @@ server (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
ret = gnutls_handshake (session);
@@ -453,13 +465,17 @@ server (void)
fail ("server: Handshake has failed (%s)\n\n", gnutls_strerror (ret));
return;
}
- if (debug) success ("server: Handshake was completed\n");
+ if (debug)
+ success ("server: Handshake was completed\n");
- if (debug) success ("server: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("server: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
/* see the Getting peer's information example */
- if (debug) print_info (session);
+ if (debug)
+ print_info (session);
i = 0;
for (;;)
@@ -469,7 +485,8 @@ server (void)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -499,7 +516,8 @@ server (void)
gnutls_global_deinit ();
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}
diff --git a/tests/x509self.c b/tests/x509self.c
index e0e620f89e..39aaeca225 100644
--- a/tests/x509self.c
+++ b/tests/x509self.c
@@ -161,17 +161,21 @@ client (void)
success ("client: Handshake was completed\n");
}
- if (debug) success ("client: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("client: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
/* see the Getting peer's information example */
- if (debug) print_info (session);
+ if (debug)
+ print_info (session);
ret = gnutls_record_send (session, MSG, strlen (MSG));
if (ret == strlen (MSG))
{
- if (debug) success ("client: sent record.\n");
+ if (debug)
+ success ("client: sent record.\n");
}
else
{
@@ -182,15 +186,18 @@ client (void)
ret = gnutls_record_recv (session, buffer, MAX_BUF);
- if (debug) success ("client: recv returned %d.\n", ret);
+ if (debug)
+ success ("client: recv returned %d.\n", ret);
if (ret == GNUTLS_E_REHANDSHAKE)
{
- if (debug) success ("client: doing handshake!\n");
+ if (debug)
+ success ("client: doing handshake!\n");
ret = gnutls_handshake (session);
if (ret == 0)
{
- if (debug) success ("client: handshake complete, reading again.\n");
+ if (debug)
+ success ("client: handshake complete, reading again.\n");
ret = gnutls_record_recv (session, buffer, MAX_BUF);
}
else
@@ -201,7 +208,8 @@ client (void)
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -210,13 +218,13 @@ client (void)
goto end;
}
- if (debug)
+ if (debug)
{
printf ("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++)
- {
- fputc (buffer[ii], stdout);
- }
+ {
+ fputc (buffer[ii], stdout);
+ }
fputs ("\n", stdout);
}
@@ -372,7 +380,8 @@ server_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'.\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'.\n", PORT);
}
static void
@@ -392,7 +401,8 @@ server (void)
gnutls_certificate_set_x509_key_mem (x509_cred, &server_cert, &server_key,
GNUTLS_X509_FMT_PEM);
- if (debug) success ("Launched, generating DH parameters...\n");
+ if (debug)
+ success ("Launched, generating DH parameters...\n");
generate_dh_params ();
@@ -404,9 +414,10 @@ server (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
ret = gnutls_handshake (session);
@@ -421,11 +432,13 @@ server (void)
{
success ("server: Handshake was completed\n");
success ("server: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
}
/* see the Getting peer's information example */
- if (debug) print_info (session);
+ if (debug)
+ print_info (session);
i = 0;
for (;;)
@@ -435,7 +448,8 @@ server (void)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -448,7 +462,8 @@ server (void)
gnutls_certificate_server_set_request (session,
GNUTLS_CERT_REQUEST);
- if (debug) success ("server: got data, forcing rehandshake.\n");
+ if (debug)
+ success ("server: got data, forcing rehandshake.\n");
ret = gnutls_rehandshake (session);
if (ret < 0)
@@ -466,7 +481,8 @@ server (void)
break;
}
- if (debug) success ("server: rehandshake complete.\n");
+ if (debug)
+ success ("server: rehandshake complete.\n");
/* echo data back to the client
*/
@@ -488,7 +504,8 @@ server (void)
gnutls_global_deinit ();
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}
diff --git a/tests/x509sign-verify.c b/tests/x509sign-verify.c
index 4253864f5f..e582d875c7 100644
--- a/tests/x509sign-verify.c
+++ b/tests/x509sign-verify.c
@@ -148,7 +148,8 @@ doit (void)
for (i = 0; i < sizeof (key_dat) / sizeof (key_dat[0]); i++)
{
- if (debug) success ("loop %d\n", (int)i);
+ if (debug)
+ success ("loop %d\n", (int) i);
ret = gnutls_x509_privkey_init (&key);
if (ret < 0)
diff --git a/tests/x509signself.c b/tests/x509signself.c
index 52115db7ee..c05ecee7f5 100644
--- a/tests/x509signself.c
+++ b/tests/x509signself.c
@@ -190,21 +190,26 @@ client (void)
}
else
{
- if (debug) success ("client: Handshake was completed\n");
+ if (debug)
+ success ("client: Handshake was completed\n");
}
- if (debug) success ("client: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("client: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
/* see the Getting peer's information example */
- if (debug) print_info (session);
+ if (debug)
+ print_info (session);
gnutls_record_send (session, MSG, strlen (MSG));
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
{
- if (debug) success ("client: Peer has closed the TLS connection\n");
+ if (debug)
+ success ("client: Peer has closed the TLS connection\n");
goto end;
}
else if (ret < 0)
@@ -217,9 +222,9 @@ client (void)
{
printf ("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++)
- {
- fputc (buffer[ii], stdout);
- }
+ {
+ fputc (buffer[ii], stdout);
+ }
fputs ("\n", stdout);
}
@@ -373,7 +378,8 @@ server_start (void)
return;
}
- if (debug) success ("server: ready. Listening to port '%d'.\n", PORT);
+ if (debug)
+ success ("server: ready. Listening to port '%d'.\n", PORT);
}
static void
@@ -393,7 +399,8 @@ server (void)
gnutls_certificate_set_x509_key_mem (x509_cred, &server_cert, &server_key,
GNUTLS_X509_FMT_PEM);
- if (debug) success ("Launched, generating DH parameters...\n");
+ if (debug)
+ success ("Launched, generating DH parameters...\n");
generate_dh_params ();
@@ -405,9 +412,10 @@ server (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
- if (debug) success ("server: connection from %s, port %d\n",
- inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
- sizeof (topbuf)), ntohs (sa_cli.sin_port));
+ if (debug)
+ success ("server: connection from %s, port %d\n",
+ inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
+ sizeof (topbuf)), ntohs (sa_cli.sin_port));
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
ret = gnutls_handshake (session);
@@ -418,13 +426,17 @@ server (void)
fail ("server: Handshake has failed (%s)\n\n", gnutls_strerror (ret));
return;
}
- if (debug) success ("server: Handshake was completed\n");
+ if (debug)
+ success ("server: Handshake was completed\n");
- if (debug) success ("server: TLS version is: %s\n",
- gnutls_protocol_get_name (gnutls_protocol_get_version (session)));
+ if (debug)
+ success ("server: TLS version is: %s\n",
+ gnutls_protocol_get_name (gnutls_protocol_get_version
+ (session)));
/* see the Getting peer's information example */
- if (debug) print_info (session);
+ if (debug)
+ print_info (session);
i = 0;
for (;;)
@@ -434,7 +446,8 @@ server (void)
if (ret == 0)
{
- if (debug) success ("server: Peer has closed the GNUTLS connection\n");
+ if (debug)
+ success ("server: Peer has closed the GNUTLS connection\n");
break;
}
else if (ret < 0)
@@ -464,7 +477,8 @@ server (void)
gnutls_global_deinit ();
- if (debug) success ("server: finished\n");
+ if (debug)
+ success ("server: finished\n");
}