summaryrefslogtreecommitdiff
path: root/tests/record-sendfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/record-sendfile.c')
-rw-r--r--tests/record-sendfile.c70
1 files changed, 32 insertions, 38 deletions
diff --git a/tests/record-sendfile.c b/tests/record-sendfile.c
index aab7890cb4..9b02afb2ec 100644
--- a/tests/record-sendfile.c
+++ b/tests/record-sendfile.c
@@ -19,7 +19,7 @@
*/
#ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
#endif
#include <stdio.h>
@@ -34,23 +34,23 @@ 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 <gnutls/gnutls.h>
-# include <gnutls/crypto.h>
-# include <gnutls/dtls.h>
-# include <gnutls/socket.h>
-# include <signal.h>
-# include <assert.h>
-# include <errno.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 <gnutls/gnutls.h>
+#include <gnutls/crypto.h>
+#include <gnutls/dtls.h>
+#include <gnutls/socket.h>
+#include <signal.h>
+#include <assert.h>
+#include <errno.h>
+
+#include "cert-common.h"
+#include "utils.h"
static void server_log_func(int level, const char *str)
{
@@ -62,9 +62,9 @@ static void client_log_func(int level, const char *str)
fprintf(stderr, "client|<%d>| %s", level, str);
}
-# define MAX_BUF 1024
-# define MSG "Hello world!"
-# define OFFSET 2
+#define MAX_BUF 1024
+#define MSG "Hello world!"
+#define OFFSET 2
static void client(int fd, const char *prio)
{
@@ -93,8 +93,7 @@ static void client(int fd, const char *prio)
do {
ret = gnutls_handshake(session);
- }
- while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
+ } while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
fail("client: Handshake failed\n");
@@ -106,8 +105,7 @@ static void client(int fd, const char *prio)
memset(buffer, 0, sizeof(buffer));
do {
ret = gnutls_record_recv(session, buffer, sizeof(buffer));
- }
- while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
+ } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
if (ret == 0) {
success("client: Peer has closed the TLS connection\n");
@@ -132,7 +130,7 @@ static void client(int fd, const char *prio)
}
ret = 0;
- end:
+end:
close(fd);
@@ -160,9 +158,8 @@ static void server(int fd, const char *prio)
}
gnutls_certificate_allocate_credentials(&x509_cred);
- ret = gnutls_certificate_set_x509_key_mem(x509_cred, &server_cert,
- &server_key,
- GNUTLS_X509_FMT_PEM);
+ ret = gnutls_certificate_set_x509_key_mem(
+ x509_cred, &server_cert, &server_key, GNUTLS_X509_FMT_PEM);
if (ret < 0)
exit(1);
@@ -177,8 +174,7 @@ static void server(int fd, const char *prio)
do {
ret = gnutls_handshake(session);
- }
- while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
+ } while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
fail("server: Handshake has failed (%s)\n\n",
@@ -209,8 +205,8 @@ static void server(int fd, const char *prio)
}
do {
- ret =
- gnutls_record_send_file(session, fileno(fp), &offset, 512);
+ ret = gnutls_record_send_file(session, fileno(fp), &offset,
+ 512);
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
if (ret < 0) {
@@ -225,7 +221,7 @@ static void server(int fd, const char *prio)
gnutls_strerror(ret));
ret = 0;
- end:
+end:
close(fd);
gnutls_deinit(session);
@@ -237,8 +233,7 @@ static void server(int fd, const char *prio)
success("server: finished\n");
}
-static
-void run(const char *prio)
+static void run(const char *prio)
{
int fd[2];
int ret;
@@ -268,7 +263,6 @@ void run(const char *prio)
client(fd[1], prio);
exit(0);
}
-
}
void doit(void)
@@ -278,4 +272,4 @@ void doit(void)
run("NORMAL:-VERS-ALL:+VERS-TLS1.3:-CIPHER-ALL:+AES-128-GCM");
run("NORMAL:-VERS-ALL:+VERS-TLS1.3:-CIPHER-ALL:+AES-256-GCM");
}
-#endif /* _WIN32 */
+#endif /* _WIN32 */