diff --git a/scd/app-common.h b/scd/app-common.h index 89467dca7..d0c00df09 100644 --- a/scd/app-common.h +++ b/scd/app-common.h @@ -33,12 +33,26 @@ /* Flags used with app_genkey. */ #define APP_GENKEY_FLAG_FORCE 1 /* Force overwriting existing key. */ +/* Flags used with app_writekey. */ +#define APP_WRITEKEY_FLAG_FORCE 1 /* Force overwriting existing key. */ + +/* Flags used with app_readkey. */ +#define APP_READKEY_FLAG_INFO 1 /* Send also a KEYPAIRINFO line. */ + /* Bit flags set by the decipher function into R_INFO. */ #define APP_DECIPHER_INFO_NOPAD 1 /* Padding has been removed. */ +/* Flags used by the app_write_learn_status. */ +#define APP_LEARN_FLAG_KEYPAIRINFO 1 /* Return only keypair infos. */ +#define APP_LEARN_FLAG_MULTI 2 /* Return info for all apps. */ + +/* Forward declarations. */ +struct app_ctx_s; struct app_local_s; /* Defined by all app-*.c. */ +typedef struct app_ctx_s *app_t; + struct app_ctx_s { struct app_ctx_s *next; @@ -67,6 +81,11 @@ struct app_ctx_s { struct app_local_s *app_local; /* Local to the application. */ struct { void (*deinit) (app_t app); + + /* prep_reselect and reselect are not used in this version of scd. */ + gpg_error_t (*prep_reselect) (app_t app, ctrl_t ctrl); + 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); @@ -116,10 +135,24 @@ struct app_ctx_s { gpg_error_t (*check_pin) (app_t app, const char *keyidstr, gpg_error_t (*pincb)(void*, const char *, char **), void *pincb_arg); + + /* with_keygrip is not used in this version of scd but having it + * makes back porting app-*.c from later versions easier. */ + gpg_error_t (*with_keygrip) (app_t app, ctrl_t ctrl, int action, + const char *keygrip_str, int capability); } fnc; }; +/* Action values for app_do_with_keygrip. */ +enum + { + KEYGRIP_ACTION_SEND_DATA, + KEYGRIP_ACTION_WRITE_STATUS, + KEYGRIP_ACTION_LOOKUP + }; + + /* Helper to get the slot from an APP object. */ static inline int app_get_slot (app_t app) @@ -131,6 +164,10 @@ app_get_slot (app_t app) return -1; } +/* Macro to access members in app_t which are found in 2.3 in a linked + * card_t member. */ +#define APP_CARD(a) (a) + /*-- app-help.c --*/ unsigned int app_help_count_bits (const unsigned char *a, size_t len); diff --git a/scd/app-dinsig.c b/scd/app-dinsig.c index b0c47af9f..74a7fb8ca 100644 --- a/scd/app-dinsig.c +++ b/scd/app-dinsig.c @@ -81,7 +81,6 @@ #include "../common/i18n.h" #include "iso7816.h" -#include "app-common.h" #include "../common/tlv.h" diff --git a/scd/app-geldkarte.c b/scd/app-geldkarte.c index 510beb550..579fb48fa 100644 --- a/scd/app-geldkarte.c +++ b/scd/app-geldkarte.c @@ -39,7 +39,6 @@ #include "../common/i18n.h" #include "iso7816.h" -#include "app-common.h" #include "../common/tlv.h" diff --git a/scd/app-help.c b/scd/app-help.c index 4b8a02461..a54145840 100644 --- a/scd/app-help.c +++ b/scd/app-help.c @@ -24,7 +24,6 @@ #include #include "scdaemon.h" -#include "app-common.h" #include "iso7816.h" #include "../common/tlv.h" diff --git a/scd/app-nks.c b/scd/app-nks.c index 58a5349d5..26227d3ef 100644 --- a/scd/app-nks.c +++ b/scd/app-nks.c @@ -53,7 +53,6 @@ #include "scdaemon.h" #include "../common/i18n.h" #include "iso7816.h" -#include "app-common.h" #include "../common/tlv.h" #include "apdu.h" #include "../common/host2net.h" diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 87d77a15b..55833d876 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -56,7 +56,6 @@ #include "../common/util.h" #include "../common/i18n.h" #include "iso7816.h" -#include "app-common.h" #include "../common/tlv.h" #include "../common/host2net.h" #include "../common/openpgpdefs.h" diff --git a/scd/app-p15.c b/scd/app-p15.c index 9ad0d165b..15c068694 100644 --- a/scd/app-p15.c +++ b/scd/app-p15.c @@ -40,7 +40,6 @@ #include "scdaemon.h" #include "iso7816.h" -#include "app-common.h" #include "../common/i18n.h" #include "../common/tlv.h" #include "apdu.h" /* fixme: we should move the card detection to a diff --git a/scd/app-sc-hsm.c b/scd/app-sc-hsm.c index 352b16c7d..d8d60b20a 100644 --- a/scd/app-sc-hsm.c +++ b/scd/app-sc-hsm.c @@ -33,7 +33,6 @@ #include "scdaemon.h" #include "iso7816.h" -#include "app-common.h" #include "../common/tlv.h" #include "apdu.h" diff --git a/scd/app.c b/scd/app.c index 957345e1e..d10229030 100644 --- a/scd/app.c +++ b/scd/app.c @@ -26,7 +26,6 @@ #include "scdaemon.h" #include "../common/exechelp.h" -#include "app-common.h" #include "iso7816.h" #include "apdu.h" #include "../common/tlv.h" diff --git a/scd/command.c b/scd/command.c index 769113fba..a4557eb50 100644 --- a/scd/command.c +++ b/scd/command.c @@ -33,7 +33,6 @@ #include "scdaemon.h" #include #include -#include "app-common.h" #include "iso7816.h" #include "apdu.h" /* Required for apdu_*_reader (). */ #include "atr.h" diff --git a/scd/scdaemon.c b/scd/scdaemon.c index 5c519f8a0..6db9c1b7d 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -48,7 +48,6 @@ #include "../common/i18n.h" #include "../common/sysutils.h" -#include "app-common.h" #include "iso7816.h" #include "apdu.h" #include "ccid-driver.h" diff --git a/scd/scdaemon.h b/scd/scdaemon.h index bf0afcb0f..900af5b39 100644 --- a/scd/scdaemon.h +++ b/scd/scdaemon.h @@ -30,6 +30,8 @@ #include #include "../common/util.h" #include "../common/sysutils.h" +#include "app-common.h" + /* To convey some special hash algorithms we use algorithm numbers reserved for application use. */ @@ -112,7 +114,6 @@ struct server_control_s } in_data; }; -typedef struct app_ctx_s *app_t; /*-- scdaemon.c --*/ void scd_exit (int rc);