summaryrefslogtreecommitdiff
path: root/tests/dtls-with-seccomp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dtls-with-seccomp.c')
-rw-r--r--tests/dtls-with-seccomp.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/tests/dtls-with-seccomp.c b/tests/dtls-with-seccomp.c
index 86495ae675..8cee86b74f 100644
--- a/tests/dtls-with-seccomp.c
+++ b/tests/dtls-with-seccomp.c
@@ -20,7 +20,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
#include <stdio.h>
@@ -35,20 +35,20 @@ int main(void)
#else
-#include <string.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <signal.h>
-#include <assert.h>
-#include <gnutls/gnutls.h>
-#include <gnutls/dtls.h>
-
-#include "cert-common.h"
-#include "utils.h"
+# include <string.h>
+# include <sys/types.h>
+# include <netinet/in.h>
+# include <sys/socket.h>
+# include <sys/wait.h>
+# include <arpa/inet.h>
+# include <unistd.h>
+# include <signal.h>
+# include <assert.h>
+# include <gnutls/gnutls.h>
+# include <gnutls/dtls.h>
+
+# include "cert-common.h"
+# include "utils.h"
static void terminate(void);
@@ -62,12 +62,11 @@ static void client_log_func(int level, const char *str)
fprintf(stderr, "client|<%d>| %s", level, str);
}
-#define MAX_BUF 1024
+# define MAX_BUF 1024
-static ssize_t
-push(gnutls_transport_ptr_t tr, const void *data, size_t len)
+static ssize_t push(gnutls_transport_ptr_t tr, const void *data, size_t len)
{
- int fd = (long int) tr;
+ int fd = (long int)tr;
return send(fd, data, len, 0);
}
@@ -123,13 +122,12 @@ static void client(int fd, const char *prio)
(gnutls_protocol_get_version(session)));
do {
- ret = gnutls_record_recv(session, buffer, sizeof(buffer)-1);
+ ret = gnutls_record_recv(session, buffer, sizeof(buffer) - 1);
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
if (ret == 0) {
if (debug)
- success
- ("client: Peer has closed the TLS connection\n");
+ success("client: Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0) {
fail("client: Error: %s\n", gnutls_strerror(ret));
@@ -138,10 +136,11 @@ static void client(int fd, const char *prio)
ret = gnutls_bye(session, GNUTLS_SHUT_RDWR);
if (ret < 0) {
- fail("server: error in closing session: %s\n", gnutls_strerror(ret));
+ fail("server: error in closing session: %s\n",
+ gnutls_strerror(ret));
}
- end:
+ end:
close(fd);
@@ -152,7 +151,6 @@ static void client(int fd, const char *prio)
gnutls_global_deinit();
}
-
/* These are global */
pid_t child;
@@ -184,8 +182,8 @@ static void server(int fd, const char *prio)
gnutls_certificate_allocate_credentials(&xcred);
ret = gnutls_certificate_set_x509_key_mem(xcred,
- &server_cert, &server_key,
- GNUTLS_X509_FMT_PEM);
+ &server_cert, &server_key,
+ GNUTLS_X509_FMT_PEM);
if (ret < 0)
exit(1);
@@ -230,7 +228,7 @@ static void server(int fd, const char *prio)
memset(buffer, 1, sizeof(buffer));
do {
- ret = gnutls_record_send(session, buffer, sizeof(buffer)-1);
+ ret = gnutls_record_send(session, buffer, sizeof(buffer) - 1);
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
if (ret < 0) {
@@ -243,7 +241,8 @@ static void server(int fd, const char *prio)
ret = gnutls_bye(session, GNUTLS_SHUT_RDWR);
if (ret < 0) {
- fail("server: error in closing session: %s\n", gnutls_strerror(ret));
+ fail("server: error in closing session: %s\n",
+ gnutls_strerror(ret));
}
close(fd);
@@ -257,7 +256,7 @@ static void server(int fd, const char *prio)
success("server: finished\n");
}
-static
+static
void run(const char *name, const char *prio)
{
int fd[2];
@@ -302,5 +301,4 @@ void doit(void)
run("default", "NORMAL");
}
-
#endif /* _WIN32 */