z/OS Open Cryptographic Services Facility Service Provider Module Developer's Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


DLLMain

z/OS Open Cryptographic Services Facility Service Provider Module Developer's Guide and Reference
SC14-7514-00

#include<cssm.h>
CSSM_GUID tp_guid = 
{ 0x83bafc39, 0xfac1, 0x11cf, { 0x81, 0x72, 0x0, 0xaa, 0x0, 0xb1, 0x99, 0xdd } };

BOOL  DllMain (HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    switch (dwReason)
    {
        case DLL_PROCESS_ATTACH:
        {
           CSSM_SPI_TP_FUNCS_PTR FunctionTable;
           CSSM_SPI_MEMORY_FUNCS_PTR UpcallTable;

         /* Allocate TP memory for pointers */
         FunctionTable = (CSSM_SPI_TP_FUNCS_PTR)malloc (sizeof 
                                (CSSM_SPI_TP_FUNCS));
         UpcallTable = (CSSM_SPI_MEMORY_FUNCS_PTR)malloc (sizeof
                                (CSSM_SPI_MEMORY_FUNCS);

         /* Initialize TP callback functions */
         FunctionTable->CertSign = CertSign;
         FunctionTable->CertRevoke = CertRevoke;
         FunctionTable->CrlVerify = CrlVerify;
         FunctionTable->CrlSign = CrlSign;
         FunctionTable->ApplyCrlToDb = ApplyCrlToDb;
         FunctionTable->CertGroupConstruct = CertGroupConstruct;
         FunctionTable->CertGroupPrune = CertGroupPrune;
         FunctionTable->CertGroupVerify = CertGroupVerify;
         FunctionTable->PassThrough = NULL;

          /* Call CSSM_RegisterServices to register the FunctionTable */
          /* with OCSF and to receive the application's memory upcall table */
          if (CSSM_RegisterServices (&tp_guid, FunctionTable, UpcallTable)
                               != CSSM_OK)
             return FALSE;
          break;
   }
case DLL_THREAD_ATTACH:
   break;
case DLL_THREAD_DETACH:
   Break;
case DLL_PROCESS_DETACH:
   if (CSSM_DeregisterServices (&tp_guid) != CSSM_OK)
           return FALSE;
   break;
   }
return TRUE;
}  

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014