1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-22 14:57:02 +01:00

scd:openpgp: Add attribute "UIF" for convenience.

* scd/app-openpgp.c (do_getattr): New attrubute "UIF".
(do_learn_status): Use that.
--

Actually this is not just convenience but will make it easier to add
new keys to an openpgp card - we will need to change this only at one
place.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 11f0700282c1eeaee8db6686c38aca0900271351)
This commit is contained in:
Werner Koch 2020-05-26 16:13:15 +02:00
parent 52abdac2d4
commit 216f3fc96a
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1073,6 +1073,7 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
{ "UIF-1", 0x00D6, 0 }, { "UIF-1", 0x00D6, 0 },
{ "UIF-2", 0x00D7, 0 }, { "UIF-2", 0x00D7, 0 },
{ "UIF-3", 0x00D8, 0 }, { "UIF-3", 0x00D8, 0 },
{ "UIF", 0x0000, -9 }, /* Shortcut for all UIF */
{ "KDF", 0x00F9, 5 }, { "KDF", 0x00F9, 5 },
{ "MANUFACTURER", 0x0000, -8 }, { "MANUFACTURER", 0x0000, -8 },
{ NULL, 0 } { NULL, 0 }
@ -1171,6 +1172,15 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
app->app_local->manufacturer, app->app_local->manufacturer,
get_manufacturer (app->app_local->manufacturer)); get_manufacturer (app->app_local->manufacturer));
} }
if (table[idx].special == -9)
{
rc = do_getattr (app, ctrl, "UIF-1");
if (!rc)
rc = do_getattr (app, ctrl, "UIF-2");
if (!rc)
rc = do_getattr (app, ctrl, "UIF-3");
return rc;
}
relptr = get_one_do (app, table[idx].tag, &value, &valuelen, &rc); relptr = get_one_do (app, table[idx].tag, &value, &valuelen, &rc);
if (relptr) if (relptr)
@ -2072,18 +2082,14 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
err = do_getattr (app, ctrl, "CHV-STATUS"); err = do_getattr (app, ctrl, "CHV-STATUS");
if (!err) if (!err)
err = do_getattr (app, ctrl, "SIG-COUNTER"); err = do_getattr (app, ctrl, "SIG-COUNTER");
if (!err) if (!err && app->app_local->extcap.kdf_do)
err = do_getattr (app, ctrl, "UIF-1");
if (!err)
err = do_getattr (app, ctrl, "UIF-2");
if (!err)
err = do_getattr (app, ctrl, "UIF-3");
if (app->app_local->extcap.private_dos)
{ {
err = do_getattr (app, ctrl, "KDF"); err = do_getattr (app, ctrl, "KDF");
if (gpg_err_code (err) == GPG_ERR_NO_OBJ) if (gpg_err_code (err) == GPG_ERR_NO_OBJ)
err = 0; err = 0;
} }
if (!err && app->app_local->extcap.has_button)
err = do_getattr (app, ctrl, "UIF");
if (!err && app->app_local->extcap.private_dos) if (!err && app->app_local->extcap.private_dos)
{ {
if (!err) if (!err)