aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-04-01 05:38:51 +0000
committerNIIBE Yutaka <[email protected]>2024-04-01 05:38:51 +0000
commitc69363e8c7b6bb11163c2820e6007f227b5ebb84 (patch)
tree4802fde25a912189ee432b4522c107f4d6a8d229 /agent/command.c
parentcommon: Add KMAC. (diff)
downloadgnupg-c69363e8c7b6bb11163c2820e6007f227b5ebb84.tar.gz
gnupg-c69363e8c7b6bb11163c2820e6007f227b5ebb84.zip
agent: Add --another option for hybrid crypto.
* agent/agent.h (struct server_control_s): Add have_keygrip1. * agent/command.c (reset_notify): Clear have_keygrip1 field. (cmd_havekey): Add --another option handling. -- Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/command.c')
-rw-r--r--agent/command.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/agent/command.c b/agent/command.c
index 575456cc5..5e74381ed 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -241,7 +241,7 @@ reset_notify (assuan_context_t ctx, char *line)
(void) line;
memset (ctrl->keygrip, 0, 20);
- ctrl->have_keygrip = 0;
+ ctrl->have_keygrip = ctrl->have_keygrip1 = 0;
ctrl->digest.valuelen = 0;
xfree (ctrl->digest.data);
ctrl->digest.data = NULL;
@@ -796,8 +796,8 @@ cmd_havekey (assuan_context_t ctx, char *line)
static const char hlp_sigkey[] =
- "SIGKEY <hexstring_with_keygrip>\n"
- "SETKEY <hexstring_with_keygrip>\n"
+ "SIGKEY [--another] <hexstring_with_keygrip>\n"
+ "SETKEY [--another] <hexstring_with_keygrip>\n"
"\n"
"Set the key used for a sign or decrypt operation.";
static gpg_error_t
@@ -805,11 +805,17 @@ cmd_sigkey (assuan_context_t ctx, char *line)
{
int rc;
ctrl_t ctrl = assuan_get_pointer (ctx);
+ int opt_another;
- rc = parse_keygrip (ctx, line, ctrl->keygrip);
+ opt_another = has_option (line, "--another");
+ line = skip_options (line);
+ rc = parse_keygrip (ctx, line, opt_another? ctrl->keygrip1 : ctrl->keygrip);
if (rc)
return rc;
- ctrl->have_keygrip = 1;
+ if (opt_another)
+ ctrl->have_keygrip1 = 1;
+ else
+ ctrl->have_keygrip = 1;
return 0;
}