diff options
author | NIIBE Yutaka <[email protected]> | 2019-05-15 06:53:35 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2019-05-15 08:13:32 +0000 |
commit | 1091f22511e1a8259eb5c998f5c207ee95723a4a (patch) | |
tree | d95561f015aae5be609189ab24f4f1ef6b920a7b /agent/agent.h | |
parent | scd: Don't put newline at the end of status. (diff) | |
download | gnupg-1091f22511e1a8259eb5c998f5c207ee95723a4a.tar.gz gnupg-1091f22511e1a8259eb5c998f5c207ee95723a4a.zip |
agent: Support scdaemon operation using KEYGRIP.
* agent/agent.h (struct card_key_info_s): New.
(divert_pksign, divert_pkdecrypt): New API.
* agent/call-scd.c (card_keyinfo_cb): New.
(agent_card_free_keyinfo, agent_card_keyinfo): New.
* agent/divert-scd.c (ask_for_card): Having GRIP argument,
ask scdaemon with agent_card_keyinfo.
(divert_pksign, divert_pkdecrypt): Ditto.
* agent/pkdecrypt.c (agent_pkdecrypt): Supply GRIP.
* agent/pksign.c (agent_pksign_do): Ditto.
--
We are going to relax the requirment for SERIALNO of card. It's OK,
when a card doesn't have recorded SERIALNO. If a card has a key
with GRIP, it can be used.
GnuPG-bug-id: 2291, 4301
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/agent.h')
-rw-r--r-- | agent/agent.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/agent/agent.h b/agent/agent.h index b7eacf471..77672bd50 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -361,6 +361,15 @@ typedef int (*lookup_ttl_t)(const char *hexgrip); #endif +/* Information from scdaemon for card keys. */ +struct card_key_info_s +{ + struct card_key_info_s *next; + char keygrip[40]; + char *serialno; + char *idstr; +}; + /*-- gpg-agent.c --*/ void agent_exit (int rc) GPGRT_ATTR_NORETURN; /* Also implemented in other tools */ @@ -544,10 +553,12 @@ void agent_reload_trustlist (void); /*-- divert-scd.c --*/ int divert_pksign (ctrl_t ctrl, const char *desc_text, + const unsigned char *grip, const unsigned char *digest, size_t digestlen, int algo, const unsigned char *shadow_info, unsigned char **r_sig, size_t *r_siglen); int divert_pkdecrypt (ctrl_t ctrl, const char *desc_text, + const unsigned char *grip, const unsigned char *cipher, const unsigned char *shadow_info, char **r_buf, size_t *r_len, int *r_padding); @@ -604,6 +615,9 @@ int agent_card_scd (ctrl_t ctrl, const char *cmdline, int (*getpin_cb)(void *, const char *, const char *, char*, size_t), void *getpin_cb_arg, void *assuan_context); +void agent_card_free_keyinfo (struct card_key_info_s *l); +gpg_error_t agent_card_keyinfo (ctrl_t ctrl, const char *keygrip, + struct card_key_info_s **result); /*-- learncard.c --*/ |