1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-05 12:31:50 +01:00

agent: Add --another option for hybrid crypto.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2024-03-01 14:45:46 +09:00
parent 3114d16bf2
commit 97f2ee8a4f
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
2 changed files with 15 additions and 4 deletions

View File

@ -274,6 +274,10 @@ struct server_control_s
unsigned char keygrip[20]; unsigned char keygrip[20];
int have_keygrip; 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 /* A flag to enable a hack to send the PKAUTH command instead of the
PKSIGN command to the scdaemon. */ PKSIGN command to the scdaemon. */
int use_auth_call; int use_auth_call;

View File

@ -242,6 +242,7 @@ reset_notify (assuan_context_t ctx, char *line)
memset (ctrl->keygrip, 0, 20); memset (ctrl->keygrip, 0, 20);
ctrl->have_keygrip = 0; ctrl->have_keygrip = 0;
ctrl->have_keygrip1 = 0;
ctrl->digest.valuelen = 0; ctrl->digest.valuelen = 0;
xfree (ctrl->digest.data); xfree (ctrl->digest.data);
ctrl->digest.data = NULL; ctrl->digest.data = NULL;
@ -763,8 +764,8 @@ cmd_havekey (assuan_context_t ctx, char *line)
static const char hlp_sigkey[] = static const char hlp_sigkey[] =
"SIGKEY <hexstring_with_keygrip>\n" "SIGKEY [--another] <hexstring_with_keygrip>\n"
"SETKEY <hexstring_with_keygrip>\n" "SETKEY [--another] <hexstring_with_keygrip>\n"
"\n" "\n"
"Set the key used for a sign or decrypt operation."; "Set the key used for a sign or decrypt operation.";
static gpg_error_t static gpg_error_t
@ -772,11 +773,17 @@ cmd_sigkey (assuan_context_t ctx, char *line)
{ {
int rc; int rc;
ctrl_t ctrl = assuan_get_pointer (ctx); 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) if (rc)
return rc; return rc;
ctrl->have_keygrip = 1; if (opt_another)
ctrl->have_keygrip1 = 1;
else
ctrl->have_keygrip = 1;
return 0; return 0;
} }