Re: x86 SHA1: Faster than OpenSSL
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Aug 5, 2009, 20:55 UTC
- Message-ID
- <alpine.LFD.2.01.0908051352280.3390@localhost.localdomain>
- In-Reply-To
- <20090805181755.22765.qmail@science.horizon.com>
On Wed, 5 Aug 2009, George Spelvin wrote:
> > > We can continue shipping mozilla one to help the last group. > > Of course, we always need a C fallback. Would you like a faster one?
I actually looked at code generation (on x86-64) for the C fallback, and it should be quite doable to re-write the C one to generate good code on x86-64.
On 32-bit x86, I suspect the register pressures are so intense that it's unrealistic to expect gcc to do a good job, but the Mozilla SHA1 C code really seems _designed_ to be slow in stupid ways (that whole "byte at a time into a word buffer with shifts" is a really really sucky way to handle the endianness issues).
So if you'd like to look at the C version, that's definitely worth it. Much bigger bang for the buck than trying to schedule asm language and having to deal with different assemblers/linkers/whatnot.
Linus