Last Comment Bug 220115 - CKM_INVALID_MECHANISM should be an unsigned long constant.
: CKM_INVALID_MECHANISM should be an unsigned long constant.
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: 3.8
: All All
P3 normal (vote)
: 3.12
Assigned To: Julien Pierre
Depends on:
  Show dependency treegraph
Reported: 2003-09-23 16:31 PDT by Wan-Teh Chang
Modified: 2007-07-11 11:03 PDT (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

Fix types for mechanism constants (3.09 KB, patch)
2007-07-10 20:07 PDT, Julien Pierre
nelson: review+
Details | Diff | Splinter Review

Description User image Wan-Teh Chang 2003-09-23 16:31:10 PDT
Current lib/pk11wrap/secmodt.h defines CKM_INVALID_MECHANISM as
a signed long constant:

#define CKM_INVALID_MECHANISM 0xffffffffL

This causes compiler warnings because CK_MECHANISM_TYPE is an
unsigned long (CK_ULONG).

Other macros that should be defined as unsigned long constants
Comment 1 User image Julien Pierre 2007-07-10 20:07:37 PDT
Created attachment 271786 [details] [diff] [review]
Fix types for mechanism constants
Comment 2 User image Nelson Bolyard (seldom reads bugmail) 2007-07-10 20:47:25 PDT
Comment on attachment 271786 [details] [diff] [review]
Fix types for mechanism constants

r=nelson, provided you make one additional change. 
You want to change ALL the CKM_ values to have a UL suffix, right?
You missed one.  Please change it, too.

>+#define CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN       0x8000000aUL
>+#define CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN       0x8000000bUL
> #define CKM_TLS_PRF_GENERAL                     0x80000373L

That's the missed one.
Comment 3 User image Julien Pierre 2007-07-10 21:42:14 PDT

Thanks for the review. Yes, I intended to change them all. I actually looked at the CKM_TLS_PRF_GENERAL definition, but somehow forgot to include that change my  patch.

I checked this patch in on the trunk (with the change) :

Checking in pk11wrap/secmodt.h;
/cvsroot/mozilla/security/nss/lib/pk11wrap/secmodt.h,v  <--  secmodt.h
new revision: 1.33; previous revision: 1.32
Checking in softoken/pkcs11n.h;
/cvsroot/mozilla/security/nss/lib/softoken/pkcs11n.h,v  <--  pkcs11n.h
new revision: 1.17; previous revision: 1.16
Comment 4 User image Wan-Teh Chang 2007-07-11 11:03:21 PDT
We could also use no suffix, as is done in pkcs11t.h for
the standard CKM_xxx macros:

I remember hex constants are by default unsigned.

Note You need to log in before you can comment on or make changes to this bug.