1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-01 16:33:02 +01:00

Fixed nasty Hash bug

This commit is contained in:
Werner Koch 2001-03-28 21:20:39 +00:00
parent f0b82cd352
commit ec742b7f58
11 changed files with 72 additions and 37 deletions

4
NEWS
View File

@ -34,6 +34,10 @@
* Keyserver support for the W32 version.
* Corrected hash calculation for some inputs greater than 512M - it
was just wrong, so you might notice bad signature in some very
big files. It may be wise to keep an old copy of GnuPG around.
Noteworthy changes in version 1.0.4 (2000-10-17)
------------------------------------------------

1
THANKS
View File

@ -165,6 +165,7 @@ Werner Koch wk@gnupg.org
Wim Vandeputte bunbun@reptile.rug.ac.be
Yosiaki IIDA iida@ring.gr.jp
Yoshihiro Kajiki kajiki@ylug.org
disastry@saiknes.lv
nbecker@hns.com
Thanks to the German Unix User Group for providing FTP space,

View File

@ -1 +1 @@
1.0.4f
1.0.4g

View File

@ -1,3 +1,12 @@
2001-03-28 Werner Koch <wk@gnupg.org>
* md5.c (md5_final): Fixed calculation of hashed length. Thanks
to disastry@saiknes.lv for pointing out that it was horrible wrong
for more than 512MB of input.
* sha1.c (sha1_final): Ditto.
* rmd160.c (rmd160_final): Ditto.
* tiger.c (tiger_final): Ditto.
2001-03-19 Werner Koch <wk@gnupg.org>
* blowfish.c (encrypt,do_encrypt): Changed name to do_encrypt to

View File

@ -258,18 +258,19 @@ md5_final( MD5_CONTEXT *hd )
md5_write(hd, NULL, 0); /* flush */;
msb = 0;
t = hd->nblocks;
if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */
msb++;
msb += t >> 26;
/* multiply by 64 to make a byte count */
lsb = t << 6;
msb = t >> 26;
/* add the count */
t = lsb;
if( (lsb = t + hd->count) < t ) /* add the count */
if( (lsb += hd->count) < t )
msb++;
/* multiply by 8 to make a bit count */
t = lsb;
if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */
msb++;
msb += t >> 29;
lsb <<= 3;
msb <<= 3;
msb |= t >> 29;
if( hd->count < 56 ) { /* enough room */
hd->buf[hd->count++] = 0x80; /* pad */

View File

@ -461,18 +461,19 @@ rmd160_final( RMD160_CONTEXT *hd )
rmd160_write(hd, NULL, 0); /* flush */;
msb = 0;
t = hd->nblocks;
if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */
msb++;
msb += t >> 26;
/* multiply by 64 to make a byte count */
lsb = t << 6;
msb = t >> 26;
/* add the count */
t = lsb;
if( (lsb = t + hd->count) < t ) /* add the count */
if( (lsb += hd->count) < t )
msb++;
/* multiply by 8 to make a bit count */
t = lsb;
if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */
msb++;
msb += t >> 29;
lsb <<= 3;
msb <<= 3;
msb |= t >> 29;
if( hd->count < 56 ) { /* enough room */
hd->buf[hd->count++] = 0x80; /* pad */

View File

@ -254,18 +254,19 @@ sha1_final(SHA1_CONTEXT *hd)
sha1_write(hd, NULL, 0); /* flush */;
msb = 0;
t = hd->nblocks;
if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */
msb++;
msb += t >> 26;
/* multiply by 64 to make a byte count */
lsb = t << 6;
msb = t >> 26;
/* add the count */
t = lsb;
if( (lsb = t + hd->count) < t ) /* add the count */
if( (lsb += hd->count) < t )
msb++;
/* multiply by 8 to make a bit count */
t = lsb;
if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */
msb++;
msb += t >> 29;
lsb <<= 3;
msb <<= 3;
msb |= t >> 29;
if( hd->count < 56 ) { /* enough room */
hd->buf[hd->count++] = 0x80; /* pad */

View File

@ -805,18 +805,19 @@ tiger_final( TIGER_CONTEXT *hd )
tiger_write(hd, NULL, 0); /* flush */;
msb = 0;
t = hd->nblocks;
if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */
msb++;
msb += t >> 26;
/* multiply by 64 to make a byte count */
lsb = t << 6;
msb = t >> 26;
/* add the count */
t = lsb;
if( (lsb = t + hd->count) < t ) /* add the count */
if( (lsb += hd->count) < t )
msb++;
/* multiply by 8 to make a bit count */
t = lsb;
if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */
msb++;
msb += t >> 29;
lsb <<= 3;
msb <<= 3;
msb |= t >> 29;
if( hd->count < 56 ) { /* enough room */
hd->buf[hd->count++] = 0x01; /* pad */

View File

@ -1,3 +1,10 @@
2001-03-28 Werner Koch <wk@gnupg.org>
* mainproc.c (do_check_sig): Allow direct key and subkey
revocation signature.
* sig-check.c (check_key_signature2): Check direct key signatures.
Print the signature class along with an error.
2001-03-27 Werner Koch <wk@gnupg.org>
* packet.h: Add a missing typedef to an enum. Thanks to Stefan Bellon.

View File

@ -609,8 +609,10 @@ do_check_sig( CTX c, KBNODE node, int *is_selfsig )
}
else if( (sig->sig_class&~3) == 0x10
|| sig->sig_class == 0x18
|| sig->sig_class == 0x1f
|| sig->sig_class == 0x20
|| sig->sig_class == 0x30 ) { /* classes 0x10..0x17,0x20,0x30 */
|| sig->sig_class == 0x28
|| sig->sig_class == 0x30 ) {
if( c->list->pkt->pkttype == PKT_PUBLIC_KEY
|| c->list->pkt->pkttype == PKT_PUBLIC_SUBKEY ) {
return check_key_signature( c->list, node, is_selfsig );

View File

@ -550,7 +550,7 @@ check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
rc = G10ERR_SIG_CLASS;
}
}
else if( sig->sig_class == 0x18 ) {
else if( sig->sig_class == 0x18 ) { /* key binding */
KBNODE snode = find_prev_kbnode( root, node, PKT_PUBLIC_SUBKEY );
if( snode ) {
@ -573,7 +573,14 @@ check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
rc = G10ERR_SIG_CLASS;
}
}
else {
else if( sig->sig_class == 0x1f ) { /* direct key signature */
md = md_open( algo, 0 );
hash_public_key( md, pk );
rc = do_check( pk, sig, md, r_expired );
cache_selfsig_result ( sig, rc );
md_close(md);
}
else { /* all other classes */
KBNODE unode = find_prev_kbnode( root, node, PKT_USER_ID );
if( unode ) {
@ -595,7 +602,8 @@ check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
md_close(md);
}
else {
log_error("no user ID for key signature packet\n");
log_error("no user ID for key signature packet of class %02x\n",
sig->sig_class );
rc = G10ERR_SIG_CLASS;
}
}