CSSM_CL_HANDLE pkiClStartup(void) { CSSM_CL_HANDLE clHand; CSSM_RETURN crtn; if(cuCssmStartup() == CSSM_FALSE) { return 0; } crtn = CSSM_ModuleLoad(&gGuidAppleX509CL, CSSM_KEY_HIERARCHY_NONE, NULL, /* eventHandler */ NULL); /* AppNotifyCallbackCtx */ if(crtn) { return 0; } crtn = CSSM_ModuleAttach (&gGuidAppleX509CL, &vers, &memFuncs, /* memFuncs */ 0, /* SubserviceID */ CSSM_SERVICE_CL, /* SubserviceFlags - Where is this used? */ 0, /* AttachFlags */ CSSM_KEY_HIERARCHY_NONE, NULL, /* FunctionTable */ 0, /* NumFuncTable */ NULL, /* reserved */ &clHand); if(crtn) { return 0; } else { return clHand; } }
/* Attach to DL side of CSPDL */ CSSM_DL_HANDLE cuDlStartup() { CSSM_DL_HANDLE dlHand = 0; CSSM_RETURN crtn; if(cuCssmStartup() == CSSM_FALSE) { return 0; } crtn = CSSM_ModuleLoad(&gGuidAppleCSPDL, CSSM_KEY_HIERARCHY_NONE, NULL, // eventHandler NULL); // AppNotifyCallbackCtx if(crtn) { cuPrintError("CSSM_ModuleLoad(Apple CSPDL)", crtn); return 0; } crtn = CSSM_ModuleAttach (&gGuidAppleCSPDL, &vers, &memFuncs, // memFuncs 0, // SubserviceID CSSM_SERVICE_DL, 0, // AttachFlags CSSM_KEY_HIERARCHY_NONE, NULL, // FunctionTable 0, // NumFuncTable NULL, // reserved &dlHand); if(crtn) { cuPrintError("CSSM_ModuleAttach(Apple CSPDL)", crtn); return 0; } return dlHand; }
CSSM_TP_HANDLE cuTpStartup() { CSSM_TP_HANDLE tpHand; CSSM_RETURN crtn; if(cuCssmStartup() == CSSM_FALSE) { return 0; } crtn = CSSM_ModuleLoad(&gGuidAppleX509TP, CSSM_KEY_HIERARCHY_NONE, NULL, // eventHandler NULL); // AppNotifyCallbackCtx if(crtn) { cuPrintError("CSSM_ModuleLoad(AppleTP)", crtn); return 0; } crtn = CSSM_ModuleAttach (&gGuidAppleX509TP, &vers, &memFuncs, // memFuncs 0, // SubserviceID CSSM_SERVICE_TP, // SubserviceFlags 0, // AttachFlags CSSM_KEY_HIERARCHY_NONE, NULL, // FunctionTable 0, // NumFuncTable NULL, // reserved &tpHand); if(crtn) { cuPrintError("CSSM_ModuleAttach(AppleTP)", crtn); return 0; } else { return tpHand; } }
/* * Attach to CSP. Returns zero on error. */ CSSM_CSP_HANDLE cuCspStartup( CSSM_BOOL bareCsp) // true ==> CSP, false ==> CSP/DL { CSSM_CSP_HANDLE cspHand; CSSM_RETURN crtn; const CSSM_GUID *guid; /* common CSSM init */ if(cuCssmStartup() == CSSM_FALSE) { return 0; } if(bareCsp) { guid = &gGuidAppleCSP; } else { guid = &gGuidAppleCSPDL; } crtn = CSSM_ModuleLoad(guid, CSSM_KEY_HIERARCHY_NONE, NULL, // eventHandler NULL); // AppNotifyCallbackCtx if(crtn) { cuPrintError("CSSM_ModuleLoad()", crtn); return 0; } crtn = CSSM_ModuleAttach (guid, &vers, &memFuncs, // memFuncs 0, // SubserviceID CSSM_SERVICE_CSP, 0, // AttachFlags CSSM_KEY_HIERARCHY_NONE, NULL, // FunctionTable 0, // NumFuncTable NULL, // reserved &cspHand); if(crtn) { cuPrintError("CSSM_ModuleAttach()", crtn); return 0; } return cspHand; }