diff options
author | Simon Josefsson <simon@josefsson.org> | 2010-06-07 15:20:58 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2010-06-07 15:20:58 +0200 |
commit | 62e03fb4b0f30790bfb17fe428c306ac910a61bf (patch) | |
tree | 783a52cb126ecb1dad1245e0b4c7278e6967908f | |
parent | cf0152fe0c3970ea2fa0b27fec202e605b05ecab (diff) | |
download | gnutls-62e03fb4b0f30790bfb17fe428c306ac910a61bf.tar.gz |
Indent code.
-rw-r--r-- | lib/gnutls_handshake.c | 36 | ||||
-rw-r--r-- | lib/gnutls_int.h | 3 | ||||
-rw-r--r-- | lib/gnutls_priority.c | 12 | ||||
-rw-r--r-- | lib/x509/common.h | 2 | ||||
-rw-r--r-- | lib/x509/sign.c | 4 | ||||
-rw-r--r-- | lib/x509/verify.c | 35 | ||||
-rw-r--r-- | tests/mini-x509-rehandshake.c | 8 | ||||
-rw-r--r-- | tests/safe-renegotiation/srn0.c | 11 | ||||
-rw-r--r-- | tests/safe-renegotiation/srn1.c | 11 | ||||
-rw-r--r-- | tests/safe-renegotiation/srn2.c | 11 | ||||
-rw-r--r-- | tests/safe-renegotiation/srn3.c | 3 | ||||
-rw-r--r-- | tests/safe-renegotiation/srn5.c | 8 | ||||
-rw-r--r-- | tests/safe-renegotiation/srn6.c | 8 | ||||
-rw-r--r-- | tests/safe-renegotiation/srn7.c | 11 |
14 files changed, 86 insertions, 77 deletions
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index a597254107..9c25772b6f 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -866,22 +866,22 @@ _gnutls_server_select_suite (gnutls_session_t session, opaque * data, */ if (session->internals.priorities.sr != SR_DISABLED) { - int offset; + int offset; - for (offset = 0; offset < datalen; offset += 2) - { - /* TLS_RENEGO_PROTECTION_REQUEST = { 0x00, 0xff } */ - if (data[offset] == GNUTLS_RENEGO_PROTECTION_REQUEST_MAJOR && - data[offset + 1] == GNUTLS_RENEGO_PROTECTION_REQUEST_MINOR) - { - _gnutls_handshake_log - ("HSK[%p]: Received safe renegotiation CS\n", session); - session->internals.safe_renegotiation_received = 1; - session->internals.connection_using_safe_renegotiation = 1; - break; - } - } - } + for (offset = 0; offset < datalen; offset += 2) + { + /* TLS_RENEGO_PROTECTION_REQUEST = { 0x00, 0xff } */ + if (data[offset] == GNUTLS_RENEGO_PROTECTION_REQUEST_MAJOR && + data[offset + 1] == GNUTLS_RENEGO_PROTECTION_REQUEST_MINOR) + { + _gnutls_handshake_log + ("HSK[%p]: Received safe renegotiation CS\n", session); + session->internals.safe_renegotiation_received = 1; + session->internals.connection_using_safe_renegotiation = 1; + break; + } + } + } pk_algo = _gnutls_server_find_pk_algos_in_ciphersuites (data, datalen); @@ -2386,7 +2386,7 @@ _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen) _gnutls_handshake_log ("HSK[%p]: Safe renegotiation succeeded\n", session); } - else /* safe renegotiation not received... */ + else /* safe renegotiation not received... */ { if (session->internals.connection_using_safe_renegotiation) { @@ -2401,7 +2401,7 @@ _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen) if (session->internals.initial_negotiation_completed) { - if (session->internals.priorities.sr < SR_PARTIAL) + if (session->internals.priorities.sr < SR_PARTIAL) { _gnutls_handshake_log ("HSK[%p]: Allowing unsafe (re)negotiation\n", session); @@ -2411,7 +2411,7 @@ _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen) gnutls_assert (); _gnutls_handshake_log ("HSK[%p]: Denying unsafe (re)negotiation\n", session); - return GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED; + return GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED; } } else diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 3d23f94b04..1740e51834 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -451,7 +451,8 @@ typedef struct unsigned int algorithms; } priority_st; -typedef enum { +typedef enum +{ SR_DISABLED, SR_UNSAFE, SR_PARTIAL, diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c index 319f0972f8..3d721db809 100644 --- a/lib/gnutls_priority.c +++ b/lib/gnutls_priority.c @@ -578,7 +578,7 @@ gnutls_priority_init (gnutls_priority_t * priority_cache, gnutls_assert (); return GNUTLS_E_MEMORY_ERROR; } - + /* for now unsafe renegotiation is default on everyone. To be removed * when we make it the default. */ @@ -733,13 +733,13 @@ gnutls_priority_init (gnutls_priority_t * priority_cache, GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT; else if (strcasecmp (&broken_list[i][1], "UNSAFE_RENEGOTIATION") == 0) - { + { (*priority_cache)->sr = SR_UNSAFE; - } + } else if (strcasecmp (&broken_list[i][1], "SAFE_RENEGOTIATION") == 0) { (*priority_cache)->sr = SR_SAFE; - } + } else if (strcasecmp (&broken_list[i][1], "PARTIAL_RENEGOTIATION") == 0) { @@ -747,9 +747,9 @@ gnutls_priority_init (gnutls_priority_t * priority_cache, } else if (strcasecmp (&broken_list[i][1], "DISABLE_SAFE_RENEGOTIATION") == 0) - { + { (*priority_cache)->sr = SR_DISABLED; - } + } else goto error; } diff --git a/lib/x509/common.h b/lib/x509/common.h index a2a94fea54..0853a117d9 100644 --- a/lib/x509/common.h +++ b/lib/x509/common.h @@ -128,6 +128,6 @@ int _gnutls_x509_get_signed_data (ASN1_TYPE src, const char *src_name, int _gnutls_x509_get_signature (ASN1_TYPE src, const char *src_name, gnutls_datum_t * signature); -gnutls_digest_algorithm_t _gnutls_dsa_q_to_hash(bigint_t q); +gnutls_digest_algorithm_t _gnutls_dsa_q_to_hash (bigint_t q); #endif diff --git a/lib/x509/sign.c b/lib/x509/sign.c index e74c48f00e..b2fd7c2764 100644 --- a/lib/x509/sign.c +++ b/lib/x509/sign.c @@ -180,7 +180,7 @@ dsa_sign (const gnutls_datum_t * text, opaque _digest[MAX_HASH_SIZE]; digest_hd_st hd; gnutls_datum_t digest; - gnutls_digest_algorithm_t hash = _gnutls_dsa_q_to_hash(params[1]); + gnutls_digest_algorithm_t hash = _gnutls_dsa_q_to_hash (params[1]); ret = _gnutls_hash_init (&hd, hash); if (ret < 0) @@ -193,7 +193,7 @@ dsa_sign (const gnutls_datum_t * text, _gnutls_hash_deinit (&hd, _digest); digest.data = _digest; - digest.size = _gnutls_hash_get_algo_len(hash); + digest.size = _gnutls_hash_get_algo_len (hash); if ((ret = _gnutls_sign (GNUTLS_PK_DSA, params, params_len, &digest, diff --git a/lib/x509/verify.c b/lib/x509/verify.c index 8ef697b16d..393b8a5ab0 100644 --- a/lib/x509/verify.c +++ b/lib/x509/verify.c @@ -839,17 +839,23 @@ verify_sig (const gnutls_datum_t * tbs, } } -gnutls_digest_algorithm_t _gnutls_dsa_q_to_hash(bigint_t q) +gnutls_digest_algorithm_t +_gnutls_dsa_q_to_hash (bigint_t q) { - int bits = _gnutls_mpi_get_nbits(q); - - if (bits <= 160) { - return GNUTLS_DIG_SHA1; - } else if (bits <= 224) { - return GNUTLS_DIG_SHA224; - } else { - return GNUTLS_DIG_SHA256; - } + int bits = _gnutls_mpi_get_nbits (q); + + if (bits <= 160) + { + return GNUTLS_DIG_SHA1; + } + else if (bits <= 224) + { + return GNUTLS_DIG_SHA224; + } + else + { + return GNUTLS_DIG_SHA256; + } } int @@ -866,8 +872,7 @@ _gnutls_x509_verify_algorithm (gnutls_mac_algorithm_t * hash, issuer_params_size = MAX_PUBLIC_PARAMS_SIZE; ret = - _gnutls_x509_crt_get_mpis (issuer, issuer_params, - &issuer_params_size); + _gnutls_x509_crt_get_mpis (issuer, issuer_params, &issuer_params_size); if (ret < 0) { gnutls_assert (); @@ -877,9 +882,9 @@ _gnutls_x509_verify_algorithm (gnutls_mac_algorithm_t * hash, switch (gnutls_x509_crt_get_pk_algorithm (issuer, NULL)) { case GNUTLS_PK_DSA: - + if (hash) - *hash = _gnutls_dsa_q_to_hash(issuer_params[1]); + *hash = _gnutls_dsa_q_to_hash (issuer_params[1]); ret = 0; break; @@ -924,7 +929,7 @@ _gnutls_x509_verify_algorithm (gnutls_mac_algorithm_t * hash, } cleanup: - /* release allocated mpis */ + /* release allocated mpis */ for (i = 0; i < issuer_params_size; i++) { _gnutls_mpi_release (&issuer_params[i]); diff --git a/tests/mini-x509-rehandshake.c b/tests/mini-x509-rehandshake.c index feafa7e3c0..66b79462e6 100644 --- a/tests/mini-x509-rehandshake.c +++ b/tests/mini-x509-rehandshake.c @@ -274,10 +274,10 @@ main (int argc, char *argv[]) } } while ( - /* Not done: */ - !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) - /* No error: */ - && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); + /* Not done: */ + !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) + /* No error: */ + && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_SUCCESS) exit_code = 1; diff --git a/tests/safe-renegotiation/srn0.c b/tests/safe-renegotiation/srn0.c index 0d7e4bbcfb..739103f7ab 100644 --- a/tests/safe-renegotiation/srn0.c +++ b/tests/safe-renegotiation/srn0.c @@ -297,10 +297,10 @@ main (int argc, char *argv[]) } } while ( - /* Not done: */ - !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) - /* No error: */ - && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); + /* Not done: */ + !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) + /* No error: */ + && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_SUCCESS) exit_code = 1; @@ -308,7 +308,8 @@ main (int argc, char *argv[]) if (!gnutls_safe_renegotiation_status (client) || !gnutls_safe_renegotiation_status (server)) { - tls_log_func (0, "Rehandshaked session not using safe renegotiation!\n"); + tls_log_func (0, + "Rehandshaked session not using safe renegotiation!\n"); exit_code = EXIT_FAILURE; } diff --git a/tests/safe-renegotiation/srn1.c b/tests/safe-renegotiation/srn1.c index ec70dc5d42..f96fd8303d 100644 --- a/tests/safe-renegotiation/srn1.c +++ b/tests/safe-renegotiation/srn1.c @@ -300,12 +300,13 @@ main (int argc, char *argv[]) break; } while ( - /* Not done: */ - !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) - /* No error: */ - && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); + /* Not done: */ + !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) + /* No error: */ + && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); - if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED) + if (cret != GNUTLS_E_SUCCESS + && sret != GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED) exit_code = 1; if (gnutls_safe_renegotiation_status (client) || diff --git a/tests/safe-renegotiation/srn2.c b/tests/safe-renegotiation/srn2.c index 05b83d041b..2b4268c304 100644 --- a/tests/safe-renegotiation/srn2.c +++ b/tests/safe-renegotiation/srn2.c @@ -300,12 +300,13 @@ main (int argc, char *argv[]) break; } while ( - /* Not done: */ - !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) - /* No error: */ - && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); + /* Not done: */ + !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) + /* No error: */ + && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); - if (cret != GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED && sret != GNUTLS_E_SUCCESS) + if (cret != GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED + && sret != GNUTLS_E_SUCCESS) exit_code = 1; if (gnutls_safe_renegotiation_status (client) || diff --git a/tests/safe-renegotiation/srn3.c b/tests/safe-renegotiation/srn3.c index 9730b7d232..8cd82301b4 100644 --- a/tests/safe-renegotiation/srn3.c +++ b/tests/safe-renegotiation/srn3.c @@ -193,8 +193,7 @@ main (int argc, char *argv[]) gnutls_certificate_allocate_credentials (&clientx509cred); gnutls_init (&client, GNUTLS_CLIENT); gnutls_credentials_set (client, GNUTLS_CRD_CERTIFICATE, clientx509cred); - gnutls_priority_set_direct (client, "NORMAL:%SAFE_RENEGOTIATION", - NULL); + gnutls_priority_set_direct (client, "NORMAL:%SAFE_RENEGOTIATION", NULL); gnutls_transport_set_push_function (client, client_push); gnutls_transport_set_pull_function (client, client_pull); diff --git a/tests/safe-renegotiation/srn5.c b/tests/safe-renegotiation/srn5.c index 3da57ada2f..e91dad4dc0 100644 --- a/tests/safe-renegotiation/srn5.c +++ b/tests/safe-renegotiation/srn5.c @@ -297,10 +297,10 @@ main (int argc, char *argv[]) } } while ( - /* Not done: */ - !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) - /* No error: */ - && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); + /* Not done: */ + !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) + /* No error: */ + && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_SUCCESS) exit_code = 1; diff --git a/tests/safe-renegotiation/srn6.c b/tests/safe-renegotiation/srn6.c index f677b835f3..0e7fb1bd4a 100644 --- a/tests/safe-renegotiation/srn6.c +++ b/tests/safe-renegotiation/srn6.c @@ -297,10 +297,10 @@ main (int argc, char *argv[]) } } while ( - /* Not done: */ - !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) - /* No error: */ - && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); + /* Not done: */ + !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) + /* No error: */ + && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_SUCCESS) exit_code = 1; diff --git a/tests/safe-renegotiation/srn7.c b/tests/safe-renegotiation/srn7.c index bd8141f55c..0add9eb00b 100644 --- a/tests/safe-renegotiation/srn7.c +++ b/tests/safe-renegotiation/srn7.c @@ -295,10 +295,10 @@ main (int argc, char *argv[]) } } while ( - /* Not done: */ - !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) - /* No error: */ - && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); + /* Not done: */ + !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS) + /* No error: */ + && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN)); if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_SUCCESS) exit_code = 1; @@ -306,7 +306,8 @@ main (int argc, char *argv[]) if (!gnutls_safe_renegotiation_status (client) || !gnutls_safe_renegotiation_status (server)) { - tls_log_func (0, "Rehandshaked session not using safe renegotiation!\n"); + tls_log_func (0, + "Rehandshaked session not using safe renegotiation!\n"); exit_code = EXIT_FAILURE; } |