1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-06-09 17:41:05 +02:00

gpg: Fix regression in notation data regression.

* g10/misc.c (pct_expando): Reorder conditions for clarity.
* g10/sign.c (write_signature_packets): Fix notation data creation.
--

Also re-added the check for signature version > 3.

Reported-by: MFPA
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2014-12-15 09:50:19 +01:00
parent b4e402cb5c
commit fc9a35d2de
2 changed files with 14 additions and 11 deletions

View File

@ -867,23 +867,25 @@ pct_expando(const char *string,struct expando_args *args)
} }
break; break;
case 'p': /* primary pk fingerprint of a sk */ case 'f': /* Fingerprint of key being signed */
case 'f': /* pk fingerprint */ case 'p': /* Fingerprint of the primary key making the signature. */
case 'g': /* sk fingerprint */ case 'g': /* Fingerprint of thge key making the signature. */
{ {
byte array[MAX_FINGERPRINT_LEN]; byte array[MAX_FINGERPRINT_LEN];
size_t len; size_t len;
int i; int i;
if((*(ch+1))=='p' && args->pksk) if ((*(ch+1))=='f' && args->pk)
fingerprint_from_pk (args->pk, array, &len);
else if ((*(ch+1))=='p' && args->pksk)
{ {
if(args->pksk->flags.primary) if(args->pksk->flags.primary)
fingerprint_from_pk (args->pksk, array, &len); fingerprint_from_pk (args->pksk, array, &len);
else if (args->pksk->main_keyid[0] else if (args->pksk->main_keyid[0]
|| args->pksk->main_keyid[1]) || args->pksk->main_keyid[1])
{ {
/* FIXME: Document teh code and check whether /* Not the primary key: Find the fingerprint
it is still needed. */ of the primary key. */
PKT_public_key *pk= PKT_public_key *pk=
xmalloc_clear(sizeof(PKT_public_key)); xmalloc_clear(sizeof(PKT_public_key));
@ -893,11 +895,9 @@ pct_expando(const char *string,struct expando_args *args)
memset (array, 0, (len=MAX_FINGERPRINT_LEN)); memset (array, 0, (len=MAX_FINGERPRINT_LEN));
free_public_key (pk); free_public_key (pk);
} }
else else /* Oops: info about the primary key missing. */
memset(array,0,(len=MAX_FINGERPRINT_LEN)); memset(array,0,(len=MAX_FINGERPRINT_LEN));
} }
else if((*(ch+1))=='f' && args->pk)
fingerprint_from_pk (args->pk, array, &len);
else if((*(ch+1))=='g' && args->pksk) else if((*(ch+1))=='g' && args->pksk)
fingerprint_from_pk (args->pksk, array, &len); fingerprint_from_pk (args->pksk, array, &len);
else else

View File

@ -700,8 +700,11 @@ write_signature_packets (SK_LIST sk_list, IOBUF out, gcry_md_hd_t hash,
if (gcry_md_copy (&md, hash)) if (gcry_md_copy (&md, hash))
BUG (); BUG ();
build_sig_subpkt_from_sig (sig); if (sig->version >= 4)
mk_notation_policy_etc (sig, pk, NULL); {
build_sig_subpkt_from_sig (sig);
mk_notation_policy_etc (sig, NULL, pk);
}
hash_sigversion_to_magic (md, sig); hash_sigversion_to_magic (md, sig);
gcry_md_final (md); gcry_md_final (md);