The default bug view has changed. See this FAQ.

Make Security use of new NSPR rotate macros

RESOLVED FIXED in 3.12

Status

NSS
Libraries
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: Steve Snyder, Assigned: Steve Snyder)

Tracking

({perf})

trunk
3.12
x86
Windows 2000

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

9 years ago
Created attachment 300897 [details] [diff] [review]
Security use of NSPR rotate macros

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.

Comment 1

9 years ago
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
Last Resolved: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.12

Comment 2

9 years ago
Created attachment 300970 [details] [diff] [review]
Use the equivalent PR_ROTATE_LEFT32 calls

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 4

9 years ago
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.