diff options
author | Werner Koch <[email protected]> | 2017-02-22 08:40:50 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2017-02-22 08:40:50 +0000 |
commit | 78d875a0f83bc046279b951aea76cd74f3c44fd8 (patch) | |
tree | 509767cdcabddb39dd9603813ff492d76f863929 /agent/divert-scd.c | |
parent | tests: No spelling fix for test text. (diff) | |
download | gnupg-78d875a0f83bc046279b951aea76cd74f3c44fd8.tar.gz gnupg-78d875a0f83bc046279b951aea76cd74f3c44fd8.zip |
agent: Prepare to pass an additional parameter to the getpin callback.
* agent/call-scd.c (writekey_parm_s, inq_needpin_s): Merge into ...
(inq_needpin_parm_s): new struct. Add new field 'getpin_cb_desc'.
Change users to set all fields.
(inq_needpin): Pass GETPIN_CB_DESC to the GETPIN_CB.
(agent_card_pksign): Add arg 'desc_text' and change arg 'getpin_cb' to
take an additional arg 'desc_text'.
(agent_card_pkdecrypt): Ditto.
(agent_card_writekey): Change arg 'getpin_cb' to take an additional
arg 'desc_text'.
(agent_card_scd): Ditto.
* agent/divert-scd.c (getpin_cb): Add new arg 'desc_text'.
(divert_pksign): Add new arg 'desc_text' and pass is to
agent_card_pksign.
(divert_pkdecrypt): Add new arg 'desc_text' and pass is to
agent_card_pkdecrypt.
* agent/pkdecrypt.c (agent_pkdecrypt): Pass DESC_TEXT to
divert_pkdecrypt.
* agent/pksign.c (agent_pksign_do): Pass DESC_TEXT to
divert_pksign.
--
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/divert-scd.c')
-rw-r--r-- | agent/divert-scd.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/agent/divert-scd.c b/agent/divert-scd.c index c23c67335..5ffb7ea54 100644 --- a/agent/divert-scd.c +++ b/agent/divert-scd.c @@ -163,6 +163,9 @@ encode_md_for_card (const unsigned char *digest, size_t digestlen, int algo, string with the passphrase, the buffer may optionally be padded with arbitrary characters. + If DESC_TEXT is not NULL it can be used as further informtion shown + atop of the INFO message. + INFO gets displayed as part of a generic string. However if the first character of INFO is a vertical bar all up to the next verical bar are considered flags and only everything after the @@ -185,7 +188,8 @@ encode_md_for_card (const unsigned char *digest, size_t digestlen, int algo, are considered. */ static int -getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf) +getpin_cb (void *opaque, const char *desc_text, const char *info, + char *buf, size_t maxbuf) { struct pin_entry_info_s *pi; int rc; @@ -337,9 +341,13 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf) - +/* This function is used when a sign operation has been diverted to a + * smartcard. DESC_TEXT is the original text for a prompt has send by + * gpg to gpg-agent. + * + * FIXME: Explain the other args. */ int -divert_pksign (ctrl_t ctrl, +divert_pksign (ctrl_t ctrl, const char *desc_text, const unsigned char *digest, size_t digestlen, int algo, const unsigned char *shadow_info, unsigned char **r_sig, size_t *r_siglen) @@ -357,7 +365,7 @@ divert_pksign (ctrl_t ctrl, { int save = ctrl->use_auth_call; ctrl->use_auth_call = 1; - rc = agent_card_pksign (ctrl, kid, getpin_cb, ctrl, + rc = agent_card_pksign (ctrl, kid, getpin_cb, ctrl, desc_text, algo, digest, digestlen, &sigval, &siglen); ctrl->use_auth_call = save; } @@ -369,7 +377,7 @@ divert_pksign (ctrl_t ctrl, rc = encode_md_for_card (digest, digestlen, algo, &data, &ndata); if (!rc) { - rc = agent_card_pksign (ctrl, kid, getpin_cb, ctrl, + rc = agent_card_pksign (ctrl, kid, getpin_cb, ctrl, desc_text, algo, data, ndata, &sigval, &siglen); xfree (data); } @@ -392,7 +400,7 @@ divert_pksign (ctrl_t ctrl, allocated buffer in R_BUF. The padding information is stored at R_PADDING with -1 for not known. */ int -divert_pkdecrypt (ctrl_t ctrl, +divert_pkdecrypt (ctrl_t ctrl, const char *desc_text, const unsigned char *cipher, const unsigned char *shadow_info, char **r_buf, size_t *r_len, int *r_padding) @@ -471,7 +479,7 @@ divert_pkdecrypt (ctrl_t ctrl, if (rc) return rc; - rc = agent_card_pkdecrypt (ctrl, kid, getpin_cb, ctrl, + rc = agent_card_pkdecrypt (ctrl, kid, getpin_cb, ctrl, desc_text, ciphertext, ciphertextlen, &plaintext, &plaintextlen, r_padding); if (!rc) |