summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-12-16 17:30:42 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-12-16 17:30:42 +0100
commit6eb6bbfe8e504a611145f454f4045e8f49fd5e44 (patch)
treebaba850cc86ee2d9d61de89da1cdfe408ad8694a /doc
parentbdcfdac13179eccee6294402f2654fece149f82b (diff)
downloadgnutls-6eb6bbfe8e504a611145f454f4045e8f49fd5e44.tar.gz
Indented code. Use same indentation but with -nut to avoid usage of tabs. In several editors tabs can be configured not to be 8 spaces and this produces artifacts with the current indentation that is a mixture of tabs and spaces.
Diffstat (limited to 'doc')
-rw-r--r--doc/errcodes.c6
-rw-r--r--doc/examples/ex-alert.c10
-rw-r--r--doc/examples/ex-cert-select-pkcs11.c84
-rw-r--r--doc/examples/ex-cert-select.c76
-rw-r--r--doc/examples/ex-client-psk.c8
-rw-r--r--doc/examples/ex-client-resume.c90
-rw-r--r--doc/examples/ex-client-srp.c24
-rw-r--r--doc/examples/ex-client-tlsia.c20
-rw-r--r--doc/examples/ex-client1.c2
-rw-r--r--doc/examples/ex-client2.c6
-rw-r--r--doc/examples/ex-crq.c4
-rw-r--r--doc/examples/ex-pkcs12.c8
-rw-r--r--doc/examples/ex-rfc2818.c10
-rw-r--r--doc/examples/ex-serv-anon.c68
-rw-r--r--doc/examples/ex-serv-pgp.c72
-rw-r--r--doc/examples/ex-serv-psk.c74
-rw-r--r--doc/examples/ex-serv-srp.c76
-rw-r--r--doc/examples/ex-serv1.c74
-rw-r--r--doc/examples/ex-session-info.c26
-rw-r--r--doc/examples/ex-verify.c48
-rw-r--r--doc/examples/ex-x509-info.c12
-rw-r--r--doc/examples/examples.h8
-rw-r--r--doc/examples/tcp.c2
-rw-r--r--doc/printlist.c26
24 files changed, 417 insertions, 417 deletions
diff --git a/doc/errcodes.c b/doc/errcodes.c
index 789b8199dc..915ae66fc5 100644
--- a/doc/errcodes.c
+++ b/doc/errcodes.c
@@ -49,7 +49,7 @@ main (int argc, char *argv[])
int i, j;
const char *desc;
const char *_name;
- error_name names_to_sort[400]; /* up to 400 names */
+ error_name names_to_sort[400]; /* up to 400 names */
printf ("@table @code\n");
@@ -59,7 +59,7 @@ main (int argc, char *argv[])
{
_name = gnutls_strerror_name (i);
if (_name == NULL)
- continue;
+ continue;
strcpy (names_to_sort[j].name, _name);
names_to_sort[j].error_index = i;
@@ -73,7 +73,7 @@ main (int argc, char *argv[])
_name = names_to_sort[i].name;
desc = gnutls_strerror (names_to_sort[i].error_index);
if (desc == NULL || _name == NULL)
- continue;
+ continue;
printf ("@item %s:\n%s\n\n", _name, desc);
}
diff --git a/doc/examples/ex-alert.c b/doc/examples/ex-alert.c
index 11aff1c137..6bc14562fe 100644
--- a/doc/examples/ex-alert.c
+++ b/doc/examples/ex-alert.c
@@ -28,11 +28,11 @@ check_alert (gnutls_session_t session, int ret)
* a server, and we had requested a rehandshake.
*/
if (last_alert == GNUTLS_A_NO_RENEGOTIATION &&
- ret == GNUTLS_E_WARNING_ALERT_RECEIVED)
- printf ("* Received NO_RENEGOTIATION alert. "
- "Client Does not support renegotiation.\n");
+ ret == GNUTLS_E_WARNING_ALERT_RECEIVED)
+ printf ("* Received NO_RENEGOTIATION alert. "
+ "Client Does not support renegotiation.\n");
else
- printf ("* Received alert '%d': %s.\n", last_alert,
- gnutls_alert_get_name (last_alert));
+ printf ("* Received alert '%d': %s.\n", last_alert,
+ gnutls_alert_get_name (last_alert));
}
}
diff --git a/doc/examples/ex-cert-select-pkcs11.c b/doc/examples/ex-cert-select-pkcs11.c
index 75f755509f..4177618f8b 100644
--- a/doc/examples/ex-cert-select-pkcs11.c
+++ b/doc/examples/ex-cert-select-pkcs11.c
@@ -35,9 +35,9 @@ extern int tcp_connect (void);
extern void tcp_close (int sd);
static int cert_callback (gnutls_session_t session,
- const gnutls_datum_t * req_ca_rdn, int nreqs,
- const gnutls_pk_algorithm_t * sign_algos,
- int sign_algos_length, gnutls_retr2_st * st);
+ const gnutls_datum_t * req_ca_rdn, int nreqs,
+ const gnutls_pk_algorithm_t * sign_algos,
+ int sign_algos_length, gnutls_retr2_st * st);
gnutls_x509_crt_t crt;
gnutls_pkcs11_privkey_t key;
@@ -56,12 +56,12 @@ load_keys (void)
/* some tokens require login to read data */
if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
ret = gnutls_x509_crt_import_pkcs11_url (crt, CERT_URL,
- GNUTLS_PKCS11_OBJ_FLAG_LOGIN);
+ GNUTLS_PKCS11_OBJ_FLAG_LOGIN);
if (ret < 0)
{
fprintf (stderr, "*** Error loading key file: %s\n",
- gnutls_strerror (ret));
+ gnutls_strerror (ret));
exit (1);
}
@@ -71,7 +71,7 @@ load_keys (void)
if (ret < 0)
{
fprintf (stderr, "*** Error loading key file: %s\n",
- gnutls_strerror (ret));
+ gnutls_strerror (ret));
exit (1);
}
@@ -79,14 +79,14 @@ load_keys (void)
static int
pin_callback (void *user, int attempt, const char *token_url,
- const char *token_label, unsigned int flags, char *pin,
- size_t pin_max)
+ const char *token_label, unsigned int flags, char *pin,
+ size_t pin_max)
{
const char *password;
int len;
printf ("PIN required for token '%s' with URL '%s'\n", token_label,
- token_url);
+ token_url);
if (flags & GNUTLS_PKCS11_PIN_FINAL_TRY)
printf ("*** This is the final try before locking!\n");
if (flags & GNUTLS_PKCS11_PIN_COUNT_LOW)
@@ -216,9 +216,9 @@ end:
static int
cert_callback (gnutls_session_t session,
- const gnutls_datum_t * req_ca_rdn, int nreqs,
- const gnutls_pk_algorithm_t * sign_algos,
- int sign_algos_length, gnutls_retr2_st * st)
+ const gnutls_datum_t * req_ca_rdn, int nreqs,
+ const gnutls_pk_algorithm_t * sign_algos,
+ int sign_algos_length, gnutls_retr2_st * st)
{
char issuer_dn[256];
int i, ret;
@@ -238,10 +238,10 @@ cert_callback (gnutls_session_t session,
len = sizeof (issuer_dn);
ret = gnutls_x509_rdn_get (&req_ca_rdn[i], issuer_dn, &len);
if (ret >= 0)
- {
- printf (" [%d]: ", i);
- printf ("%s\n", issuer_dn);
- }
+ {
+ printf (" [%d]: ", i);
+ printf ("%s\n", issuer_dn);
+ }
}
/* Select a certificate and return it.
@@ -259,39 +259,39 @@ cert_callback (gnutls_session_t session,
ret = gnutls_x509_crt_get_signature_algorithm (crt);
if (ret < 0)
- {
- /* error reading signature algorithm
- */
- return -1;
- }
+ {
+ /* error reading signature algorithm
+ */
+ return -1;
+ }
cert_algo = ret;
i = 0;
do
- {
- ret = gnutls_sign_algorithm_get_requested (session, i, &req_algo);
- if (ret >= 0 && cert_algo == req_algo)
- {
- match = 1;
- break;
- }
-
- /* server has not requested anything specific */
- if (i == 0 && ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
- {
- match = 1;
- break;
- }
- i++;
- }
+ {
+ ret = gnutls_sign_algorithm_get_requested (session, i, &req_algo);
+ if (ret >= 0 && cert_algo == req_algo)
+ {
+ match = 1;
+ break;
+ }
+
+ /* server has not requested anything specific */
+ if (i == 0 && ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
+ {
+ match = 1;
+ break;
+ }
+ i++;
+ }
while (ret >= 0);
if (match == 0)
- {
- printf
- ("- Could not find a suitable certificate to send to server\n");
- return -1;
- }
+ {
+ printf
+ ("- Could not find a suitable certificate to send to server\n");
+ return -1;
+ }
st->cert_type = type;
st->ncerts = 1;
diff --git a/doc/examples/ex-cert-select.c b/doc/examples/ex-cert-select.c
index 16b97e2898..09b9a5e57c 100644
--- a/doc/examples/ex-cert-select.c
+++ b/doc/examples/ex-cert-select.c
@@ -31,9 +31,9 @@ extern int tcp_connect (void);
extern void tcp_close (int sd);
static int cert_callback (gnutls_session_t session,
- const gnutls_datum_t * req_ca_rdn, int nreqs,
- const gnutls_pk_algorithm_t * sign_algos,
- int sign_algos_length, gnutls_retr2_st * st);
+ const gnutls_datum_t * req_ca_rdn, int nreqs,
+ const gnutls_pk_algorithm_t * sign_algos,
+ int sign_algos_length, gnutls_retr2_st * st);
gnutls_x509_crt_t crt;
gnutls_x509_privkey_t key;
@@ -90,7 +90,7 @@ load_keys (void)
if (ret < 0)
{
fprintf (stderr, "*** Error loading key file: %s\n",
- gnutls_strerror (ret));
+ gnutls_strerror (ret));
exit (1);
}
@@ -109,7 +109,7 @@ load_keys (void)
if (ret < 0)
{
fprintf (stderr, "*** Error loading key file: %s\n",
- gnutls_strerror (ret));
+ gnutls_strerror (ret));
exit (1);
}
@@ -223,9 +223,9 @@ end:
static int
cert_callback (gnutls_session_t session,
- const gnutls_datum_t * req_ca_rdn, int nreqs,
- const gnutls_pk_algorithm_t * sign_algos,
- int sign_algos_length, gnutls_retr2_st * st)
+ const gnutls_datum_t * req_ca_rdn, int nreqs,
+ const gnutls_pk_algorithm_t * sign_algos,
+ int sign_algos_length, gnutls_retr2_st * st)
{
char issuer_dn[256];
int i, ret;
@@ -245,10 +245,10 @@ cert_callback (gnutls_session_t session,
len = sizeof (issuer_dn);
ret = gnutls_x509_rdn_get (&req_ca_rdn[i], issuer_dn, &len);
if (ret >= 0)
- {
- printf (" [%d]: ", i);
- printf ("%s\n", issuer_dn);
- }
+ {
+ printf (" [%d]: ", i);
+ printf ("%s\n", issuer_dn);
+ }
}
/* Select a certificate and return it.
@@ -266,39 +266,39 @@ cert_callback (gnutls_session_t session,
ret = gnutls_x509_crt_get_signature_algorithm (crt);
if (ret < 0)
- {
- /* error reading signature algorithm
- */
- return -1;
- }
+ {
+ /* error reading signature algorithm
+ */
+ return -1;
+ }
cert_algo = ret;
i = 0;
do
- {
- ret = gnutls_sign_algorithm_get_requested (session, i, &req_algo);
- if (ret >= 0 && cert_algo == req_algo)
- {
- match = 1;
- break;
- }
-
- /* server has not requested anything specific */
- if (i == 0 && ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
- {
- match = 1;
- break;
- }
- i++;
- }
+ {
+ ret = gnutls_sign_algorithm_get_requested (session, i, &req_algo);
+ if (ret >= 0 && cert_algo == req_algo)
+ {
+ match = 1;
+ break;
+ }
+
+ /* server has not requested anything specific */
+ if (i == 0 && ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
+ {
+ match = 1;
+ break;
+ }
+ i++;
+ }
while (ret >= 0);
if (match == 0)
- {
- printf
- ("- Could not find a suitable certificate to send to server\n");
- return -1;
- }
+ {
+ printf
+ ("- Could not find a suitable certificate to send to server\n");
+ return -1;
+ }
st->cert_type = type;
st->ncerts = 1;
diff --git a/doc/examples/ex-client-psk.c b/doc/examples/ex-client-psk.c
index 2947b2c081..2264f076b2 100644
--- a/doc/examples/ex-client-psk.c
+++ b/doc/examples/ex-client-psk.c
@@ -36,7 +36,7 @@ main (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
*/
@@ -47,9 +47,9 @@ main (void)
if (ret < 0)
{
if (ret == GNUTLS_E_INVALID_REQUEST)
- {
- fprintf (stderr, "Syntax error at: %s\n", err);
- }
+ {
+ fprintf (stderr, "Syntax error at: %s\n", err);
+ }
exit (1);
}
diff --git a/doc/examples/ex-client-resume.c b/doc/examples/ex-client-resume.c
index f38b8d9924..9e6e9b60fd 100644
--- a/doc/examples/ex-client-resume.c
+++ b/doc/examples/ex-client-resume.c
@@ -42,7 +42,7 @@ main (void)
gnutls_certificate_set_x509_trust_file (xcred, CAFILE, GNUTLS_X509_FMT_PEM);
for (t = 0; t < 2; t++)
- { /* connect 2 times to the server */
+ { /* connect 2 times to the server */
sd = tcp_connect ();
@@ -53,11 +53,11 @@ main (void)
gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);
if (t > 0)
- {
- /* if this is not the first time we connect */
- gnutls_session_set_data (session, session_data, session_data_size);
- free (session_data);
- }
+ {
+ /* if this is not the first time we connect */
+ gnutls_session_set_data (session, session_data, session_data_size);
+ free (session_data);
+ }
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd);
@@ -66,39 +66,39 @@ main (void)
ret = gnutls_handshake (session);
if (ret < 0)
- {
- fprintf (stderr, "*** Handshake failed\n");
- gnutls_perror (ret);
- goto end;
- }
+ {
+ fprintf (stderr, "*** Handshake failed\n");
+ gnutls_perror (ret);
+ goto end;
+ }
else
- {
- printf ("- Handshake was completed\n");
- }
+ {
+ printf ("- Handshake was completed\n");
+ }
if (t == 0)
- { /* the first time we connect */
- /* get the session data size */
- gnutls_session_get_data (session, NULL, &session_data_size);
- session_data = malloc (session_data_size);
+ { /* the first time we connect */
+ /* get the session data size */
+ gnutls_session_get_data (session, NULL, &session_data_size);
+ session_data = malloc (session_data_size);
- /* put session data to the session variable */
- gnutls_session_get_data (session, session_data, &session_data_size);
+ /* put session data to the session variable */
+ gnutls_session_get_data (session, session_data, &session_data_size);
- }
+ }
else
- { /* the second time we connect */
-
- /* check if we actually resumed the previous session */
- if (gnutls_session_is_resumed (session) != 0)
- {
- printf ("- Previous session was resumed\n");
- }
- else
- {
- fprintf (stderr, "*** Previous session was NOT resumed\n");
- }
- }
+ { /* the second time we connect */
+
+ /* check if we actually resumed the previous session */
+ if (gnutls_session_is_resumed (session) != 0)
+ {
+ printf ("- Previous session was resumed\n");
+ }
+ else
+ {
+ fprintf (stderr, "*** Previous session was NOT resumed\n");
+ }
+ }
/* This function was defined in a previous example
*/
@@ -108,21 +108,21 @@ main (void)
ret = gnutls_record_recv (session, buffer, MAX_BUF);
if (ret == 0)
- {
- printf ("- Peer has closed the TLS connection\n");
- goto end;
- }
+ {
+ printf ("- Peer has closed the TLS connection\n");
+ goto end;
+ }
else if (ret < 0)
- {
- fprintf (stderr, "*** Error: %s\n", gnutls_strerror (ret));
- goto end;
- }
+ {
+ fprintf (stderr, "*** Error: %s\n", gnutls_strerror (ret));
+ goto end;
+ }
printf ("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++)
- {
- fputc (buffer[ii], stdout);
- }
+ {
+ fputc (buffer[ii], stdout);
+ }
fputs ("\n", stdout);
gnutls_bye (session, GNUTLS_SHUT_RDWR);
@@ -133,7 +133,7 @@ main (void)
gnutls_deinit (session);
- } /* for() */
+ } /* for() */
gnutls_certificate_free_credentials (xcred);
diff --git a/doc/examples/ex-client-srp.c b/doc/examples/ex-client-srp.c
index 7094a79921..a7109b6167 100644
--- a/doc/examples/ex-client-srp.c
+++ b/doc/examples/ex-client-srp.c
@@ -43,7 +43,7 @@ main (void)
gnutls_certificate_allocate_credentials (&cert_cred);
gnutls_certificate_set_x509_trust_file (cert_cred, CAFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
gnutls_srp_set_client_credentials (srp_cred, USERNAME, PASSWORD);
/* connects to server
@@ -87,15 +87,15 @@ main (void)
if (gnutls_error_is_fatal (ret) == 1 || ret == 0)
{
if (ret == 0)
- {
- printf ("- Peer has closed the GnuTLS connection\n");
- goto end;
- }
+ {
+ printf ("- Peer has closed the GnuTLS connection\n");
+ goto end;
+ }
else
- {
- fprintf (stderr, "*** Error: %s\n", gnutls_strerror (ret));
- goto end;
- }
+ {
+ fprintf (stderr, "*** Error: %s\n", gnutls_strerror (ret));
+ goto end;
+ }
}
else
check_alert (session, ret);
@@ -104,9 +104,9 @@ main (void)
{
printf ("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++)
- {
- fputc (buffer[ii], stdout);
- }
+ {
+ fputc (buffer[ii], stdout);
+ }
fputs ("\n", stdout);
}
gnutls_bye (session, GNUTLS_SHUT_RDWR);
diff --git a/doc/examples/ex-client-tlsia.c b/doc/examples/ex-client-tlsia.c
index 909ade1348..99d36402af 100644
--- a/doc/examples/ex-client-tlsia.c
+++ b/doc/examples/ex-client-tlsia.c
@@ -25,12 +25,12 @@ extern void tcp_close (int sd);
static int
client_avp (gnutls_session_t session, void *ptr,
- const char *last, size_t lastlen, char **new, size_t * newlen)
+ const char *last, size_t lastlen, char **new, size_t * newlen)
{
if (last)
printf ("- received %d bytes AVP: `%.*s'\n",
- (int) lastlen, (int) lastlen, last);
+ (int) lastlen, (int) lastlen, last);
else
printf ("- new application phase\n");
@@ -111,15 +111,15 @@ main (void)
ret = gnutls_ia_handshake (session);
if (ret < 0)
- {
- fprintf (stderr, "*** TLS/IA handshake failed\n");
- gnutls_perror (ret);
- goto end;
- }
+ {
+ fprintf (stderr, "*** TLS/IA handshake failed\n");
+ gnutls_perror (ret);
+ goto end;
+ }
else
- {
- printf ("- TLS/IA Handshake was completed\n");
- }
+ {
+ printf ("- TLS/IA Handshake was completed\n");
+ }
}
diff --git a/doc/examples/ex-client1.c b/doc/examples/ex-client1.c
index 87e721f448..4d7c94734f 100644
--- a/doc/examples/ex-client1.c
+++ b/doc/examples/ex-client1.c
@@ -41,7 +41,7 @@ main (void)
/* Use default priorities */
gnutls_priority_set_direct (session, "PERFORMANCE:+ANON-DH:!ARCFOUR-128",
- NULL);
+ NULL);
/* put the anonymous credentials to the current session
*/
diff --git a/doc/examples/ex-client2.c b/doc/examples/ex-client2.c
index 2946c75955..e58c910143 100644
--- a/doc/examples/ex-client2.c
+++ b/doc/examples/ex-client2.c
@@ -50,9 +50,9 @@ main (void)
if (ret < 0)
{
if (ret == GNUTLS_E_INVALID_REQUEST)
- {
- fprintf (stderr, "Syntax error at: %s\n", err);
- }
+ {
+ fprintf (stderr, "Syntax error at: %s\n", err);
+ }
exit (1);
}
diff --git a/doc/examples/ex-crq.c b/doc/examples/ex-crq.c
index 59fedb36b2..c8961d8799 100644
--- a/doc/examples/ex-crq.c
+++ b/doc/examples/ex-crq.c
@@ -41,10 +41,10 @@ main (void)
/* Add stuff to the distinguished name
*/
gnutls_x509_crq_set_dn_by_oid (crq, GNUTLS_OID_X520_COUNTRY_NAME,
- 0, "GR", 2);
+ 0, "GR", 2);
gnutls_x509_crq_set_dn_by_oid (crq, GNUTLS_OID_X520_COMMON_NAME,
- 0, "Nikos", strlen ("Nikos"));
+ 0, "Nikos", strlen ("Nikos"));
/* Set the request version.
*/
diff --git a/doc/examples/ex-pkcs12.c b/doc/examples/ex-pkcs12.c
index 10d35c7c65..0be058e924 100644
--- a/doc/examples/ex-pkcs12.c
+++ b/doc/examples/ex-pkcs12.c
@@ -21,7 +21,7 @@
*/
int
write_pkcs12 (const gnutls_datum_t * cert,
- const gnutls_datum_t * pkcs8_key, const char *password)
+ const gnutls_datum_t * pkcs8_key, const char *password)
{
gnutls_pkcs12_t pkcs12;
int ret, bag_index;
@@ -73,8 +73,8 @@ write_pkcs12 (const gnutls_datum_t * cert,
*/
ret = gnutls_pkcs12_bag_set_data (key_bag,
- GNUTLS_BAG_PKCS8_ENCRYPTED_KEY,
- pkcs8_key);
+ GNUTLS_BAG_PKCS8_ENCRYPTED_KEY,
+ pkcs8_key);
if (ret < 0)
{
fprintf (stderr, "ret: %s\n", gnutls_strerror (ret));
@@ -110,7 +110,7 @@ write_pkcs12 (const gnutls_datum_t * cert,
pkcs12_struct_size = sizeof (pkcs12_struct);
ret =
gnutls_pkcs12_export (pkcs12, GNUTLS_X509_FMT_DER, pkcs12_struct,
- &pkcs12_struct_size);
+ &pkcs12_struct_size);
if (ret < 0)
{
fprintf (stderr, "ret: %s\n", gnutls_strerror (ret));
diff --git a/doc/examples/ex-rfc2818.c b/doc/examples/ex-rfc2818.c
index dac194502f..04114f41ba 100644
--- a/doc/examples/ex-rfc2818.c
+++ b/doc/examples/ex-rfc2818.c
@@ -96,7 +96,7 @@ verify_certificate_callback (gnutls_session_t session)
if (!gnutls_x509_crt_check_hostname (cert, hostname))
{
printf ("The certificate's owner does not match hostname '%s'\n",
- hostname);
+ hostname);
return GNUTLS_E_CERTIFICATE_ERROR;
}
@@ -126,7 +126,7 @@ main (void)
gnutls_certificate_set_x509_trust_file (xcred, CAFILE, GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_verify_function (xcred, verify_certificate_callback);
gnutls_certificate_set_verify_flags (xcred,
- GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT);
+ GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT);
/* Initialize TLS session
*/
@@ -139,9 +139,9 @@ main (void)
if (ret < 0)
{
if (ret == GNUTLS_E_INVALID_REQUEST)
- {
- fprintf (stderr, "Syntax error at: %s\n", err);
- }
+ {
+ fprintf (stderr, "Syntax error at: %s\n", err);
+ }
exit (1);
}
diff --git a/doc/examples/ex-serv-anon.c b/doc/examples/ex-serv-anon.c
index 68b1dff675..88f38acfef 100644
--- a/doc/examples/ex-serv-anon.c
+++ b/doc/examples/ex-serv-anon.c
@@ -22,7 +22,7 @@
#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
-#define PORT 5556 /* listen to 5556 port */
+#define PORT 5556 /* listen to 5556 port */
#define DH_BITS 1024
/* These are global */
@@ -92,10 +92,10 @@ main (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));
SOCKET_ERR (err, "bind");
@@ -112,47 +112,47 @@ main (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
printf ("- 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);
if (ret < 0)
- {
- close (sd);
- gnutls_deinit (session);
- fprintf (stderr, "*** Handshake has failed (%s)\n\n",
- gnutls_strerror (ret));
- continue;
- }
+ {
+ close (sd);
+ gnutls_deinit (session);
+ fprintf (stderr, "*** Handshake has failed (%s)\n\n",
+ gnutls_strerror (ret));
+ continue;
+ }
printf ("- Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
for (;;)
- {
- memset (buffer, 0, MAX_BUF + 1);
- ret = gnutls_record_recv (session, buffer, MAX_BUF);
-
- if (ret == 0)
- {
- printf ("\n- Peer has closed the GnuTLS connection\n");
- break;
- }
- else if (ret < 0)
- {
- fprintf (stderr, "\n*** Received corrupted "
- "data(%d). Closing the connection.\n\n", ret);
- break;
- }
- else if (ret > 0)
- {
- /* echo data back to the client
- */
- gnutls_record_send (session, buffer, strlen (buffer));
- }
- }
+ {
+ memset (buffer, 0, MAX_BUF + 1);
+ ret = gnutls_record_recv (session, buffer, MAX_BUF);
+
+ if (ret == 0)
+ {
+ printf ("\n- Peer has closed the GnuTLS connection\n");
+ break;
+ }
+ else if (ret < 0)
+ {
+ fprintf (stderr, "\n*** Received corrupted "
+ "data(%d). Closing the connection.\n\n", ret);
+ break;
+ }
+ else if (ret > 0)
+ {
+ /* echo data back to the client
+ */
+ gnutls_record_send (session, buffer, strlen (buffer));
+ }
+ }
printf ("\n");
/* do not wait for the peer to close the connection.
*/
diff --git a/doc/examples/ex-serv-pgp.c b/doc/examples/ex-serv-pgp.c
index 9b016c9f74..43744839f6 100644
--- a/doc/examples/ex-serv-pgp.c
+++ b/doc/examples/ex-serv-pgp.c
@@ -27,7 +27,7 @@
#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
-#define PORT 5556 /* listen to 5556 port */
+#define PORT 5556 /* listen to 5556 port */
#define DH_BITS 1024
/* These are global */
@@ -89,10 +89,10 @@ main (void)
gnutls_certificate_allocate_credentials (&cred);
gnutls_certificate_set_openpgp_keyring_file (cred, RINGFILE,
- GNUTLS_OPENPGP_FMT_BASE64);
+ GNUTLS_OPENPGP_FMT_BASE64);
gnutls_certificate_set_openpgp_key_file (cred, CERTFILE, KEYFILE,
- GNUTLS_OPENPGP_FMT_BASE64);
+ GNUTLS_OPENPGP_FMT_BASE64);
generate_dh_params ();
@@ -106,10 +106,10 @@ main (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));
SOCKET_ERR (err, "bind");
@@ -126,47 +126,47 @@ main (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
printf ("- 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);
if (ret < 0)
- {
- close (sd);
- gnutls_deinit (session);
- fprintf (stderr, "*** Handshake has failed (%s)\n\n",
- gnutls_strerror (ret));
- continue;
- }
+ {
+ close (sd);
+ gnutls_deinit (session);
+ fprintf (stderr, "*** Handshake has failed (%s)\n\n",
+ gnutls_strerror (ret));
+ continue;
+ }
printf ("- Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
for (;;)
- {
- memset (buffer, 0, MAX_BUF + 1);
- ret = gnutls_record_recv (session, buffer, MAX_BUF);
-
- if (ret == 0)
- {
- printf ("\n- Peer has closed the GnuTLS connection\n");
- break;
- }
- else if (ret < 0)
- {
- fprintf (stderr, "\n*** Received corrupted "
- "data(%d). Closing the connection.\n\n", ret);
- break;
- }
- else if (ret > 0)
- {
- /* echo data back to the client
- */
- gnutls_record_send (session, buffer, strlen (buffer));
- }
- }
+ {
+ memset (buffer, 0, MAX_BUF + 1);
+ ret = gnutls_record_recv (session, buffer, MAX_BUF);
+
+ if (ret == 0)
+ {
+ printf ("\n- Peer has closed the GnuTLS connection\n");
+ break;
+ }
+ else if (ret < 0)
+ {
+ fprintf (stderr, "\n*** Received corrupted "
+ "data(%d). Closing the connection.\n\n", ret);
+ break;
+ }
+ else if (ret > 0)
+ {
+ /* echo data back to the client
+ */
+ gnutls_record_send (session, buffer, strlen (buffer));
+ }
+ }
printf ("\n");
/* do not wait for the peer to close the connection.
*/
diff --git a/doc/examples/ex-serv-psk.c b/doc/examples/ex-serv-psk.c
index 1374cd65be..d2b907f4e1 100644
--- a/doc/examples/ex-serv-psk.c
+++ b/doc/examples/ex-serv-psk.c
@@ -28,7 +28,7 @@
#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
-#define PORT 5556 /* listen to 5556 port */
+#define PORT 5556 /* listen to 5556 port */
#define DH_BITS 1024
/* These are global */
@@ -106,13 +106,13 @@ main (void)
gnutls_certificate_allocate_credentials (&x509_cred);
gnutls_certificate_set_x509_trust_file (x509_cred, CAFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_crl_file (x509_cred, CRLFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_key_file (x509_cred, CERTFILE, KEYFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
gnutls_psk_allocate_server_credentials (&psk_cred);
gnutls_psk_set_server_credentials_function (psk_cred, pskfunc);
@@ -132,10 +132,10 @@ main (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));
SOCKET_ERR (err, "bind");
@@ -152,47 +152,47 @@ main (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
printf ("- 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);
if (ret < 0)
- {
- close (sd);
- gnutls_deinit (session);
- fprintf (stderr, "*** Handshake has failed (%s)\n\n",
- gnutls_strerror (ret));
- continue;
- }
+ {
+ close (sd);
+ gnutls_deinit (session);
+ fprintf (stderr, "*** Handshake has failed (%s)\n\n",
+ gnutls_strerror (ret));
+ continue;
+ }
printf ("- Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
for (;;)
- {
- memset (buffer, 0, MAX_BUF + 1);
- ret = gnutls_record_recv (session, buffer, MAX_BUF);
-
- if (ret == 0)
- {
- printf ("\n- Peer has closed the GnuTLS connection\n");
- break;
- }
- else if (ret < 0)
- {
- fprintf (stderr, "\n*** Received corrupted "
- "data(%d). Closing the connection.\n\n", ret);
- break;
- }
- else if (ret > 0)
- {
- /* echo data back to the client
- */
- gnutls_record_send (session, buffer, strlen (buffer));
- }
- }
+ {
+ memset (buffer, 0, MAX_BUF + 1);
+ ret = gnutls_record_recv (session, buffer, MAX_BUF);
+
+ if (ret == 0)
+ {
+ printf ("\n- Peer has closed the GnuTLS connection\n");
+ break;
+ }
+ else if (ret < 0)
+ {
+ fprintf (stderr, "\n*** Received corrupted "
+ "data(%d). Closing the connection.\n\n", ret);
+ break;
+ }
+ else if (ret > 0)
+ {
+ /* echo data back to the client
+ */
+ gnutls_record_send (session, buffer, strlen (buffer));
+ }
+ }
printf ("\n");
/* do not wait for the peer to close the connection.
*/
diff --git a/doc/examples/ex-serv-srp.c b/doc/examples/ex-serv-srp.c
index fcd94c4155..96a0a7432e 100644
--- a/doc/examples/ex-serv-srp.c
+++ b/doc/examples/ex-serv-srp.c
@@ -29,7 +29,7 @@
#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
-#define PORT 5556 /* listen to 5556 port */
+#define PORT 5556 /* listen to 5556 port */
/* These are global */
gnutls_srp_server_credentials_t srp_cred;
@@ -75,19 +75,19 @@ main (void)
/* these must be called once in the program
*/
gnutls_global_init ();
- gnutls_global_init_extra (); /* for SRP */
+ gnutls_global_init_extra (); /* for SRP */
/* SRP_PASSWD a password file (created with the included srptool utility)
*/
gnutls_srp_allocate_server_credentials (&srp_cred);
gnutls_srp_set_server_credentials_file (srp_cred, SRP_PASSWD,
- SRP_PASSWD_CONF);
+ SRP_PASSWD_CONF);
gnutls_certificate_allocate_credentials (&cert_cred);
gnutls_certificate_set_x509_trust_file (cert_cred, CAFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_key_file (cert_cred, CERTFILE, KEYFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
/* TCP socket operations
*/
@@ -97,10 +97,10 @@ main (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));
SOCKET_ERR (err, "bind");
@@ -117,46 +117,46 @@ main (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
printf ("- 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);
if (ret < 0)
- {
- close (sd);
- gnutls_deinit (session);
- fprintf (stderr, "*** Handshake has failed (%s)\n\n",
- gnutls_strerror (ret));
- continue;
- }
+ {
+ close (sd);
+ gnutls_deinit (session);
+ fprintf (stderr, "*** Handshake has failed (%s)\n\n",
+ gnutls_strerror (ret));
+ continue;
+ }
printf ("- Handshake was completed\n");
/* print_info(session); */
for (;;)
- {
- memset (buffer, 0, MAX_BUF + 1);
- ret = gnutls_record_recv (session, buffer, MAX_BUF);
-
- if (ret == 0)
- {
- printf ("\n- Peer has closed the GnuTLS connection\n");
- break;
- }
- else if (ret < 0)
- {
- fprintf (stderr, "\n*** Received corrupted "
- "data(%d). Closing the connection.\n\n", ret);
- break;
- }
- else if (ret > 0)
- {
- /* echo data back to the client
- */
- gnutls_record_send (session, buffer, strlen (buffer));
- }
- }
+ {
+ memset (buffer, 0, MAX_BUF + 1);
+ ret = gnutls_record_recv (session, buffer, MAX_BUF);
+
+ if (ret == 0)
+ {
+ printf ("\n- Peer has closed the GnuTLS connection\n");
+ break;
+ }
+ else if (ret < 0)
+ {
+ fprintf (stderr, "\n*** Received corrupted "
+ "data(%d). Closing the connection.\n\n", ret);
+ break;
+ }
+ else if (ret > 0)
+ {
+ /* echo data back to the client
+ */
+ gnutls_record_send (session, buffer, strlen (buffer));
+ }
+ }
printf ("\n");
/* do not wait for the peer to close the connection. */
gnutls_bye (session, GNUTLS_SHUT_WR);
diff --git a/doc/examples/ex-serv1.c b/doc/examples/ex-serv1.c
index a6d84a842e..7166657e9d 100644
--- a/doc/examples/ex-serv1.c
+++ b/doc/examples/ex-serv1.c
@@ -27,7 +27,7 @@
#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
-#define PORT 5556 /* listen to 5556 port */
+#define PORT 5556 /* listen to 5556 port */
#define DH_BITS 1024
/* These are global */
@@ -95,13 +95,13 @@ main (void)
gnutls_certificate_allocate_credentials (&x509_cred);
gnutls_certificate_set_x509_trust_file (x509_cred, CAFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_crl_file (x509_cred, CRLFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_key_file (x509_cred, CERTFILE, KEYFILE,
- GNUTLS_X509_FMT_PEM);
+ GNUTLS_X509_FMT_PEM);
generate_dh_params ();
@@ -118,10 +118,10 @@ main (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));
SOCKET_ERR (err, "bind");
@@ -138,47 +138,47 @@ main (void)
sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
printf ("- 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);
if (ret < 0)
- {
- close (sd);
- gnutls_deinit (session);
- fprintf (stderr, "*** Handshake has failed (%s)\n\n",
- gnutls_strerror (ret));
- continue;
- }
+ {
+ close (sd);
+ gnutls_deinit (session);
+ fprintf (stderr, "*** Handshake has failed (%s)\n\n",
+ gnutls_strerror (ret));
+ continue;
+ }
printf ("- Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
for (;;)
- {
- memset (buffer, 0, MAX_BUF + 1);
- ret = gnutls_record_recv (session, buffer, MAX_BUF);
-
- if (ret == 0)
- {
- printf ("\n- Peer has closed the GnuTLS connection\n");
- break;
- }
- else if (ret < 0)
- {
- fprintf (stderr, "\n*** Received corrupted "
- "data(%d). Closing the connection.\n\n", ret);
- break;
- }
- else if (ret > 0)
- {
- /* echo data back to the client
- */
- gnutls_record_send (session, buffer, strlen (buffer));
- }
- }
+ {
+ memset (buffer, 0, MAX_BUF + 1);
+ ret = gnutls_record_recv (session, buffer, MAX_BUF);
+
+ if (ret == 0)
+ {
+ printf ("\n- Peer has closed the GnuTLS connection\n");
+ break;
+ }
+ else if (ret < 0)
+ {
+ fprintf (stderr, "\n*** Received corrupted "
+ "data(%d). Closing the connection.\n\n", ret);
+ break;
+ }
+ else if (ret > 0)
+ {
+ /* echo data back to the client
+ */
+ gnutls_record_send (session, buffer, strlen (buffer));
+ }
+ }
printf ("\n");
/* do not wait for the peer to close the connection.
*/
diff --git a/doc/examples/ex-session-info.c b/doc/examples/ex-session-info.c
index 946ec5b44f..c8404dd158 100644
--- a/doc/examples/ex-session-info.c
+++ b/doc/examples/ex-session-info.c
@@ -41,7 +41,7 @@ print_info (gnutls_session_t session)
#ifdef ENABLE_SRP
case GNUTLS_CRD_SRP:
printf ("- SRP session with username %s\n",
- gnutls_srp_server_get_username (session));
+ gnutls_srp_server_get_username (session));
break;
#endif
@@ -49,37 +49,37 @@ print_info (gnutls_session_t session)
/* This returns NULL in server side.
*/
if (gnutls_psk_client_get_hint (session) != NULL)
- printf ("- PSK authentication. PSK hint '%s'\n",
- gnutls_psk_client_get_hint (session));
+ printf ("- PSK authentication. PSK hint '%s'\n",
+ gnutls_psk_client_get_hint (session));
/* This returns NULL in client side.
*/
if (gnutls_psk_server_get_username (session) != NULL)
- printf ("- PSK authentication. Connected as '%s'\n",
- gnutls_psk_server_get_username (session));
+ printf ("- PSK authentication. Connected as '%s'\n",
+ gnutls_psk_server_get_username (session));
break;
- case GNUTLS_CRD_ANON: /* anonymous authentication */
+ case GNUTLS_CRD_ANON: /* anonymous authentication */
printf ("- Anonymous DH using prime of %d bits\n",
- gnutls_dh_get_prime_bits (session));
+ gnutls_dh_get_prime_bits (session));
break;
- case GNUTLS_CRD_CERTIFICATE: /* certificate authentication */
+ case GNUTLS_CRD_CERTIFICATE: /* certificate authentication */
/* Check if we have been using ephemeral Diffie-Hellman.
*/
if (kx == GNUTLS_KX_DHE_RSA || kx == GNUTLS_KX_DHE_DSS)
- {
- printf ("\n- Ephemeral DH using prime of %d bits\n",
- gnutls_dh_get_prime_bits (session));
- }
+ {
+ printf ("\n- Ephemeral DH using prime of %d bits\n",
+ gnutls_dh_get_prime_bits (session));
+ }
/* if the certificate list is available, then
* print some information about it.
*/
print_x509_certificate_info (session);
- } /* switch */
+ } /* switch */
/* print the protocol's name (ie TLS 1.0)
*/
diff --git a/doc/examples/ex-verify.c b/doc/examples/ex-verify.c
index a08cd418a1..5165e45877 100644
--- a/doc/examples/ex-verify.c
+++ b/doc/examples/ex-verify.c
@@ -22,12 +22,12 @@ gnutls_x509_crt_t *ca_list;
int ca_list_size;
static void verify_cert2 (gnutls_x509_crt_t crt,
- gnutls_x509_crt_t issuer,
- gnutls_x509_crl_t * crl_list, int crl_list_size);
+ gnutls_x509_crt_t issuer,
+ gnutls_x509_crl_t * crl_list, int crl_list_size);
static void verify_last_cert (gnutls_x509_crt_t crt,
- gnutls_x509_crt_t * ca_list, int ca_list_size,
- gnutls_x509_crl_t * crl_list,
- int crl_list_size);
+ gnutls_x509_crt_t * ca_list, int ca_list_size,
+ gnutls_x509_crl_t * crl_list,
+ int crl_list_size);
/* This function will try to verify the peer's certificate chain, and
@@ -35,9 +35,9 @@ static void verify_last_cert (gnutls_x509_crt_t crt,
*/
void
verify_certificate_chain (gnutls_session_t session,
- const char *hostname,
- const gnutls_datum_t * cert_chain,
- int cert_chain_length)
+ const char *hostname,
+ const gnutls_datum_t * cert_chain,
+ int cert_chain_length)
{
int i;
gnutls_x509_crt_t *cert;
@@ -58,7 +58,7 @@ verify_certificate_chain (gnutls_session_t session,
* list.
*/
if (gnutls_x509_crt_check_issuer (cert[cert_chain_length - 1],
- cert[cert_chain_length - 1]) > 0
+ cert[cert_chain_length - 1]) > 0
&& cert_chain_length > 0)
{
cert_chain_length--;
@@ -76,14 +76,14 @@ verify_certificate_chain (gnutls_session_t session,
* our trusted CA list.
*/
verify_last_cert (cert[cert_chain_length - 1],
- ca_list, ca_list_size, crl_list, crl_list_size);
+ ca_list, ca_list_size, crl_list, crl_list_size);
/* Check if the name in the first certificate matches our destination!
*/
if (!gnutls_x509_crt_check_hostname (cert[0], hostname))
{
printf ("The certificate's owner does not match hostname '%s'\n",
- hostname);
+ hostname);
}
for (i = 0; i < cert_chain_length; i++)
@@ -99,7 +99,7 @@ verify_certificate_chain (gnutls_session_t session,
*/
static void
verify_cert2 (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
- gnutls_x509_crl_t * crl_list, int crl_list_size)
+ gnutls_x509_crl_t * crl_list, int crl_list_size)
{
unsigned int output;
int ret;
@@ -135,13 +135,13 @@ verify_cert2 (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
fprintf (stderr, "Not trusted");
if (output & GNUTLS_CERT_SIGNER_NOT_FOUND)
- fprintf (stderr, ": no issuer was found");
+ fprintf (stderr, ": no issuer was found");
if (output & GNUTLS_CERT_SIGNER_NOT_CA)
- fprintf (stderr, ": issuer is not a CA");
+ fprintf (stderr, ": issuer is not a CA");
if (output & GNUTLS_CERT_NOT_ACTIVATED)
- fprintf (stderr, ": not yet activated\n");
+ fprintf (stderr, ": not yet activated\n");
if (output & GNUTLS_CERT_EXPIRED)
- fprintf (stderr, ": expired\n");
+ fprintf (stderr, ": expired\n");
fprintf (stderr, "\n");
}
@@ -152,7 +152,7 @@ verify_cert2 (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
*/
ret = gnutls_x509_crt_check_revocation (crt, crl_list, crl_list_size);
if (ret == 1)
- { /* revoked */
+ { /* revoked */
fprintf (stderr, "Revoked\n");
}
}
@@ -163,8 +163,8 @@ verify_cert2 (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
*/
static void
verify_last_cert (gnutls_x509_crt_t crt,
- gnutls_x509_crt_t * ca_list, int ca_list_size,
- gnutls_x509_crl_t * crl_list, int crl_list_size)
+ gnutls_x509_crt_t * ca_list, int ca_list_size,
+ gnutls_x509_crl_t * crl_list, int crl_list_size)
{
unsigned int output;
int ret;
@@ -187,18 +187,18 @@ verify_last_cert (gnutls_x509_crt_t crt,
/* Do the actual verification.
*/
gnutls_x509_crt_verify (crt, ca_list, ca_list_size,
- GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT, &output);
+ GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT, &output);
if (output & GNUTLS_CERT_INVALID)
{
fprintf (stderr, "Not trusted");
if (output & GNUTLS_CERT_SIGNER_NOT_CA)
- fprintf (stderr, ": Issuer is not a CA\n");
+ fprintf (stderr, ": Issuer is not a CA\n");
if (output & GNUTLS_CERT_NOT_ACTIVATED)
- fprintf (stderr, ": Not yet activated\n");
+ fprintf (stderr, ": Not yet activated\n");
if (output & GNUTLS_CERT_EXPIRED)
- fprintf (stderr, ": Expired\n");
+ fprintf (stderr, ": Expired\n");
fprintf (stderr, "\n");
}
else
@@ -209,7 +209,7 @@ verify_last_cert (gnutls_x509_crt_t crt,
*/
ret = gnutls_x509_crt_check_revocation (crt, crl_list, crl_list_size);
if (ret == 1)
- { /* revoked */
+ { /* revoked */
fprintf (stderr, "Revoked\n");
}
}
diff --git a/doc/examples/ex-x509-info.c b/doc/examples/ex-x509-info.c
index 3251e0bd9d..d2f39cf437 100644
--- a/doc/examples/ex-x509-info.c
+++ b/doc/examples/ex-x509-info.c
@@ -74,10 +74,10 @@ print_x509_certificate_info (gnutls_session_t session)
ret = gnutls_x509_crt_print (cert, GNUTLS_CRT_PRINT_ONELINE, &cinfo);
if (ret == 0)
- {
- printf ("\t%s\n", cinfo.data);
- gnutls_free (cinfo.data);
- }
+ {
+ printf ("\t%s\n", cinfo.data);
+ gnutls_free (cinfo.data);
+ }
/* If you want to extract fields manually for some other reason,
below are popular example calls. */
@@ -100,13 +100,13 @@ print_x509_certificate_info (gnutls_session_t session)
algo = gnutls_x509_crt_get_pk_algorithm (cert, &bits);
printf ("Certificate public key: %s",
- gnutls_pk_algorithm_get_name (algo));
+ gnutls_pk_algorithm_get_name (algo));
/* Print the version of the X.509
* certificate.
*/
printf ("\tCertificate version: #%d\n",
- gnutls_x509_crt_get_version (cert));
+ gnutls_x509_crt_get_version (cert));
size = sizeof (dn);
gnutls_x509_crt_get_dn (cert, dn, &size);
diff --git a/doc/examples/examples.h b/doc/examples/examples.h
index e88784fa0c..bca087a84e 100644
--- a/doc/examples/examples.h
+++ b/doc/examples/examples.h
@@ -5,7 +5,7 @@ void check_alert (gnutls_session_t session, int ret);
int
write_pkcs12 (const gnutls_datum_t * cert,
- const gnutls_datum_t * pkcs8_key, const char *password);
+ const gnutls_datum_t * pkcs8_key, const char *password);
void verify_certificate (gnutls_session_t session, const char *hostname);
@@ -15,8 +15,8 @@ void print_x509_certificate_info (gnutls_session_t session);
void
verify_certificate_chain (gnutls_session_t session,
- const char *hostname,
- const gnutls_datum_t * cert_chain,
- int cert_chain_length);
+ const char *hostname,
+ const gnutls_datum_t * cert_chain,
+ int cert_chain_length);
#endif /* EXAMPLES_H */
diff --git a/doc/examples/tcp.c b/doc/examples/tcp.c
index bf47f449f3..6961c4eef6 100644
--- a/doc/examples/tcp.c
+++ b/doc/examples/tcp.c
@@ -54,6 +54,6 @@ tcp_connect (void)
extern void
tcp_close (int sd)
{
- shutdown (sd, SHUT_RDWR); /* no more receptions */
+ shutdown (sd, SHUT_RDWR); /* no more receptions */
close (sd);
}
diff --git a/doc/printlist.c b/doc/printlist.c
index 140f08012d..743ffdac06 100644
--- a/doc/printlist.c
+++ b/doc/printlist.c
@@ -41,12 +41,12 @@ main (void)
printf ("Available cipher suites:\n");
printf ("@multitable @columnfractions .60 .20 .20\n");
for (i = 0; (name = gnutls_cipher_suite_info
- (i, id, &kx, &cipher, &mac, &version)); i++)
+ (i, id, &kx, &cipher, &mac, &version)); i++)
{
- printf ("@item %s\n@tab 0x%02x 0x%02x\n@tab %s\n",
- name,
- (unsigned char) id[0], (unsigned char) id[1],
- gnutls_protocol_get_name (version));
+ printf ("@item %s\n@tab 0x%02x 0x%02x\n@tab %s\n",
+ name,
+ (unsigned char) id[0], (unsigned char) id[1],
+ gnutls_protocol_get_name (version));
}
printf ("@end multitable\n");
}
@@ -57,7 +57,7 @@ main (void)
printf ("\n\nAvailable certificate types:\n@itemize\n");
for (; *p; p++)
{
- printf ("@item %s\n", gnutls_certificate_type_get_name (*p));
+ printf ("@item %s\n", gnutls_certificate_type_get_name (*p));
}
printf ("@end itemize\n");
}
@@ -68,7 +68,7 @@ main (void)
printf ("\nAvailable protocols:\n@itemize\n");
for (; *p; p++)
{
- printf ("@item %s\n", gnutls_protocol_get_name (*p));
+ printf ("@item %s\n", gnutls_protocol_get_name (*p));
}
printf ("@end itemize\n");
}
@@ -79,7 +79,7 @@ main (void)
printf ("\nAvailable ciphers:\n@itemize\n");
for (; *p; p++)
{
- printf ("@item %s\n", gnutls_cipher_get_name (*p));
+ printf ("@item %s\n", gnutls_cipher_get_name (*p));
}
printf ("@end itemize\n");
}
@@ -90,7 +90,7 @@ main (void)
printf ("\nAvailable MAC algorithms:\n@itemize\n");
for (; *p; p++)
{
- printf ("@item %s\n", gnutls_mac_get_name (*p));
+ printf ("@item %s\n", gnutls_mac_get_name (*p));
}
printf ("@end itemize\n");
}
@@ -101,7 +101,7 @@ main (void)
printf ("\nAvailable key exchange methods:\n@itemize\n");
for (; *p; p++)
{
- printf ("@item %s\n", gnutls_kx_get_name (*p));
+ printf ("@item %s\n", gnutls_kx_get_name (*p));
}
printf ("@end itemize\n");
}
@@ -112,7 +112,7 @@ main (void)
printf ("\nAvailable public key algorithms:\n@itemize\n");
for (; *p; p++)
{
- printf ("@item %s\n", gnutls_pk_get_name (*p));
+ printf ("@item %s\n", gnutls_pk_get_name (*p));
}
printf ("@end itemize\n");
}
@@ -123,7 +123,7 @@ main (void)
printf ("\nAvailable public key signature algorithms:\n@itemize\n");
for (; *p; p++)
{
- printf ("@item %s\n", gnutls_sign_get_name (*p));
+ printf ("@item %s\n", gnutls_sign_get_name (*p));
}
printf ("@end itemize\n");
}
@@ -134,7 +134,7 @@ main (void)
printf ("\nAvailable compression methods:\n@itemize\n");
for (; *p; p++)
{
- printf ("@item %s\n", gnutls_compression_get_name (*p));
+ printf ("@item %s\n", gnutls_compression_get_name (*p));
}
printf ("@end itemize\n");
}