diff options
-rw-r--r-- | lib/ext/session_ticket.c | 1 | ||||
-rw-r--r-- | lib/gnutls_dtls.h | 24 | ||||
-rw-r--r-- | lib/gnutls_privkey.c | 56 | ||||
-rw-r--r-- | lib/openpgp/output.c | 1 | ||||
-rw-r--r-- | lib/random.c | 2 | ||||
-rw-r--r-- | lib/system.c | 4 | ||||
-rw-r--r-- | lib/x509/ocsp_output.c | 12 | ||||
-rw-r--r-- | lib/x509/pkcs12.c | 10 | ||||
-rw-r--r-- | src/certtool.c | 8 | ||||
-rw-r--r-- | src/cli.c | 24 |
10 files changed, 68 insertions, 74 deletions
diff --git a/lib/ext/session_ticket.c b/lib/ext/session_ticket.c index 62c8bcdf55..33ad8d9aa3 100644 --- a/lib/ext/session_ticket.c +++ b/lib/ext/session_ticket.c @@ -257,7 +257,6 @@ session_ticket_recv_params(gnutls_session_t session, if (session->security_parameters.entity == GNUTLS_SERVER) { struct ticket_st ticket; const uint8_t *encrypted_state; - int ret; /* The client requested a new session ticket. */ if (data_size == 0) { diff --git a/lib/gnutls_dtls.h b/lib/gnutls_dtls.h index 1f4ca848bb..fb3d313840 100644 --- a/lib/gnutls_dtls.h +++ b/lib/gnutls_dtls.h @@ -37,24 +37,24 @@ void _dtls_reset_hsk_state(gnutls_session_t session); #define RETURN_DTLS_EAGAIN_OR_TIMEOUT(session, r) { \ - struct timespec now; \ - unsigned int diff; \ - gettime(&now); \ + struct timespec _now; \ + unsigned int _diff; \ + gettime(&_now); \ \ - diff = timespec_sub_ms(&now, &session->internals.dtls.handshake_start_time); \ - if (diff > session->internals.dtls.total_timeout_ms) \ + _diff = timespec_sub_ms(&_now, &session->internals.dtls.handshake_start_time); \ + if (_diff > session->internals.dtls.total_timeout_ms) \ { \ - _gnutls_dtls_log("Session timeout: %u ms\n", diff); \ + _gnutls_dtls_log("Session timeout: %u ms\n", _diff); \ return gnutls_assert_val(GNUTLS_E_TIMEDOUT); \ } \ else \ { \ - int rr; \ - if (r != GNUTLS_E_INTERRUPTED) rr = GNUTLS_E_AGAIN; \ - else rr = r; \ + int _rr; \ + if (r != GNUTLS_E_INTERRUPTED) _rr = GNUTLS_E_AGAIN; \ + else _rr = r; \ if (session->internals.dtls.blocking != 0) \ millisleep(50); \ - return gnutls_assert_val(rr); \ + return gnutls_assert_val(_rr); \ } \ } @@ -101,10 +101,10 @@ inline static void _dtls_async_timer_check(gnutls_session_t session) return; if (session->internals.dtls.async_term != 0) { - time_t now = time(0); + time_t _now = time(0); /* check if we need to expire the queued handshake data */ - if (now > session->internals.dtls.async_term) { + if (_now > session->internals.dtls.async_term) { _dtls_async_timer_delete(session); } } diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c index 37909db5d2..2fb4b42ad9 100644 --- a/lib/gnutls_privkey.c +++ b/lib/gnutls_privkey.c @@ -498,9 +498,9 @@ gnutls_privkey_import_ext(gnutls_privkey_t pkey, * @pkey: The private key * @pk: The public key algorithm * @userdata: private data to be provided to the callbacks - * @sign_func: callback for signature operations - * @decrypt_func: callback for decryption operations - * @deinit_func: a deinitialization function + * @sign_fn: callback for signature operations + * @decrypt_fn: callback for decryption operations + * @deinit_fn: a deinitialization function * @flags: Flags for the import * * This function will associate the given callbacks with the @@ -524,9 +524,9 @@ int gnutls_privkey_import_ext2(gnutls_privkey_t pkey, gnutls_pk_algorithm_t pk, void *userdata, - gnutls_privkey_sign_func sign_func, - gnutls_privkey_decrypt_func decrypt_func, - gnutls_privkey_deinit_func deinit_func, + gnutls_privkey_sign_func sign_fn, + gnutls_privkey_decrypt_func decrypt_fn, + gnutls_privkey_deinit_func deinit_fn, unsigned int flags) { int ret; @@ -537,19 +537,19 @@ gnutls_privkey_import_ext2(gnutls_privkey_t pkey, return ret; } - if (sign_func == NULL && decrypt_func == NULL) + if (sign_fn == NULL && decrypt_fn == NULL) return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); - pkey->key.ext.sign_func = sign_func; - pkey->key.ext.decrypt_func = decrypt_func; - pkey->key.ext.deinit_func = deinit_func; + pkey->key.ext.sign_func = sign_fn; + pkey->key.ext.decrypt_func = decrypt_fn; + pkey->key.ext.deinit_func = deinit_fn; pkey->key.ext.userdata = userdata; pkey->type = GNUTLS_PRIVKEY_EXT; pkey->pk_algorithm = pk; pkey->flags = flags; /* Ensure gnutls_privkey_deinit() calls the deinit_func */ - if (deinit_func) + if (deinit_fn) pkey->flags |= GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE; return 0; @@ -560,11 +560,11 @@ gnutls_privkey_import_ext2(gnutls_privkey_t pkey, * @pkey: The private key * @pk: The public key algorithm, when @pk_func isn't provided * @userdata: private data to be provided to the callbacks - * @sign_func: callback for signature operations - * @decrypt_func: callback for decryption operations - * @deinit_func: a deinitialization function - * @pk_func: returns the public key algorithm (may be %NULL; if set @pk will be ignored) - * @copy_func: copies a context + * @sign_fn: callback for signature operations + * @decrypt_fn: callback for decryption operations + * @deinit_fn: a deinitialization function + * @pk_fn: returns the public key algorithm (may be %NULL; if set @pk will be ignored) + * @copy_fn: copies a context * @flags: Flags for the import * * This function will associate the given callbacks with the @@ -586,11 +586,11 @@ int gnutls_privkey_import_ext3(gnutls_privkey_t pkey, gnutls_pk_algorithm_t pk, void *userdata, - gnutls_privkey_sign_func sign_func, - gnutls_privkey_decrypt_func decrypt_func, - gnutls_privkey_deinit_func deinit_func, - gnutls_privkey_pk_func pk_func, - gnutls_privkey_copy_func copy_func, + gnutls_privkey_sign_func sign_fn, + gnutls_privkey_decrypt_func decrypt_fn, + gnutls_privkey_deinit_func deinit_fn, + gnutls_privkey_pk_func pk_fn, + gnutls_privkey_copy_func copy_fn, unsigned int flags) { int ret; @@ -601,21 +601,21 @@ gnutls_privkey_import_ext3(gnutls_privkey_t pkey, return ret; } - if (sign_func == NULL && decrypt_func == NULL) + if (sign_fn == NULL && decrypt_fn == NULL) return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); - pkey->key.ext.sign_func = sign_func; - pkey->key.ext.decrypt_func = decrypt_func; - pkey->key.ext.deinit_func = deinit_func; - pkey->key.ext.pk_func = pk_func; - pkey->key.ext.copy_func = copy_func; + pkey->key.ext.sign_func = sign_fn; + pkey->key.ext.decrypt_func = decrypt_fn; + pkey->key.ext.deinit_func = deinit_fn; + pkey->key.ext.pk_func = pk_fn; + pkey->key.ext.copy_func = copy_fn; pkey->key.ext.userdata = userdata; pkey->type = GNUTLS_PRIVKEY_EXT; pkey->pk_algorithm = pk; pkey->flags = flags; /* Ensure gnutls_privkey_deinit() calls the deinit_func */ - if (deinit_func) + if (deinit_fn) pkey->flags |= GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE; return 0; diff --git a/lib/openpgp/output.c b/lib/openpgp/output.c index e7c02769f6..a574670c47 100644 --- a/lib/openpgp/output.c +++ b/lib/openpgp/output.c @@ -461,7 +461,6 @@ print_oneline(gnutls_buffer_st * str, gnutls_openpgp_crt_t cert) { char fpr[128]; size_t fpr_size = sizeof(fpr); - int err; err = gnutls_openpgp_crt_get_fingerprint(cert, fpr, diff --git a/lib/random.c b/lib/random.c index 42d5c82646..bb71ba6cba 100644 --- a/lib/random.c +++ b/lib/random.c @@ -94,7 +94,7 @@ int gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len) * * Since: 3.1.7 **/ -void gnutls_rnd_refresh() +void gnutls_rnd_refresh(void) { _gnutls_rnd_refresh(); } diff --git a/lib/system.c b/lib/system.c index 0868298c8a..e9a40b1858 100644 --- a/lib/system.c +++ b/lib/system.c @@ -277,7 +277,7 @@ mutex_deinit_func gnutls_mutex_deinit = gnutls_system_mutex_deinit; mutex_lock_func gnutls_mutex_lock = gnutls_system_mutex_lock; mutex_unlock_func gnutls_mutex_unlock = gnutls_system_mutex_unlock; -int gnutls_system_global_init() +int gnutls_system_global_init(void) { #ifdef _WIN32 #if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20 @@ -301,7 +301,7 @@ int gnutls_system_global_init() return 0; } -void gnutls_system_global_deinit() +void gnutls_system_global_deinit(void) { #ifdef _WIN32 #if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20 diff --git a/lib/x509/ocsp_output.c b/lib/x509/ocsp_output.c index 20fe7de70d..6ec726b193 100644 --- a/lib/x509/ocsp_output.c +++ b/lib/x509/ocsp_output.c @@ -114,17 +114,17 @@ static void print_req(gnutls_buffer_st * str, gnutls_ocsp_req_t req) if (memcmp(oid.data, GNUTLS_OCSP_NONCE, oid.size) == 0) { gnutls_datum_t nonce; - unsigned int critical; + unsigned int ncrit; ret = - gnutls_ocsp_req_get_nonce(req, &critical, + gnutls_ocsp_req_get_nonce(req, &ncrit, &nonce); if (ret != GNUTLS_E_SUCCESS) { addf(str, "error: get_nonce: %s\n", gnutls_strerror(ret)); } else { addf(str, "\t\tNonce%s: ", - critical ? " (critical)" : ""); + ncrit ? " (critical)" : ""); _gnutls_buffer_hexprint(str, nonce.data, nonce.size); adds(str, "\n"); @@ -471,17 +471,17 @@ print_resp(gnutls_buffer_st * str, gnutls_ocsp_resp_t resp, if (memcmp(oid.data, GNUTLS_OCSP_NONCE, oid.size) == 0) { gnutls_datum_t nonce; - unsigned int critical; + unsigned int ncrit; ret = - gnutls_ocsp_resp_get_nonce(resp, &critical, + gnutls_ocsp_resp_get_nonce(resp, &ncrit, &nonce); if (ret != GNUTLS_E_SUCCESS) { addf(str, "error: get_nonce: %s\n", gnutls_strerror(ret)); } else { addf(str, "\t\tNonce%s: ", - critical ? " (critical)" : ""); + ncrit ? " (critical)" : ""); _gnutls_buffer_hexprint(str, nonce.data, nonce.size); adds(str, "\n"); diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c index 5321ed254f..679e401089 100644 --- a/lib/x509/pkcs12.c +++ b/lib/x509/pkcs12.c @@ -1464,6 +1464,7 @@ gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12, uint8_t key_id[20]; int privkey_ok = 0; unsigned int i; + int elements_in_bag; *key = NULL; @@ -1472,8 +1473,6 @@ gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12, /* find the first private key */ for (;;) { - int elements_in_bag; - int i; ret = gnutls_pkcs12_bag_init(&bag); if (ret < 0) { @@ -1517,7 +1516,7 @@ gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12, goto done; } - for (i = 0; i < elements_in_bag; i++) { + for (i = 0; i < (unsigned)elements_in_bag; i++) { int type; gnutls_datum_t data; @@ -1602,9 +1601,6 @@ gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12, idx = 0; bag = NULL; for (;;) { - int elements_in_bag; - int i; - ret = gnutls_pkcs12_bag_init(&bag); if (ret < 0) { bag = NULL; @@ -1640,7 +1636,7 @@ gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12, goto done; } - for (i = 0; i < elements_in_bag; i++) { + for (i = 0; i < (unsigned)elements_in_bag; i++) { int type; gnutls_datum_t data; gnutls_x509_crt_t this_cert; diff --git a/src/certtool.c b/src/certtool.c index 6061c1faf8..90200beee5 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -2412,15 +2412,15 @@ _verify_x509_mem(const void *cert, int cert_size, const void *ca, return 0; } -static void print_verification_res(FILE * outfile, unsigned int output) +static void print_verification_res(FILE * out, unsigned int output) { gnutls_datum_t pout; int ret; if (output) { - fprintf(outfile, "Not verified."); + fprintf(out, "Not verified."); } else { - fprintf(outfile, "Verified."); + fprintf(out, "Verified."); } ret = @@ -2432,7 +2432,7 @@ static void print_verification_res(FILE * outfile, unsigned int output) exit(EXIT_FAILURE); } - fprintf(outfile, " %s", pout.data); + fprintf(out, " %s", pout.data); gnutls_free(pout.data); } @@ -604,7 +604,7 @@ cert_callback(gnutls_session_t session, /* initializes a gnutls_session_t with some defaults. */ -static gnutls_session_t init_tls_session(const char *hostname) +static gnutls_session_t init_tls_session(const char *host) { const char *err; int ret; @@ -631,9 +631,9 @@ static gnutls_session_t init_tls_session(const char *hostname) /* allow the use of private ciphersuites. */ if (disable_extensions == 0 && disable_sni == 0) { - if (hostname != NULL && is_ip(hostname) == 0) + if (host != NULL && is_ip(host) == 0) gnutls_server_name_set(session, GNUTLS_NAME_DNS, - hostname, strlen(hostname)); + host, strlen(host)); } if (HAVE_OPT(DH_BITS)) @@ -1520,26 +1520,26 @@ psk_callback(gnutls_session_t session, char **username, if (HAVE_OPT(PSKUSERNAME)) *username = gnutls_strdup(OPT_ARG(PSKUSERNAME)); else { - char *tmp = NULL; + char *p = NULL; size_t n; printf("Enter PSK identity: "); fflush(stdout); - getline(&tmp, &n, stdin); + getline(&p, &n, stdin); - if (tmp == NULL) { + if (p == NULL) { fprintf(stderr, "No username given, aborting...\n"); return GNUTLS_E_INSUFFICIENT_CREDENTIALS; } - if (tmp[strlen(tmp) - 1] == '\n') - tmp[strlen(tmp) - 1] = '\0'; - if (tmp[strlen(tmp) - 1] == '\r') - tmp[strlen(tmp) - 1] = '\0'; + if (p[strlen(p) - 1] == '\n') + p[strlen(p) - 1] = '\0'; + if (p[strlen(p) - 1] == '\r') + p[strlen(p) - 1] = '\0'; - *username = gnutls_strdup(tmp); - free(tmp); + *username = gnutls_strdup(p); + free(p); } if (!*username) return GNUTLS_E_MEMORY_ERROR; |