1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Removed some set but unused vars.

This commit is contained in:
Werner Koch 2011-08-09 10:54:22 +02:00
parent 0ad1458f82
commit a95143e225
14 changed files with 132 additions and 119 deletions

View file

@ -1,5 +1,11 @@
2011-08-09 Werner Koch <wk@g10code.com>
* 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

View file

@ -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;

View file

@ -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) {

View file

@ -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 );
}

View file

@ -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;i<pk->numrevkeys;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? */