mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpg: Fix v5 signature for clearsign.
* g10/sign.c (clearsign_file): Prepare EXTRAHASH. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
90a5b4e648
commit
14ef703ad6
20
g10/sign.c
20
g10/sign.c
@ -1394,6 +1394,7 @@ clearsign_file (ctrl_t ctrl,
|
|||||||
SK_LIST sk_list = NULL;
|
SK_LIST sk_list = NULL;
|
||||||
SK_LIST sk_rover = NULL;
|
SK_LIST sk_rover = NULL;
|
||||||
u32 duration = 0;
|
u32 duration = 0;
|
||||||
|
pt_extra_hash_data_t extrahash = NULL;
|
||||||
|
|
||||||
pfx = new_progress_context ();
|
pfx = new_progress_context ();
|
||||||
afx = new_armor_context ();
|
afx = new_armor_context ();
|
||||||
@ -1502,9 +1503,23 @@ clearsign_file (ctrl_t ctrl,
|
|||||||
afx->what = 2;
|
afx->what = 2;
|
||||||
push_armor_filter (afx, out);
|
push_armor_filter (afx, out);
|
||||||
|
|
||||||
|
/* Prepare EXTRAHASH, so that it can be used for v5 signature. */
|
||||||
|
extrahash = xtrymalloc (sizeof extrahash);
|
||||||
|
if (!extrahash)
|
||||||
|
{
|
||||||
|
rc = gpg_error_from_syserror ();
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
extrahash->mode = 't';
|
||||||
|
extrahash->timestamp = 0;
|
||||||
|
extrahash->namelen = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Write the signatures. */
|
/* Write the signatures. */
|
||||||
rc = write_signature_packets (ctrl, sk_list, out, textmd, NULL, 0x01, 0,
|
rc = write_signature_packets (ctrl, sk_list, out, textmd, extrahash,
|
||||||
duration, 'C', NULL);
|
0x01, 0, duration, 'C', NULL);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
@ -1518,6 +1533,7 @@ clearsign_file (ctrl_t ctrl,
|
|||||||
release_sk_list (sk_list);
|
release_sk_list (sk_list);
|
||||||
release_progress_context (pfx);
|
release_progress_context (pfx);
|
||||||
release_armor_context (afx);
|
release_armor_context (afx);
|
||||||
|
xfree (extrahash);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user