aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-common.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-06-25 06:30:04 +0000
committerWerner Koch <[email protected]>2019-06-25 07:21:14 +0000
commitd803b3bb3c084b6bce4d2bd161db50dc45442e5b (patch)
treef316cf0e99db9629dc24de46212efe5e69fc7408 /scd/app-common.h
parentspelling: Fix "synchronize" (diff)
downloadgnupg-d803b3bb3c084b6bce4d2bd161db50dc45442e5b.tar.gz
gnupg-d803b3bb3c084b6bce4d2bd161db50dc45442e5b.zip
scd: Add an re-select mechanism to switch apps.
* scd/app-common.h (struct app_ctx_s): Add func ptr 'reselect'. * scd/app-piv.c (do_reselect): New. (app_select_piv): Move AID constant to file scope. * scd/app-openpgp.c (do_reselect): New. (app_select_openpgp): Move AID constant to file scope. * scd/app.c (apptype_from_name): New. (check_application_conflict): Check against all apps of the card. Always set current_apptype. (select_additional_application): New. (maybe_switch_app): New. (app_write_learn_status, app_readcert, app_readkey, app_getattr) (app_setattr, app_sign, app_auth, app_decipher, app_writecert) (app_writekey, app_genkey, app_change_pin, app_check_pin): Use it here. (app_do_with_keygrip): Force reselect on success. (app_new_register): Move setting of CURRENT_APPTYPE to ... (select_application): here so that it will be set to the requested card. * scd/command.c (open_card_with_request): Select additional application if possible. -- Noet that we will likely need to rework this even more so to get well defined semantics for card access. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/app-common.h')
-rw-r--r--scd/app-common.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/scd/app-common.h b/scd/app-common.h
index a13623fde..97b9b39ef 100644
--- a/scd/app-common.h
+++ b/scd/app-common.h
@@ -132,6 +132,7 @@ struct app_ctx_s {
struct app_local_s *app_local; /* Local to the application. */
struct {
void (*deinit) (app_t app);
+ gpg_error_t (*reselect) (app_t app, ctrl_t ctrl);
gpg_error_t (*learn_status) (app_t app, ctrl_t ctrl, unsigned int flags);
gpg_error_t (*readcert) (app_t app, const char *certid,
unsigned char **cert, size_t *certlen);
@@ -233,6 +234,7 @@ gpg_error_t card_reset (card_t card, ctrl_t ctrl, int send_reset);
gpg_error_t select_application (ctrl_t ctrl, const char *name, card_t *r_app,
int scan, const unsigned char *serialno_bin,
size_t serialno_bin_len);
+gpg_error_t select_additional_application (ctrl_t ctrl, const char *name);
char *get_supported_applications (void);
card_t card_ref (card_t card);