mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Prepare for longer card fingerprints.
* g10/call-agent.h (agent_card_info_s): Rename the "*valid" fields to "*len". * g10/call-agent.c (unhexify_fpr): Change to take a FPRLEN and to return the actual length. (agent_release_card_info): Adjust for these changes. * g10/card-util.c (print_sha1_fpr): Rename to print_shax_fpr and add arg FPRLEN. Change all callers to pass the length. (print_sha1_fpr_colon): Rename to print_shax_fpr_colon and add arg FPRLEN. Change all callers to pass the length. (fpr_is_zero): Add arg FPRLEN. (fpr_is_ff): Ditto. (show_card_key_info): Use the new functions. * g10/skclist.c (enum_secret_keys): Use MAX_FINGERPRINT_LEN. -- This is not needed right now but we should get rid of all hard coded fingerprint lengths. Thus this change. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
b823788d20
commit
108702ccae
4 changed files with 89 additions and 76 deletions
|
@ -149,7 +149,8 @@ build_sk_list (ctrl_t ctrl,
|
|||
}
|
||||
|
||||
err = get_seckey_default_or_card (ctrl, pk,
|
||||
info.fpr1valid? info.fpr1 : NULL, 20);
|
||||
info.fpr1len? info.fpr1 : NULL,
|
||||
info.fpr1len);
|
||||
if (err)
|
||||
{
|
||||
free_public_key (pk);
|
||||
|
@ -331,7 +332,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
|
|||
strlist_t sl;
|
||||
strlist_t card_list;
|
||||
char *serialno;
|
||||
char fpr2[43];
|
||||
char fpr2[2 * MAX_FINGERPRINT_LEN + 3 ];
|
||||
struct agent_card_info_s info;
|
||||
kbnode_t keyblock;
|
||||
kbnode_t node;
|
||||
|
@ -419,17 +420,17 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk)
|
|||
}
|
||||
|
||||
xfree (serialno);
|
||||
c->info.fpr2valid = 0;
|
||||
c->info.fpr2len = 0;
|
||||
err = agent_scd_getattr ("KEY-FPR", &c->info);
|
||||
if (err)
|
||||
log_error ("error retrieving key fingerprint from card: %s\n",
|
||||
gpg_strerror (err));
|
||||
|
||||
if (c->info.fpr2valid)
|
||||
if (c->info.fpr2len)
|
||||
{
|
||||
c->fpr2[0] = '0';
|
||||
c->fpr2[1] = 'x';
|
||||
bin2hex (c->info.fpr2, 20, c->fpr2+2);
|
||||
bin2hex (c->info.fpr2, sizeof c->info.fpr2,c->fpr2+2);
|
||||
name = c->fpr2;
|
||||
}
|
||||
c->sl = c->sl->next;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue