diff options
Diffstat (limited to 'tests/pskself.c')
-rw-r--r-- | tests/pskself.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/pskself.c b/tests/pskself.c index 052e09027b..36377c23b2 100644 --- a/tests/pskself.c +++ b/tests/pskself.c @@ -62,7 +62,7 @@ client (void) gnutls_psk_allocate_client_credentials (&pskcred); gnutls_psk_set_client_credentials (pskcred, "test", &key, - GNUTLS_PSK_KEY_HEX); + GNUTLS_PSK_KEY_HEX); /* Initialize TLS session */ @@ -95,7 +95,7 @@ client (void) else { if (debug) - success ("client: Handshake was completed\n"); + success ("client: Handshake was completed\n"); } gnutls_record_send (session, MSG, strlen (MSG)); @@ -104,7 +104,7 @@ client (void) 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) @@ -117,9 +117,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); } @@ -141,7 +141,7 @@ end: #define SA struct sockaddr #define MAX_BUF 1024 -#define PORT 5556 /* listen to 5556 port */ +#define PORT 5556 /* listen to 5556 port */ /* These are global */ gnutls_psk_server_credentials_t server_pskcred; @@ -208,10 +208,10 @@ server_start (void) memset (&sa_serv, '\0', sizeof (sa_serv)); sa_serv.sin_family = AF_INET; sa_serv.sin_addr.s_addr = INADDR_ANY; - sa_serv.sin_port = htons (PORT); /* Server Port number */ + sa_serv.sin_port = htons (PORT); /* Server Port number */ setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, - sizeof (int)); + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) @@ -251,8 +251,8 @@ server (void) 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)); + 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); @@ -276,22 +276,22 @@ server (void) ret = gnutls_record_recv (session, buffer, MAX_BUF); if (ret == 0) - { - if (debug) - success ("server: Peer has closed the GnuTLS connection\n"); - break; - } + { + if (debug) + success ("server: Peer has closed the GnuTLS connection\n"); + break; + } else if (ret < 0) - { - fail ("server: Received corrupted data(%d). Closing...\n", ret); - break; - } + { + fail ("server: Received corrupted data(%d). Closing...\n", ret); + break; + } else if (ret > 0) - { - /* echo data back to the client - */ - gnutls_record_send (session, buffer, strlen (buffer)); - } + { + /* echo data back to the client + */ + gnutls_record_send (session, buffer, strlen (buffer)); + } } /* do not wait for the peer to close the connection. */ |