summaryrefslogtreecommitdiff
path: root/tests/priorities.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/priorities.c')
-rw-r--r--tests/priorities.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/tests/priorities.c b/tests/priorities.c
index c06698e68e..45d187e542 100644
--- a/tests/priorities.c
+++ b/tests/priorities.c
@@ -21,7 +21,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
#include <stdio.h>
@@ -32,7 +32,8 @@
#include "utils.h"
static void
-try_prio(const char *prio, unsigned expected_cs, unsigned expected_ciphers, unsigned line)
+try_prio(const char *prio, unsigned expected_cs, unsigned expected_ciphers,
+ unsigned line)
{
int ret;
gnutls_priority_t p;
@@ -46,8 +47,7 @@ try_prio(const char *prio, unsigned expected_cs, unsigned expected_ciphers, unsi
ret = gnutls_priority_init(&p, prio, &err);
if (ret < 0) {
- fprintf(stderr, "error: %s: %s\n", gnutls_strerror(ret),
- err);
+ fprintf(stderr, "error: %s: %s\n", gnutls_strerror(ret), err);
exit(1);
}
@@ -65,14 +65,13 @@ try_prio(const char *prio, unsigned expected_cs, unsigned expected_ciphers, unsi
}
ret = gnutls_priority_cipher_list(p, &t);
- if ((unsigned) ret != expected_ciphers) {
+ if ((unsigned)ret != expected_ciphers) {
#if 0
for (i = 0; i < ret; i++)
- fprintf(stderr, "%s\n",
- gnutls_cipher_get_name(t[i]));
+ fprintf(stderr, "%s\n", gnutls_cipher_get_name(t[i]));
#endif
- fail("%s:%d: expected %d ciphers, found %d\n", prio, line, expected_ciphers,
- ret);
+ fail("%s:%d: expected %d ciphers, found %d\n", prio, line,
+ expected_ciphers, ret);
exit(1);
}
@@ -84,14 +83,13 @@ try_prio(const char *prio, unsigned expected_cs, unsigned expected_ciphers, unsi
success("finished: %s\n", prio);
if (count != expected_cs) {
- fail("%s:%d: expected %d ciphersuites, found %d\n", prio, line, expected_cs,
- count);
+ fail("%s:%d: expected %d ciphersuites, found %d\n", prio, line,
+ expected_cs, count);
exit(1);
}
}
-static void
-try_prio_err(const char *prio, int err)
+static void try_prio_err(const char *prio, int err)
{
int ret;
gnutls_priority_t p;
@@ -109,7 +107,6 @@ try_prio_err(const char *prio, int err)
success("finished: %s\n", prio);
}
-
void doit(void)
{
const int null = 3;
@@ -117,7 +114,7 @@ void doit(void)
int sec256_cs = 12;
int normal_cs = 29;
int pfs_cs = 23;
- int null_normal_cs = 28; /* disables TLS1.3 CS */
+ int null_normal_cs = 28; /* disables TLS1.3 CS */
int normal_ciphers = 7;
if (gnutls_fips140_mode_enabled()) {
@@ -129,7 +126,8 @@ void doit(void)
}
try_prio("NORMAL", normal_cs, normal_ciphers, __LINE__);
- try_prio("NORMAL:-MAC-ALL:+MD5:+MAC-ALL", normal_cs, normal_ciphers, __LINE__);
+ try_prio("NORMAL:-MAC-ALL:+MD5:+MAC-ALL", normal_cs, normal_ciphers,
+ __LINE__);
if (!gnutls_fips140_mode_enabled()) {
try_prio("PFS", pfs_cs, normal_ciphers, __LINE__);
@@ -150,9 +148,14 @@ void doit(void)
try_prio("SUITEB192", 1, 1, __LINE__);
try_prio("SUITEB128", 2, 2, __LINE__);
/* check legacy strings */
- try_prio("NORMAL:+RSA-EXPORT:+ARCFOUR-40", normal_cs, normal_ciphers, __LINE__);
-
- try_prio_err("NORMAL:-VERS-ALL:+VERS-TLS1.2:-SIGN-ALL:+SIGN-ECDSA-SECP256R1-SHA256", GNUTLS_E_NO_PRIORITIES_WERE_SET);
- try_prio_err("NORMAL:-VERS-ALL:+VERS-TLS1.2:-SIGN-ALL", GNUTLS_E_NO_PRIORITIES_WERE_SET);
- try_prio_err("NORMAL:-VERS-ALL:+VERS-DTLS1.2:-SIGN-ALL", GNUTLS_E_NO_PRIORITIES_WERE_SET);
+ try_prio("NORMAL:+RSA-EXPORT:+ARCFOUR-40", normal_cs, normal_ciphers,
+ __LINE__);
+
+ try_prio_err
+ ("NORMAL:-VERS-ALL:+VERS-TLS1.2:-SIGN-ALL:+SIGN-ECDSA-SECP256R1-SHA256",
+ GNUTLS_E_NO_PRIORITIES_WERE_SET);
+ try_prio_err("NORMAL:-VERS-ALL:+VERS-TLS1.2:-SIGN-ALL",
+ GNUTLS_E_NO_PRIORITIES_WERE_SET);
+ try_prio_err("NORMAL:-VERS-ALL:+VERS-DTLS1.2:-SIGN-ALL",
+ GNUTLS_E_NO_PRIORITIES_WERE_SET);
}