diff options
author | Simon Josefsson <simon@josefsson.org> | 2009-11-05 09:50:01 +0100 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2009-11-05 09:50:01 +0100 |
commit | e2a5fa157eb1c5fcc946a4690553497d2cb04c09 (patch) | |
tree | 159d5585846d1ffb7f06d03f4c4f0e46a1d487ba /tests | |
parent | 91b652d36dcb57db89d7edab6caa88d211f7d859 (diff) | |
download | gnutls-e2a5fa157eb1c5fcc946a4690553497d2cb04c09.tar.gz |
Indent code.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/anonself.c | 5 | ||||
-rw-r--r-- | tests/chainverify.c | 16 | ||||
-rw-r--r-- | tests/crq_apis.c | 9 | ||||
-rw-r--r-- | tests/cve-2008-4989.c | 197 | ||||
-rw-r--r-- | tests/cve-2009-1415.c | 3 | ||||
-rw-r--r-- | tests/dhepskself.c | 7 | ||||
-rw-r--r-- | tests/dn2.c | 10 | ||||
-rw-r--r-- | tests/finished.c | 2 | ||||
-rw-r--r-- | tests/hostname-check.c | 9 | ||||
-rw-r--r-- | tests/mini-eagain.c | 78 | ||||
-rw-r--r-- | tests/mini.c | 2 | ||||
-rw-r--r-- | tests/nul-in-x509-names.c | 11 | ||||
-rw-r--r-- | tests/openpgpself.c | 5 | ||||
-rw-r--r-- | tests/oprfi.c | 3 | ||||
-rw-r--r-- | tests/pkcs12_encode.c | 6 | ||||
-rw-r--r-- | tests/pkcs12_s2k.c | 54 | ||||
-rw-r--r-- | tests/pkcs12_s2k_pem.c | 35 | ||||
-rw-r--r-- | tests/pskself.c | 5 | ||||
-rw-r--r-- | tests/resume.c | 20 | ||||
-rw-r--r-- | tests/tlsia.c | 5 | ||||
-rw-r--r-- | tests/x509_altname.c | 114 | ||||
-rw-r--r-- | tests/x509dn.c | 5 | ||||
-rw-r--r-- | tests/x509self.c | 78 | ||||
-rw-r--r-- | tests/x509sign-verify.c | 25 | ||||
-rw-r--r-- | tests/x509signself.c | 5 |
25 files changed, 372 insertions, 337 deletions
diff --git a/tests/anonself.c b/tests/anonself.c index b454aa4861..21bd6df147 100644 --- a/tests/anonself.c +++ b/tests/anonself.c @@ -178,7 +178,7 @@ static gnutls_dh_params_t dh_params; static int generate_dh_params (void) { - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; /* Generate Diffie-Hellman parameters - for use with DHE * kx algorithms. These should be discarded and regenerated * once a day, once a week or once a month. Depending on the @@ -216,7 +216,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) diff --git a/tests/chainverify.c b/tests/chainverify.c index 13d47103b7..0407d14156 100644 --- a/tests/chainverify.c +++ b/tests/chainverify.c @@ -37,7 +37,7 @@ current time. This should work fine on systems where the library call to time is resolved at run-time. */ time_t -time (time_t *t) +time (time_t * t) { time_t then = 1256803113; @@ -779,16 +779,16 @@ main (int argc, char *argv[]) gnutls_datum_t tmp; size_t j; - printf ("Chain '%s' (%d)...\n", chains[i].name, (int)i); + printf ("Chain '%s' (%d)...\n", chains[i].name, (int) i); for (j = 0; chains[i].chain[j]; j++) { - printf ("\tAdding certificate %d...", (int)j); + printf ("\tAdding certificate %d...", (int) j); ret = gnutls_x509_crt_init (&certs[j]); if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_x509_crt_init[%d,%d]: %s", (int)i, (int)j, - gnutls_strerror (ret)); + error (EXIT_FAILURE, 0, "gnutls_x509_crt_init[%d,%d]: %s", + (int) i, (int) j, gnutls_strerror (ret)); tmp.data = (char *) chains[i].chain[j]; tmp.size = strlen (chains[i].chain[j]); @@ -796,11 +796,11 @@ main (int argc, char *argv[]) ret = gnutls_x509_crt_import (certs[j], &tmp, GNUTLS_X509_FMT_PEM); printf ("done\n"); if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_x509_crt_import[%d,%d]: %s", (int)i, (int)j, - gnutls_strerror (ret)); + error (EXIT_FAILURE, 0, "gnutls_x509_crt_import[%d,%d]: %s", + (int) i, (int) j, gnutls_strerror (ret)); gnutls_x509_crt_print (certs[j], GNUTLS_CRT_PRINT_ONELINE, &tmp); - printf ("\tCertificate %d: %.*s\n", (int)j, tmp.size, tmp.data); + printf ("\tCertificate %d: %.*s\n", (int) j, tmp.size, tmp.data); gnutls_free (tmp.data); } diff --git a/tests/crq_apis.c b/tests/crq_apis.c index ee5da504df..63742b228a 100644 --- a/tests/crq_apis.c +++ b/tests/crq_apis.c @@ -56,7 +56,8 @@ static unsigned char key_pem[] = "-----END RSA PRIVATE KEY-----\n"; const gnutls_datum_t key = { key_pem, sizeof (key_pem) }; -void doit (void) +void +doit (void) { gnutls_x509_privkey_t pkey; gnutls_x509_crt_t crt; @@ -169,7 +170,8 @@ void doit (void) fail ("gnutls_x509_crq_get_key_purpose_oid %d\n", ret); s = 0; - ret = gnutls_x509_crq_set_key_purpose_oid (crq, GNUTLS_KP_TLS_WWW_SERVER, 0); + ret = + gnutls_x509_crq_set_key_purpose_oid (crq, GNUTLS_KP_TLS_WWW_SERVER, 0); if (ret != 0) fail ("gnutls_x509_crq_set_key_purpose_oid %d\n", ret); @@ -179,7 +181,8 @@ void doit (void) fail ("gnutls_x509_crq_get_key_purpose_oid %d\n", ret); s = 0; - ret = gnutls_x509_crq_set_key_purpose_oid (crq, GNUTLS_KP_TLS_WWW_CLIENT, 1); + ret = + gnutls_x509_crq_set_key_purpose_oid (crq, GNUTLS_KP_TLS_WWW_CLIENT, 1); if (ret != 0) fail ("gnutls_x509_crq_set_key_purpose_oid2 %d\n", ret); diff --git a/tests/cve-2008-4989.c b/tests/cve-2008-4989.c index 65a9de3277..fd4fb85fe7 100644 --- a/tests/cve-2008-4989.c +++ b/tests/cve-2008-4989.c @@ -38,112 +38,109 @@ static const char *pem_certs[] = { "-----BEGIN CERTIFICATE-----\n" - "MIIB6zCCAVQCCQCgwnB/k0WZrDANBgkqhkiG9w0BAQUFADA9MQswCQYDVQQGEwJE\n" - "RTEXMBUGA1UEChMOR05VIFRMUyBBdHRhY2sxFTATBgNVBAMTDGludGVybWVkaWF0\n" - "ZTAeFw0wODExMDMxMjA1MDRaFw0wODEyMDMxMjA1MDRaMDcxCzAJBgNVBAYTAkRF\n" - "MRcwFQYDVQQKEw5HTlUgVExTIEF0dGFjazEPMA0GA1UEAxMGc2VydmVyMIGfMA0G\n" - "CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKdL9g5ErMLOLRCjiomZlNLhy0moWGaKIW\n" - "aX6vyUIfh8d6FcArHoKoqhmX7ckvod50sOYPojQesDpl7gVaQNA6Ntr1VCcuNPef\n" - "UKWtEwL0Qu9JbPnUoIYd7mAaqVQgFp6W6yzV/dp63LH4XSdzBMhpZ/EU6vZoE8Sv\n" - "VLdqj5r6jwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAH4QRR7sZEbjW00tXYk/3O/Z\n" - "96AxJNg0F78W5B68gaJrLJ7DTE2RTglscuEq1+2Jyb4AIziwXpYqxgwcP91QpH97\n" - "XfwdXIcyjYvVLHiKmkQj2zJTY7MeyiEQQ2it8VstZG2fYmi2EiMZIEnyJ2JJ7bA7\n" - "bF7pG7Cg3oEHUM0H5KUU\n" - "-----END CERTIFICATE-----\n", + "MIIB6zCCAVQCCQCgwnB/k0WZrDANBgkqhkiG9w0BAQUFADA9MQswCQYDVQQGEwJE\n" + "RTEXMBUGA1UEChMOR05VIFRMUyBBdHRhY2sxFTATBgNVBAMTDGludGVybWVkaWF0\n" + "ZTAeFw0wODExMDMxMjA1MDRaFw0wODEyMDMxMjA1MDRaMDcxCzAJBgNVBAYTAkRF\n" + "MRcwFQYDVQQKEw5HTlUgVExTIEF0dGFjazEPMA0GA1UEAxM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J5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\n" + "AoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQ\n" + "LZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29\n" + "dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk6KHYcWUNo1F7\n" + "7rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/KaAcd\n" + "HJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR3\n" + "2HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA\n" + "MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7\n" + "W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7OR\n" + "tvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE\n" + "uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQ\n" + "aEfZYGDm/Ac9IiAXxPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqd\n" + "E8hhuvU5HIe6uL17In/2/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+\n" + "MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+\n" + "fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==\n" "-----END CERTIFICATE-----\n" }; static const char *pem_ca = { "-----BEGIN CERTIFICATE-----\n" - "MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUF\n" - "ADCBqTEL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b3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\n" + "AoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQ\n" + "LZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29\n" + "dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk6KHYcWUNo1F7\n" + "7rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/KaAcd\n" + "HJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR3\n" + "2HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA\n" + "MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7\n" + "W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7OR\n" + "tvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE\n" + "uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQ\n" + "aEfZYGDm/Ac9IiAXxPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqd\n" + "E8hhuvU5HIe6uL17In/2/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+\n" + "MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+\n" + "fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==\n" "-----END CERTIFICATE-----\n" }; #define CHAIN_LENGTH (sizeof (pem_certs) / sizeof (pem_certs[0])) static const char *pem_self_cert = { "-----BEGIN CERTIFICATE-----\n" - "MIIDgjCCAmygAwIBAgIBADALBgkqhkiG9w0BA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gEF\n" + "BQcDATAPBgNVHQ8BAf8EBQMDB6QAMB0GA1UdDgQWBBQ/5v42y0jBHUKEfqpPmr5a\n" + "WsjCGjALBgkqhkiG9w0BAQUDggEBAC/WfO2yK3vM9bG0qFEj8sd0cWiapMhf5PtH\n" + "jigcPb/OKqSFQVXpAdNiUclPRP79Ih3CuWiXfZ/CW0+k2Z8tyy6AnEQItWvoVh/b\n" + "8lS7Ph/f9JUYHp2DtgsQWcNQbrUZOPFBu8J4MD6cDWG5Uxwl3YASg30ZdmMDNT8B\n" + "HshYz0HUOAhYwVSI3J/f7LFhD5OpjSroHgE7wA9UJrerAp9f7e3e9D7kNQ8DlvLP\n" + "kz6Jh+5M/xD3JO1yl+evaCp3LA+z4M2xiNvtzkAEgj3t6RaJ81Sh5XGiooDYZ14R\n" + "DgEBYLTUfBYBPzoaahPEdG/f0kUjUBJ34fkBUSjJKURPTHJfDfA=\n" + "-----END CERTIFICATE-----\n" }; int @@ -171,7 +168,7 @@ main (int argc, char *argv[]) error (EXIT_FAILURE, 0, "gnutls_x509_crt_init[%d]: %s", i, gnutls_strerror (ret)); - tmp.data = (char*) pem_certs[i]; + tmp.data = (char *) pem_certs[i]; tmp.size = strlen (pem_certs[i]); ret = gnutls_x509_crt_import (certs[i], &tmp, GNUTLS_X509_FMT_PEM); @@ -182,9 +179,10 @@ main (int argc, char *argv[]) ret = gnutls_x509_crt_init (&ca); if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s", gnutls_strerror (ret)); + error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s", + gnutls_strerror (ret)); - tmp.data = (char*) pem_ca; + tmp.data = (char *) pem_ca; tmp.size = strlen (pem_ca); ret = gnutls_x509_crt_import (ca, &tmp, GNUTLS_X509_FMT_PEM); @@ -213,9 +211,10 @@ main (int argc, char *argv[]) ret = gnutls_x509_crt_init (&self_cert); if (ret < 0) - error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s", gnutls_strerror (ret)); + error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s", + gnutls_strerror (ret)); - tmp.data = (char*) pem_self_cert; + tmp.data = (char *) pem_self_cert; tmp.size = strlen (pem_self_cert); ret = gnutls_x509_crt_import (self_cert, &tmp, GNUTLS_X509_FMT_PEM); diff --git a/tests/cve-2009-1415.c b/tests/cve-2009-1415.c index fe89aa4cfb..b74a5a29b4 100644 --- a/tests/cve-2009-1415.c +++ b/tests/cve-2009-1415.c @@ -67,8 +67,7 @@ static char dsa_cert[] = "HPutkm7mBqRWLKLhwFMnyPKVMAsGCSqGSIb3DQEBBQOBgQBCsrnfD1xzh8/Eih1f\n" "x+M0lPoX1Re5L2ElHI6DJpHYOBPwf9glwxnet2+avzgUQDUFwUSxOhodpyeaACXD\n" "o0gGVpcH8sOBTQ+aTdM37hGkPxoXjtIkR/LgG5nP2H2JRd5TkW8l13JdM4MJFB4W\n" - "QcDzQ8REwidsfh9uKAluk1c/KQ==\n" - "-----END CERTIFICATE-----\n"; + "QcDzQ8REwidsfh9uKAluk1c/KQ==\n" "-----END CERTIFICATE-----\n"; const gnutls_datum_t dsa_cert_dat = { dsa_cert, sizeof (dsa_cert) diff --git a/tests/dhepskself.c b/tests/dhepskself.c index 406668d40d..ce9f58e577 100644 --- a/tests/dhepskself.c +++ b/tests/dhepskself.c @@ -60,7 +60,7 @@ client (void) gnutls_session_t session; char buffer[MAX_BUF + 1]; gnutls_psk_client_credentials_t pskcred; - const gnutls_datum_t key = { (char*) "DEADBEEF", 8 }; + const gnutls_datum_t key = { (char *) "DEADBEEF", 8 }; gnutls_global_init (); @@ -167,7 +167,7 @@ static gnutls_dh_params_t dh_params; static int generate_dh_params (void) { - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; /* Generate Diffie-Hellman parameters - for use with DHE * kx algorithms. These should be discarded and regenerated * once a day, once a week or once a month. Depending on the @@ -220,7 +220,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) diff --git a/tests/dn2.c b/tests/dn2.c index 4df3f71b34..5ea4fb9e11 100644 --- a/tests/dn2.c +++ b/tests/dn2.c @@ -61,10 +61,10 @@ static char pem[] = "96B6WWBo9mzgwSM1d8LDhrarZ7uQhm+kBAMyEXhmDnCPWhvExvxJzjEmOlxjThyP\n" "2yvIgfLyDfplRe+jUbsY7YNe08eEyoLRq1jwPuRWTaEx2gA7C6pq45747/HkJrtF\n" "ya3ULM/AJv6Nj6pobxzQ5rEkUGEwKavu7GMjLrSMnHrbVCiQrn1v6c7B9nSPA31L\n" - "/do1TDFI0vSl5+M=\n" - "-----END CERTIFICATE-----\n"; + "/do1TDFI0vSl5+M=\n" "-----END CERTIFICATE-----\n"; -static const char *info = "subject `1.3.6.1.4.1.311.60.2.1.3=#13024445,1.3.6.1.4.1.311.60.2.1.1=#14084d75656e6368656e,2.5.4.15=#131256312e302c20436c6175736520352e286229,serialNumber=HRB 144261,C=DE,2.5.4.17=#14053830383037,ST=Bavaria,L=Muenchen,STREET=Frankfurter Ring 129,O=GMX GmbH,CN=www.gmx.de', issuer `C=US,O=VeriSign\\, Inc.,OU=VeriSign Trust Network,OU=Terms of use at https://www.verisign.com/rpa (c)06,CN=VeriSign Class 3 Extended Validation SSL SGC CA', RSA key 1024 bits, signed using RSA-SHA1, activated `2008-11-13 00:00:00 UTC', expires `2009-11-13 23:59:59 UTC', SHA-1 fingerprint `7ece297c45d5b17685224b4e929a30e91a9553cb'"; +static const char *info = + "subject `1.3.6.1.4.1.311.60.2.1.3=#13024445,1.3.6.1.4.1.311.60.2.1.1=#14084d75656e6368656e,2.5.4.15=#131256312e302c20436c6175736520352e286229,serialNumber=HRB 144261,C=DE,2.5.4.17=#14053830383037,ST=Bavaria,L=Muenchen,STREET=Frankfurter Ring 129,O=GMX GmbH,CN=www.gmx.de', issuer `C=US,O=VeriSign\\, Inc.,OU=VeriSign Trust Network,OU=Terms of use at https://www.verisign.com/rpa (c)06,CN=VeriSign Class 3 Extended Validation SSL SGC CA', RSA key 1024 bits, signed using RSA-SHA1, activated `2008-11-13 00:00:00 UTC', expires `2009-11-13 23:59:59 UTC', SHA-1 fingerprint `7ece297c45d5b17685224b4e929a30e91a9553cb'"; void doit (void) @@ -94,9 +94,7 @@ doit (void) success ("comparison ok\n"); else fail ("comparison fail (%d/%d)\nexpect: %s\n got: %.*s\n", - out.size, strlen (info), - info, - out.size, out.data); + out.size, strlen (info), info, out.size, out.data); gnutls_x509_crt_deinit (cert); gnutls_global_deinit (); diff --git a/tests/finished.c b/tests/finished.c index 5a5810ff4b..f482ef8d83 100644 --- a/tests/finished.c +++ b/tests/finished.c @@ -155,7 +155,7 @@ doit (void) { /* Server stuff. */ gnutls_anon_server_credentials_t s_anoncred; - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; static gnutls_dh_params_t dh_params; gnutls_session_t server; int sret = GNUTLS_E_AGAIN; diff --git a/tests/hostname-check.c b/tests/hostname-check.c index 45257ebf40..22ce874f00 100644 --- a/tests/hostname-check.c +++ b/tests/hostname-check.c @@ -549,8 +549,7 @@ char pem9[] = "A1UdDgQWBBRMuQqb+h00437ey9IHFf6h2stokTALBgkqhkiG9w0BAQUDgYEAoh/S\n" "kF/JHG+SHcULrLAXI8VnRpRvD2J9Zkwo/7cQc2CuDqJHgoO7iQ3xFl75WzVLzu5e\n" "0K21i8w3s6xNG1jCTxx/xqw9JRhnN/AnEZssILZ4JCGmd0TnGuX2v0WEMoFnr42W\n" - "Jvc5MWtjxRWd4KCaHpYSy62Fy6fUhqzY9emkKyA=\n" - "-----END CERTIFICATE-----\n"; + "Jvc5MWtjxRWd4KCaHpYSy62Fy6fUhqzY9emkKyA=\n" "-----END CERTIFICATE-----\n"; /* Certificate with SAN and CN that match iff you truncate the SAN to the embedded NUL. @@ -634,8 +633,7 @@ char pem10[] = "ODUiNAMP1F2rHHIVsdmJVhAS+30NGBKpCjjck89p/3WGnuNr65JsVRbVZYvXnF5L\n" "gsiSbIvmGKL4jGWqtusj7cuZ2/yLjh16Ocn1e39Ye+0BbDxA7OOpX8Q9y4EXA20t\n" "170AX8R58vurxg6iAYuhQnPelik+v9fZUafUmAd/8PTNAKHhrGwFrKuTG7BcLBOt\n" - "/yfcgJk0Zr3jMVTVtj/O1AijUihhXr0=\n" - "-----END CERTIFICATE-----\n"; + "/yfcgJk0Zr3jMVTVtj/O1AijUihhXr0=\n" "-----END CERTIFICATE-----\n"; #ifdef ENABLE_OPENPGP /* Check basic OpenPGP comparison too. @@ -668,8 +666,7 @@ char pem11[] = "03G+ynCHf5pBAXHhfCNhA0lMv5h3eJECNElcCh0sYGmo19jOzbnlRSGKRqrflOtO\n" "YwhQXK9y/ohJBBgRAgAJBQJFyJ51AhsMAAoJEK5frT5dHRTYDDgAn2bLaS5n3Xy8\n" "Z/V2Me1st/9pqPfZAJ4+9YBnyjCq/0vosIoZabi+s92m7g==\n" - "=NkXV\n" - "-----END PGP PUBLIC KEY BLOCK-----\n"; + "=NkXV\n" "-----END PGP PUBLIC KEY BLOCK-----\n"; #endif void diff --git a/tests/mini-eagain.c b/tests/mini-eagain.c index d46180cd32..9cc3c5a301 100644 --- a/tests/mini-eagain.c +++ b/tests/mini-eagain.c @@ -56,7 +56,7 @@ client_pull (gnutls_transport_ptr_t tr, void *data, size_t len) unsigned char rnd; gcry_create_nonce (&rnd, 1); - if (handshake == 0 && rnd % 2 == 0) + if (handshake == 0 && rnd % 2 == 0) { gnutls_transport_set_global_errno (EAGAIN); return -1; @@ -105,7 +105,7 @@ server_pull (gnutls_transport_ptr_t tr, void *data, size_t len) unsigned char rnd; gcry_create_nonce (&rnd, 1); - if (handshake == 0 && rnd % 2 == 0) + if (handshake == 0 && rnd % 2 == 0) { gnutls_transport_set_global_errno (EAGAIN); return -1; @@ -134,7 +134,7 @@ server_push (gnutls_transport_ptr_t tr, const void *data, size_t len) //success ("server_push len %d has %d\n", len, to_client_len); gcry_create_nonce (&rnd, 1); - if (handshake == 0 && rnd % 2 == 0) + if (handshake == 0 && rnd % 2 == 0) { gnutls_transport_set_global_errno (EAGAIN); return -1; @@ -164,7 +164,7 @@ doit (void) { /* Server stuff. */ gnutls_anon_server_credentials_t s_anoncred; - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; static gnutls_dh_params_t dh_params; gnutls_session_t server; int sret = GNUTLS_E_AGAIN; @@ -230,46 +230,48 @@ doit (void) ns = gnutls_record_send (client, MSG, strlen (MSG)); //success ("client: sent %d\n", ns); - do + do { //success("transferred: %d\n", transferred); ret = gnutls_record_recv (server, buffer, MAX_BUF); if (ret == 0) - fail ("server: didn't receive any data\n"); - else if (ret < 0) - { - if (ret != GNUTLS_E_AGAIN) { - fail ("server: error: %s\n", gnutls_strerror (ret)); - break; - } - } + fail ("server: didn't receive any data\n"); + else if (ret < 0) + { + if (ret != GNUTLS_E_AGAIN) + { + fail ("server: error: %s\n", gnutls_strerror (ret)); + break; + } + } else - { - transferred+=ret; - fputs ("*", stdout); - } - - ns = gnutls_record_send (server, MSG, strlen (MSG)); - //success ("server: sent %d\n", ns); - - ret = gnutls_record_recv (client, buffer, MAX_BUF); - if (ret == 0) - { - fail ("client: Peer has closed the TLS connection\n"); - } - else if (ret < 0) - { - if (ret != GNUTLS_E_AGAIN) { - fail ("client: Error: %s\n", gnutls_strerror (ret)); - break; - } - } - else - { - transferred+=ret; - fputs (".", stdout); - } + { + transferred += ret; + fputs ("*", stdout); + } + + ns = gnutls_record_send (server, MSG, strlen (MSG)); + //success ("server: sent %d\n", ns); + + ret = gnutls_record_recv (client, buffer, MAX_BUF); + if (ret == 0) + { + fail ("client: Peer has closed the TLS connection\n"); + } + else if (ret < 0) + { + if (ret != GNUTLS_E_AGAIN) + { + fail ("client: Error: %s\n", gnutls_strerror (ret)); + break; + } + } + else + { + transferred += ret; + fputs (".", stdout); + } } while (transferred < 7000); fputs ("\n", stdout); diff --git a/tests/mini.c b/tests/mini.c index b64401db62..21a426ee7e 100644 --- a/tests/mini.c +++ b/tests/mini.c @@ -137,7 +137,7 @@ doit (void) { /* Server stuff. */ gnutls_anon_server_credentials_t s_anoncred; - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; static gnutls_dh_params_t dh_params; gnutls_session_t server; int sret = GNUTLS_E_AGAIN; diff --git a/tests/nul-in-x509-names.c b/tests/nul-in-x509-names.c index f79dea0fff..0ad9626a5e 100644 --- a/tests/nul-in-x509-names.c +++ b/tests/nul-in-x509-names.c @@ -54,8 +54,7 @@ static char badguy_nul_cn_data[] = "8/pc7vh7C8Y5tQQzXq64Xg5mzKjAag3sYMHF2TnqvRuPHH0WOLHoyDcBqkuZ3+QP\n" "EL5h7prPzScFRgBg2Gp0CDI8i5ABagczDGyQ2+r7ahcadrtzFCfhpH7V3TCxXfIO\n" "qtSy1Uz2T5EqB/Q3wc9IGcX+fpKWqN9QajGSo7EU/kHMSWKYTerFugUtScMicu9B\n" - "CQ==\n" - "-----END CERTIFICATE-----\n"; + "CQ==\n" "-----END CERTIFICATE-----\n"; const gnutls_datum_t badguy_nul_cn = { badguy_nul_cn_data, sizeof (badguy_nul_cn_data) @@ -120,11 +119,11 @@ main (void) ret = gnutls_x509_crt_check_hostname (crt, "www.bank.com"); if (ret == 0) { - puts("gnutls_x509_crt_check_hostname OK (NUL-IN-CN)"); + puts ("gnutls_x509_crt_check_hostname OK (NUL-IN-CN)"); } else { - puts("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-CN)"); + puts ("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-CN)"); exit_code = 1; } @@ -138,11 +137,11 @@ main (void) ret = gnutls_x509_crt_check_hostname (crt, "www.bank.com"); if (ret == 0) { - puts("gnutls_x509_crt_check_hostname OK (NUL-IN-SAN)"); + puts ("gnutls_x509_crt_check_hostname OK (NUL-IN-SAN)"); } else { - puts("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-SAN)"); + puts ("gnutls_x509_crt_check_hostname BROKEN (NUL-IN-SAN)"); exit_code = 1; } diff --git a/tests/openpgpself.c b/tests/openpgpself.c index 2b07ae31f7..958388ac6d 100644 --- a/tests/openpgpself.c +++ b/tests/openpgpself.c @@ -239,7 +239,7 @@ static gnutls_dh_params_t dh_params; static int generate_dh_params (void) { - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; /* Generate Diffie-Hellman parameters - for use with DHE * kx algorithms. These should be discarded and regenerated * once a day, once a week or once a month. Depending on the @@ -352,7 +352,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) diff --git a/tests/oprfi.c b/tests/oprfi.c index 46089cefcb..8f128ef6fd 100644 --- a/tests/oprfi.c +++ b/tests/oprfi.c @@ -292,7 +292,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) diff --git a/tests/pkcs12_encode.c b/tests/pkcs12_encode.c index ff72f43053..28e24aaf27 100644 --- a/tests/pkcs12_encode.c +++ b/tests/pkcs12_encode.c @@ -45,8 +45,7 @@ static char client_pem[] = "+62SbuYGpFYsouHAUyfI8pUwCwYJKoZIhvcNAQEFA4GBALujmBJVZnvaTXr9cFRJ\n" "jpfc/3X7sLUsMvumcDE01ls/cG5mIatmiyEU9qI3jbgUf82z23ON/acwJf875D3/\n" "U7jyOsBJ44SEQITbin2yUeJMIm1tievvdNXBDfW95AM507ShzP12sfiJkJfjjdhy\n" - "dc8Siq5JojruiMizAf0pA7in\n" - "-----END CERTIFICATE-----\n"; + "dc8Siq5JojruiMizAf0pA7in\n" "-----END CERTIFICATE-----\n"; const gnutls_datum_t client_dat = { client_pem, sizeof (client_pem) }; static char ca_pem[] = @@ -61,8 +60,7 @@ static char ca_pem[] = "Viyi4cBTJ8jylTALBgkqhkiG9w0BAQUDgYEAiaIRqGfp1jPpNeVhABK60SU0KIAy\n" "njuu7kHq5peUgYn8Jd9zNzExBOEp1VOipGsf6G66oQAhDFp2o8zkz7ZH71zR4HEW\n" "KoX6n5Emn6DvcEH/9pAhnGxNHJAoS7czTKv/JDZJhkqHxyrE1fuLsg5Qv25DTw7+\n" - "PfqUpIhz5Bbm7J4=\n" - "-----END CERTIFICATE-----\n"; + "PfqUpIhz5Bbm7J4=\n" "-----END CERTIFICATE-----\n"; const gnutls_datum_t ca_dat = { ca_pem, sizeof (ca_pem) }; int diff --git a/tests/pkcs12_s2k.c b/tests/pkcs12_s2k.c index 58c58ee299..e8b6dfcb29 100644 --- a/tests/pkcs12_s2k.c +++ b/tests/pkcs12_s2k.c @@ -75,27 +75,36 @@ static struct size_t iter; size_t keylen; const char *key; -} tv[] = { - { 1, "smeg", "\x0A\x58\xCF\x64\x53\x0D\x82\x3F", 1, 24, - "8aaae6297b6cb04642ab5b077851284eb7128f1a2a7fbca3" }, - { 2, "smeg", "\x0A\x58\xCF\x64\x53\x0D\x82\x3F", 1, 8, - "79993dfe048d3b76" }, - { 1, "smeg", "\x64\x2B\x99\xAB\x44\xFB\x4B\x1F", 1, 24, - "f3a95fec48d7711e985cfe67908c5ab79fa3d7c5caa5d966" }, - { 2, "smeg", "\x64\x2B\x99\xAB\x44\xFB\x4B\x1F", 1, 8, - "c0a38d64a79bea1d" }, - { 3, "smeg", "\x3D\x83\xC0\xE4\x54\x6A\xC1\x40", 1, 20, - "8d967d88f6caa9d714800ab3d48051d63f73a312" }, - { 1, "queeg", "\x05\xDE\xC9\x59\xAC\xFF\x72\xF7", 1000, 24, - "ed2034e36328830ff09df1e1a07dd357185dac0d4f9eb3d4" }, - { 2, "queeg", "\x05\xDE\xC9\x59\xAC\xFF\x72\xF7", 1000, 8, - "11dedad7758d4860" }, - { 1, "queeg", "\x16\x82\xC0\xFC\x5B\x3F\x7E\xC5", 1000, 24, - "483dd6e919d7de2e8e648ba8f862f3fbfbdc2bcb2c02957f" }, - { 2, "queeg", "\x16\x82\xC0\xFC\x5B\x3F\x7E\xC5", 1000, 8, - "9d461d1b00355c50" }, - { 3, "queeg", "\x26\x32\x16\xFC\xC2\xFA\xB3\x1C", 1000, 20, - "5ec4c7a80df652294c3925b6489a7ab857c83476" } +} tv[] = +{ + { + 1, "smeg", "\x0A\x58\xCF\x64\x53\x0D\x82\x3F", 1, 24, + "8aaae6297b6cb04642ab5b077851284eb7128f1a2a7fbca3"}, + { + 2, "smeg", "\x0A\x58\xCF\x64\x53\x0D\x82\x3F", 1, 8, "79993dfe048d3b76"}, + { + 1, "smeg", "\x64\x2B\x99\xAB\x44\xFB\x4B\x1F", 1, 24, + "f3a95fec48d7711e985cfe67908c5ab79fa3d7c5caa5d966"}, + { + 2, "smeg", "\x64\x2B\x99\xAB\x44\xFB\x4B\x1F", 1, 8, "c0a38d64a79bea1d"}, + { + 3, "smeg", "\x3D\x83\xC0\xE4\x54\x6A\xC1\x40", 1, 20, + "8d967d88f6caa9d714800ab3d48051d63f73a312"}, + { + 1, "queeg", "\x05\xDE\xC9\x59\xAC\xFF\x72\xF7", 1000, 24, + "ed2034e36328830ff09df1e1a07dd357185dac0d4f9eb3d4"}, + { + 2, "queeg", "\x05\xDE\xC9\x59\xAC\xFF\x72\xF7", 1000, 8, + "11dedad7758d4860"}, + { + 1, "queeg", "\x16\x82\xC0\xFC\x5B\x3F\x7E\xC5", 1000, 24, + "483dd6e919d7de2e8e648ba8f862f3fbfbdc2bcb2c02957f"}, + { + 2, "queeg", "\x16\x82\xC0\xFC\x5B\x3F\x7E\xC5", 1000, 8, + "9d461d1b00355c50"}, + { + 3, "queeg", "\x26\x32\x16\xFC\xC2\xFA\xB3\x1C", 1000, 20, + "5ec4c7a80df652294c3925b6489a7ab857c83476"} }; void @@ -123,8 +132,7 @@ doit (void) fail ("_gnutls_pkcs12_string_to_key failed[0]: %d\n", rc); if (strcmp (_gnutls_bin2hex (key, sizeof (key), - tmp, sizeof (tmp)), - values[x]) != 0) + tmp, sizeof (tmp)), values[x]) != 0) fail ("_gnutls_pkcs12_string_to_key failed[1]\n"); printf ("ij: %d.%d: %s\n", i, j, diff --git a/tests/pkcs12_s2k_pem.c b/tests/pkcs12_s2k_pem.c index 71fe4bf4c8..7298e19685 100644 --- a/tests/pkcs12_s2k_pem.c +++ b/tests/pkcs12_s2k_pem.c @@ -234,17 +234,28 @@ static struct const char *password; const char *pkcs12key; int expected_result; -} keys[] = { - { "x_9607", "123456", X_9607, 0 }, - { "x_9671", "123456", X_9671, 0 }, - { "x_9925", "123456", X_9925, 0 }, - { "x_9926", "123456", X_9926, 0 }, - { "x_9927", "123456", X_9927, 0 }, - { "x_9928", "123456", X_9928, 0 }, - { "x_9929", "123456", X_9929, 0 }, - { "x_9930", "123456", X_9930, 0 }, - { "x_9931", "123456", X_9931, 0 }, - { "x_9932", "123456", X_9932, 0 } +} keys[] = +{ + { + "x_9607", "123456", X_9607, 0}, + { + "x_9671", "123456", X_9671, 0}, + { + "x_9925", "123456", X_9925, 0}, + { + "x_9926", "123456", X_9926, 0}, + { + "x_9927", "123456", X_9927, 0}, + { + "x_9928", "123456", X_9928, 0}, + { + "x_9929", "123456", X_9929, 0}, + { + "x_9930", "123456", X_9930, 0}, + { + "x_9931", "123456", X_9931, 0}, + { + "x_9932", "123456", X_9932, 0} }; int @@ -265,7 +276,7 @@ main (void) if (ret < 0) return 1; - tmp.data = (char*) keys[i].pkcs12key; + tmp.data = (char *) keys[i].pkcs12key; tmp.size = strlen (tmp.data); ret = gnutls_x509_privkey_import_pkcs8 (key, &tmp, diff --git a/tests/pskself.c b/tests/pskself.c index d3e42f473f..6c74763c2b 100644 --- a/tests/pskself.c +++ b/tests/pskself.c @@ -56,7 +56,7 @@ client (void) gnutls_psk_client_credentials_t pskcred; /* Need to enable anonymous KX specifically. */ const int kx_prio[] = { GNUTLS_KX_PSK, 0 }; - const gnutls_datum_t key = { (char*) "DEADBEEF", 8 }; + const gnutls_datum_t key = { (char *) "DEADBEEF", 8 }; gnutls_global_init (); @@ -206,7 +206,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) diff --git a/tests/resume.c b/tests/resume.c index 5cc3eda330..c52c1d6bed 100644 --- a/tests/resume.c +++ b/tests/resume.c @@ -58,16 +58,15 @@ struct params_res int expect_resume; }; -struct params_res resume_tests[] = - { - {"try to resume from db", 50, 0, 0, 1}, +struct params_res resume_tests[] = { + {"try to resume from db", 50, 0, 0, 1}, #ifdef ENABLE_SESSION_TICKET - {"try to resume from session ticket", 0, 1, 1, 1}, - {"try to resume from session ticket (server only)", 0, 1, 0, 0}, - {"try to resume from session ticket (client only)", 0, 0, 1, 0}, + {"try to resume from session ticket", 0, 1, 1, 1}, + {"try to resume from session ticket (server only)", 0, 1, 0, 0}, + {"try to resume from session ticket (client only)", 0, 0, 1, 0}, #endif - {NULL, -1} - }; + {NULL, -1} +}; /* A very basic TLS client, with anonymous authentication. */ @@ -256,7 +255,7 @@ static gnutls_dh_params_t dh_params; static int generate_dh_params (void) { - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; /* Generate Diffie-Hellman parameters - for use with DHE * kx algorithms. These should be discarded and regenerated * once a day, once a week or once a month. Depending on the @@ -294,7 +293,8 @@ global_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) diff --git a/tests/tlsia.c b/tests/tlsia.c index fff10a8595..cc1dbce345 100644 --- a/tests/tlsia.c +++ b/tests/tlsia.c @@ -262,7 +262,7 @@ static gnutls_dh_params_t dh_params; static int generate_dh_params (void) { - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; /* Generate Diffie-Hellman parameters - for use with DHE * kx algorithms. These should be discarded and regenerated * once a day, once a week or once a month. Depending on the @@ -378,7 +378,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) diff --git a/tests/x509_altname.c b/tests/x509_altname.c index ef99bae377..c9f00dc623 100644 --- a/tests/x509_altname.c +++ b/tests/x509_altname.c @@ -30,35 +30,34 @@ #include "utils.h" static char pem[] = -"-----BEGIN CERTIFICATE-----\n" -"MIIE6zCCA9OgAwIBAgIBdjANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJTRTEf\n" -"MB0GA1UEChMWU3RvY2tob2xtcyB1bml2ZXJzaXRldDEgMB4GA1UEAxMXU3RvY2to\n" -"b2xtIFVuaXZlcnNpdHkgQ0EwHhcNMDYwMzIyMDkxNTI4WhcNMDcwMzIyMDkxNTI4\n" -"WjBDMQswCQYDVQQGEwJTRTEfMB0GA1UEChMWU3RvY2tob2xtcyB1bml2ZXJzaXRl\n" -"dDETMBEGA1UEAxMKc2lwMS5zdS5zZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC\n" -"gYEArUzXTD36ZK7CwZJH/faUNTcdaqM7JyiZsfrO703d7cT/bJ3wKxT8trOOh/Ou\n" -"WwgGFX2+r7ykun3aIUXUuD13Yle/yHqH/4g9vWX7UeFCBlSI0tAxnlqt0QqlPgSd\n" -"GLHcoO4PPyjon9jj0A/zpJGZHiRUCooo63YqE9MYfr5HBfkCAwEAAaOCAl8wggJb\n" -"MAsGA1UdDwQEAwIF4DAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwHQYD\n" -"VR0OBBYEFDpcXNHMLJ7fc/c72BtZseq4MDXFMH8GA1UdIwR4MHaAFJ4uMLo32VFE\n" -"yZ2/GCHxvX7utYZIoVukWTBXMQswCQYDVQQGEwJTRTEYMBYGA1UEChMPVW1lYSBV\n" -"bml2ZXJzaXR5MRMwEQYDVQQLEwpTd1VQS0ktUENBMRkwFwYDVQQDExBTd1VQS0kg\n" -"UG9saWN5IENBggEQMDIGA1UdHwQrMCkwJ6AloCOGIWh0dHA6Ly9jYS5zdS5zZS8y\n" -"MDA1LTEvY3JsLXYyLmNyb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C\n" + "F2luY29taW5ncHJveHkuc2lwLnN1LnNlghhpbmNvbWluZ3Byb3h5MS5zaXAuc3Uu\n" + "c2WCF291dGdvaW5ncHJveHkuc2lwLnN1LnNlghhvdXRnb2luZ3Byb3h5MS5zaXAu\n" + "c3Uuc2WCDW91dC5zaXAuc3Uuc2WCE2FwcHNlcnZlci5zaXAuc3Uuc2WCFGFwcHNl\n" + "cnZlcjEuc2lwLnN1LnNlggpzaXAxLnN1LnNlMA0GCSqGSIb3DQEBBQUAA4IBAQAR\n" + "FYg7ytcph0E7WmvM44AN/8qru7tRX6aSFWrjLyVr/1Wk4prCK4y5JpfNw5dh9Z8f\n" + "/gyFsr1iFsb6fS3nJTTd3fVlWRfcNCGIx5g8KuSb3u6f7VznkGOeiRMRESQc1G8B\n" + "eh0zbdZS7BYO2g9EKlbGST5PwQnc4g9K7pqPyKSNVkzb60Nujg/+qYje7MCcN+ZR\n" + "nUBo6U2NZ06/QEUFm+uUIhZ8IGM1gLehC7Q3G4+d4c38CDJxQnSPOgWiXuSvhhQm\n" + "KDsbrKzRaeBRh5eEJbTkA8Dp0Emb0UrkRVhixeg97stxUcATAjdGljJ9MLnuHXnI\n" + "7ihGdUfg5q/105vpsQpO\n" "-----END CERTIFICATE-----\n"; #define MAX_DATA_SIZE 1024 @@ -69,7 +68,7 @@ doit (void) gnutls_datum_t derCert = { pem, sizeof (pem) }; gnutls_x509_crt_t cert; size_t data_len = MAX_DATA_SIZE; - char data[ MAX_DATA_SIZE ]; + char data[MAX_DATA_SIZE]; unsigned int critical = 0; int alt_name_count = 0; @@ -85,32 +84,43 @@ doit (void) if (ret < 0) fail ("crt_import %d\n", ret); - for (alt_name_count = 0; ; ++alt_name_count) { - ret = gnutls_x509_crt_get_issuer_alt_name (cert, alt_name_count, data, &data_len, &critical); - if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) - break; + for (alt_name_count = 0;; ++alt_name_count) + { + ret = + gnutls_x509_crt_get_issuer_alt_name (cert, alt_name_count, data, + &data_len, &critical); + if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) + break; - if (ret < 0) - fail ("get_issuer_alt_name: %d\n", ret); + if (ret < 0) + fail ("get_issuer_alt_name: %d\n", ret); - // TODO: print out / check results - if (GNUTLS_SAN_URI == ret) { - if (strcmp( data, "http://ca.su.se" ) != 0) { - fail("unexpected issuer GNUTLS_SAN_URI: %s\n", data); - } - } else if (GNUTLS_SAN_RFC822NAME == ret) { - if (strcmp( data, "ca@su.se" ) != 0) { - fail("unexpected issuer GNUTLS_SAN_RFC822NAME: %s\n", data); - } - } else { - fail("unexpected alt name type: %d\n", ret); + // TODO: print out / check results + if (GNUTLS_SAN_URI == ret) + { + if (strcmp (data, "http://ca.su.se") != 0) + { + fail ("unexpected issuer GNUTLS_SAN_URI: %s\n", data); + } + } + else if (GNUTLS_SAN_RFC822NAME == ret) + { + if (strcmp (data, "ca@su.se") != 0) + { + fail ("unexpected issuer GNUTLS_SAN_RFC822NAME: %s\n", data); + } + } + else + { + fail ("unexpected alt name type: %d\n", ret); + } + data_len = MAX_DATA_SIZE; } - data_len = MAX_DATA_SIZE; - } - if (alt_name_count !=2) { - fail("unexpected number of alt names: %i\n", alt_name_count); - } + if (alt_name_count != 2) + { + fail ("unexpected number of alt names: %i\n", alt_name_count); + } success ("done\n"); diff --git a/tests/x509dn.c b/tests/x509dn.c index 57a517bb1c..f64f68f9fe 100644 --- a/tests/x509dn.c +++ b/tests/x509dn.c @@ -305,7 +305,7 @@ static gnutls_dh_params_t dh_params; static int generate_dh_params (void) { - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; /* Generate Diffie-Hellman parameters - for use with DHE * kx algorithms. These should be discarded and regenerated * once a day, once a week or once a month. Depending on the @@ -385,7 +385,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) diff --git a/tests/x509self.c b/tests/x509self.c index 14979a1ec0..fa2dbe86c9 100644 --- a/tests/x509self.c +++ b/tests/x509self.c @@ -167,15 +167,15 @@ client (void) print_info (session); ret = gnutls_record_send (session, MSG, strlen (MSG)); - - if (ret == strlen(MSG)) + + if (ret == strlen (MSG)) { success ("client: sent record.\n"); } - else + else { fail ("client: failed to send record.\n"); - gnutls_perror(ret); + gnutls_perror (ret); goto end; } @@ -187,16 +187,16 @@ client (void) { success ("client: doing handshake!\n"); ret = gnutls_handshake (session); - if (ret == 0) - { - success ("client: handshake complete, reading again.\n"); - ret = gnutls_record_recv (session, buffer, MAX_BUF); - } + if (ret == 0) + { + success ("client: handshake complete, reading again.\n"); + ret = gnutls_record_recv (session, buffer, MAX_BUF); + } else - { - fail ("client: handshake failed.\n"); - } - } + { + fail ("client: handshake failed.\n"); + } + } if (ret == 0) { @@ -256,8 +256,8 @@ initialize_tls_session (void) /* request client certificate if any. Moved to later on to be able to test re-handshakes. - gnutls_certificate_server_set_request (session, GNUTLS_CERT_REQUEST); - */ + gnutls_certificate_server_set_request (session, GNUTLS_CERT_REQUEST); + */ gnutls_dh_set_prime_bits (session, DH_BITS); @@ -269,7 +269,7 @@ static gnutls_dh_params_t dh_params; static int generate_dh_params (void) { - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; /* Generate Diffie-Hellman parameters - for use with DHE * kx algorithms. These should be discarded and regenerated * once a day, once a week or once a month. Depending on the @@ -349,7 +349,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) @@ -438,27 +439,28 @@ server (void) } else if (ret > 0) { - gnutls_certificate_server_set_request (session, GNUTLS_CERT_REQUEST); - - success ("server: got data, forcing rehandshake.\n"); - - ret = gnutls_rehandshake(session); - if (ret < 0) - { - fail ("server: rehandshake failed\n"); - gnutls_perror(ret); - break; - } - - ret = gnutls_handshake(session); - if (ret < 0) - { - fail ("server: (re)handshake failed\n"); - gnutls_perror(ret); - break; - } - - success ("server: rehandshake complete.\n"); + gnutls_certificate_server_set_request (session, + GNUTLS_CERT_REQUEST); + + success ("server: got data, forcing rehandshake.\n"); + + ret = gnutls_rehandshake (session); + if (ret < 0) + { + fail ("server: rehandshake failed\n"); + gnutls_perror (ret); + break; + } + + ret = gnutls_handshake (session); + if (ret < 0) + { + fail ("server: (re)handshake failed\n"); + gnutls_perror (ret); + break; + } + + success ("server: rehandshake complete.\n"); /* echo data back to the client */ diff --git a/tests/x509sign-verify.c b/tests/x509sign-verify.c index 3b68a70401..532114f297 100644 --- a/tests/x509sign-verify.c +++ b/tests/x509sign-verify.c @@ -65,8 +65,7 @@ static char pem1_cert[] = "+62SbuYGpFYsouHAUyfI8pUwCwYJKoZIhvcNAQEFA4GBALujmBJVZnvaTXr9cFRJ\n" "jpfc/3X7sLUsMvumcDE01ls/cG5mIatmiyEU9qI3jbgUf82z23ON/acwJf875D3/\n" "U7jyOsBJ44SEQITbin2yUeJMIm1tievvdNXBDfW95AM507ShzP12sfiJkJfjjdhy\n" - "dc8Siq5JojruiMizAf0pA7in\n" - "-----END CERTIFICATE-----\n"; + "dc8Siq5JojruiMizAf0pA7in\n" "-----END CERTIFICATE-----\n"; static char pem1_key[] = "-----BEGIN RSA PRIVATE KEY-----\n" @@ -105,8 +104,7 @@ static char pem2_cert[] = "HPutkm7mBqRWLKLhwFMnyPKVMAsGCSqGSIb3DQEBBQOBgQBCsrnfD1xzh8/Eih1f\n" "x+M0lPoX1Re5L2ElHI6DJpHYOBPwf9glwxnet2+avzgUQDUFwUSxOhodpyeaACXD\n" "o0gGVpcH8sOBTQ+aTdM37hGkPxoXjtIkR/LgG5nP2H2JRd5TkW8l13JdM4MJFB4W\n" - "QcDzQ8REwidsfh9uKAluk1c/KQ==\n" - "-----END CERTIFICATE-----\n"; + "QcDzQ8REwidsfh9uKAluk1c/KQ==\n" "-----END CERTIFICATE-----\n"; static char pem2_key[] = "-----BEGIN DSA PRIVATE KEY-----\n" @@ -119,17 +117,18 @@ static char pem2_key[] = "jsY+OpcCgYAPiodX8tHC3KzfS4sPi7op9+ED5FX6spgH1v0SsYC89bq0UNR/oA5D\n" "55/JeBFf5eQMLGtqpDXcvVTlYDaaMdGKWW5rHLq9LrrrfIfv2sjdoeukg+aLrfr6\n" "jlvXN8gyPpbCPvRD2n2RAg+3vPjvj/dBAF6W3w8IltzqsukGgq/SLwIUS5/r/2ya\n" - "AoNBXjeBjgCGMei2m8E=\n" - "-----END DSA PRIVATE KEY-----\n"; + "AoNBXjeBjgCGMei2m8E=\n" "-----END DSA PRIVATE KEY-----\n"; const gnutls_datum_t cert_dat[] = { - { pem1_cert, sizeof (pem1_cert) }, - { pem2_cert, sizeof (pem2_cert) } + {pem1_cert, sizeof (pem1_cert)} + , + {pem2_cert, sizeof (pem2_cert)} }; const gnutls_datum_t key_dat[] = { - { pem1_key, sizeof (pem1_key) }, - { pem2_key, sizeof (pem2_key) } + {pem1_key, sizeof (pem1_key)} + , + {pem2_key, sizeof (pem2_key)} }; void @@ -154,7 +153,8 @@ doit (void) if (ret < 0) fail ("gnutls_x509_privkey_init\n"); - ret = gnutls_x509_privkey_import (key, &key_dat[i], GNUTLS_X509_FMT_PEM); + ret = + gnutls_x509_privkey_import (key, &key_dat[i], GNUTLS_X509_FMT_PEM); if (ret < 0) fail ("gnutls_x509_privkey_import\n"); @@ -174,7 +174,8 @@ doit (void) signature.data = _signature; signature.size = _signature_size; - ret = gnutls_x509_crt_get_verify_algorithm (crt, &signature, &hash_algo); + ret = + gnutls_x509_crt_get_verify_algorithm (crt, &signature, &hash_algo); if (ret < 0 || hash_algo != GNUTLS_DIG_SHA1) fail ("gnutls_x509_crt_get_verify_algorithm\n"); diff --git a/tests/x509signself.c b/tests/x509signself.c index b39439d58d..6f7c1a2332 100644 --- a/tests/x509signself.c +++ b/tests/x509signself.c @@ -271,7 +271,7 @@ static gnutls_dh_params_t dh_params; static int generate_dh_params (void) { - const gnutls_datum_t p3 = { (char*) pkcs3, strlen (pkcs3) }; + const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) }; /* Generate Diffie-Hellman parameters - for use with DHE * kx algorithms. These should be discarded and regenerated * once a day, once a week or once a month. Depending on the @@ -350,7 +350,8 @@ server_start (void) sa_serv.sin_addr.s_addr = INADDR_ANY; sa_serv.sin_port = htons (PORT); /* Server Port number */ - setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, sizeof (int)); + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval, + sizeof (int)); err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); if (err == -1) |