diff options
author | NIIBE Yutaka <[email protected]> | 2024-03-01 05:45:46 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2024-03-01 05:45:46 +0000 |
commit | 97f2ee8a4f92ff57461dd6da8ab1e3babcac58f4 (patch) | |
tree | dc18b02073f6a8adc85e4c50cc87dc32ade9d354 | |
parent | Experiment to use KEM interface for Curve25519 ECDH. (diff) | |
download | gnupg-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.h | 4 | ||||
-rw-r--r-- | agent/command.c | 15 |
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; } |