mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
scd:openpgp: Use a special compare for the serialno.
* scd/app-openpgp.c (check_keyidstr): Ignore the card version and also compare case insensitive. (do_learn_status): Add mssing error handling. -- This is required because we changed what we emit as serialno of OpenPGP cards but existing keys still use the old form of the serial number (i.e. with a firmware version). This is so that existing stub keys of gpg-agent will continue to work. GnuPG-bug-id: 5100
This commit is contained in:
parent
4e47639af0
commit
c45a8b034c
@ -2161,6 +2161,8 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
|
|||||||
}
|
}
|
||||||
if (!err && app->app_local->extcap.has_button)
|
if (!err && app->app_local->extcap.has_button)
|
||||||
err = do_getattr (app, ctrl, "UIF");
|
err = do_getattr (app, ctrl, "UIF");
|
||||||
|
if (gpg_err_code (err) == GPG_ERR_NO_OBJ)
|
||||||
|
err = 0;
|
||||||
if (!err && app->app_local->extcap.private_dos)
|
if (!err && app->app_local->extcap.private_dos)
|
||||||
{
|
{
|
||||||
if (!err)
|
if (!err)
|
||||||
@ -4986,7 +4988,10 @@ check_keyidstr (app_t app, const char *keyidstr, int keyno, int *r_use_auth)
|
|||||||
return gpg_error (GPG_ERR_INV_ID);
|
return gpg_error (GPG_ERR_INV_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n != 32 || strncmp (keyidstr, "D27600012401", 12))
|
/* For a description of the serialno compare function see
|
||||||
|
* is_same_serialno. We don't use that function because here we
|
||||||
|
* are working on a hex string. */
|
||||||
|
if (n != 32 || ascii_strncasecmp (keyidstr, "D27600012401", 12))
|
||||||
return gpg_error (GPG_ERR_INV_ID);
|
return gpg_error (GPG_ERR_INV_ID);
|
||||||
else if (!*s)
|
else if (!*s)
|
||||||
; /* no fingerprint given: we allow this for now. */
|
; /* no fingerprint given: we allow this for now. */
|
||||||
@ -4994,7 +4999,9 @@ check_keyidstr (app_t app, const char *keyidstr, int keyno, int *r_use_auth)
|
|||||||
fpr = s + 1;
|
fpr = s + 1;
|
||||||
|
|
||||||
serial = app_get_serialno (app);
|
serial = app_get_serialno (app);
|
||||||
if (strncmp (serial, keyidstr, 32))
|
if (!serial || strlen (serial) != 32
|
||||||
|
|| ascii_memcasecmp (serial, "D27600012401", 12)
|
||||||
|
|| ascii_memcasecmp (serial+16, keyidstr+16, 16))
|
||||||
{
|
{
|
||||||
xfree (serial);
|
xfree (serial);
|
||||||
return gpg_error (GPG_ERR_WRONG_CARD);
|
return gpg_error (GPG_ERR_WRONG_CARD);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user