From a95143e22541c65ce2fd7fe7834ff7c3939c0325 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 9 Aug 2011 10:54:22 +0200 Subject: [PATCH] Removed some set but unused vars. --- cipher/ChangeLog | 24 ++++++++----- cipher/dynload.c | 7 ++-- g10/ChangeLog | 6 ++++ g10/apdu.c | 53 ++++++++++++++-------------- g10/keyedit.c | 76 ++++++++++++++++++++--------------------- g10/pipemode.c | 31 ++++++++--------- g10/sig-check.c | 21 +++++------- keyserver/ChangeLog | 8 +++-- keyserver/gpgkeys_hkp.c | 5 ++- mpi/ChangeLog | 6 ++++ mpi/mpi-pow.c | 5 ++- mpi/mpicoder.c | 4 +-- util/ChangeLog | 1 + util/pka.c | 4 +-- 14 files changed, 132 insertions(+), 119 deletions(-) diff --git a/cipher/ChangeLog b/cipher/ChangeLog index 1f754f912..6457035ef 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,11 @@ +2011-08-09 Werner Koch + + * rijndael.c (u32_a_t): New. + (do_encrypt_aligned, do_decrypt): Use the new type to avoid + problems with strict aliasing rules. + + * dynload.c (register_cipher_extension): Remove unused var. + 2010-10-18 Werner Koch * rndw32.c (slow_gatherer_windowsNT): Add GNUPG_RNDW32_NOPERF envvar. @@ -153,7 +161,7 @@ 2005-03-23 Werner Koch * rndw32.c (rndw32_gather_random_fast): While adding data use the - size of the object and not the one of its address. Bug reported by + size of the object and not the one of its address. Bug reported by Sascha Kiefer. 2005-03-07 Werner Koch @@ -170,7 +178,7 @@ * idea-stub.c (dlopen, dlsym): Use w32_strerror instead of just showing the error number. - + 2004-10-14 Werner Koch * rndunix.c (start_gatherer) [ENABLE_SELINUX_HACKS]: Don't allow @@ -418,7 +426,7 @@ * blowfish.h, cast5.h, des.h: Removed after moving all prototypes to * algorithms.h: here. Changed all sources to use this one. - + 2002-08-03 Stefan Bellon * idea-stub.c (idea_get_info): RISC OS' Norcroft C needs a cast. @@ -433,7 +441,7 @@ 2002-08-02 Werner Koch The big extension removal. - + * Makefile.am: Removed all extension stuff. * dynload.c: Removed everything except for register_cipher_extension. @@ -453,7 +461,7 @@ (load_digest_module): Simplified by removing all the dynload code. * algorithms.h: New. * md5.c (md5_get_info): Made global. Removed all dynload stuff. - * rmd160.c (rmd160_get_info): Likewise. + * rmd160.c (rmd160_get_info): Likewise. * sha1.c (sha1_get_info): Likewise. * tiger.c (tiger_get_info): Likewise. Return NULL if we can't use this module. @@ -572,7 +580,7 @@ RISC OS. Nearly all of these patches are identified by the __riscos__ macro. * blowfish.c, twofish.c: Added pragmas for use with a Norcraft - compiler. + compiler. * dynload.c, md5.c, rmd160.c, sha1.c: Minor patches for RISC OS. * rndriscos.c: New. * rnd-internal.h: Added prototype. @@ -595,7 +603,7 @@ * rndlinux.c (gather_random): casted a size_t arg to int so that the format string is correct. Casting is okay here and avoids - translation changes. + translation changes. 2001-06-12 Werner Koch @@ -635,7 +643,7 @@ * md5.c, sha1.c, rmd160.c, tiger.c (burn_stack): Likewise. * random.c (burn_stack): New. (mix_pool): Use it here to burn the stack of the mixblock function. - + 2001-04-02 Werner Koch * primegen.c (generate_elg_prime): I was not initialized for mode diff --git a/cipher/dynload.c b/cipher/dynload.c index 43a428780..a68ef49eb 100644 --- a/cipher/dynload.c +++ b/cipher/dynload.c @@ -34,8 +34,8 @@ typedef struct ext_list { static EXTLIST extensions; -/* This is actually not used anymore but we keep a list of already - * set extensions modules here. +/* This is actually not used anymore but we keep a list of already + * set extensions modules here. * * Here is the ancient comment: * Register an extension module. The last registered module will @@ -53,7 +53,7 @@ static EXTLIST extensions; void register_cipher_extension( const char *mainpgm, const char *fname ) { - EXTLIST r, el, intex; + EXTLIST r, el; char *p, *pe; if( *fname != DIRSEP_C ) { /* do tilde expansion etc */ @@ -76,7 +76,6 @@ register_cipher_extension( const char *mainpgm, const char *fname ) *p = *pe = 0; /* check that it is not already registered */ - intex = NULL; for(r = extensions; r; r = r->next ) { if( !compare_filenames(r->name, el->name) ) { log_info("extension `%s' already registered\n", el->name ); diff --git a/g10/ChangeLog b/g10/ChangeLog index 5787b80d6..ecfb3db9f 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,11 @@ 2011-08-09 Werner Koch + * keyedit.c (show_key_with_all_names): Remove unused var. + + * apdu.c (open_pcsc_reader_direct): Remove unused var. + + * sig-check.c (do_check): Remove unused var. + * keygen.c (ask_user_id): Fix loop break condition. See bug#1307. * import.c (import_keys_internal): Make breaking the loop more diff --git a/g10/apdu.c b/g10/apdu.c index d114b6eca..4544d709d 100644 --- a/g10/apdu.c +++ b/g10/apdu.c @@ -343,7 +343,7 @@ new_reader_slot (void) reader_table[reader].dump_status_reader = NULL; reader_table[reader].set_progress_cb = NULL; - reader_table[reader].used = 1; + reader_table[reader].used = 1; reader_table[reader].any_status = 0; reader_table[reader].last_status = 0; reader_table[reader].is_t0 = 1; @@ -394,8 +394,8 @@ host_sw_string (long err) case SW_HOST_GENERAL_ERROR: return "general error"; case SW_HOST_NO_READER: return "no reader"; case SW_HOST_ABORTED: return "aborted"; - case SW_HOST_NO_KEYPAD: return "no keypad"; - case SW_HOST_ALREADY_CONNECTED: return "already connected"; + case SW_HOST_NO_KEYPAD: return "no keypad"; + case SW_HOST_ALREADY_CONNECTED: return "already connected"; default: return "unknown host status error"; } } @@ -771,7 +771,7 @@ pcsc_error_to_sw (long ec) case PCSC_E_INVALID_TARGET: case PCSC_E_INVALID_VALUE: - case PCSC_E_INVALID_HANDLE: + case PCSC_E_INVALID_HANDLE: case PCSC_E_INVALID_PARAMETER: case PCSC_E_INSUFFICIENT_BUFFER: rc = SW_HOST_INV_VALUE; break; @@ -985,7 +985,7 @@ pcsc_get_status (int slot, unsigned int *status) #ifndef NEED_PCSC_WRAPPER static int pcsc_send_apdu_direct (int slot, unsigned char *apdu, size_t apdulen, - unsigned char *buffer, size_t *buflen, + unsigned char *buffer, size_t *buflen, struct pininfo_s *pininfo) { long err; @@ -1021,7 +1021,7 @@ pcsc_send_apdu_direct (int slot, unsigned char *apdu, size_t apdulen, #ifdef NEED_PCSC_WRAPPER static int pcsc_send_apdu_wrapped (int slot, unsigned char *apdu, size_t apdulen, - unsigned char *buffer, size_t *buflen, + unsigned char *buffer, size_t *buflen, struct pininfo_s *pininfo) { long err; @@ -1140,7 +1140,7 @@ pcsc_send_apdu_wrapped (int slot, unsigned char *apdu, size_t apdulen, BUFLEN. Returns: A status word. */ static int pcsc_send_apdu (int slot, unsigned char *apdu, size_t apdulen, - unsigned char *buffer, size_t *buflen, + unsigned char *buffer, size_t *buflen, struct pininfo_s *pininfo) { #ifdef NEED_PCSC_WRAPPER @@ -1269,7 +1269,7 @@ connect_pcsc_card (int slot) if (err) { reader_table[slot].pcsc.card = 0; - if (err != PCSC_E_NO_SMARTCARD) + if (err != PCSC_E_NO_SMARTCARD) log_error ("pcsc_connect failed: %s (0x%lx)\n", pcsc_error_string (err), err); } @@ -1319,7 +1319,7 @@ disconnect_pcsc_card (int slot) assert (slot >= 0 && slot < MAX_READER); if (!reader_table[slot].pcsc.card) - return 0; + return 0; err = pcsc_disconnect (reader_table[slot].pcsc.card, PCSC_LEAVE_CARD); if (err) @@ -1473,7 +1473,7 @@ open_pcsc_reader_direct (const char *portstr) long err; int slot; char *list = NULL; - unsigned long nreader, listlen; + unsigned long nreader; char *p; slot = new_reader_slot (); @@ -1517,7 +1517,6 @@ open_pcsc_reader_direct (const char *portstr) return -1; } - listlen = nreader; p = list; while (nreader) { @@ -2606,7 +2605,7 @@ apdu_connect (int slot) } else sw = 0; - + /* We need to call apdu_get_status_internal, so that the last-status machinery gets setup properly even if a card is inserted while scdaemon is fired up and apdu_get_status has not yet been called. @@ -2864,7 +2863,7 @@ send_apdu (int slot, unsigned char *apdu, size_t apdulen, if (reader_table[slot].send_apdu_reader) return reader_table[slot].send_apdu_reader (slot, apdu, apdulen, - buffer, buflen, + buffer, buflen, pininfo); else return SW_HOST_NOT_SUPPORTED; @@ -2892,7 +2891,7 @@ send_le (int slot, int class, int ins, int p0, int p1, { #define SHORT_RESULT_BUFFER_SIZE 258 /* We allocate 8 extra bytes as a safety margin towards a driver bug. */ - unsigned char short_result_buffer[SHORT_RESULT_BUFFER_SIZE+10]; + unsigned char short_result_buffer[SHORT_RESULT_BUFFER_SIZE+10]; unsigned char *result_buffer = NULL; size_t result_buffer_size; unsigned char *result; @@ -2930,16 +2929,16 @@ send_le (int slot, int class, int ins, int p0, int p1, if (lc > 16384) return SW_WRONG_LENGTH; /* Sanity check. */ if ((class&0xf0) != 0) - return SW_HOST_INV_VALUE; /* Upper 4 bits need to be 0. */ - use_chaining = extended_mode == -1? 255 : -extended_mode; + return SW_HOST_INV_VALUE; /* Upper 4 bits need to be 0. */ + use_chaining = extended_mode == -1? 255 : -extended_mode; use_chaining &= 0xff; } - else + else return SW_HOST_INV_VALUE; } else if (lc == -1 && extended_mode > 0) use_extended_length = 1; - + if (le != -1 && (le > (extended_mode > 0? 255:256) || le < 0)) { /* Expected Data does not fit into an APDU. What we do now @@ -2952,7 +2951,7 @@ send_le (int slot, int class, int ins, int p0, int p1, ; /* We are already using extended length. */ else if (extended_mode > 0) use_extended_length = 1; - else + else return SW_HOST_INV_VALUE; } @@ -3023,8 +3022,8 @@ send_le (int slot, int class, int ins, int p0, int p1, } if (le != -1) { - apdu[apdulen++] = ((le >> 8) & 0xff); - apdu[apdulen++] = (le & 0xff); + apdu[apdulen++] = ((le >> 8) & 0xff); + apdu[apdulen++] = (le & 0xff); } } else @@ -3078,7 +3077,7 @@ send_le (int slot, int class, int ins, int p0, int p1, return rc? rc : SW_HOST_INCOMPLETE_CARD_RESPONSE; } sw = (result[resultlen-2] << 8) | result[resultlen-1]; - if (!use_extended_length + if (!use_extended_length && !did_exact_length_hack && SW_EXACT_LENGTH_P (sw)) { apdu[apdulen-1] = (sw & 0x00ff); @@ -3094,7 +3093,7 @@ send_le (int slot, int class, int ins, int p0, int p1, apdu_buffer = NULL; apdu_buffer_size = 0; } - + /* Store away the returned data but strip the statusword. */ resultlen -= 2; if (DBG_CARD_IO) @@ -3237,7 +3236,7 @@ send_le (int slot, int class, int ins, int p0, int p1, that data will be put into *RETBUFLEN. The caller is reponsible for releasing the buffer even in case of errors. */ int -apdu_send_le(int slot, int extended_mode, +apdu_send_le(int slot, int extended_mode, int class, int ins, int p0, int p1, int lc, const char *data, int le, unsigned char **retbuf, size_t *retbuflen) @@ -3280,7 +3279,7 @@ apdu_send_simple (int slot, int extended_mode, int class, int ins, int p0, int p1, int lc, const char *data) { - return send_le (slot, class, ins, p0, p1, lc, data, -1, NULL, NULL, NULL, + return send_le (slot, class, ins, p0, p1, lc, data, -1, NULL, NULL, NULL, extended_mode); } @@ -3288,7 +3287,7 @@ apdu_send_simple (int slot, int extended_mode, /* Same as apdu_send_simple but uses the keypad of the reader. */ int apdu_send_simple_kp (int slot, int class, int ins, int p0, int p1, - int lc, const char *data, + int lc, const char *data, int pin_mode, int pinlen_min, int pinlen_max, int pin_padlen) { @@ -3320,7 +3319,7 @@ apdu_send_direct (int slot, size_t extended_length, unsigned char **retbuf, size_t *retbuflen) { #define SHORT_RESULT_BUFFER_SIZE 258 - unsigned char short_result_buffer[SHORT_RESULT_BUFFER_SIZE+10]; + unsigned char short_result_buffer[SHORT_RESULT_BUFFER_SIZE+10]; unsigned char *result_buffer = NULL; size_t result_buffer_size; unsigned char *result; diff --git a/g10/keyedit.c b/g10/keyedit.c index 56e1e82b9..c47fd0f85 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -115,7 +115,7 @@ find_pk_from_sknode (KBNODE pub_keyblock, KBNODE sec_node) KBNODE node = pub_keyblock; PKT_secret_key *sk; PKT_public_key *pk; - + if (sec_node->pkt->pkttype == PKT_SECRET_KEY && node->pkt->pkttype == PKT_PUBLIC_KEY) return node->pkt->pkt.public_key; @@ -129,7 +129,7 @@ find_pk_from_sknode (KBNODE pub_keyblock, KBNODE sec_node) if (pk->keyid[0] == sk->keyid[0] && pk->keyid[1] == sk->keyid[1]) return pk; } - + return NULL; } #endif /* ENABLE_CARD_SUPPORT */ @@ -528,7 +528,7 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified, } /* build a list of all signators. - * + * * We use the CERT flag to request the primary which must always * be one which is capable of signing keys. I can't see a reason * why to sign keys using a subkey. Implementation of USAGE_CERT @@ -705,7 +705,7 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified, { tty_printf(_("The self-signature on \"%s\"\n" "is a PGP 2.x-style signature.\n"),user); - + /* Note that the regular PGP2 warning below still applies if there are no v4 sigs on this key at all. */ @@ -1109,11 +1109,11 @@ change_passphrase( KBNODE keyblock ) sk = node->pkt->pkt.secret_key; for (any = 0, node=keyblock; node; node = node->next) { - if (node->pkt->pkttype == PKT_SECRET_KEY + if (node->pkt->pkttype == PKT_SECRET_KEY || node->pkt->pkttype == PKT_SECRET_SUBKEY) { PKT_secret_key *tmpsk = node->pkt->pkt.secret_key; if (!(tmpsk->is_protected - && (tmpsk->protect.s2k.mode == 1001 + && (tmpsk->protect.s2k.mode == 1001 || tmpsk->protect.s2k.mode == 1002))) { any = 1; break; @@ -1125,7 +1125,7 @@ change_passphrase( KBNODE keyblock ) "no passphrase to change.\n")); goto leave; } - + /* See how to handle this key. */ switch( is_secret_key_protected( sk ) ) { case -1: @@ -1157,7 +1157,7 @@ change_passphrase( KBNODE keyblock ) if( node->pkt->pkttype == PKT_SECRET_SUBKEY ) { PKT_secret_key *subsk = node->pkt->pkt.secret_key; if ( !(subsk->is_protected - && (subsk->protect.s2k.mode == 1001 + && (subsk->protect.s2k.mode == 1001 || subsk->protect.s2k.mode == 1002))) { set_next_passphrase( passphrase ); rc = check_secret_key( subsk, 0 ); @@ -1208,7 +1208,7 @@ change_passphrase( KBNODE keyblock ) if( node->pkt->pkttype == PKT_SECRET_SUBKEY ) { PKT_secret_key *subsk = node->pkt->pkt.secret_key; if ( !(subsk->is_protected - && (subsk->protect.s2k.mode == 1001 + && (subsk->protect.s2k.mode == 1001 || subsk->protect.s2k.mode == 1002))) { subsk->protect.algo = dek->algo; subsk->protect.s2k = *s2k; @@ -1345,7 +1345,7 @@ static struct int flags; const char *desc; } cmds[] = - { + { { "quit" , cmdQUIT , 0, N_("quit this menu") }, { "q" , cmdQUIT , 0, NULL }, { "save" , cmdSAVE , 0, N_("save and quit") }, @@ -1388,9 +1388,9 @@ static struct #ifdef ENABLE_CARD_SUPPORT { "addcardkey", cmdADDCARDKEY , KEYEDIT_NOT_SK|KEYEDIT_NEED_SK, N_("add a key to a smartcard") }, - { "keytocard", cmdKEYTOCARD , KEYEDIT_NEED_SK|KEYEDIT_ONLY_SK, + { "keytocard", cmdKEYTOCARD , KEYEDIT_NEED_SK|KEYEDIT_ONLY_SK, N_("move a key to a smartcard")}, - { "bkuptocard", cmdBKUPTOCARD , KEYEDIT_NEED_SK|KEYEDIT_ONLY_SK, + { "bkuptocard", cmdBKUPTOCARD , KEYEDIT_NEED_SK|KEYEDIT_ONLY_SK, N_("move a backup key to a smartcard")}, #endif /*ENABLE_CARD_SUPPORT*/ @@ -1554,7 +1554,7 @@ keyedit_menu( const char *username, STRLIST locusr, size_t an; fingerprint_from_pk (pk, afp, &an); - while (an < MAX_FINGERPRINT_LEN) + while (an < MAX_FINGERPRINT_LEN) afp[an++] = 0; rc = keydb_search_fpr (sec_kdbhd, afp); } @@ -1870,7 +1870,7 @@ keyedit_menu( const char *username, STRLIST locusr, case 1: for (node = sec_keyblock; node; node = node->next ) { - if (node->pkt->pkttype == PKT_SECRET_SUBKEY + if (node->pkt->pkttype == PKT_SECRET_SUBKEY && node->flag & NODFLG_SELKEY) break; } @@ -1922,15 +1922,15 @@ keyedit_menu( const char *username, STRLIST locusr, fname, strerror(errno)); break; } - + /* Parse and check that file. */ pkt = xmalloc (sizeof *pkt); init_packet (pkt); rc = parse_packet (a, pkt); iobuf_close (a); iobuf_ioctl (NULL, 2, 0, (char*)fname); /* (invalidate cache). */ - if (!rc - && pkt->pkttype != PKT_SECRET_KEY + if (!rc + && pkt->pkttype != PKT_SECRET_KEY && pkt->pkttype != PKT_SECRET_SUBKEY) rc = G10ERR_NO_SECKEY; if (rc) @@ -2309,7 +2309,7 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose) for(i=any=0; prefs[i].type; i++ ) { if( prefs[i].type == PREFTYPE_SYM ) { const char *s = cipher_algo_to_string (prefs[i].value); - + if (any) tty_printf (", "); any = 1; @@ -2320,7 +2320,7 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose) tty_printf ("[%d]", prefs[i].value); if (prefs[i].value == CIPHER_ALGO_3DES ) des_seen = 1; - } + } } if (!des_seen) { if (any) @@ -2332,7 +2332,7 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose) for(i=any=0; prefs[i].type; i++ ) { if( prefs[i].type == PREFTYPE_HASH ) { const char *s = digest_algo_to_string (prefs[i].value); - + if (any) tty_printf (", "); any = 1; @@ -2355,7 +2355,7 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose) for(i=any=0; prefs[i].type; i++ ) { if( prefs[i].type == PREFTYPE_ZIP ) { const char *s=compress_algo_to_string(prefs[i].value); - + if (any) tty_printf (", "); any = 1; @@ -2489,15 +2489,15 @@ show_key_with_all_names_colon (KBNODE keyblock) putchar(get_ownertrust_info (pk)); putchar(':'); putchar('\n'); - + print_fingerprint (pk, NULL, 0); print_revokers(pk); } } - + /* the user ids */ i = 0; - for (node = keyblock; node; node = node->next) + for (node = keyblock; node; node = node->next) { if ( node->pkt->pkttype == PKT_USER_ID ) { @@ -2541,7 +2541,7 @@ show_key_with_all_names_colon (KBNODE keyblock) if (pk_version>3 || uid->selfsigversion>3) { const prefitem_t *prefs = uid->prefs; - + for (j=0; prefs && prefs[j].type; j++) { if (j) @@ -2550,12 +2550,12 @@ show_key_with_all_names_colon (KBNODE keyblock) prefs[j].type == PREFTYPE_HASH ? 'H' : prefs[j].type == PREFTYPE_ZIP ? 'Z':'?', prefs[j].value); - } + } if (uid->flags.mdc) printf (",mdc"); if (!uid->flags.ks_modify) printf (",no-ks-modify"); - } + } putchar (':'); /* flags */ printf ("%d,", i); @@ -2644,7 +2644,6 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, KBNODE node; int i; int do_warn = 0; - byte pk_version=0; PKT_public_key *primary=NULL; if (opt.with_colons) @@ -2676,7 +2675,6 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, do_warn = 1; } - pk_version=pk->version; primary=pk; } @@ -2754,7 +2752,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, tty_printf(_("trust: %s"), otrust); tty_printf("%*s",width,""); } - + tty_printf(_("validity: %s"), trust ); tty_printf("\n"); } @@ -2790,7 +2788,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, if (sk->is_protected && sk->protect.s2k.mode == 1002) { tty_printf(" "); - tty_printf(_("card-no: ")); + tty_printf(_("card-no: ")); if (sk->protect.ivlen == 16 && !memcmp (sk->protect.iv, "\xD2\x76\x00\x01\x24\x01", 6)) { /* This is an OpenPGP card. */ @@ -2816,7 +2814,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, if (do_warn) tty_printf (_("Please note that the shown key validity" " is not necessarily correct\n" - "unless you restart the program.\n")); + "unless you restart the program.\n")); } @@ -2836,7 +2834,7 @@ show_basic_key_info ( KBNODE keyblock ) if (node->pkt->pkttype == PKT_PUBLIC_KEY) { PKT_public_key *pk = node->pkt->pkt.public_key; - + /* Note, we use the same format string as in other show functions to make the translation job easier. */ tty_printf ("%s %4u%c/%s ", @@ -2875,7 +2873,7 @@ show_basic_key_info ( KBNODE keyblock ) { PKT_user_id *uid = node->pkt->pkt.user_id; ++i; - + tty_printf (" "); if (uid->is_revoked) tty_printf("[%s] ",_("revoked")); @@ -3823,7 +3821,7 @@ change_primary_uid_cb ( PKT_signature *sig, void *opaque ) delete_sig_subpkt (sig->unhashed, SIGSUBPKT_PRIMARY_UID); /* if opaque is set,we want to set the primary id */ - if (opaque) { + if (opaque) { buf[0] = 1; build_sig_subpkt (sig, SIGSUBPKT_PRIMARY_UID, buf, 1 ); } @@ -3956,7 +3954,7 @@ menu_set_primary_uid ( KBNODE pub_keyblock, KBNODE sec_keyblock ) } -/* +/* * Set preferences to new values for the selected user IDs */ static int @@ -4007,7 +4005,7 @@ menu_set_preferences (KBNODE pub_keyblock, KBNODE sec_keyblock ) xfree(user); } else { - /* This is a selfsignature which is to be replaced + /* This is a selfsignature which is to be replaced * We have to ignore v3 signatures because they are * not able to carry the preferences */ PKT_signature *newsig; @@ -4037,7 +4035,7 @@ menu_set_preferences (KBNODE pub_keyblock, KBNODE sec_keyblock ) } } } - + free_secret_key( sk ); return modified; } @@ -4684,7 +4682,7 @@ menu_revsig( KBNODE keyblock ) /* First check whether we have any signatures at all. */ any = 0; - for (node = keyblock; node; node = node->next ) + for (node = keyblock; node; node = node->next ) { node->flag &= ~(NODFLG_SELSIG | NODFLG_MARK_A); if (node->pkt->pkttype == PKT_USER_ID) { diff --git a/g10/pipemode.c b/g10/pipemode.c index 2b0978959..077f967cd 100644 --- a/g10/pipemode.c +++ b/g10/pipemode.c @@ -36,7 +36,7 @@ #include "filter.h" -#define CONTROL_PACKET_SPACE 30 +#define CONTROL_PACKET_SPACE 30 #define FAKED_LITERAL_PACKET_SPACE (9+2+2) @@ -73,7 +73,7 @@ make_control ( byte *buf, int code, int operation ) buf[n++] = 0xff; /* new format, type 63, 1 length byte */ n++; /* length will fixed below */ memcpy(buf+n, sesmark, sesmarklen ); n+= sesmarklen; - buf[n++] = CTRLPKT_PIPEMODE; + buf[n++] = CTRLPKT_PIPEMODE; buf[n++] = code; buf[n++] = operation; buf[1] = n-2; @@ -85,7 +85,7 @@ make_control ( byte *buf, int code, int operation ) static int pipemode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len) -{ +{ size_t size = *ret_len; struct pipemode_context_s *stx = opaque; int rc=0; @@ -104,11 +104,11 @@ pipemode_filter( void *opaque, int control, buf[n++] = 0; buf[n++] = 0; } - + while ( n < size ) { /* FIXME: we have to make sure that we have a large enough - * buffer for a control packet even after we already read + * buffer for a control packet even after we already read * something. The easest way to do this is probably by ungetting * the control sequence and returning the buffer we have * already assembled */ @@ -123,7 +123,7 @@ pipemode_filter( void *opaque, int control, } if ( esc ) { switch (c) { - case '@': + case '@': if ( stx->state == STX_text ) { buf[n++] = c; break; @@ -181,7 +181,7 @@ pipemode_filter( void *opaque, int control, goto leave; case 't': /* plaintext text follows */ - if ( stx->state == STX_detached_signature_wait_text ) + if ( stx->state == STX_detached_signature_wait_text ) stx->state = STX_detached_signature; if ( stx->state == STX_detached_signature ) { if ( stx->operation != 'B' ) { @@ -215,7 +215,7 @@ pipemode_filter( void *opaque, int control, break; case '.': /* ready */ - if ( stx->state == STX_signed_data ) { + if ( stx->state == STX_signed_data ) { if (stx->block_mode) { buf[0] = (n-2) >> 8; buf[1] = (n-2); @@ -236,7 +236,7 @@ pipemode_filter( void *opaque, int control, stx->state = STX_wait_init; goto leave; - default: + default: log_error ("invalid escape sequence 0x%02x in stream\n", c); stx->stop = 1; @@ -244,7 +244,7 @@ pipemode_filter( void *opaque, int control, } esc = 0; } - else if (c == '@') + else if (c == '@') esc = 1; else if (stx->unarmor_ctx) { do_unarmor: /* used to handle a @@ */ @@ -254,7 +254,7 @@ pipemode_filter( void *opaque, int control, else if ( c < 0 ) { /* end of armor or error - we don't care becuase the armor can be modified anyway. The unarmored - stuff should stand for itself. */ + stuff should stand for itself. */ unarmor_pump_release (stx->unarmor_ctx); stx->unarmor_ctx = NULL; stx->state = STX_detached_signature_wait_text; @@ -263,10 +263,10 @@ pipemode_filter( void *opaque, int control, else if (stx->state == STX_detached_signature_wait_text) ; /* just wait */ else - buf[n++] = c; + buf[n++] = c; } - leave: + leave: if ( !n ) { stx->stop = 1; rc = -1; /* eof */ @@ -293,7 +293,6 @@ run_in_pipemode(void) IOBUF fp; armor_filter_context_t afx; struct pipemode_context_s stx; - int rc; memset( &afx, 0, sizeof afx); memset( &stx, 0, sizeof stx); @@ -303,10 +302,10 @@ run_in_pipemode(void) do { write_status (STATUS_BEGIN_STREAM); - rc = proc_packets( NULL, fp ); + proc_packets( NULL, fp ); write_status (STATUS_END_STREAM); } while ( !stx.stop ); - + } diff --git a/g10/sig-check.c b/g10/sig-check.c index b4c353c59..d6bbb925e 100644 --- a/g10/sig-check.c +++ b/g10/sig-check.c @@ -54,7 +54,7 @@ signature_check( PKT_signature *sig, MD_HANDLE digest ) } int -signature_check2( PKT_signature *sig, MD_HANDLE digest, u32 *r_expiredate, +signature_check2( PKT_signature *sig, MD_HANDLE digest, u32 *r_expiredate, int *r_expired, int *r_revoked, PKT_public_key *ret_pk ) { PKT_public_key *pk = xmalloc_clear( sizeof *pk ); @@ -239,7 +239,6 @@ do_check( PKT_public_key *pk, PKT_signature *sig, MD_HANDLE digest, { MPI result = NULL; int rc=0; - struct cmp_help_context_s ctx; if( (rc=do_check_messages(pk,sig,r_expired,r_revoked)) ) return rc; @@ -291,8 +290,6 @@ do_check( PKT_public_key *pk, PKT_signature *sig, MD_HANDLE digest, result = encode_md_value( pk, NULL, digest, sig->digest_algo ); if (!result) return G10ERR_GENERAL; - ctx.sig = sig; - ctx.md = digest; rc = pubkey_verify( pk->pubkey_algo, result, sig->data, pk->pkey ); mpi_free( result ); @@ -326,7 +323,7 @@ do_check( PKT_public_key *pk, PKT_signature *sig, MD_HANDLE digest, warning during signature checking. Note that while validating a key we might have already checked MD5 key signatures. */ if (sig->digest_algo == DIGEST_ALGO_MD5) - md5_digest_warn (0); + md5_digest_warn (0); if( !rc && sig->flags.unknown_critical ) { @@ -438,13 +435,13 @@ check_revocation_keys(PKT_public_key *pk,PKT_signature *sig) for(i=0;inumrevkeys;i++) { u32 keyid[2]; - + keyid_from_fingerprint(pk->revkey[i].fpr,MAX_FINGERPRINT_LEN,keyid); - + if(keyid[0]==sig->keyid[0] && keyid[1]==sig->keyid[1]) { MD_HANDLE md; - + md=md_open(sig->digest_algo,0); hash_public_key(md,pk); rc=signature_check(sig,md); @@ -457,7 +454,7 @@ check_revocation_keys(PKT_public_key *pk,PKT_signature *sig) busy=0; return rc; -} +} /* Backsigs (0x19) have the same format as binding sigs (0x18), but this function is simpler than check_key_signature in a few ways. @@ -538,8 +535,8 @@ check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *check_pk, cache refresh detects and clears these cases. */ if ( !opt.no_sig_cache ) { if (sig->flags.checked) { /*cached status available*/ - if( is_selfsig ) { - u32 keyid[2]; + if( is_selfsig ) { + u32 keyid[2]; keyid_from_pk( pk, keyid ); if( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] ) @@ -559,7 +556,7 @@ check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *check_pk, return rc; if( sig->sig_class == 0x20 ) { /* key revocation */ - u32 keyid[2]; + u32 keyid[2]; keyid_from_pk( pk, keyid ); /* is it a designated revoker? */ diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index 87fb3b241..302138daa 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,3 +1,7 @@ +2011-08-09 Werner Koch + + * gpgkeys_hkp.c (srv_replace): Remove unused var. + 2009-09-02 Werner Koch * Makefile.am (gpgkeys_curl_SOURCES, gpgkeys_ldap_SOURCES) @@ -52,7 +56,7 @@ hostname to a real hostname. (main): Call it from here for the HAVE_LIBCURL case (without libcurl is handled via the curl-shim). - + 2009-04-02 David Shaw * curl-shim.h, curl-shim.c (curl_easy_setopt, curl_easy_perform): @@ -669,7 +673,7 @@ 2004-10-28 Werner Koch - * Makefile.am (other_libs): + * Makefile.am (other_libs): 2004-10-18 David Shaw diff --git a/keyserver/gpgkeys_hkp.c b/keyserver/gpgkeys_hkp.c index a15cbf656..ae520fbaa 100644 --- a/keyserver/gpgkeys_hkp.c +++ b/keyserver/gpgkeys_hkp.c @@ -498,7 +498,6 @@ srv_replace(const char *srvtag) { #ifdef USE_DNS_SRV struct srventry *srvlist=NULL; - int srvcount; if(!srvtag) return; @@ -511,7 +510,7 @@ srv_replace(const char *srvtag) strcat(srvname,srvtag); strcat(srvname,"._tcp."); strcat(srvname,opt->host); - srvcount=getsrv(srvname,&srvlist); + getsrv(srvname,&srvlist); } if(srvlist) @@ -538,7 +537,7 @@ srv_replace(const char *srvtag) } #endif -static void +static void show_help (FILE *fp) { fprintf (fp,"-h, --help\thelp\n"); diff --git a/mpi/ChangeLog b/mpi/ChangeLog index 1f81333ba..d51e0d212 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,9 @@ +2011-08-09 Werner Koch + + * mpicoder.c (mpi_fromstr): Remove unused var. + + * mpi-pow.c (mpi_powm): Remove unused var. + 2011-07-04 Werner Koch * longlong.h: [__arm__]: Do no use asm if thumb code generation is diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c index c4c62d7e4..beb01f95a 100644 --- a/mpi/mpi-pow.c +++ b/mpi/mpi-pow.c @@ -42,7 +42,7 @@ mpi_powm( MPI res, MPI base, MPI exponent, MPI mod) { mpi_ptr_t rp, ep, mp, bp; mpi_size_t esize, msize, bsize, rsize; - int esign, msign, bsign, rsign; + int msign, bsign, rsign; int esec, msec, bsec, rsec; mpi_size_t size; int mod_shift_cnt; @@ -57,7 +57,6 @@ mpi_powm( MPI res, MPI base, MPI exponent, MPI mod) esize = exponent->nlimbs; msize = mod->nlimbs; size = 2 * msize; - esign = exponent->sign; msign = mod->sign; esec = mpi_is_secure(exponent); @@ -136,7 +135,7 @@ mpi_powm( MPI res, MPI base, MPI exponent, MPI mod) MPN_COPY(bp, rp, bsize); } if( rp == ep ) { - /* RES and EXPONENT are identical. + /* RES and EXPONENT are identical. Allocate temp. space for EXPONENT. */ ep = ep_marker = mpi_alloc_limb_space( esize, esec ); MPN_COPY(ep, rp, esize); diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c index cbfe14947..92fc15aac 100644 --- a/mpi/mpicoder.c +++ b/mpi/mpicoder.c @@ -200,7 +200,7 @@ mpi_read_from_buffer(byte *buffer, unsigned int *ret_nread, int secure) int mpi_fromstr(MPI val, const char *str) { - int hexmode=0, sign=0, prepend_zero=0, i, j, c, c1, c2; + int sign=0, prepend_zero=0, i, j, c, c1, c2; unsigned nbits, nbytes, nlimbs; mpi_limb_t a; @@ -209,7 +209,7 @@ mpi_fromstr(MPI val, const char *str) str++; } if( *str == '0' && str[1] == 'x' ) - hexmode = 1; + ; else return 1; /* other bases are not yet supported */ str += 2; diff --git a/util/ChangeLog b/util/ChangeLog index fabedeecc..506e1f359 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -3,6 +3,7 @@ * pka.c (get_pka_info): Turn ANSWER into a union to avoid aliasing problems with modern compilers. See bug#1307. Reported by Steve Grubb. + (get_pka_info): Remove unused vars. 2010-10-27 Werner Koch diff --git a/util/pka.c b/util/pka.c index a8e4f9aa3..08c82f1bb 100644 --- a/util/pka.c +++ b/util/pka.c @@ -122,7 +122,7 @@ get_pka_info (const char *address, unsigned char *fpr) HEADER h; } answer; int anslen; - int qdcount, ancount, nscount, arcount; + int qdcount, ancount; int rc; unsigned char *p, *pend; const char *domain; @@ -151,8 +151,6 @@ get_pka_info (const char *address, unsigned char *fpr) qdcount = ntohs (answer.h.qdcount); ancount = ntohs (answer.h.ancount); - nscount = ntohs (answer.h.nscount); - arcount = ntohs (answer.h.arcount); if (!ancount) return NULL; /* Got no answer. */