diff options
author | Werner Koch <[email protected]> | 2020-11-09 13:46:35 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-11-09 13:46:35 +0000 |
commit | 12fd10791f1dec4ec42810d7b92c69e1ae2327b9 (patch) | |
tree | 52dcec153b233ad0cebd827b1f78836fcf25f5c7 /tools/card-misc.c | |
parent | card: Run factory-reset in locked stated. (diff) | |
download | gnupg-12fd10791f1dec4ec42810d7b92c69e1ae2327b9.tar.gz gnupg-12fd10791f1dec4ec42810d7b92c69e1ae2327b9.zip |
card: Run factory-reset in locked stated also in gpg-card.
* tools/card-call-scd.c (scd_apdu): Add more pseudo APDUs.
* tools/card-misc.c (send_apdu): Handle them.
* tools/gpg-card.c (cmd_factoryreset): Use lock commands.
--
This is port of the code used with gpg-card-edit. Note that the
command "apdu" now also understands some extra keywords.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tools/card-misc.c')
-rw-r--r-- | tools/card-misc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/card-misc.c b/tools/card-misc.c index bbb2b4810..6466e98b2 100644 --- a/tools/card-misc.c +++ b/tools/card-misc.c @@ -92,8 +92,13 @@ send_apdu (const char *hexapdu, const char *desc, unsigned int ignore, if (err) log_error ("sending card command %s failed: %s\n", desc, gpg_strerror (err)); - else if (!hexapdu || !strcmp (hexapdu, "undefined")) - ; + else if (!hexapdu + || !strcmp (hexapdu, "undefined") + || !strcmp (hexapdu, "reset-keep-lock") + || !strcmp (hexapdu, "lock") + || !strcmp (hexapdu, "trylock") + || !strcmp (hexapdu, "unlock")) + ; /* Ignore pseudo APDUs. */ else if (ignore == 0xffff) ; /* Ignore all status words. */ else if (sw != 0x9000) |