Common Data Security Architecture (CDSA) White Paper

Appendix C 91
Sample Add-in Module Code
typedef void * FUNC_PTR;
#if defined(__STDC__) || defined(__cplusplus)
typedef CSSM_RETURN (*REGISTER_FUNC_PTR) (
const CSSM_GUID_PTR GUID,
const CSSM_REGISTRATION_INFO_PTR FunctionTable,
CSSM_SPI_MEMORY_FUNCS_PTR UpcallTable,
void *Reserved);
typedef CSSM_RETURN (*DE_REGISTER_FUNC_PTR) (const CSSM_GUID_PTR GUID);
typedef CSSM_RETURN (*SET_ERROR_FUNC_PTR) (CSSM_GUID_PTR guid, uint32 error);
#else
typedef CSSM_RETURN (*REGISTER_FUNC_PTR) ();
typedef CSSM_RETURN (*DE_REGISTER_FUNC_PTR) ();
typedef CSSM_RETURN (*SET_ERROR_FUNC_PTR) ();
#endif
static void * cssmRegister = NULL;
static void * cssmDeregister = NULL;
static void * cssmSetError = NULL;
static CSSM_GUID my_addin_guid =
{ /* 714ed4ea-15d8-11d2-9be7-0060b0b6e655 */
0x714ed4ea, 0x15d8, 0x11d2, {0x9b, 0xe7, 0x00, 0x60, 0xb0, 0xb6, 0xe6, 0x55}
};
/*----------------------------------------------------------------------------
* Name: _MyAddIn_Init
* This is the add-in initializer. When the library is loaded, “loading” is 1,
* when the library is unloaded, “loading” is 0.