diff options
author | Werner Koch <wk@gnupg.org> | 2018-10-24 16:18:27 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2018-10-24 16:18:27 +0200 |
commit | 64a1e86fc06d89c980a196c61d2b6d77d167565e (patch) | |
tree | 9556ec306876f1d0357123d428c16c7ff7660b2d /g10/sig-check.c | |
parent | indent: Modernize g10/sign.c (diff) | |
download | gnupg2-64a1e86fc06d89c980a196c61d2b6d77d167565e.tar.xz gnupg2-64a1e86fc06d89c980a196c61d2b6d77d167565e.zip |
gpg: Unfinished support for v5 signatures.
* g10/parse-packet.c (parse_signature): Allow for v5 signatures.
* g10/sig-check.c (check_signature_end_simple): Support the 64bit v5
byte count.
* g10/sign.c (hash_sigversion_to_magic): Ditto.
(write_signature_packets): Request v5 sig for v5 keys. Remove useless
condition.
(make_keysig_packet): Request v5 sig for v5 keys.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/sig-check.c')
-rw-r--r-- | g10/sig-check.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/g10/sig-check.c b/g10/sig-check.c index 9c32d4d12..6d7f1afbd 100644 --- a/g10/sig-check.c +++ b/g10/sig-check.c @@ -510,7 +510,8 @@ check_signature_end_simple (PKT_public_key *pk, PKT_signature *sig, } else { - byte buf[6]; + byte buf[10]; + int i; size_t n; gcry_md_putc (digest, sig->pubkey_algo); gcry_md_putc (digest, sig->digest_algo); @@ -531,13 +532,21 @@ check_signature_end_simple (PKT_public_key *pk, PKT_signature *sig, n = 6; } /* add some magic per Section 5.2.4 of RFC 4880. */ - buf[0] = sig->version; - buf[1] = 0xff; - buf[2] = n >> 24; - buf[3] = n >> 16; - buf[4] = n >> 8; - buf[5] = n; - gcry_md_write( digest, buf, 6 ); + i = 0; + buf[i++] = sig->version; + buf[i++] = 0xff; + if (sig->version >= 5) + { + buf[i++] = 0; + buf[i++] = 0; + buf[i++] = 0; + buf[i++] = 0; + } + buf[i++] = n >> 24; + buf[i++] = n >> 16; + buf[i++] = n >> 8; + buf[i++] = n; + gcry_md_write (digest, buf, i); } gcry_md_final( digest ); @@ -572,7 +581,7 @@ hash_uid_packet (PKT_user_id *uid, gcry_md_hd_t md, PKT_signature *sig ) { if (uid->attrib_data) { - if (sig->version >=4) + if (sig->version >= 4) { byte buf[5]; buf[0] = 0xd1; /* packet of type 17 */ @@ -586,7 +595,7 @@ hash_uid_packet (PKT_user_id *uid, gcry_md_hd_t md, PKT_signature *sig ) } else { - if (sig->version >=4) + if (sig->version >= 4) { byte buf[5]; buf[0] = 0xb4; /* indicates a userid packet */ |