aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/sha1.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher/sha1.c')
-rw-r--r--cipher/sha1.c17
1 files changed, 9 insertions, 8 deletions
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 */