1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-01 16:33:02 +01:00

* keyedit.c (keyedit_menu), gpgv.c (agent_scd_getattr (stub)), keygen.c

(copy_mpi, generate_raw_key): Fix a compile problem and a few warnings
when building without card support.
This commit is contained in:
David Shaw 2004-09-24 14:34:45 +00:00
parent f36154535e
commit 680be9be10
4 changed files with 45 additions and 34 deletions

View File

@ -1,3 +1,9 @@
2004-09-24 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (keyedit_menu), gpgv.c (agent_scd_getattr (stub)),
keygen.c (copy_mpi, generate_raw_key): Fix a compile problem and a
few warnings when building without card support.
2004-09-23 Werner Koch <wk@g10code.com>
* card_util.c (generate_card_keys): ask whether backup should be

View File

@ -340,7 +340,9 @@ void show_photos(const struct user_attribute *attrs,int count,PKT_public_key *pk
int parse_image_header(const struct user_attribute *attr,byte *type,u32 *len) {return 0;}
char *image_type_to_string(byte type,int string) {return NULL;}
#ifdef ENABLE_CARD_SUPPORT
int agent_scd_getattr (const char *name, struct agent_card_info_s *info) {return 0;}
#endif /* ENABLE_CARD_SUPPORT */
/* Stubs to void linking to ../cipher/cipher.c */
int string_to_cipher_algo( const char *string ) { return 0; }

View File

@ -95,6 +95,7 @@ struct sign_attrib {
};
#ifdef ENABLE_CARD_SUPPORT
/* Given a node SEC_NODE with a secret key or subkey, locate the
corresponding public key from pub_keyblock. */
static PKT_public_key *
@ -120,7 +121,7 @@ find_pk_from_sknode (KBNODE pub_keyblock, KBNODE sec_node)
return NULL;
}
#endif /* ENABLE_CARD_SUPPORT */
/* TODO: Fix duplicated code between here and the check-sigs/list-sigs
@ -1285,7 +1286,6 @@ keyedit_menu( const char *username, STRLIST locusr,
KBNODE sec_keyblock = NULL;
KEYDB_HANDLE sec_kdbhd = NULL;
KBNODE cur_keyblock;
KBNODE node;
char *answer = NULL;
int redisplay = 1;
int modified = 0;
@ -1576,35 +1576,37 @@ keyedit_menu( const char *username, STRLIST locusr,
break;
case cmdKEYTOCARD:
node = NULL;
switch ( count_selected_keys (sec_keyblock) )
{
case 0:
if (cpr_get_answer_is_yes("keyedit.keytocard.use_primary",
_("Really move the primary key? ")))
node = sec_keyblock;
break;
case 1:
for (node = sec_keyblock; node; node = node->next )
{
if (node->pkt->pkttype == PKT_SECRET_SUBKEY
&& node->flag & NODFLG_SELKEY)
break;
}
break;
default:
tty_printf(_("You must select exactly one key.\n"));
break;
}
if (node)
{
PKT_public_key *xxpk = find_pk_from_sknode (keyblock, node);
if (card_store_subkey (node, xxpk?xxpk->pubkey_usage:0))
{
redisplay = 1;
sec_modified = 1;
}
}
{
KBNODE node=NULL;
switch ( count_selected_keys (sec_keyblock) )
{
case 0:
if (cpr_get_answer_is_yes("keyedit.keytocard.use_primary",
_("Really move the primary key? ")))
node = sec_keyblock;
break;
case 1:
for (node = sec_keyblock; node; node = node->next )
{
if (node->pkt->pkttype == PKT_SECRET_SUBKEY
&& node->flag & NODFLG_SELKEY)
break;
}
break;
default:
tty_printf(_("You must select exactly one key.\n"));
break;
}
if (node)
{
PKT_public_key *xxpk = find_pk_from_sknode (keyblock, node);
if (card_store_subkey (node, xxpk?xxpk->pubkey_usage:0))
{
redisplay = 1;
sec_modified = 1;
}
}
}
break;
#endif /* ENABLE_CARD_SUPPORT */

View File

@ -133,7 +133,7 @@ static int gen_card_key_with_backup (int algo, int keyno, int is_primary,
#define GET_NBITS(a) gcry_mpi_get_nbits (a)
#endif
#ifdef ENABLE_CARD_SUPPORT
static int
copy_mpi (MPI a, unsigned char *buffer, size_t len, size_t *ncopied)
{
@ -159,8 +159,7 @@ copy_mpi (MPI a, unsigned char *buffer, size_t len, size_t *ncopied)
log_error ("mpi_copy failed: %s\n", gpg_strerror (rc));
return rc;
}
#endif /* ENABLE_CARD_SUPPORT */
static void
@ -2450,6 +2449,7 @@ generate_keypair (const char *fname, const char *card_serialno,
}
#ifdef ENABLE_CARD_SUPPORT
/* Generate a raw key and return it as a secret key packet. The
function will ask for the passphrase and return a protected as well
as an unprotected copy of a new secret key packet. 0 is returned
@ -2526,6 +2526,7 @@ generate_raw_key (int algo, unsigned int nbits, u32 created_at,
m_free (s2k);
return rc;
}
#endif /* ENABLE_CARD_SUPPORT */
static void