Closed
Bug 144448
Opened 22 years ago
Closed 22 years ago
CKFW incorrectly uses ## operator to create cryptoki entry points
Categories
(NSS :: Libraries, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
3.6
People
(Reporter: bugz, Assigned: bugz)
Details
Attachments
(1 file)
The file nssck.api defines the macro __ADJOIN: #define __ADJOIN(x,y) x##y then uses it to define cryptoki entry points: CK_RV CK_ENTRY __ADJOIN(MODULE_NAME,C_Finalize) ( CK_VOID_PTR pReserved ) As noted in K&R, this use of the ## operator creates an ambiguity. The result will be MODULE_NAMEC_Finalize, which is not the intention. The fix is to define a second level macro that allows expansion of the parameters before the ## operator is applied. Here is the patch: -#define __ADJOIN(x,y) x##y +#define nssadjoin(x,y) x##y + +#define __ADJOIN(x,y) nssadjoin(x,y) This fix is purely cosmetic. It does not change functionality at all, and the bug would only appear to someone who ran the code through a preprocessor (as I did).
Comment 1•22 years ago
|
||
I had to deal with a similar problem with the stringize operator # in nss.rc. Just a stylistic nit: use all caps in macro names. I also want to confirm that this change won't break binary compatibility, right? Do we ever call or look up the function MODULE_NAMEC_Finalize by name directly?
Priority: -- → P2
Target Milestone: --- → 3.6
Assignee | ||
Comment 2•22 years ago
|
||
Will change it to NSSADJOIN. This won't break compatibility -- the functions are never called directly, but returned in a table of function pointers. If a CKFW implementor has code which made calls to the functions, this would break his or her builds. But that is an unlikely situation, and not the intended use of CKFW. In addition, that implementor would have been making calls to MODULE_NAMEC_XXX, so should have filed this bug already ;-)
Comment 3•22 years ago
|
||
If the functions are never called directly, we should declare them as static. Ian, do you know how to make that change?
Assignee | ||
Comment 4•22 years ago
|
||
Note, there is a seperate method for defining all of the entry points as API functions (for example, C_GenerateKeyPair which calls <module>C_GenerateKeyPair). This patch implements the <module>C_XXX functions as static functions, as I see no reason not to do that.
Comment 5•22 years ago
|
||
Comment on attachment 83554 [details] [diff] [review] implement cryptoki entry points as static functions (except for C_GetFunctionList) r=wtc. Please wait until the NSS_3_5_BRANCH has been created to check in this patch.
Attachment #83554 -
Flags: review+
Assignee | ||
Comment 6•22 years ago
|
||
Checked in to 3.6.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•