From: Nicolas Pitre Date: Thu, 06 Aug 2009 01:52:35 GMT Subject: Re: x86 SHA1: Faster than OpenSSL Message-ID: In-Reply-To: On Wed, 5 Aug 2009, Linus Torvalds wrote: > But while looking at 32-bit issues, I noticed that I really should also > cast 'len' when shifting it. Otherwise the thing is limited to fairly > small areas (28 bits - 256MB). This is not just a 32-bit problem ("int" is > a signed 32-bit thing even in a 64-bit build), but I only noticed it when > looking at 32-bit issues. Even better is to not shift len at all in SHA_update() but shift ctx->size only at the end in SHA_final(). It is not like if SHA_update() could operate on partial bytes, so counting total bytes instead of total bits is all you need. This way you need no cast there and make the code slightly faster. Nicolas