diff options
author | Werner Koch <[email protected]> | 2017-02-22 10:04:55 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2017-02-22 10:04:55 +0000 |
commit | 6488ffb767733a2cf92ca5ba3e61fc0c53e0f673 (patch) | |
tree | 155001a4315fee87418e97d87116d2bda66f5abd /agent/pksign.c | |
parent | agent: Prepare to pass an additional parameter to the getpin callback. (diff) | |
download | gnupg-6488ffb767733a2cf92ca5ba3e61fc0c53e0f673.tar.gz gnupg-6488ffb767733a2cf92ca5ba3e61fc0c53e0f673.zip |
agent: Prepend the description to a PIN prompt.
* agent/divert-scd.c (has_percent0A_suffix): New.
(getpin_cb): Prepend DESC_TEXT to the prompt.
* agent/findkey.c (modify_description): Rename to ...
(agent_modify_description): this. MAke global. Add kludge to remove
empty parentheses from the end.
(agent_key_from_file, agent_delete_key): Adjust for above change.
* agent/pksign.c (agent_pksign_do): Modify DESC_TEXT also when
diverting to a card.
--
Now that we have support for multiple tokens, it is important to show
information on which key has been requested. Without that it may
happen that the PIN for a wrong card is accidentally entered.
The texts are a bit ugly, because they talk about "passphrase" but
later about entering a PIN.
A quick hack would be to s/passphrase/PIN/ in the description but that
is complicated due to i18n. Another solution might be never to talk
about PINs in the description but always about "passphrase: and only
use "PIN" or "passphrase" on the left of the entry field.
Diffstat (limited to 'agent/pksign.c')
-rw-r--r-- | agent/pksign.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/agent/pksign.c b/agent/pksign.c index 4a5daedb0..3b2fcc4f5 100644 --- a/agent/pksign.c +++ b/agent/pksign.c @@ -285,7 +285,8 @@ agent_pksign_do (ctrl_t ctrl, const char *cache_nonce, cache_mode_t cache_mode, lookup_ttl_t lookup_ttl, const void *overridedata, size_t overridedatalen) { - gcry_sexp_t s_skey = NULL, s_sig = NULL; + gcry_sexp_t s_skey = NULL; + gcry_sexp_t s_sig = NULL; gcry_sexp_t s_hash = NULL; gcry_sexp_t s_pkey = NULL; unsigned char *shadow_info = NULL; @@ -346,10 +347,18 @@ agent_pksign_do (ctrl_t ctrl, const char *cache_nonce, is_ECDSA = 1; } - rc = divert_pksign (ctrl, desc_text, - data, datalen, - ctrl->digest.algo, - shadow_info, &buf, &len); + { + char *desc2 = NULL; + + if (desc_text) + agent_modify_description (desc_text, NULL, s_skey, &desc2); + + rc = divert_pksign (ctrl, desc2? desc2 : desc_text, + data, datalen, + ctrl->digest.algo, + shadow_info, &buf, &len); + xfree (desc2); + } if (rc) { log_error ("smartcard signing failed: %s\n", gpg_strerror (rc)); |