mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Fixed nasty Hash bug
This commit is contained in:
parent
f0b82cd352
commit
ec742b7f58
11 changed files with 72 additions and 37 deletions
|
@ -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
|
||||
|
|
17
cipher/md5.c
17
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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue