From: Simon Josefsson Date: Mon, 6 Dec 2010 15:47:25 +0000 (+0100) Subject: Indent code. X-Git-Tag: gnutls_2_11_5~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c236da00885163f387a0bc62897de7126265d59a;p=thirdparty%2Fgnutls.git Indent code. --- diff --git a/cfg.mk b/cfg.mk index ca040f8d0c..7fea00e2e9 100644 --- a/cfg.mk +++ b/cfg.mk @@ -23,7 +23,7 @@ WFLAGS ?= --enable-gcc-warnings ADDFLAGS ?= CFGFLAGS ?= --enable-gtk-doc --enable-gtk-doc-pdf $(ADDFLAGS) $(WFLAGS) -INDENT_SOURCES = `find . -name \*.[ch] -o -name gnutls.h.in | grep -v -e ^./build-aux/ -e ^./lib/minitasn1/ -e ^./lib/build-aux/ -e ^./lib/gl/ -e ^./gl/ -e ^./libextra/gl/ -e ^./src/cfg/ -e -gaa.[ch] -e asn1_tab.c` +INDENT_SOURCES = `find . -name \*.[ch] -o -name gnutls.h.in | grep -v -e ^./build-aux/ -e ^./lib/minitasn1/ -e ^./lib/build-aux/ -e ^./lib/gl/ -e ^./gl/ -e ^./libextra/gl/ -e ^./src/cfg/ -e -gaa.[ch] -e asn1_tab.c -e ^./tests/suite/` ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile) .DEFAULT_GOAL := bootstrap diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c index 0912a56d33..b79d738e46 100644 --- a/lib/gnutls_priority.c +++ b/lib/gnutls_priority.c @@ -683,66 +683,70 @@ gnutls_priority_init (gnutls_priority_t * priority_cache, else if (strncasecmp (&broken_list[i][1], "VERS-", 5) == 0) { if (strncasecmp (&broken_list[i][1], "VERS-TLS-ALL", 12) == 0) - { - _set_priority (&(*priority_cache)->protocol, protocol_priority); - } - else - { + { + _set_priority (&(*priority_cache)->protocol, + protocol_priority); + } + else + { if ((algo = gnutls_protocol_get_id (&broken_list[i][6])) != GNUTLS_VERSION_UNKNOWN) - fn (&(*priority_cache)->protocol, algo); - else + fn (&(*priority_cache)->protocol, algo); + else goto error; - } + } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], "COMP-", 5) == 0) { if (strncasecmp (&broken_list[i][1], "COMP-ALL", 8) == 0) - { - _set_priority (&(*priority_cache)->compression, comp_priority); - } - else - { - if ((algo = + { + _set_priority (&(*priority_cache)->compression, + comp_priority); + } + else + { + if ((algo = gnutls_compression_get_id (&broken_list[i][6])) != - GNUTLS_COMP_UNKNOWN) - fn (&(*priority_cache)->compression, algo); - else - goto error; - } + GNUTLS_COMP_UNKNOWN) + fn (&(*priority_cache)->compression, algo); + else + goto error; + } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], "CTYPE-", 6) == 0) { if (strncasecmp (&broken_list[i][1], "CTYPE-ALL", 9) == 0) - { - _set_priority (&(*priority_cache)->cert_type, cert_type_priority); - } - else - { - if ((algo = + { + _set_priority (&(*priority_cache)->cert_type, + cert_type_priority); + } + else + { + if ((algo = gnutls_certificate_type_get_id (&broken_list[i][7])) != - GNUTLS_CRT_UNKNOWN) - fn (&(*priority_cache)->cert_type, algo); - else - goto error; - } + GNUTLS_CRT_UNKNOWN) + fn (&(*priority_cache)->cert_type, algo); + else + goto error; + } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], "SIGN-", 5) == 0) { if (strncasecmp (&broken_list[i][1], "SIGN-ALL", 8) == 0) - { - _set_priority (&(*priority_cache)->sign_algo, sign_priority_default); - } - else - { - if ((algo = + { + _set_priority (&(*priority_cache)->sign_algo, + sign_priority_default); + } + else + { + if ((algo = gnutls_sign_get_id (&broken_list[i][6])) != - GNUTLS_SIGN_UNKNOWN) + GNUTLS_SIGN_UNKNOWN) fn (&(*priority_cache)->sign_algo, algo); - else - goto error; - } + else + goto error; + } } /* now check if the element is something like -ALGO */ else goto error; diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index 310e143216..f253b196fa 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -1367,7 +1367,7 @@ gnutls_session_enable_compatibility_mode (gnutls_session_t session) int gnutls_session_channel_binding (gnutls_session_t session, gnutls_channel_binding_t cbtype, - gnutls_datum_t *cb) + gnutls_datum_t * cb) { if (cbtype != GNUTLS_CB_TLS_UNIQUE) return GNUTLS_E_UNIMPLEMENTED_FEATURE; diff --git a/lib/includes/gnutls/compat.h b/lib/includes/gnutls/compat.h index 81e0b925e6..7804214576 100644 --- a/lib/includes/gnutls/compat.h +++ b/lib/includes/gnutls/compat.h @@ -170,19 +170,20 @@ gnutls_sign_callback_set (gnutls_session_t session, gnutls_sign_func gnutls_sign_callback_get (gnutls_session_t session, void **userdata); -int gnutls_ext_register (int type, + int gnutls_ext_register (int type, const char *name, gnutls_ext_parse_type_t parse_type, gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func) -_GNUTLS_GCC_ATTR_DEPRECATED; + _GNUTLS_GCC_ATTR_DEPRECATED; -typedef void (*gnutls_finished_callback_func) (gnutls_session_t session, - const void *finished, - size_t len); -void gnutls_session_set_finished_function (gnutls_session_t session, - gnutls_finished_callback_func func) - _GNUTLS_GCC_ATTR_DEPRECATED; + typedef void (*gnutls_finished_callback_func) (gnutls_session_t session, + const void *finished, + size_t len); + void gnutls_session_set_finished_function (gnutls_session_t session, + gnutls_finished_callback_func + func) + _GNUTLS_GCC_ATTR_DEPRECATED; /* returns security values. * Do not use them unless you know what you're doing. Those are dangerous since @@ -190,13 +191,18 @@ void gnutls_session_set_finished_function (gnutls_session_t session, */ #define GNUTLS_MASTER_SIZE 48 #define GNUTLS_RANDOM_SIZE 32 -const void *gnutls_session_get_server_random (gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED; -const void *gnutls_session_get_client_random (gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED; -const void *gnutls_session_get_master_secret (gnutls_session_t session) _GNUTLS_GCC_ATTR_DEPRECATED; - -int gnutls_psk_netconf_derive_key (const char *password, - const char *psk_identity, - const char *psk_identity_hint, - gnutls_datum_t * output_key) _GNUTLS_GCC_ATTR_DEPRECATED; + const void *gnutls_session_get_server_random (gnutls_session_t session) + _GNUTLS_GCC_ATTR_DEPRECATED; + const void *gnutls_session_get_client_random (gnutls_session_t session) + _GNUTLS_GCC_ATTR_DEPRECATED; + const void *gnutls_session_get_master_secret (gnutls_session_t session) + _GNUTLS_GCC_ATTR_DEPRECATED; + + int gnutls_psk_netconf_derive_key (const char *password, + const char *psk_identity, + const char *psk_identity_hint, + gnutls_datum_t * + output_key) + _GNUTLS_GCC_ATTR_DEPRECATED; #endif /* _GNUTLS_COMPAT_H */ diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index c038c1a2a4..139ac612f7 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -632,9 +632,9 @@ extern "C" * Enumeration of support channel binding types. */ typedef enum - { - GNUTLS_CB_TLS_UNIQUE - } gnutls_channel_binding_t; + { + GNUTLS_CB_TLS_UNIQUE + } gnutls_channel_binding_t; /* If you want to change this, then also change the define in * gnutls_int.h, and recompile. @@ -934,7 +934,7 @@ extern "C" int gnutls_session_channel_binding (gnutls_session_t session, gnutls_channel_binding_t cbtype, - gnutls_datum_t *cb); + gnutls_datum_t * cb); /* checks if this session is a resumed one */ diff --git a/lib/includes/gnutls/pkcs11.h b/lib/includes/gnutls/pkcs11.h index 749d96dc03..9ea9a6e4dc 100644 --- a/lib/includes/gnutls/pkcs11.h +++ b/lib/includes/gnutls/pkcs11.h @@ -22,18 +22,18 @@ typedef int (*gnutls_pkcs11_token_callback_t) (void *const global_data, /* flags */ typedef enum { - GNUTLS_PKCS11_PIN_USER = (1<<0), - GNUTLS_PKCS11_PIN_SO = (1<<1), - GNUTLS_PKCS11_PIN_FINAL_TRY = (1<<2), - GNUTLS_PKCS11_PIN_COUNT_LOW = (1<<3) + GNUTLS_PKCS11_PIN_USER = (1 << 0), + GNUTLS_PKCS11_PIN_SO = (1 << 1), + GNUTLS_PKCS11_PIN_FINAL_TRY = (1 << 2), + GNUTLS_PKCS11_PIN_COUNT_LOW = (1 << 3) } gnutls_pkcs11_pin_flag_t; typedef int (*gnutls_pkcs11_pin_callback_t) (void *userdata, int attempt, const char *token_url, const char *token_label, - unsigned int flags /*gnutls_pkcs11_pin_flag_t*/, - char *pin, - size_t pin_max); + unsigned int flags + /*gnutls_pkcs11_pin_flag_t */ , + char *pin, size_t pin_max); struct gnutls_pkcs11_obj_st; typedef struct gnutls_pkcs11_obj_st *gnutls_pkcs11_obj_t; @@ -88,11 +88,11 @@ int gnutls_pkcs11_copy_x509_privkey (const char *token_url, gnutls_x509_privkey_ int gnutls_pkcs11_delete_url (const char *object_url, unsigned int flags /* GNUTLS_PKCS11_OBJ_FLAG_* */ ); -int gnutls_pkcs11_copy_secret_key (const char *token_url, gnutls_datum_t* key, - const char *label, - unsigned int key_usage /* GNUTLS_KEY_* */, - unsigned int flags - /* GNUTLS_PKCS11_OBJ_FLAG_* */ ); +int gnutls_pkcs11_copy_secret_key (const char *token_url, + gnutls_datum_t * key, const char *label, + unsigned int key_usage /* GNUTLS_KEY_* */ , + unsigned int flags + /* GNUTLS_PKCS11_OBJ_FLAG_* */ ); typedef enum { @@ -144,16 +144,14 @@ typedef enum int gnutls_pkcs11_token_init (const char *token_url, - const char* so_pin, - const char *label); + const char *so_pin, const char *label); int -gnutls_pkcs11_token_get_mechanism (const char *url, int idx, - unsigned long *mechanism); +gnutls_pkcs11_token_get_mechanism (const char *url, int idx, + unsigned long *mechanism); -int -gnutls_pkcs11_token_set_pin (const char *token_url, - const char* oldpin, const char* newpin, unsigned int flags/*gnutls_pkcs11_pin_flag_t*/); +int gnutls_pkcs11_token_set_pin (const char *token_url, const char *oldpin, const char *newpin, unsigned int flags /*gnutls_pkcs11_pin_flag_t */ + ); int gnutls_pkcs11_token_get_url (unsigned int seq, gnutls_pkcs11_url_type_t detailed, @@ -181,9 +179,8 @@ gnutls_pkcs11_obj_type_t gnutls_pkcs11_obj_get_type (gnutls_pkcs11_obj_t certificate); const char *gnutls_pkcs11_type_get_name (gnutls_pkcs11_obj_type_t); -int gnutls_x509_crt_list_import_pkcs11 (gnutls_x509_crt_t * certs, - unsigned int cert_max, gnutls_pkcs11_obj_t * const pkcs11_certs, - unsigned int flags /* must be zero */); +int gnutls_x509_crt_list_import_pkcs11 (gnutls_x509_crt_t * certs, unsigned int cert_max, gnutls_pkcs11_obj_t * const pkcs11_certs, unsigned int flags /* must be zero */ + ); /* private key functions...*/ diff --git a/lib/nettle/rnd.c b/lib/nettle/rnd.c index 6f6aa8ef84..0166cddcaf 100644 --- a/lib/nettle/rnd.c +++ b/lib/nettle/rnd.c @@ -156,7 +156,7 @@ wrap_nettle_rnd_deinit (void *ctx) #include #include #ifdef HAVE_GETRUSAGE -# include +#include #endif #include "egd.h" diff --git a/lib/pkcs11.c b/lib/pkcs11.c index dd7951c523..d04727e045 100644 --- a/lib/pkcs11.c +++ b/lib/pkcs11.c @@ -1090,8 +1090,8 @@ fix_strings (struct token_info *info) } int -pkcs11_find_slot (pakchois_module_t** module, ck_slot_id_t *slot, - struct pkcs11_url_info *info, struct token_info* _tinfo) +pkcs11_find_slot (pakchois_module_t ** module, ck_slot_id_t * slot, + struct pkcs11_url_info *info, struct token_info *_tinfo) { int x, z; @@ -1129,15 +1129,15 @@ pkcs11_find_slot (pakchois_module_t** module, ck_slot_id_t *slot, /* ok found */ *module = providers[x].module; *slot = providers[x].slots[z]; - + if (_tinfo != NULL) - memcpy(_tinfo, &tinfo, sizeof(tinfo)); + memcpy (_tinfo, &tinfo, sizeof (tinfo)); return 0; } } - gnutls_assert(); + gnutls_assert (); return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; } @@ -1152,10 +1152,10 @@ pkcs11_open_session (pakchois_session_t ** _pks, ck_slot_id_t slot; struct token_info tinfo; - ret = pkcs11_find_slot(&module, &slot, info, &tinfo); + ret = pkcs11_find_slot (&module, &slot, info, &tinfo); if (ret < 0) { - gnutls_assert(); + gnutls_assert (); return ret; } @@ -1166,13 +1166,13 @@ pkcs11_open_session (pakchois_session_t ** _pks, CKF_SERIAL_SESSION, NULL, NULL, &pks); if (rv != CKR_OK) { - gnutls_assert(); + gnutls_assert (); return pkcs11_rv_to_err (rv); } if (flags & SESSION_LOGIN) { - ret = pkcs11_login (pks, &tinfo, (flags & SESSION_SO)?1:0); + ret = pkcs11_login (pks, &tinfo, (flags & SESSION_SO) ? 1 : 0); if (ret < 0) { gnutls_assert (); @@ -1234,7 +1234,7 @@ _pkcs11_traverse_tokens (find_func_t find_func, void *input, if (flags & SESSION_LOGIN) { - ret = pkcs11_login (pks, &info, (flags & SESSION_SO)?1:0); + ret = pkcs11_login (pks, &info, (flags & SESSION_SO) ? 1 : 0); if (ret < 0) { gnutls_assert (); @@ -1781,11 +1781,11 @@ cleanup: unsigned int pkcs11_obj_flags_to_int (unsigned int flags) { -unsigned int ret_flags = 0; + unsigned int ret_flags = 0; if (flags & GNUTLS_PKCS11_OBJ_FLAG_LOGIN) - ret_flags |= SESSION_LOGIN; - + ret_flags |= SESSION_LOGIN; + return ret_flags; } @@ -2029,8 +2029,8 @@ struct pkey_list size_t key_ids_size; }; -int pkcs11_login (pakchois_session_t * pks, - const struct token_info *info, int so) +int +pkcs11_login (pakchois_session_t * pks, const struct token_info *info, int so) { int attempt = 0, ret; ck_rv_t rv; @@ -2063,7 +2063,8 @@ int pkcs11_login (pakchois_session_t * pks, * required. */ if (info->tinfo.flags & CKF_PROTECTED_AUTHENTICATION_PATH) { - if (pakchois_login (pks, (so==0)?CKU_USER:CKU_SO, NULL, 0) == CKR_OK) + if (pakchois_login (pks, (so == 0) ? CKU_USER : CKU_SO, NULL, 0) == + CKR_OK) { return 0; } @@ -2108,7 +2109,7 @@ int pkcs11_login (pakchois_session_t * pks, flags = 0; if (so == 0) - { + { flags |= GNUTLS_PKCS11_PIN_USER; if (tinfo.flags & CKF_USER_PIN_COUNT_LOW) flags |= GNUTLS_PKCS11_PIN_COUNT_LOW; @@ -2116,7 +2117,7 @@ int pkcs11_login (pakchois_session_t * pks, flags |= GNUTLS_PKCS11_PIN_FINAL_TRY; } else - { + { flags |= GNUTLS_PKCS11_PIN_SO; if (tinfo.flags & CKF_SO_PIN_COUNT_LOW) flags |= GNUTLS_PKCS11_PIN_COUNT_LOW; @@ -2135,8 +2136,8 @@ int pkcs11_login (pakchois_session_t * pks, } pin_len = strlen (pin); - rv = pakchois_login (pks, (so==0)?CKU_USER:CKU_SO, - (unsigned char *) pin, pin_len); + rv = pakchois_login (pks, (so == 0) ? CKU_USER : CKU_SO, + (unsigned char *) pin, pin_len); /* Try to scrub the pin off the stack. Clever compilers will * probably optimize this away, oh well. */ @@ -2812,8 +2813,8 @@ gnutls_pkcs11_token_get_flags (const char *url, unsigned int *flags) * Returns: zero on success or a negative value on error. **/ int -gnutls_pkcs11_token_get_mechanism (const char *url, int idx, - unsigned long* mechanism) +gnutls_pkcs11_token_get_mechanism (const char *url, int idx, + unsigned long *mechanism) { int ret; ck_rv_t rv; @@ -2832,27 +2833,27 @@ gnutls_pkcs11_token_get_mechanism (const char *url, int idx, } - ret = pkcs11_find_slot(&module, &slot, &info, &tinfo); + ret = pkcs11_find_slot (&module, &slot, &info, &tinfo); if (ret < 0) { - gnutls_assert(); + gnutls_assert (); return ret; } - count = sizeof(mlist)/sizeof(mlist[0]); - rv = pakchois_get_mechanism_list(module, slot, mlist, &count); + count = sizeof (mlist) / sizeof (mlist[0]); + rv = pakchois_get_mechanism_list (module, slot, mlist, &count); if (rv != CKR_OK) { - gnutls_assert(); + gnutls_assert (); return pkcs11_rv_to_err (rv); } if (idx >= count) { - gnutls_assert(); + gnutls_assert (); return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; } - + *mechanism = mlist[idx]; return 0; diff --git a/lib/pkcs11_int.h b/lib/pkcs11_int.h index 11306e0dee..23aeb1ba96 100644 --- a/lib/pkcs11_int.h +++ b/lib/pkcs11_int.h @@ -61,14 +61,14 @@ typedef int (*find_func_t) (pakchois_session_t * pks, int pkcs11_rv_to_err (ck_rv_t rv); int pkcs11_url_to_info (const char *url, struct pkcs11_url_info *info); int -pkcs11_find_slot (pakchois_module_t** module, ck_slot_id_t *slot, - struct pkcs11_url_info *info, struct token_info* _tinfo); +pkcs11_find_slot (pakchois_module_t ** module, ck_slot_id_t * slot, + struct pkcs11_url_info *info, struct token_info *_tinfo); int pkcs11_get_info (struct pkcs11_url_info *info, gnutls_pkcs11_obj_info_t itype, void *output, size_t * output_size); -int pkcs11_login (pakchois_session_t * pks, - const struct token_info *info, int admin); +int pkcs11_login (pakchois_session_t * pks, + const struct token_info *info, int admin); extern gnutls_pkcs11_token_callback_t token_func; extern void *token_data; @@ -79,7 +79,7 @@ int pkcs11_info_to_url (const struct pkcs11_url_info *info, #define SESSION_WRITE (1<<0) #define SESSION_LOGIN (1<<1) -#define SESSION_SO (1<<2) /* security officer session */ +#define SESSION_SO (1<<2) /* security officer session */ int pkcs11_open_session (pakchois_session_t ** _pks, struct pkcs11_url_info *info, unsigned int flags); int _pkcs11_traverse_tokens (find_func_t find_func, void *input, diff --git a/lib/pkcs11_secret.c b/lib/pkcs11_secret.c index 88fe05f51b..eaa09c60c8 100644 --- a/lib/pkcs11_secret.c +++ b/lib/pkcs11_secret.c @@ -44,11 +44,11 @@ * Returns: On success, %GNUTLS_E_SUCCESS is returned, otherwise a * negative error value. **/ -int gnutls_pkcs11_copy_secret_key (const char *token_url, gnutls_datum_t* key, - const char *label, - unsigned int key_usage, - unsigned int flags - /* GNUTLS_PKCS11_OBJ_FLAG_* */ ) +int +gnutls_pkcs11_copy_secret_key (const char *token_url, gnutls_datum_t * key, + const char *label, + unsigned int key_usage, unsigned int flags + /* GNUTLS_PKCS11_OBJ_FLAG_* */ ) { int ret; pakchois_session_t *pks; @@ -70,10 +70,10 @@ int gnutls_pkcs11_copy_secret_key (const char *token_url, gnutls_datum_t* key, } /* generate a unique ID */ - ret = _gnutls_rnd (GNUTLS_RND_NONCE, id, sizeof(id)); + ret = _gnutls_rnd (GNUTLS_RND_NONCE, id, sizeof (id)); if (ret < 0) { - gnutls_assert(); + gnutls_assert (); return ret; } @@ -105,7 +105,7 @@ int gnutls_pkcs11_copy_secret_key (const char *token_url, gnutls_datum_t* key, a[4].value_len = sizeof (keytype); a[5].type = CKA_ID; a[5].value = id; - a[5].value_len = sizeof(id); + a[5].value_len = sizeof (id); a_val = 6; diff --git a/lib/pkcs11_write.c b/lib/pkcs11_write.c index 34fb921ace..b3235bb64d 100644 --- a/lib/pkcs11_write.c +++ b/lib/pkcs11_write.c @@ -593,8 +593,7 @@ gnutls_pkcs11_delete_url (const char *object_url, unsigned int flags) **/ int gnutls_pkcs11_token_init (const char *token_url, - const char* so_pin, - const char *label) + const char *so_pin, const char *label) { int ret; struct pkcs11_url_info info; @@ -610,19 +609,21 @@ gnutls_pkcs11_token_init (const char *token_url, return ret; } - ret = pkcs11_find_slot(&module, &slot, &info, NULL); + ret = pkcs11_find_slot (&module, &slot, &info, NULL); if (ret < 0) { - gnutls_assert(); + gnutls_assert (); return ret; } /* so it seems memset has other uses than zeroing! */ - memset(flabel, ' ', sizeof(flabel)); + memset (flabel, ' ', sizeof (flabel)); if (label != NULL) - memcpy(flabel, label, strlen(label)); + memcpy (flabel, label, strlen (label)); - rv = pakchois_init_token(module, slot, (char*)so_pin, strlen(so_pin), flabel); + rv = + pakchois_init_token (module, slot, (char *) so_pin, strlen (so_pin), + flabel); if (rv != CKR_OK) { gnutls_assert (); @@ -650,9 +651,8 @@ gnutls_pkcs11_token_init (const char *token_url, **/ int gnutls_pkcs11_token_set_pin (const char *token_url, - const char* oldpin, - const char* newpin, - unsigned int flags) + const char *oldpin, + const char *newpin, unsigned int flags) { int ret; pakchois_session_t *pks; @@ -667,22 +667,22 @@ gnutls_pkcs11_token_set_pin (const char *token_url, return ret; } - if (((flags & GNUTLS_PKCS11_PIN_USER) && oldpin == NULL) || - (flags & GNUTLS_PKCS11_PIN_SO)) - ses_flags = SESSION_WRITE|SESSION_LOGIN|SESSION_SO; - else - ses_flags = SESSION_WRITE|SESSION_LOGIN; + if (((flags & GNUTLS_PKCS11_PIN_USER) && oldpin == NULL) || + (flags & GNUTLS_PKCS11_PIN_SO)) + ses_flags = SESSION_WRITE | SESSION_LOGIN | SESSION_SO; + else + ses_flags = SESSION_WRITE | SESSION_LOGIN; ret = pkcs11_open_session (&pks, &info, ses_flags); if (ret < 0) { - gnutls_assert(); + gnutls_assert (); return ret; } if (oldpin == NULL) { - rv = pakchois_init_pin(pks, (char*)newpin, strlen(newpin)); + rv = pakchois_init_pin (pks, (char *) newpin, strlen (newpin)); if (rv != CKR_OK) { gnutls_assert (); @@ -693,9 +693,9 @@ gnutls_pkcs11_token_set_pin (const char *token_url, } else { - rv = pakchois_set_pin(pks, - (char*)oldpin, strlen(oldpin), - (char*)newpin, strlen(newpin)); + rv = pakchois_set_pin (pks, + (char *) oldpin, strlen (oldpin), + (char *) newpin, strlen (newpin)); if (rv != CKR_OK) { gnutls_assert (); diff --git a/lib/x509/verify.c b/lib/x509/verify.c index e7cdc74526..077ccd8a7d 100644 --- a/lib/x509/verify.c +++ b/lib/x509/verify.c @@ -336,7 +336,8 @@ _gnutls_verify_certificate2 (gnutls_x509_crt_t cert, } if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && - ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) || issuer_version != 1)) + ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) + || issuer_version != 1)) { if (check_if_ca (cert, issuer, flags) == 0) { @@ -685,7 +686,7 @@ decode_ber_digest_info (const gnutls_datum_t * info, parameters field is not present, or it contains 0x05 0x00. */ if (!(result == ASN1_ELEMENT_NOT_FOUND || (result == ASN1_SUCCESS && len == ASN1_NULL_SIZE && - memcmp(str, ASN1_NULL, ASN1_NULL_SIZE) == 0))) + memcmp (str, ASN1_NULL, ASN1_NULL_SIZE) == 0))) { gnutls_assert (); asn1_delete_structure (&dinfo); diff --git a/src/certtool-common.c b/src/certtool-common.c index 0c96f47919..34706ff966 100644 --- a/src/certtool-common.c +++ b/src/certtool-common.c @@ -73,10 +73,10 @@ safe_open_rw (const char *file, int privkey_op) } gnutls_datum_t * -load_secret_key (int mand, common_info_st* info) +load_secret_key (int mand, common_info_st * info) { unsigned char raw_key[64]; - size_t raw_key_size = sizeof(raw_key); + size_t raw_key_size = sizeof (raw_key); static gnutls_datum_t key; gnutls_datum_t hex_key; int ret; @@ -91,16 +91,16 @@ load_secret_key (int mand, common_info_st* info) return NULL; } - hex_key.data = (char*)info->secret_key; - hex_key.size = strlen(info->secret_key); - - ret = gnutls_hex_decode( &hex_key, raw_key, &raw_key_size); + hex_key.data = (char *) info->secret_key; + hex_key.size = strlen (info->secret_key); + + ret = gnutls_hex_decode (&hex_key, raw_key, &raw_key_size); if (ret < 0) - error (EXIT_FAILURE, 0, "hex_decode: %s", gnutls_strerror (ret)); + error (EXIT_FAILURE, 0, "hex_decode: %s", gnutls_strerror (ret)); key.data = raw_key; key.size = raw_key_size; - + return &key; } @@ -108,7 +108,7 @@ load_secret_key (int mand, common_info_st* info) * @mand should be non zero if it is required to read a private key. */ gnutls_x509_privkey_t -load_private_key (int mand, common_info_st* info) +load_private_key (int mand, common_info_st * info) { gnutls_x509_privkey_t key; int ret; @@ -162,7 +162,7 @@ load_private_key (int mand, common_info_st* info) * null will be returned if the certificate loading fails. */ gnutls_x509_crt_t -load_cert (int mand, common_info_st* info) +load_cert (int mand, common_info_st * info) { gnutls_x509_crt_t *crt; size_t size; @@ -177,7 +177,7 @@ load_cert (int mand, common_info_st* info) /* Loads a certificate list */ gnutls_x509_crt_t * -load_cert_list (int mand, size_t * crt_size, common_info_st* info) +load_cert_list (int mand, size_t * crt_size, common_info_st * info) { FILE *fd; static gnutls_x509_crt_t crt[MAX_CERTS]; @@ -247,7 +247,7 @@ load_cert_list (int mand, size_t * crt_size, common_info_st* info) /* Load the Certificate Request. */ gnutls_x509_crq_t -load_request (common_info_st* info) +load_request (common_info_st * info) { gnutls_x509_crq_t crq; int ret; @@ -285,7 +285,7 @@ load_request (common_info_st* info) /* Load the CA's private key. */ gnutls_x509_privkey_t -load_ca_private_key (common_info_st* info) +load_ca_private_key (common_info_st * info) { gnutls_x509_privkey_t key; int ret; @@ -326,7 +326,7 @@ load_ca_private_key (common_info_st* info) /* Loads the CA's certificate */ gnutls_x509_crt_t -load_ca_cert (common_info_st* info) +load_ca_cert (common_info_st * info) { gnutls_x509_crt_t crt; int ret; @@ -344,7 +344,8 @@ load_ca_cert (common_info_st* info) dat.size = size; if (!dat.data) - error (EXIT_FAILURE, errno, "reading --load-ca-certificate: %s", info->ca); + error (EXIT_FAILURE, errno, "reading --load-ca-certificate: %s", + info->ca); ret = gnutls_x509_crt_import (crt, &dat, info->incert_format); free (dat.data); @@ -359,7 +360,7 @@ load_ca_cert (common_info_st* info) * @mand should be non zero if it is required to read a public key. */ gnutls_pubkey_t -load_pubkey (int mand, common_info_st* info) +load_pubkey (int mand, common_info_st * info) { gnutls_pubkey_t key; int ret; diff --git a/src/certtool-common.h b/src/certtool-common.h index 4d384df956..ec75ad2d10 100644 --- a/src/certtool-common.h +++ b/src/certtool-common.h @@ -1,5 +1,5 @@ #ifndef CERTTOOL_COMMON_H -# define CERTTOOL_COMMON_H +#define CERTTOOL_COMMON_H #include #include @@ -41,27 +41,29 @@ void certtool_version (void); #include #include -typedef struct common_info { - const char* secret_key; - const char* privkey; - const char* pubkey; +typedef struct common_info +{ + const char *secret_key; + const char *privkey; + const char *pubkey; int pkcs8; int incert_format; - const char* cert; - - const char* request; - const char* ca; - const char* ca_privkey; + const char *cert; + + const char *request; + const char *ca; + const char *ca_privkey; } common_info_st; -gnutls_x509_privkey_t load_private_key (int mand, common_info_st* info); -gnutls_x509_crq_t load_request (common_info_st* info); -gnutls_x509_privkey_t load_ca_private_key (common_info_st* info); -gnutls_x509_crt_t load_ca_cert (common_info_st* info); -gnutls_x509_crt_t load_cert (int mand, common_info_st* info); -gnutls_datum* load_secret_key (int mand, common_info_st* info); -gnutls_pubkey_t load_pubkey (int mand, common_info_st* info); -gnutls_x509_crt_t *load_cert_list (int mand, size_t * size, common_info_st* info); +gnutls_x509_privkey_t load_private_key (int mand, common_info_st * info); +gnutls_x509_crq_t load_request (common_info_st * info); +gnutls_x509_privkey_t load_ca_private_key (common_info_st * info); +gnutls_x509_crt_t load_ca_cert (common_info_st * info); +gnutls_x509_crt_t load_cert (int mand, common_info_st * info); +gnutls_datum *load_secret_key (int mand, common_info_st * info); +gnutls_pubkey_t load_pubkey (int mand, common_info_st * info); +gnutls_x509_crt_t *load_cert_list (int mand, size_t * size, + common_info_st * info); /* returns the bits specified in cmd */ int get_bits (gnutls_pk_algorithm_t); @@ -69,7 +71,7 @@ int get_bits (gnutls_pk_algorithm_t); /* prime.c */ int generate_prime (int how); -FILE * safe_open_rw (const char *file, int privkey_op); +FILE *safe_open_rw (const char *file, int privkey_op); extern unsigned char buffer[]; extern const int buffer_size; diff --git a/src/certtool.c b/src/certtool.c index 6b3067f182..681a77ba55 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -56,20 +56,20 @@ void pkcs7_info (void); void crq_info (void); void smime_to_pkcs7 (void); void pkcs12_info (void); -void generate_pkcs12 (common_info_st*); -void generate_pkcs8 (common_info_st*); +void generate_pkcs12 (common_info_st *); +void generate_pkcs8 (common_info_st *); void verify_chain (void); -void verify_crl (common_info_st* cinfo); -void pubkey_info (gnutls_x509_crt crt, common_info_st*); +void verify_crl (common_info_st * cinfo); +void pubkey_info (gnutls_x509_crt crt, common_info_st *); void pgp_privkey_info (void); void pgp_ring_info (void); -void certificate_info (int, common_info_st*); +void certificate_info (int, common_info_st *); void pgp_certificate_info (void); void crl_info (void); void privkey_info (void); static void gaa_parser (int argc, char **argv); -void generate_self_signed (common_info_st*); -void generate_request (common_info_st* ); +void generate_self_signed (common_info_st *); +void generate_request (common_info_st *); static void print_certificate_info (gnutls_x509_crt_t crt, FILE * out, unsigned int all); @@ -359,7 +359,8 @@ generate_private_key (void) static gnutls_x509_crt_t generate_certificate (gnutls_x509_privkey_t * ret_key, - gnutls_x509_crt_t ca_crt, int proxy, common_info_st* cinfo) + gnutls_x509_crt_t ca_crt, int proxy, + common_info_st * cinfo) { gnutls_x509_crt_t crt; gnutls_x509_privkey_t key = NULL; @@ -685,7 +686,7 @@ generate_certificate (gnutls_x509_privkey_t * ret_key, } static gnutls_x509_crl_t -generate_crl (gnutls_x509_crt_t ca_crt, common_info_st* cinfo) +generate_crl (gnutls_x509_crt_t ca_crt, common_info_st * cinfo) { gnutls_x509_crl_t crl; gnutls_x509_crt_t *crts; @@ -783,7 +784,7 @@ get_dig (gnutls_x509_crt crt) } void -generate_self_signed (common_info_st* cinfo) +generate_self_signed (common_info_st * cinfo) { gnutls_x509_crt_t crt; gnutls_x509_privkey_t key; @@ -829,7 +830,7 @@ generate_self_signed (common_info_st* cinfo) } static void -generate_signed_certificate (common_info_st* cinfo) +generate_signed_certificate (common_info_st * cinfo) { gnutls_x509_crt_t crt; gnutls_x509_privkey_t key; @@ -871,7 +872,7 @@ generate_signed_certificate (common_info_st* cinfo) } static void -generate_proxy_certificate (common_info_st* cinfo) +generate_proxy_certificate (common_info_st * cinfo) { gnutls_x509_crt_t crt, eecrt; gnutls_x509_privkey_t key, eekey; @@ -905,7 +906,7 @@ generate_proxy_certificate (common_info_st* cinfo) } static void -generate_signed_crl (common_info_st* cinfo) +generate_signed_crl (common_info_st * cinfo) { gnutls_x509_crl_t crl; int result; @@ -930,7 +931,7 @@ generate_signed_crl (common_info_st* cinfo) } static void -update_signed_certificate (common_info_st* cinfo) +update_signed_certificate (common_info_st * cinfo) { gnutls_x509_crt_t crt; size_t size; @@ -1056,7 +1057,7 @@ gaa_parser (int argc, char **argv) if ((ret = gnutls_global_init_extra ()) < 0) error (EXIT_FAILURE, 0, "global_init_extra: %s", gnutls_strerror (ret)); - memset(&cinfo, 0, sizeof(cinfo)); + memset (&cinfo, 0, sizeof (cinfo)); cinfo.privkey = info.privkey; cinfo.pubkey = info.pubkey; cinfo.pkcs8 = info.pkcs8; @@ -1157,7 +1158,7 @@ gaa_parser (int argc, char **argv) #define MAX_CRTS 500 void -certificate_info (int pubkey, common_info_st* cinfo) +certificate_info (int pubkey, common_info_st * cinfo) { gnutls_x509_crt_t crt[MAX_CRTS]; size_t size; @@ -1734,7 +1735,7 @@ privkey_info (void) /* Generate a PKCS #10 certificate request. */ void -generate_request (common_info_st* cinfo) +generate_request (common_info_st * cinfo) { gnutls_x509_crq_t crq; gnutls_x509_privkey_t key; @@ -2235,7 +2236,7 @@ verify_chain (void) } void -verify_crl (common_info_st* cinfo) +verify_crl (common_info_st * cinfo) { size_t size, dn_size; char dn[128]; @@ -2328,7 +2329,7 @@ verify_crl (common_info_st* cinfo) void -generate_pkcs8 (common_info_st* cinfo) +generate_pkcs8 (common_info_st * cinfo) { gnutls_x509_privkey_t key; int result; @@ -2372,7 +2373,7 @@ generate_pkcs8 (common_info_st* cinfo) #include void -generate_pkcs12 (common_info_st* cinfo) +generate_pkcs12 (common_info_st * cinfo) { gnutls_pkcs12_t pkcs12; gnutls_x509_crt_t *crts; @@ -2879,7 +2880,7 @@ print_key_usage (FILE * outfile, unsigned int usage) } void -pubkey_info (gnutls_x509_crt crt, common_info_st* cinfo) +pubkey_info (gnutls_x509_crt crt, common_info_st * cinfo) { gnutls_pubkey_t pubkey; unsigned int bits, usage; diff --git a/src/cli.c b/src/cli.c index 8aea0695d5..54ff65ac4f 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1137,7 +1137,7 @@ static int psk_callback (gnutls_session_t session, char **username, gnutls_datum_t * key) { const char *hint = gnutls_psk_client_get_hint (session); - unsigned char* rawkey; + unsigned char *rawkey; char *passwd; int ret; size_t res_size; @@ -1186,14 +1186,14 @@ psk_callback (gnutls_session_t session, char **username, gnutls_datum_t * key) } tmp.data = passwd; - tmp.size = strlen(passwd); - - res_size = tmp.size/2+1; - rawkey = gnutls_malloc(res_size); + tmp.size = strlen (passwd); + + res_size = tmp.size / 2 + 1; + rawkey = gnutls_malloc (res_size); if (rawkey == NULL) return GNUTLS_E_MEMORY_ERROR; - ret = gnutls_hex_decode(&tmp, rawkey, &res_size); + ret = gnutls_hex_decode (&tmp, rawkey, &res_size); if (ret < 0) { fprintf (stderr, "Error deriving password: %s\n", @@ -1201,7 +1201,7 @@ psk_callback (gnutls_session_t session, char **username, gnutls_datum_t * key) gnutls_free (*username); return ret; } - + key->data = rawkey; key->size = res_size; diff --git a/src/common.c b/src/common.c index 661c770c75..cbd40e2d9c 100644 --- a/src/common.c +++ b/src/common.c @@ -493,7 +493,8 @@ print_info (gnutls_session_t session, const char *hostname, int insecure) gnutls_datum cb; int rc; - rc = gnutls_session_channel_binding (session, GNUTLS_CB_TLS_UNIQUE, &cb); + rc = + gnutls_session_channel_binding (session, GNUTLS_CB_TLS_UNIQUE, &cb); if (rc) fprintf (stderr, "Channel binding error: %s\n", gnutls_strerror (rc)); else diff --git a/src/p11tool.c b/src/p11tool.c index 2cd7a4b23d..cca778118c 100644 --- a/src/p11tool.c +++ b/src/p11tool.c @@ -125,7 +125,7 @@ gaa_parser (int argc, char **argv) else outfile = stdout; - memset(&cinfo, 0, sizeof(cinfo)); + memset (&cinfo, 0, sizeof (cinfo)); cinfo.secret_key = info.secret_key; cinfo.privkey = info.privkey; cinfo.pkcs8 = info.pkcs8; @@ -142,7 +142,8 @@ gaa_parser (int argc, char **argv) pkcs11_token_list (outfile, info.pkcs11_detailed_url, &cinfo); break; case ACTION_PKCS11_MECHANISMS: - pkcs11_mechanism_list (outfile, info.pkcs11_url, info.pkcs11_login, &cinfo); + pkcs11_mechanism_list (outfile, info.pkcs11_url, info.pkcs11_login, + &cinfo); break; case ACTION_PKCS11_EXPORT_URL: pkcs11_export (outfile, info.pkcs11_url, info.pkcs11_login, &cinfo); diff --git a/src/p11tool.h b/src/p11tool.h index 9a6909809a..dc034a6984 100644 --- a/src/p11tool.h +++ b/src/p11tool.h @@ -1,19 +1,23 @@ #ifndef P11TOOL_H -# define P11TOOL_H +#define P11TOOL_H #include "certtool-common.h" void pkcs11_list (FILE * outfile, const char *url, int type, - unsigned int login, unsigned int detailed, common_info_st*); -void pkcs11_mechanism_list (FILE * outfile, const char *url, unsigned int login, common_info_st*); + unsigned int login, unsigned int detailed, + common_info_st *); +void pkcs11_mechanism_list (FILE * outfile, const char *url, + unsigned int login, common_info_st *); void pkcs11_export (FILE * outfile, const char *pkcs11_url, - unsigned int login, common_info_st*); -void pkcs11_token_list (FILE * outfile, unsigned int detailed, common_info_st*); + unsigned int login, common_info_st *); +void pkcs11_token_list (FILE * outfile, unsigned int detailed, + common_info_st *); void pkcs11_write (FILE * outfile, const char *pkcs11_url, const char *label, - int trusted, unsigned int login, common_info_st*); + int trusted, unsigned int login, common_info_st *); void pkcs11_delete (FILE * outfile, const char *pkcs11_url, int batch, - unsigned int login, common_info_st*); -void pkcs11_init (FILE * outfile, const char *pkcs11_url, const char* label, common_info_st*); + unsigned int login, common_info_st *); +void pkcs11_init (FILE * outfile, const char *pkcs11_url, const char *label, + common_info_st *); #define PKCS11_TYPE_CRT_ALL 1 #define PKCS11_TYPE_TRUSTED 2 diff --git a/src/pkcs11.c b/src/pkcs11.c index 1ac05031af..87fd113164 100644 --- a/src/pkcs11.c +++ b/src/pkcs11.c @@ -88,7 +88,8 @@ pkcs11_common (void) } void -pkcs11_delete (FILE * outfile, const char *url, int batch, unsigned int login, common_info_st* info) +pkcs11_delete (FILE * outfile, const char *url, int batch, unsigned int login, + common_info_st * info) { int ret; unsigned int obj_flags = 0; @@ -125,7 +126,7 @@ pkcs11_delete (FILE * outfile, const char *url, int batch, unsigned int login, c */ void pkcs11_list (FILE * outfile, const char *url, int type, unsigned int login, - unsigned int detailed, common_info_st* info) + unsigned int detailed, common_info_st * info) { gnutls_pkcs11_obj_t *crt_list; gnutls_x509_crt_t xcrt; @@ -297,7 +298,8 @@ pkcs11_list (FILE * outfile, const char *url, int type, unsigned int login, } void -pkcs11_export (FILE * outfile, const char *url, unsigned int login, common_info_st* info) +pkcs11_export (FILE * outfile, const char *url, unsigned int login, + common_info_st * info) { gnutls_pkcs11_obj_t crt; gnutls_x509_crt_t xcrt; @@ -428,7 +430,8 @@ pkcs11_export (FILE * outfile, const char *url, unsigned int login, common_info_ } void -pkcs11_token_list (FILE * outfile, unsigned int detailed, common_info_st* info) +pkcs11_token_list (FILE * outfile, unsigned int detailed, + common_info_st * info) { int ret; int i; @@ -515,14 +518,14 @@ pkcs11_token_list (FILE * outfile, unsigned int detailed, common_info_st* info) void pkcs11_write (FILE * outfile, const char *url, const char *label, int trusted, - unsigned int login, common_info_st* info) + unsigned int login, common_info_st * info) { gnutls_x509_crt_t xcrt; gnutls_x509_privkey_t xkey; int ret; unsigned int flags = 0; unsigned int key_usage = 0; - gnutls_datum_t* secret_key; + gnutls_datum_t *secret_key; if (login) flags = GNUTLS_PKCS11_OBJ_FLAG_LOGIN; @@ -532,13 +535,13 @@ pkcs11_write (FILE * outfile, const char *url, const char *label, int trusted, if (url == NULL) url = "pkcs11:"; - secret_key = load_secret_key(0, info); + secret_key = load_secret_key (0, info); if (secret_key != NULL) { ret = gnutls_pkcs11_copy_secret_key (url, secret_key, label, key_usage, - flags | - GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE); + flags | + GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE); if (ret < 0) { fprintf (stderr, "Error in %s:%d: %s\n", __func__, __LINE__, @@ -589,52 +592,51 @@ pkcs11_write (FILE * outfile, const char *url, const char *label, int trusted, } void -pkcs11_init (FILE * outfile, const char *url, const char *label, common_info_st* info) +pkcs11_init (FILE * outfile, const char *url, const char *label, + common_info_st * info) { int ret; - char * pin; + char *pin; char so_pin[32]; pkcs11_common (); if (url == NULL) { - fprintf(stderr, "No token URL given to initialize!\n"); - exit(1); + fprintf (stderr, "No token URL given to initialize!\n"); + exit (1); } pin = getpass ("Enter Security Officer's PIN: "); if (pin == NULL) - exit(0); - - strcpy(so_pin, pin); + exit (0); + + strcpy (so_pin, pin); pin = getpass ("Enter new User's PIN: "); if (pin == NULL) - exit(0); - - ret = - gnutls_pkcs11_token_init (url, so_pin, label); + exit (0); + + ret = gnutls_pkcs11_token_init (url, so_pin, label); if (ret < 0) { fprintf (stderr, "Error in %s:%d: %s\n", __func__, __LINE__, - gnutls_strerror (ret)); + gnutls_strerror (ret)); exit (1); } - ret = - gnutls_pkcs11_token_set_pin (url, NULL, pin, GNUTLS_PKCS11_PIN_USER); + ret = gnutls_pkcs11_token_set_pin (url, NULL, pin, GNUTLS_PKCS11_PIN_USER); if (ret < 0) { fprintf (stderr, "Error in %s:%d: %s\n", __func__, __LINE__, - gnutls_strerror (ret)); + gnutls_strerror (ret)); exit (1); } return; } -const char* mech_list[] = { +const char *mech_list[] = { [0] = "CKM_RSA_PKCS_KEY_PAIR_GEN", [1] = "CKM_RSA_PKCS", [2] = "CKM_RSA_9796", @@ -842,13 +844,13 @@ const char* mech_list[] = { void pkcs11_mechanism_list (FILE * outfile, const char *url, unsigned int login, - common_info_st* info) + common_info_st * info) { int ret; int idx; unsigned int obj_flags = 0; unsigned long mechanism; - const char* str; + const char *str; if (login) obj_flags = GNUTLS_PKCS11_OBJ_FLAG_LOGIN; @@ -857,21 +859,23 @@ pkcs11_mechanism_list (FILE * outfile, const char *url, unsigned int login, if (url == NULL) url = "pkcs11:"; - + idx = 0; - do + do { - ret = gnutls_pkcs11_token_get_mechanism(url, idx++, &mechanism); + ret = gnutls_pkcs11_token_get_mechanism (url, idx++, &mechanism); if (ret >= 0) - { - str = NULL; - if (mechanism <= sizeof(mech_list)/sizeof(mech_list[0])) - str = mech_list[mechanism]; - if (str == NULL) str = "UNKNOWN"; - - fprintf(outfile, "[0x%.4lx] %s\n", mechanism, str); - } - } while(ret >= 0); + { + str = NULL; + if (mechanism <= sizeof (mech_list) / sizeof (mech_list[0])) + str = mech_list[mechanism]; + if (str == NULL) + str = "UNKNOWN"; + + fprintf (outfile, "[0x%.4lx] %s\n", mechanism, str); + } + } + while (ret >= 0); return; diff --git a/src/serv.c b/src/serv.c index 1d45c96221..7834139d6d 100644 --- a/src/serv.c +++ b/src/serv.c @@ -488,8 +488,8 @@ peer_print_info (gnutls_session_t session, int *ret_length, snprintf (tmp2, "%.2X", sesid[i]); snprintf (tmp2, "

\n"); snprintf (tmp2, - "
If your browser supports session resuming, then you should see the " - "same session ID, when you press the reload button.
\n"); + "
If your browser supports session resuming, then you should see the " + "same session ID, when you press the reload button.
\n"); /* Here unlike print_info() we use the kx algorithm to distinguish * the functions to call. @@ -513,7 +513,7 @@ peer_print_info (gnutls_session_t session, int *ret_length, if (kx_alg == GNUTLS_KX_SRP) { snprintf (tmp2, "

Connected as user '%s'.

\n", - gnutls_srp_server_get_username (session)); + gnutls_srp_server_get_username (session)); } #endif @@ -521,7 +521,7 @@ peer_print_info (gnutls_session_t session, int *ret_length, if (kx_alg == GNUTLS_KX_PSK) { snprintf (tmp2, "

Connected as user '%s'.

\n", - gnutls_psk_server_get_username (session)); + gnutls_psk_server_get_username (session)); } #endif @@ -529,16 +529,16 @@ peer_print_info (gnutls_session_t session, int *ret_length, if (kx_alg == GNUTLS_KX_ANON_DH) { snprintf (tmp2, - "

Connect using anonymous DH (prime of %d bits)

\n", - gnutls_dh_get_prime_bits (session)); + "

Connect using anonymous DH (prime of %d bits)

\n", + gnutls_dh_get_prime_bits (session)); } #endif if (kx_alg == GNUTLS_KX_DHE_RSA || kx_alg == GNUTLS_KX_DHE_DSS) { snprintf (tmp2, - "Ephemeral DH using prime of %d bits.
\n", - gnutls_dh_get_prime_bits (session)); + "Ephemeral DH using prime of %d bits.
\n", + gnutls_dh_get_prime_bits (session)); } /* print session information */ @@ -548,8 +548,8 @@ peer_print_info (gnutls_session_t session, int *ret_length, if (tmp == NULL) tmp = str_unknown; snprintf (tmp2, - "\n", - tmp); + "
Protocol version:%s
\n", + tmp); if (gnutls_auth_get_type (session) == GNUTLS_CRD_CERTIFICATE) { @@ -558,7 +558,8 @@ peer_print_info (gnutls_session_t session, int *ret_length, (session)); if (tmp == NULL) tmp = str_unknown; - snprintf (tmp2, "\n", tmp); + snprintf (tmp2, "\n", + tmp); } tmp = gnutls_kx_get_name (kx_alg); @@ -587,15 +588,16 @@ peer_print_info (gnutls_session_t session, int *ret_length, if (tmp == NULL) tmp = str_unknown; snprintf (tmp2, "

Protocol version:%s
Certificate Type:%s
Certificate Type:%s
Ciphersuite%s
\n", - tmp); + tmp); if (crtinfo) { - snprintf(tmp2, "
%s\n
\n", crtinfo); + snprintf (tmp2, "
%s\n
\n", crtinfo); free (crtinfo); } - snprintf(tmp2, "

Your HTTP header was:

%s

\n" HTTP_END, header); + snprintf (tmp2, "

Your HTTP header was:

%s

\n" HTTP_END, + header); *ret_length = strlen (http_buffer); diff --git a/tests/chainverify.c b/tests/chainverify.c index f0f21a154b..eb2e761650 100644 --- a/tests/chainverify.c +++ b/tests/chainverify.c @@ -850,12 +850,12 @@ doit (void) verify_status, chains[i].expected_verify_result); #if 0 - j=0; - do - { - fprintf(stderr, "%s\n", chains[i].chain[j]); - } - while(chains[i].chain[++j] != NULL); + j = 0; + do + { + fprintf (stderr, "%s\n", chains[i].chain[j]); + } + while (chains[i].chain[++j] != NULL); #endif if (!debug) diff --git a/tests/openpgp-auth.c b/tests/openpgp-auth.c index 7230a9aa39..d348f5bb84 100644 --- a/tests/openpgp-auth.c +++ b/tests/openpgp-auth.c @@ -222,7 +222,8 @@ doit () if (err) fail ("server DH params init %d\n", err); - err = gnutls_dh_params_import_pkcs3 (dh_params, &p3, GNUTLS_X509_FMT_PEM); + err = + gnutls_dh_params_import_pkcs3 (dh_params, &p3, GNUTLS_X509_FMT_PEM); if (err) fail ("server DH params generate %d\n", err);