diff options
author | Werner Koch <[email protected]> | 2023-05-26 09:59:46 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2023-05-26 09:59:46 +0000 |
commit | 13013ec1c0d308b5d22f176f3850840cbbf21f05 (patch) | |
tree | c4758ca5e39b1f5ab3d82917cad82ffee0e43f7d /agent/command.c | |
parent | common: New function nve_set (diff) | |
download | gnupg-13013ec1c0d308b5d22f176f3850840cbbf21f05.tar.gz gnupg-13013ec1c0d308b5d22f176f3850840cbbf21f05.zip |
agent: Create and use Token entries to track the display s/n.
* agent/findkey.c (agent_write_private_key): Add arg dispserialno and
update the token.
(agent_write_shadow_key): Add arg dispserialno and adjust all callers.
--
GnuPG-bug-id: 6135
Note that this has been forward ported from 2.2
Diffstat (limited to 'agent/command.c')
-rw-r--r-- | agent/command.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/agent/command.c b/agent/command.c index dd7cb5e57..b7a71cbe5 100644 --- a/agent/command.c +++ b/agent/command.c @@ -1359,7 +1359,14 @@ cmd_readkey (assuan_context_t ctx, char *line) if (agent_key_available (grip)) { /* (Shadow)-key is not available in our key storage. */ - rc = agent_write_shadow_key (grip, serialno, keyid, pkbuf, 0); + char *dispserialno; + char hexgrip[40+1]; + + bin2hex (grip, 20, hexgrip); + agent_card_getattr (ctrl, "$DISPSERIALNO", &dispserialno, hexgrip); + rc = agent_write_shadow_key (grip, serialno, keyid, pkbuf, 0, + dispserialno); + xfree (dispserialno); if (rc) goto leave; } @@ -2916,11 +2923,11 @@ cmd_import_key (assuan_context_t ctx, char *line) ctrl->s2k_count); if (!err) err = agent_write_private_key (grip, finalkey, finalkeylen, force, - NULL, NULL, opt_timestamp); + NULL, NULL, NULL, opt_timestamp); } else - err = agent_write_private_key (grip, key, realkeylen, force, NULL, NULL, - opt_timestamp); + err = agent_write_private_key (grip, key, realkeylen, force, + NULL, NULL, NULL, opt_timestamp); leave: gcry_sexp_release (openpgp_sexp); |