mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
card: Print card version. Check for bad Yubikeys.
* scd/app.c (app_new_register): Set card version for Yubikeys. (app_write_learn_status): Print CARDVERSION and APPVERSION. * tools/card-call-scd.c (learn_status_cb): Detect them. * tools/gpg-card.h (struct card_info_s): Add appversion and cardversion. * tools/gpg-card.c (list_openpgp): Remove version printing from serial number. (print_a_version): New. (list_card): Print card and app version. (cmd_generate): Do not allow broken Yubikeys. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
64caa6a082
commit
8d4af54ddd
5 changed files with 67 additions and 13 deletions
20
scd/app.c
20
scd/app.c
|
@ -263,6 +263,9 @@ app_new_register (int slot, ctrl_t ctrl, const char *name,
|
|||
* set the serial number. */
|
||||
}
|
||||
}
|
||||
s1 = find_tlv (buf+1, buflen-1, 0x05, &n); /* version */
|
||||
if (s1 && n == 3)
|
||||
app->cardversion = ((s1[0]<<16)|(s1[1]<<8)|s1[2]);
|
||||
}
|
||||
}
|
||||
xfree (buf);
|
||||
|
@ -632,7 +635,7 @@ app_get_serialno (app_t app)
|
|||
}
|
||||
|
||||
|
||||
/* Write out the application specifig status lines for the LEARN
|
||||
/* Write out the application specific status lines for the LEARN
|
||||
command. */
|
||||
gpg_error_t
|
||||
app_write_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
|
||||
|
@ -645,10 +648,17 @@ app_write_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
|
|||
return gpg_error (GPG_ERR_UNSUPPORTED_OPERATION);
|
||||
|
||||
/* We do not send CARD and APPTYPE if only keypairinfo is requested. */
|
||||
if (app->cardtype && !(flags & 1))
|
||||
send_status_direct (ctrl, "CARDTYPE", app->cardtype);
|
||||
if (app->apptype && !(flags & 1))
|
||||
send_status_direct (ctrl, "APPTYPE", app->apptype);
|
||||
if (!(flags &1))
|
||||
{
|
||||
if (app->cardtype)
|
||||
send_status_direct (ctrl, "CARDTYPE", app->cardtype);
|
||||
if (app->cardversion)
|
||||
send_status_printf (ctrl, "CARDVERSION", "%X", app->cardversion);
|
||||
if (app->apptype)
|
||||
send_status_direct (ctrl, "APPTYPE", app->apptype);
|
||||
if (app->appversion)
|
||||
send_status_printf (ctrl, "APPVERSION", "%X", app->appversion);
|
||||
}
|
||||
|
||||
err = lock_app (app, ctrl);
|
||||
if (err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue