diff options
author | David Shaw <[email protected]> | 2003-02-04 19:33:09 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2003-02-04 19:33:09 +0000 |
commit | f523e53d4e7a59feabf3873f39291061aff9e8d5 (patch) | |
tree | 0ac23fb15a502fcdef33131da70908df8dd34a70 /g10/armor.c | |
parent | * sha256.c, sha512.c: New. (diff) | |
download | gnupg-f523e53d4e7a59feabf3873f39291061aff9e8d5.tar.gz gnupg-f523e53d4e7a59feabf3873f39291061aff9e8d5.zip |
* armor.c (parse_hash_header, armor_filter): Accept the new SHAs in the
armor Hash: header.
* g10.c (print_hex): Print long hash strings a little neater. (print_mds):
Add the new SHAs to the hash list.
Diffstat (limited to 'g10/armor.c')
-rw-r--r-- | g10/armor.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/g10/armor.c b/g10/armor.c index 70d4d5aac..8383345c2 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -252,6 +252,12 @@ parse_hash_header( const char *line ) found |= 8; else if( !strncmp( s, "TIGER", s2-s ) ) /* used by old versions */ found |= 8; + else if( !strncmp( s, "SHA256", s2-s ) ) + found |= 16; + else if( !strncmp( s, "SHA384", s2-s ) ) + found |= 32; + else if( !strncmp( s, "SHA512", s2-s ) ) + found |= 64; else return 0; for(; *s2 && (*s2==' ' || *s2 == '\t'); s2++ ) @@ -858,7 +864,7 @@ armor_filter( void *opaque, int control, rc = -1; } else if( afx->faked ) { - unsigned int hashes = afx->hashes; + unsigned int hashes = afx->hashes; const byte *sesmark; size_t sesmarklen; @@ -869,7 +875,7 @@ armor_filter( void *opaque, int control, /* the buffer is at least 15+n*15 bytes long, so it * is easy to construct the packets */ - hashes &= 1|2|4|8; + hashes &= 1|2|4|8|16|32|64; if( !hashes ) { hashes |= 4; /* default to MD 5 */ /* This is non-ideal since PGP 5-8 have the same @@ -885,14 +891,20 @@ armor_filter( void *opaque, int control, memcpy(buf+n, sesmark, sesmarklen ); n+= sesmarklen; buf[n++] = CTRLPKT_CLEARSIGN_START; buf[n++] = afx->not_dash_escaped? 0:1; /* sigclass */ - if( hashes & 1 ) + if( hashes & 1 ) buf[n++] = DIGEST_ALGO_RMD160; - if( hashes & 2 ) + if( hashes & 2 ) buf[n++] = DIGEST_ALGO_SHA1; - if( hashes & 4 ) + if( hashes & 4 ) buf[n++] = DIGEST_ALGO_MD5; - if( hashes & 8 ) + if( hashes & 8 ) buf[n++] = DIGEST_ALGO_TIGER; + if( hashes & 16 ) + buf[n++] = DIGEST_ALGO_SHA256; + if( hashes & 32 ) + buf[n++] = DIGEST_ALGO_SHA384; + if( hashes & 64 ) + buf[n++] = DIGEST_ALGO_SHA512; buf[1] = n - 2; /* followed by a plaintext packet */ |