aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2004-09-24 14:34:45 +0000
committerDavid Shaw <[email protected]>2004-09-24 14:34:45 +0000
commit680be9be101aa2edb2bd058046b6f757c5c93ad2 (patch)
treefedcf4dd3fd3602219049d5f3d31f4f3c050b001
parentNote: I have not fully tested the new key creation due to a pc/sc (diff)
downloadgnupg-680be9be101aa2edb2bd058046b6f757c5c93ad2.tar.gz
gnupg-680be9be101aa2edb2bd058046b6f757c5c93ad2.zip
* 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.
Diffstat (limited to '')
-rw-r--r--g10/ChangeLog6
-rw-r--r--g10/gpgv.c2
-rw-r--r--g10/keyedit.c64
-rw-r--r--g10/keygen.c7
4 files changed, 45 insertions, 34 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 96e724edf..559671a2a 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-24 David Shaw <[email protected]>
+
+ * 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 <[email protected]>
* card_util.c (generate_card_keys): ask whether backup should be
diff --git a/g10/gpgv.c b/g10/gpgv.c
index e0a9aed34..a2d5ad391 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -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; }
diff --git a/g10/keyedit.c b/g10/keyedit.c
index 4070d2fac..b3067bf51 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -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 */
diff --git a/g10/keygen.c b/g10/keygen.c
index 96afad4e8..d75f0b826 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -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