diff options
Diffstat (limited to 'tests/naked-alerts.c')
-rw-r--r-- | tests/naked-alerts.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/tests/naked-alerts.c b/tests/naked-alerts.c index fee16fb715..aded2932f5 100644 --- a/tests/naked-alerts.c +++ b/tests/naked-alerts.c @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif #include <stdio.h> @@ -40,18 +40,18 @@ int main(int argc, char **argv) #else -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#if !defined(_WIN32) -#include <sys/wait.h> -#endif -#include <unistd.h> -#include <assert.h> -#include <gnutls/gnutls.h> +# include <string.h> +# include <sys/types.h> +# include <sys/socket.h> +# if !defined(_WIN32) +# include <sys/wait.h> +# endif +# include <unistd.h> +# include <assert.h> +# include <gnutls/gnutls.h> -#include "utils.h" -#include "cert-common.h" +# include "utils.h" +# include "cert-common.h" pid_t child; @@ -61,8 +61,7 @@ static void tls_log_func(int level, const char *str) str); } -static unsigned char tls_alert[] = - "\x15\x03\x03\x00\x02\x00\x0A"; +static unsigned char tls_alert[] = "\x15\x03\x03\x00\x02\x00\x0A"; static void client(int sd) { @@ -71,8 +70,8 @@ static void client(int sd) /* send a list of warning alerts */ - for (i=0;i<128;i++) { - ret = send(sd, tls_alert, sizeof(tls_alert)-1, 0); + for (i = 0; i < 128; i++) { + ret = send(sd, tls_alert, sizeof(tls_alert) - 1, 0); if (ret < 0) fail("error sending hello\n"); } @@ -99,7 +98,8 @@ static void server(int sd) gnutls_certificate_set_x509_trust_mem(x509_cred, &ca3_cert, GNUTLS_X509_FMT_PEM); - gnutls_certificate_set_x509_key_mem(x509_cred, &server_ca3_localhost_cert, + gnutls_certificate_set_x509_key_mem(x509_cred, + &server_ca3_localhost_cert, &server_ca3_key, GNUTLS_X509_FMT_PEM); @@ -111,7 +111,8 @@ static void server(int sd) /* avoid calling all the priority functions, since the defaults * are adequate. */ - assert(gnutls_priority_set_direct(session, "NORMAL:-VERS-ALL:+VERS-TLS1.2", NULL)>=0); + assert(gnutls_priority_set_direct + (session, "NORMAL:-VERS-ALL:+VERS-TLS1.2", NULL) >= 0); gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred); @@ -122,7 +123,8 @@ static void server(int sd) loops++; if (loops > 64) fail("Too many loops in the handshake!\n"); - } while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_WARNING_ALERT_RECEIVED); + } while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN + || ret == GNUTLS_E_WARNING_ALERT_RECEIVED); if (ret != GNUTLS_E_UNEXPECTED_PACKET) { fail("server: Handshake didn't fail with expected code (failed with %d)\n", ret); @@ -139,7 +141,6 @@ static void server(int sd) success("server: finished\n"); } - void doit(void) { int sockets[2]; |