Richard,

On Wednesday, May 17, 2000 2:44 PM, Richard Levitte - VMS Whacker 
[SMTP:[EMAIL PROTECTED]] wrote:
> From: Kevin Steves <[EMAIL PROTECTED]>
>
> stevesk> http://people.hp.se/stevesk/patch/sha_md5.patch
> stevesk>
> stevesk> is a patch to speedup MD5 and SHA1 on LP64 platforms by using
> stevesk> ints instead of long.  There are some comments in the patch
> stevesk> that explain the reasoning behind this, and Chris can provide
> stevesk> more information if needed.
>
> Downloaded as well.  However, I'm wondering about some of the changes
> and what they will do to some compilers and/or operating systems.
> Especially removing U from constants that are supposed to be
> unsigned...
>
You probably have a valid point regarding the "unsigned".  For all of
the "R0/R1/.." macros, I just converted "L" to nothing given "L" is
signed.  For the others, however, I converted "UL" to nothing which
is not maintaining the same sign.  This should have been converted
to "U".  It appears the main code is wrong today in this respect given
the "L" in the "R0/R1/..." macros should be a UL.  In general, since this
is effectively a big hash, the sign should not matter (other than for
performance issues).

Now, in the case of the code I submitted, the reason for converting
everything to unsigned int for 64-bit is that the algorithm is 32-bits, so
having 64-bit constants just creates more unnecessary work for the
compiler.  On PA-RISC, we need 4-5 instructions to load a 64-bit
constant, but need only 2 for a 32-bit constant.  Also, when mixing
32-bit and 64-bit values, the compiler has to generate extra instructions
to make everything 64-bit (extra zero extends or sign extends), so
you want to be all 32-bit or all 64-bit and not mix/match when doing
lots of math.

--Chris
----------------------------------------------------------------------------  
--------------------
> --
> Richard Levitte   \ Spannvagen 38, II \ [EMAIL PROTECTED]
> Chairman@Stacken   \ S-168 35  BROMMA  \ T: +46-8-26 52 47
> Redakteur@Stacken   \      SWEDEN       \ or +46-709-50 36 10
> Procurator Odiosus Ex Infernis             -- [EMAIL PROTECTED]
> Member of the OpenSSL development team: http://www.openssl.org/
> Software Engineer, Celo Communications: http://www.celocom.com/
>
> Unsolicited commercial email is subject to an archival fee of $400.
> See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to