aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-08-10 08:01:03 +0000
committerWerner Koch <[email protected]>2020-08-10 08:22:42 +0000
commitbb096905b9ee1f5175efee1ab6c98045a26a2678 (patch)
treef7d44f717d0cb5657b92a92ce517ab583ddd5895 /agent/command.c
parentgpg: Fix trustdb for v5key. (diff)
downloadgnupg-bb096905b9ee1f5175efee1ab6c98045a26a2678.tar.gz
gnupg-bb096905b9ee1f5175efee1ab6c98045a26a2678.zip
agent: Add option --pss to pksign to be used by smartcards.
* agent/command.c (cmd_sethash): Add option --pss and allow for --hash=null. * agent/agent.h (struct server_control_s): Add digest.is_pss and zero where needed. * agent/pksign.c (agent_pksign_do): Allow for PSS with cards. * scd/command.c (cmd_pksign): Add for --hash=none. -- This is not a full implementaion of PSS but allows scdaemon card drivers to detect already PSS formatted data. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/command.c')
-rw-r--r--agent/command.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/agent/command.c b/agent/command.c
index 2980ae2da..6efde5e28 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -707,11 +707,12 @@ cmd_setkeydesc (assuan_context_t ctx, char *line)
static const char hlp_sethash[] =
"SETHASH (--hash=<name>)|(<algonumber>) <hexstring>]\n"
- "SETHASH --inquire\n"
+ "SETHASH [--pss] --inquire\n"
"\n"
"The client can use this command to tell the server about the data\n"
"(which usually is a hash) to be signed. The option --inquire is\n"
- "used to ask back for to-be-signed data in case of PureEdDSA";
+ "used to ask back for to-be-signed data in case of PureEdDSA or\n"
+ "with --pss for pre-formatted rsaPSS.";
static gpg_error_t
cmd_sethash (assuan_context_t ctx, char *line)
{
@@ -722,7 +723,7 @@ cmd_sethash (assuan_context_t ctx, char *line)
unsigned char *buf;
char *endp;
int algo;
- int opt_inquire;
+ int opt_inquire, opt_pss;
/* Parse the alternative hash options which may be used instead of
the algo number. */
@@ -744,6 +745,8 @@ cmd_sethash (assuan_context_t ctx, char *line)
algo = GCRY_MD_MD5;
else if (has_option (line, "--hash=tls-md5sha1"))
algo = MD_USER_TLS_MD5SHA1;
+ else if (has_option (line, "--hash=none"))
+ algo = 0;
else
{
err = set_error (GPG_ERR_ASS_PARAMETER, "invalid hash algorithm");
@@ -753,6 +756,7 @@ cmd_sethash (assuan_context_t ctx, char *line)
else
algo = 0;
+ opt_pss = has_option (line, "--pss");
opt_inquire = has_option (line, "--inquire");
line = skip_options (line);
@@ -772,6 +776,7 @@ cmd_sethash (assuan_context_t ctx, char *line)
ctrl->digest.data = NULL;
ctrl->digest.algo = algo;
ctrl->digest.raw_value = 0;
+ ctrl->digest.is_pss = opt_pss;
if (opt_inquire)
{
@@ -3807,6 +3812,7 @@ start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd)
ctrl->digest.data = NULL;
ctrl->digest.raw_value = 0;
+ ctrl->digest.is_pss = 0;
assuan_set_io_monitor (ctx, io_monitor, NULL);
agent_set_progress_cb (progress_cb, ctrl);