summaryrefslogtreecommitdiff
path: root/cipher/rmd160.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-03-29 10:01:44 +0000
committerWerner Koch <wk@gnupg.org>2001-03-29 10:01:44 +0000
commit7e68abda362fce76e91631973d062fd7c8ff5e4e (patch)
treed4c9e9156fde813d270dbe0963756d4a2c7ec191 /cipher/rmd160.c
parent0eecba659555d50cd7bdd26daef9a32334759dc4 (diff)
downloadlibgcrypt-7e68abda362fce76e91631973d062fd7c8ff5e4e.tar.gz
Fixed the bug in the hash code
Diffstat (limited to 'cipher/rmd160.c')
-rw-r--r--cipher/rmd160.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/cipher/rmd160.c b/cipher/rmd160.c
index 381e6531..d7f3bb0c 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 */