| Cryptographic Token Interface Standard |
PKCS#11
|
Pointer-related macros
Because different platforms and compilers have different ways of dealing with different types of pointers, Cryptoki requires the following 6 macros to be set outside the scope of Cryptoki:
CK_PTR
CK_PTR is the "indirection string" a given platform and compiler uses to make a pointer to an object. It is used in the following fashion:
typedef CK_BYTE CK_PTR CK_BYTE_PTR;
CK_DEFINE_FUNCTION
CK_DEFINE_FUNCTION(returnType, name), when followed by a parentheses-enclosed list of arguments and a function definition, defines a Cryptoki API function in a Cryptoki library. returnType is the return type of the function, and name is its name. It is used in the following fashion:
CK_DECLARE_FUNCTION
CK_DECLARE_FUNCTION(returnType, name), when followed by a parentheses-enclosed list of arguments and a semicolon, declares a Cryptoki API function in a Cryptoki library. returnType is the return type of the function, and name is its name. It is used in the following fashion:
CK_DECLARE_FUNCTION_POINTER
CK_DECLARE_FUNCTION_POINTER(returnType, name), when followed by a parentheses-enclosed list of arguments and a semicolon, declares a variable or type which is a pointer to a Cryptoki API function in a Cryptoki library. returnType is the return type of the function, and name is its name. It can be used in either of the following fashions to define a function pointer variable, myC_Initialize, which can point to a C_Initialize function in a Cryptoki library (note that neither of the following code snippets actually assigns a value to myC_Initialize):
or:
typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, myC_InitializeType)( CK_VOID_PTR pReserved );
myC_InitializeType myC_Initialize;
CK_CALLBACK_FUNCTION
CK_CALLBACK_FUNCTION(returnType, name), when followed by a parentheses-enclosed list of arguments and a semicolon, declares a variable or type which is a pointer to an application callback function that can be used by a Cryptoki API function in a Cryptoki library. returnType is the return type of the function, and name is its name. It can be used in either of the following fashions to define a function pointer variable, myCallback, which can point to an application callback which takes arguments args and returns a CK_RV (note that neither of the following code snippets actually assigns a value to myCallback):
CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args);
or:
NULL_PTR is the value of a NULL pointer. In any ANSI C environment"and in many others as well"NULL_PTR should be defined simply as 0.
RSA Security Inc. Public-Key Cryptography Standards -
PKCS#11 - v220