aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2001-03-28 21:20:39 +0000
committerWerner Koch <[email protected]>2001-03-28 21:20:39 +0000
commitec742b7f586c3ff2ee535bae26591475c2f7d1c8 (patch)
treedc02e01f796b86cb643edc97f121439da6d0f274
parenta second snapshot thsi day (1.0.4f) (diff)
downloadgnupg-ec742b7f586c3ff2ee535bae26591475c2f7d1c8.tar.gz
gnupg-ec742b7f586c3ff2ee535bae26591475c2f7d1c8.zip
Fixed nasty Hash bug
-rw-r--r--NEWS4
-rw-r--r--THANKS1
-rw-r--r--VERSION2
-rw-r--r--cipher/ChangeLog9
-rw-r--r--cipher/md5.c17
-rw-r--r--cipher/rmd160.c17
-rw-r--r--cipher/sha1.c17
-rw-r--r--cipher/tiger.c17
-rw-r--r--g10/ChangeLog7
-rw-r--r--g10/mainproc.c4
-rw-r--r--g10/sig-check.c14
11 files changed, 72 insertions, 37 deletions
diff --git a/NEWS b/NEWS
index b593f2282..c12315b76 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
------------------------------------------------
diff --git a/THANKS b/THANKS
index d80c2575f..5e340829b 100644
--- a/THANKS
+++ b/THANKS
@@ -165,6 +165,7 @@ Werner Koch [email protected]
Wim Vandeputte [email protected]
Yosiaki IIDA [email protected]
Yoshihiro Kajiki [email protected]
Thanks to the German Unix User Group for providing FTP space,
diff --git a/VERSION b/VERSION
index 18608ea8d..52bed12f0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.4f
+1.0.4g
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 74bafed4b..778517628 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,12 @@
+2001-03-28 Werner Koch <[email protected]>
+
+ * md5.c (md5_final): Fixed calculation of hashed length. Thanks
+ to [email protected] 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 <[email protected]>
* blowfish.c (encrypt,do_encrypt): Changed name to do_encrypt to
diff --git a/cipher/md5.c b/cipher/md5.c
index eb09d261c..9bba57641 100644
--- a/cipher/md5.c
+++ b/cipher/md5.c
@@ -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 */
diff --git a/cipher/rmd160.c b/cipher/rmd160.c
index fba910d7e..94e3ece0b 100644
--- a/cipher/rmd160.c
+++ b/cipher/rmd160.c
@@ -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 */
diff --git a/cipher/sha1.c b/cipher/sha1.c
index bd21aeea4..9160bc260 100644
--- a/cipher/sha1.c
+++ b/cipher/sha1.c
@@ -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 */
diff --git a/cipher/tiger.c b/cipher/tiger.c
index 193017076..adc23c85c 100644
--- a/cipher/tiger.c
+++ b/cipher/tiger.c
@@ -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 */
diff --git a/g10/ChangeLog b/g10/ChangeLog
index bbaae1b1c..caad560e5 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,10 @@
+2001-03-28 Werner Koch <[email protected]>
+
+ * 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 <[email protected]>
* packet.h: Add a missing typedef to an enum. Thanks to Stefan Bellon.
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 948643f05..76e7f4167 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -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 );
diff --git a/g10/sig-check.c b/g10/sig-check.c
index 5282281d7..49cc72c32 100644
--- a/g10/sig-check.c
+++ b/g10/sig-check.c
@@ -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;
}
}