aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-03-01 05:45:46 +0000
committerNIIBE Yutaka <[email protected]>2024-03-01 05:45:46 +0000
commit97f2ee8a4f92ff57461dd6da8ab1e3babcac58f4 (patch)
treedc18b02073f6a8adc85e4c50cc87dc32ade9d354
parentExperiment to use KEM interface for Curve25519 ECDH. (diff)
downloadgnupg-97f2ee8a4f92ff57461dd6da8ab1e3babcac58f4.tar.gz
gnupg-97f2ee8a4f92ff57461dd6da8ab1e3babcac58f4.zip
agent: Add --another option for hybrid crypto.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--agent/agent.h4
-rw-r--r--agent/command.c15
2 files changed, 15 insertions, 4 deletions
diff --git a/agent/agent.h b/agent/agent.h
index e283398fe..1e3bf82b6 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -274,6 +274,10 @@ struct server_control_s
unsigned char keygrip[20];
int have_keygrip;
+ /* Another keygrip for hybrid crypto. */
+ unsigned char keygrip1[20];
+ int have_keygrip1;
+
/* A flag to enable a hack to send the PKAUTH command instead of the
PKSIGN command to the scdaemon. */
int use_auth_call;
diff --git a/agent/command.c b/agent/command.c
index 7bf161031..e2037dead 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -242,6 +242,7 @@ reset_notify (assuan_context_t ctx, char *line)
memset (ctrl->keygrip, 0, 20);
ctrl->have_keygrip = 0;
+ ctrl->have_keygrip1 = 0;
ctrl->digest.valuelen = 0;
xfree (ctrl->digest.data);
ctrl->digest.data = NULL;
@@ -763,8 +764,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
@@ -772,11 +773,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");
+
+ 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;
}