aboutsummaryrefslogtreecommitdiffstats
path: root/scd/command.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2021-04-08 17:27:25 +0000
committerWerner Koch <[email protected]>2021-04-08 17:27:25 +0000
commit22fd48e48d007a0cba6c8a8f6ad6cb4fe7470534 (patch)
tree4d916e203de787d18c50476908e4ef1a02d2b0a2 /scd/command.c
parentgpg: Ed448 and X448 are only for v5. (diff)
downloadgnupg-22fd48e48d007a0cba6c8a8f6ad6cb4fe7470534.tar.gz
gnupg-22fd48e48d007a0cba6c8a8f6ad6cb4fe7470534.zip
scd: Fix duplicate output of KEYPAIRINFO by readkey command.
* scd/app-help.c (app_help_get_keygrip_string_pk): Make HEXKEYGRIP parm optional. * scd/command.c (do_readkey): Remove duplicate output of keypairinfo lines. -- Note that this change needs a fix in app-p15 which does not yet handle the APP_READKEY_FLAG_INFO. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/command.c')
-rw-r--r--scd/command.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/scd/command.c b/scd/command.c
index fc1bb0145..11d61648b 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -471,11 +471,11 @@ static const char hlp_learn[] =
"\n"
"For certain cards, more information will be returned:\n"
"\n"
- " S KEY-FPR <no> <hexstring>\n"
+ " S KEY-FPR <keyref> <hexstring>\n"
"\n"
- "For OpenPGP cards this returns the stored fingerprints of the\n"
+ "For some cards this returns the stored fingerprints of the\n"
"keys. This can be used check whether a key is available on the\n"
- "card. NO may be 1, 2 or 3.\n"
+ "card. KEYREF may be 1, 2 or 3 for OpenPGP or a standard keyref.\n"
"\n"
" S CA-FPR <no> <hexstring>\n"
"\n"
@@ -616,19 +616,19 @@ cmd_readcert (assuan_context_t ctx, char *line)
static gpg_error_t
do_readkey (card_t card, ctrl_t ctrl, const char *line,
- int opt_info, int opt_nokey,
- unsigned char **pk_p, size_t *pklen_p)
+ int opt_info, unsigned char **pk_p, size_t *pklen_p)
{
int rc;
+ int direct_readkey = 0;
/* If the application supports the READKEY function we use that.
Otherwise we use the old way by extracting it from the
certificate. */
rc = app_readkey (card, ctrl, line,
opt_info? APP_READKEY_FLAG_INFO : 0,
- opt_nokey? NULL : pk_p, pklen_p);
+ pk_p, pklen_p);
if (!rc)
- ; /* Got the key. */
+ direct_readkey = 1; /* Got the key. */
else if (gpg_err_code (rc) == GPG_ERR_UNSUPPORTED_OPERATION
|| gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
{
@@ -651,7 +651,7 @@ do_readkey (card_t card, ctrl_t ctrl, const char *line,
else
log_error ("app_readkey failed: %s\n", gpg_strerror (rc));
- if (!rc && opt_info)
+ if (!rc && opt_info && !direct_readkey)
{
char keygripstr[KEYGRIP_LEN*2+1];
char *algostr;
@@ -730,7 +730,7 @@ cmd_readkey (assuan_context_t ctx, char *line)
if (direct)
card_ref (card);
- rc = do_readkey (card, ctrl, line, opt_info, opt_nokey, &pk, &pklen);
+ rc = do_readkey (card, ctrl, line, opt_info, &pk, &pklen);
if (direct)
card_unref (card);