Closed Bug 415264 Opened 13 years ago Closed 13 years ago

Make Security use of new NSPR rotate macros

Categories

(NSS :: Libraries, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: swsnyder, Assigned: swsnyder)

References

Details

(Keywords: perf)

Attachments

(2 files)

Replace several uses of shift/xor, intended to rotate bits, with the use of the
new NSPR rotate macros.  The goal is to improve performance by replacing the
existing code with the hardware rotate instructions that the macros alias.
Thanks for the patch.

Nelson already checked in the changes to mozilla/security/nss
(see bug 331043 comment 97).

MD4 is an old, broken hash algorithm.  It is not worth our time
to optimize our MD4 implementation.  So I'm not going to check
in the change to mozilla/security/manager/ssl/src/md4.c.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.12
I found that all the code in Steve's patch is copies of this
in various forms:

    h = (h >> 28)) ^ (h << 4) ^ *s;

I believe that the original author of this code meant to say
"rotate h left by 4, and then XOR with the current character *s".
This is clearer in the copies of the code in JavaScript, where
it's written like this:

    h = (h >> (32 - 4)) ^ (h << 4) ^ *s;

So it is more natural to the equivalent PR_ROTATE_LEFT32 calls
here.  That is, I'd describe the rotation as "rotate left by
one hex digit" rather than "rotate right by seven hex digits."
Attachment #300970 - Flags: review?(nelson)
Comment on attachment 300970 [details] [diff] [review]
Use the equivalent PR_ROTATE_LEFT32 calls

r=nelson
Attachment #300970 - Flags: review?(nelson) → review+
Comment on attachment 300970 [details] [diff] [review]
Use the equivalent PR_ROTATE_LEFT32 calls

I checked in this patch on the NSS trunk.

Checking in lib/base/hash.c;
/cvsroot/mozilla/security/nss/lib/base/hash.c,v  <--  hash.c
new revision: 1.11; previous revision: 1.10
done
Checking in lib/pki/pkistore.c;
/cvsroot/mozilla/security/nss/lib/pki/pkistore.c,v  <--  pkistore.c
new revision: 1.32; previous revision: 1.31
done
You need to log in before you can comment on or make changes to this bug.