mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-12 21:58:50 +01:00
Fix PKSIGN to get data by EXTRA.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
18a4002eab
commit
84dd9cf6c3
@ -264,12 +264,17 @@ cmd_readkey (assuan_context_t ctx, char *line)
|
||||
gpg_error_t err;
|
||||
const char *keygrip;
|
||||
|
||||
line = xtrystrdup (line); /* Need a copy of the line. */
|
||||
if (!line)
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
keygrip = skip_options (line);
|
||||
if (strlen (keygrip) != 40)
|
||||
err = gpg_error (GPG_ERR_INV_ID);
|
||||
|
||||
err = tkd_readkey (ctrl, ctx, keygrip);
|
||||
|
||||
xfree (line);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -300,6 +305,10 @@ cmd_pksign (assuan_context_t ctx, char *line)
|
||||
else
|
||||
return set_error (GPG_ERR_ASS_PARAMETER, "invalid hash algorithm");
|
||||
|
||||
line = xtrystrdup (line); /* Need a copy of the line. */
|
||||
if (!line)
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
keygrip = skip_options (line);
|
||||
|
||||
if (strlen (keygrip) != 40)
|
||||
@ -316,6 +325,7 @@ cmd_pksign (assuan_context_t ctx, char *line)
|
||||
xfree (outdata);
|
||||
}
|
||||
|
||||
xfree (line);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -373,6 +383,10 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
|
||||
|
||||
opt_data = has_option (line, "--data");
|
||||
|
||||
line = xtrystrdup (line); /* Need a copy of the line. */
|
||||
if (!line)
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
cap = 0;
|
||||
if (has_option (line, "--list"))
|
||||
cap = 0;
|
||||
@ -387,6 +401,7 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
|
||||
|
||||
err = tkd_keyinfo (ctrl, ctx, keygrip, opt_data, cap);
|
||||
|
||||
xfree (line);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -280,6 +280,7 @@ compute_keygrip_rsa (char *keygrip, gcry_sexp_t *r_pubkey,
|
||||
else
|
||||
{
|
||||
bin2hex (grip, 20, keygrip);
|
||||
log_debug ("keygrip: %s\n", keygrip);
|
||||
*r_pubkey = s_pkey;
|
||||
}
|
||||
}
|
||||
@ -302,6 +303,7 @@ compute_keygrip_ec (char *keygrip, gcry_sexp_t *r_pubkey,
|
||||
else
|
||||
{
|
||||
bin2hex (grip, 20, keygrip);
|
||||
log_debug ("keygrip: %s\n", keygrip);
|
||||
*r_pubkey = s_pkey;
|
||||
}
|
||||
}
|
||||
@ -731,6 +733,8 @@ find_key (struct cryptoki *ck, const char *keygrip, struct key **r_key)
|
||||
int i;
|
||||
int j;
|
||||
|
||||
log_debug ("find_key: %s\n", keygrip);
|
||||
|
||||
*r_key = NULL;
|
||||
for (i = 0; i < ck->num_slots; i++)
|
||||
{
|
||||
@ -1271,7 +1275,7 @@ tkd_sign (ctrl_t ctrl, assuan_context_t ctx,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
cmd = "VALUE";
|
||||
cmd = "EXTRA";
|
||||
err = assuan_inquire (ctx, cmd, &value, &valuelen, MAXLEN_VALUE);
|
||||
if (err)
|
||||
{
|
||||
@ -1287,6 +1291,7 @@ tkd_sign (ctrl_t ctrl, assuan_context_t ctx,
|
||||
xfree (sig);
|
||||
return err;
|
||||
}
|
||||
|
||||
*r_outdata = sig;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user