aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2019-04-25 05:49:49 +0000
committerNIIBE Yutaka <[email protected]>2019-04-25 05:49:49 +0000
commit874bc970ba6ec243ff474ef090242e0f7be6a7bc (patch)
treeb4c9814832ad8a1438ed708616a0c6671a05480f /scd/app.c
parentpo: Update Japanese Translation. (diff)
downloadgnupg-874bc970ba6ec243ff474ef090242e0f7be6a7bc.tar.gz
gnupg-874bc970ba6ec243ff474ef090242e0f7be6a7bc.zip
scd: Add new command: KEYINFO.
* scd/app-common.h (struct app_ctx_s): Add with_keygrip function. * scd/app-openpgp.c (do_with_keygrip): New. * scd/app.c (app_do_with_keygrip): New. * scd/command.c (cmd_keyinfo): New. (send_keyinfo): New. -- KEYGRIP_ACTION_LOOKUP is not yet used. It will be used for directly asking PK* action to determine an APP. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/app.c')
-rw-r--r--scd/app.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/scd/app.c b/scd/app.c
index 1f3808fd4..4fe60cbbb 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -1290,3 +1290,24 @@ app_send_card_list (ctrl_t ctrl)
}
npth_mutex_unlock (&app_list_lock);
}
+
+/* Execute an action for each app. ACTION can be one of:
+ KEYGRIP_ACTION_SEND_DATA: send data if KEYGRIP_STR matches
+ KEYGRIP_ACTION_WRITE_STATUS: write status if KEYGRIP_STR matches
+ KEYGRIP_ACTION_LOOKUP: Return matching APP
+ */
+app_t
+app_do_with_keygrip (ctrl_t ctrl, int action, const char *keygrip_str)
+{
+ app_t a;
+
+ npth_mutex_lock (&app_list_lock);
+
+ for (a = app_top; a; a = a->next)
+ if (a->fnc.with_keygrip
+ && !a->fnc.with_keygrip (a, ctrl, action, keygrip_str))
+ break;
+
+ npth_mutex_unlock (&app_list_lock);
+ return a;
+}