summaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-12-15 17:38:40 +0100
committerWerner Koch <wk@gnupg.org>2014-12-15 17:38:40 +0100
commitdd65e21cb4934b40e6f2f7a8095f39fd6d9971bc (patch)
tree789d4242e852d337de44a0195badb5e577a1ccae /scd
parentgpg: Fix regression in notation data regression. (diff)
downloadgnupg2-dd65e21cb4934b40e6f2f7a8095f39fd6d9971bc.tar.xz
gnupg2-dd65e21cb4934b40e6f2f7a8095f39fd6d9971bc.zip
gpg: Add sub-command "factory-reset" to --card-edit.
* common/util.h (GPG_ERR_OBJ_TERM_STATE): New. * scd/iso7816.c (map_sw): Add this error code. * scd/app-openpgp.c (do_getattr): Return the life cycle indicator. * scd/app.c (select_application): Allow a return value of GPG_ERR_OBJ_TERM_STATE. * scd/scdaemon.c (set_debug): Print the DBG_READER value. * g10/call-agent.c (start_agent): Print a status line for the termination state. (agent_scd_learn): Make arg "info" optional. (agent_scd_apdu): New. * g10/card-util.c (send_apdu): New. (factory_reset): New. (card_edit): Add command factory-reset. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'scd')
-rw-r--r--scd/apdu.h2
-rw-r--r--scd/app-openpgp.c7
-rw-r--r--scd/app.c2
-rw-r--r--scd/iso7816.c2
-rw-r--r--scd/scdaemon.c5
5 files changed, 10 insertions, 8 deletions
diff --git a/scd/apdu.h b/scd/apdu.h
index 2e518b1b6..7e30f761b 100644
--- a/scd/apdu.h
+++ b/scd/apdu.h
@@ -53,7 +53,7 @@ enum {
SW_CLA_NOT_SUP = 0x6e00,
SW_SUCCESS = 0x9000,
- /* The follwoing statuswords are no real ones but used to map host
+ /* The following statuswords are no real ones but used to map host
OS errors into status words. A status word is 16 bit so that
those values can't be issued by a card. */
SW_HOST_OUT_OF_CORE = 0x10001, /* No way yet to differentiate
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index ac290c9ac..daf0310e8 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -1073,10 +1073,10 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
}
if (table[idx].special == -2)
{
- char tmp[100];
+ char tmp[110];
snprintf (tmp, sizeof tmp,
- "gc=%d ki=%d fc=%d pd=%d mcl3=%u aac=%d sm=%d",
+ "gc=%d ki=%d fc=%d pd=%d mcl3=%u aac=%d sm=%d si=%u",
app->app_local->extcap.get_challenge,
app->app_local->extcap.key_import,
app->app_local->extcap.change_force_chv,
@@ -1085,7 +1085,8 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
app->app_local->extcap.algo_attr_change,
(app->app_local->extcap.sm_supported
? (app->app_local->extcap.sm_aes128? 7 : 2)
- : 0));
+ : 0),
+ app->app_local->status_indicator);
send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0);
return 0;
}
diff --git a/scd/app.c b/scd/app.c
index 1694ea1c4..5fa06b095 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -389,7 +389,7 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app)
err = app_select_dinsig (app);
if (err && is_app_allowed ("sc-hsm") && (!name || !strcmp (name, "sc-hsm")))
err = app_select_sc_hsm (app);
- if (err && name)
+ if (err && name && gpg_err_code (err) != GPG_ERR_OBJ_TERM_STATE)
err = gpg_error (GPG_ERR_NOT_SUPPORTED);
leave:
diff --git a/scd/iso7816.c b/scd/iso7816.c
index f1dbcffe4..3c43a4c81 100644
--- a/scd/iso7816.c
+++ b/scd/iso7816.c
@@ -64,7 +64,7 @@ map_sw (int sw)
switch (sw)
{
case SW_EEPROM_FAILURE: ec = GPG_ERR_HARDWARE; break;
- case SW_TERM_STATE: ec = GPG_ERR_CARD; break;
+ case SW_TERM_STATE: ec = GPG_ERR_OBJ_TERM_STATE; break;
case SW_WRONG_LENGTH: ec = GPG_ERR_INV_VALUE; break;
case SW_SM_NOT_SUP: ec = GPG_ERR_NOT_SUPPORTED; break;
case SW_CC_NOT_SUP: ec = GPG_ERR_NOT_SUPPORTED; break;
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 763ce2d90..7c786c2c4 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -344,7 +344,7 @@ set_debug (const char *level)
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
if (opt.debug)
- log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s\n",
+ log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s%s\n",
(opt.debug & DBG_COMMAND_VALUE)? " command":"",
(opt.debug & DBG_MPI_VALUE )? " mpi":"",
(opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
@@ -353,7 +353,8 @@ set_debug (const char *level)
(opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
(opt.debug & DBG_HASHING_VALUE)? " hashing":"",
(opt.debug & DBG_ASSUAN_VALUE )? " assuan":"",
- (opt.debug & DBG_CARD_IO_VALUE)? " cardio":"");
+ (opt.debug & DBG_CARD_IO_VALUE)? " cardio":"",
+ (opt.debug & DBG_READER_VALUE )? " reader":"");
}