From 7fb903d10a7b5ecff96bfb3268c2d48c14a650eb Mon Sep 17 00:00:00 2001 From: "ian.mcgreer%sun.com" Date: Thu, 24 Apr 2003 18:30:12 +0000 Subject: [PATCH] bug 201081, better spreading of session id hash r=relyea git-svn-id: svn://10.0.0.236/trunk@141751 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/security/nss/lib/softoken/pkcs11i.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mozilla/security/nss/lib/softoken/pkcs11i.h b/mozilla/security/nss/lib/softoken/pkcs11i.h index 35841b26944..5ca17b1db28 100644 --- a/mozilla/security/nss/lib/softoken/pkcs11i.h +++ b/mozilla/security/nss/lib/softoken/pkcs11i.h @@ -447,8 +447,12 @@ struct PK11SSLMACInfoStr { #define pk11_SlotFromSession(sp) ((sp)->slot) #define pk11_isToken(id) (((id) & PK11_TOKEN_MASK) == PK11_TOKEN_MAGIC) +/* the session hash multiplier (see bug 201081) */ +#define SHMULTIPLIER 1791398085 + /* queueing helper macros */ -#define pk11_hash(value,size) ((value) & (size-1))/*size must be a power of 2*/ +#define pk11_hash(value,size) \ + ((PRUint32)((value) * SHMULTIPLIER) & (size-1)) #define pk11queue_add(element,id,head,hash_size) \ { int tmp = pk11_hash(id,hash_size); \ (element)->next = (head)[tmp]; \