6399N/AIn-house patch created to avoid the multiple declaration for log variable.
6399N/AThis is necessary only when building the component with Solaris Studio.
6399N/A
6399N/AThis patch is Solaris buildenv specific and may not be suitable for upstream.
6399N/A
6399N/AOther modifications were introduced to keep this in sync with upstream patches
6399N/Aof the coolkey.cpp source file.
6399N/A
6399N/AFor example, the addition of RSA, EC, or both mechanisms support the variance
6399N/Aof different types of smart cards, where some cards support only EC, some only RSA.
6399N/A
6399N/A--- ORIGINAL/./src/coolkey/coolkey.cpp 2016-06-24 16:07:19.284028543 -0400
6399N/A+++ ././src/coolkey/coolkey.cpp 2016-06-27 13:38:03.637785724 -0400
6399N/A@@ -34,15 +34,19 @@
6399N/A #include "cky_base.h"
6399N/A #include "params.h"
6399N/A
6399N/A-#define NULL 0
6399N/A
6399N/A /* static module data -------------------------------- */
6399N/A-
6399N/A-static Log *log = NULL;
6399N/A+
6399N/A+// XXX - Solaris studio compiler specific
6399N/A+// changed variable name from "log" to "mylog" as we need to
6399N/A+// avoid multiple declarations of a variable named "log"
6399N/A+static Log *mylog = NULL;
6399N/A
6399N/A static SlotList *slotList = NULL;
6399N/A
6399N/A-static OSLock finalizeLock(false);
6399N/A+static OSLock *finalizeLock = NULL;
6399N/A+#define FINALIZE_GETLOCK() if (finalizeLock) finalizeLock->getLock();
6399N/A+#define FINALIZE_RELEASELOCK() if (finalizeLock) finalizeLock->releaseLock();
6399N/A
6399N/A static CK_BBOOL initialized = FALSE;
6399N/A static CK_BBOOL finalizing = FALSE;
6399N/A@@ -68,11 +72,25 @@
6399N/A /**********************************************************************
6399N/A ************************** MECHANISM TABLE ***************************
6399N/A **********************************************************************/
6399N/A-static MechInfo
6399N/A-mechanismList[] = {
6399N/A+
6399N/A+static const MechInfo
6399N/A+rsaMechanismList[] = {
6399N/A {CKM_RSA_PKCS, { 1024, 4096, CKF_HW | CKF_SIGN | CKF_DECRYPT } }
6399N/A };
6399N/A-static unsigned int numMechanisms = sizeof(mechanismList)/sizeof(MechInfo);
6399N/A+
6399N/A+static const MechInfo
6399N/A+ecMechanismList[] = {
6399N/A+ {CKM_ECDSA,{256,521,CKF_HW | CKF_SIGN | CKF_EC_F_P}},{ CKM_ECDSA_SHA1, {256, 521, CKF_HW | CKF_SIGN | CKF_EC_F_P}},{ CKM_ECDH1_DERIVE,{256, 521, CKF_HW | CKF_DERIVE | CKF_EC_F_P} }
6399N/A+};
6399N/A+static const MechInfo
6399N/A+allMechanismList[] = {
6399N/A+ {CKM_RSA_PKCS, { 1024, 4096, CKF_HW | CKF_SIGN | CKF_DECRYPT } },
6399N/A+ {CKM_ECDSA,{256,521,CKF_HW | CKF_SIGN | CKF_EC_F_P}},{ CKM_ECDSA_SHA1, {256, 521, CKF_HW | CKF_SIGN | CKF_EC_F_P}},{ CKM_ECDH1_DERIVE,{256, 521, CKF_HW | CKF_DERIVE | CKF_EC_F_P} }
6399N/A+};
6399N/A+
6399N/A+unsigned int numRSAMechanisms = sizeof(rsaMechanismList)/sizeof(MechInfo);
6399N/A+unsigned int numECMechanisms = sizeof(ecMechanismList)/sizeof(MechInfo);
6399N/A+unsigned int numAllMechanisms = sizeof(allMechanismList)/sizeof(MechInfo);
6399N/A
6399N/A /* ------------------------------------------------------------ */
6399N/A
6399N/A@@ -86,11 +104,11 @@
6399N/A for (i = 0; i < ulCount; ++i) {
6399N/A CK_ATTRIBUTE_PTR pT = pTemplate + i;
6399N/A if (pT->pValue && pT->ulValueLen == 4) {
6399N/A- log->log(
6399N/A+ mylog->log(
6399N/A "template [%02lu] type: %04lx, pValue: %08lx, ulValueLen: %08lx, value: %lu\n",
6399N/A i, pT->type, pT->pValue, pT->ulValueLen, *(CK_ULONG_PTR)pT->pValue);
6399N/A } else
6399N/A- log->log("template [%02lu] type: %04lx, pValue: %08lx, ulValueLen: %08lx\n",
6399N/A+ mylog->log("template [%02lu] type: %04lx, pValue: %08lx, ulValueLen: %08lx\n",
6399N/A i, pT->type, pT->pValue, pT->ulValueLen);
6399N/A }
6399N/A }
6399N/A@@ -101,7 +119,7 @@
6399N/A #define NOTSUPPORTED(name, args) \
6399N/A CK_RV name args \
6399N/A { \
6399N/A- log->log(#name " called (notSupported)\n"); \
6399N/A+ mylog->log(#name " called (notSupported)\n"); \
6399N/A return CKR_FUNCTION_NOT_SUPPORTED; \
6399N/A }
6399N/A
6399N/A@@ -112,11 +130,11 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED; \
6399N/A } \
6399N/A try { \
6399N/A- log->log(#name " called\n"); \
6399N/A+ mylog->log(#name " called\n"); \
6399N/A slotList->name2 use_args ; \
6399N/A return CKR_OK; \
6399N/A } catch(PKCS11Exception& e) { \
6399N/A- e.log(log); \
6399N/A+ e.log(mylog); \
6399N/A return e.getCRV(); \
6399N/A } \
6399N/A }
6399N/A@@ -164,7 +182,6 @@
6399N/A NOTSUPPORTED(C_GenerateKeyPair, (CK_SESSION_HANDLE,CK_MECHANISM_PTR,CK_ATTRIBUTE_PTR,CK_ULONG,CK_ATTRIBUTE_PTR,CK_ULONG,CK_OBJECT_HANDLE_PTR,CK_OBJECT_HANDLE_PTR))
6399N/A NOTSUPPORTED(C_WrapKey, (CK_SESSION_HANDLE,CK_MECHANISM_PTR,CK_OBJECT_HANDLE,CK_OBJECT_HANDLE,CK_BYTE_PTR,CK_ULONG_PTR))
6399N/A NOTSUPPORTED(C_UnwrapKey, (CK_SESSION_HANDLE,CK_MECHANISM_PTR,CK_OBJECT_HANDLE,CK_BYTE_PTR,CK_ULONG,CK_ATTRIBUTE_PTR,CK_ULONG,CK_OBJECT_HANDLE_PTR))
6399N/A-NOTSUPPORTED(C_DeriveKey, (CK_SESSION_HANDLE,CK_MECHANISM_PTR,CK_OBJECT_HANDLE,CK_ATTRIBUTE_PTR,CK_ULONG,CK_OBJECT_HANDLE_PTR))
6399N/A NOTSUPPORTED(C_GetFunctionStatus, (CK_SESSION_HANDLE))
6399N/A NOTSUPPORTED(C_CancelFunction, (CK_SESSION_HANDLE))
6399N/A
6399N/A@@ -198,6 +215,10 @@
6399N/A SUPPORTED(C_GenerateRandom, generateRandom,
6399N/A (CK_SESSION_HANDLE hSession ,CK_BYTE_PTR data,CK_ULONG dataLen),
6399N/A (hSession, data, dataLen))
6399N/A+SUPPORTED(C_DeriveKey,derive,
6399N/A+ (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism,
6399N/A+ CK_OBJECT_HANDLE hBaseKey, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulAttributeCount, CK_OBJECT_HANDLE_PTR phKey ),
6399N/A+ (hSession, pMechanism, hBaseKey, pTemplate, ulAttributeCount, phKey))
6399N/A
6399N/A /* non-specialized functions supported with the slot directly */
6399N/A
6399N/A@@ -208,11 +229,13 @@
6399N/A if( initialized ) {
6399N/A return CKR_CRYPTOKI_ALREADY_INITIALIZED;
6399N/A }
6399N/A- if (!finalizeLock.isValid()) {
6399N/A+ if (finalizeLock && !finalizeLock->isValid()) {
6399N/A return CKR_CANT_LOCK;
6399N/A }
6399N/A CK_C_INITIALIZE_ARGS* initArgs = (CK_C_INITIALIZE_ARGS*) pInitArgs;
6399N/A+ OSLock::setThreadSafe(0);
6399N/A if( initArgs != NULL ) {
6399N/A+ bool needThreads;
6399N/A /* work around a bug in NSS where the library parameters are only
6399N/A * send if locking is requested */
6399N/A if (initArgs->LibraryParameters) {
6399N/A@@ -220,28 +243,38 @@
6399N/A } else {
6399N/A Params::ClearParams();
6399N/A }
6399N/A- if( (initArgs->flags & CKF_OS_LOCKING_OK) || initArgs->LockMutex ){
6399N/A+ needThreads = ((initArgs->flags & CKF_OS_LOCKING_OK) != 0);
6399N/A+ OSLock::setThreadSafe(needThreads);
6399N/A+ /* don't get a finalize lock unless someone initializes us asking
6399N/A+ * us to use threads */
6399N/A+ if (needThreads && !finalizeLock) {
6399N/A+ finalizeLock = new OSLock(true);
6399N/A+ if (finalizeLock == NULL) return CKR_HOST_MEMORY;
6399N/A+ }
6399N/A+ /* only support OS LOCKING threads */
6399N/A+ if( ((initArgs->flags & CKF_OS_LOCKING_OK) == 0)
6399N/A+ && initArgs->LockMutex ){
6399N/A throw PKCS11Exception(CKR_CANT_LOCK);
6399N/A }
6399N/A }
6399N/A char * logFileName = getenv("COOL_KEY_LOG_FILE");
6399N/A if (logFileName) {
6399N/A if (strcmp(logFileName,"SYSLOG") == 0) {
6399N/A- log = new SysLog();
6399N/A+ mylog = new SysLog();
6399N/A } else {
6399N/A- log = new FileLog(logFileName);
6399N/A+ mylog = new FileLog(logFileName);
6399N/A }
6399N/A } else {
6399N/A- log = new DummyLog();
6399N/A+ mylog = new DummyLog();
6399N/A }
6399N/A- log->log("Initialize called, hello %d\n", 5);
6399N/A- CKY_SetName("coolkey");
6399N/A- slotList = new SlotList(log);
6399N/A+ mylog->log("Initialize called, hello %d\n", 5);
6399N/A+ CKY_SetName((char *) "coolkey");
6399N/A+ slotList = new SlotList(mylog);
6399N/A initialized = TRUE;
6399N/A return CKR_OK;
6399N/A } catch(PKCS11Exception &e) {
6399N/A- if( log )
6399N/A- e.log(log);
6399N/A+ if( mylog )
6399N/A+ e.log(mylog);
6399N/A return e.getReturnValue();
6399N/A }
6399N/A }
6399N/A@@ -254,14 +287,14 @@
6399N/A }
6399N/A // XXX cleanup all data structures !!!
6399N/A //delete sessionManager;
6399N/A- log->log("Finalizing...\n");
6399N/A+ mylog->log("Finalizing...\n");
6399N/A // don't race the setting of finalizing. If C_WaitEvent gets passed
6399N/A // the finalizing call first, we know it will set waitEvent before
6399N/A // we can get the lock, so we only need to protect setting finalizing
6399N/A // to true.
6399N/A- finalizeLock.getLock();
6399N/A+ FINALIZE_GETLOCK();
6399N/A finalizing = TRUE;
6399N/A- finalizeLock.releaseLock();
6399N/A+ FINALIZE_RELEASELOCK();
6399N/A if (waitEvent) {
6399N/A /* we're waiting on a slot event, shutdown first to allow
6399N/A * the wait function to complete before we pull the rug out.
6399N/A@@ -272,11 +305,11 @@
6399N/A }
6399N/A }
6399N/A delete slotList;
6399N/A- delete log;
6399N/A- finalizeLock.getLock();
6399N/A+ delete mylog;
6399N/A+ FINALIZE_GETLOCK();
6399N/A finalizing = FALSE;
6399N/A initialized = FALSE;
6399N/A- finalizeLock.releaseLock();
6399N/A+ FINALIZE_RELEASELOCK();
6399N/A return CKR_OK;
6399N/A }
6399N/A
6399N/A@@ -287,7 +320,7 @@
6399N/A if( ! initialized ) {
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A- log->log("C_GetInfo called\n");
6399N/A+ mylog->log("C_GetInfo called\n");
6399N/A ckInfo.manufacturerID[31] = ' ';
6399N/A ckInfo.libraryDescription[31] = ' ';
6399N/A *p = ckInfo;
6399N/A@@ -302,12 +335,12 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("Called C_GetSlotInfo\n");
6399N/A+ mylog->log("Called C_GetSlotInfo\n");
6399N/A slotList->validateSlotID(slotID);
6399N/A return slotList->getSlot(
6399N/A slotIDToIndex(slotID))->getSlotInfo(pSlotInfo);
6399N/A } catch( PKCS11Exception &excep ) {
6399N/A- excep.log(log);
6399N/A+ excep.log(mylog);
6399N/A return excep.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -319,12 +352,12 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("C_GetTokenInfo called\n");
6399N/A+ mylog->log("C_GetTokenInfo called\n");
6399N/A slotList->validateSlotID(slotID);
6399N/A return slotList->getSlot(
6399N/A slotIDToIndex(slotID))->getTokenInfo(pTokenInfo);
6399N/A } catch( PKCS11Exception &excep ) {
6399N/A- excep.log(log);
6399N/A+ excep.log(mylog);
6399N/A return excep.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -333,23 +366,47 @@
6399N/A C_GetMechanismList(CK_SLOT_ID slotID, CK_MECHANISM_TYPE_PTR pMechanismList,
6399N/A CK_ULONG_PTR pulCount)
6399N/A {
6399N/A+
6399N/A+ const MechInfo *mechanismList = NULL;
6399N/A+ unsigned int numMechanisms = 0;
6399N/A+
6399N/A+
6399N/A if( ! initialized ) {
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A CK_RV rv = CKR_OK;
6399N/A
6399N/A- log->log("C_GetMechanismList called\n");
6399N/A+ mylog->log("C_GetMechanismList called\n");
6399N/A if( pulCount == NULL ) {
6399N/A throw PKCS11Exception(CKR_ARGUMENTS_BAD);
6399N/A }
6399N/A
6399N/A slotList->validateSlotID(slotID);
6399N/A- if( ! slotList->getSlot(
6399N/A- slotIDToIndex(slotID))->isTokenPresent() ) {
6399N/A+
6399N/A+ Slot *slot = slotList->getSlot(slotIDToIndex(slotID));
6399N/A+
6399N/A+ if( ! slot || ! slot->isTokenPresent() ) {
6399N/A return CKR_TOKEN_NOT_PRESENT;
6399N/A }
6399N/A
6399N/A+ switch (slot->getAlgs()) {
6399N/A+ case ALG_ECC|ALG_RSA:
6399N/A+ mechanismList = allMechanismList;
6399N/A+ numMechanisms = numAllMechanisms;
6399N/A+ break;
6399N/A+ case ALG_ECC:
6399N/A+ mechanismList = ecMechanismList;
6399N/A+ numMechanisms = numECMechanisms;
6399N/A+ break;
6399N/A+ case ALG_NONE:
6399N/A+ case ALG_RSA:
6399N/A+ default:
6399N/A+ mechanismList = rsaMechanismList;
6399N/A+ numMechanisms = numRSAMechanisms;
6399N/A+ break;
6399N/A+ }
6399N/A+
6399N/A if( pMechanismList != NULL ) {
6399N/A if( *pulCount < numMechanisms ) {
6399N/A rv = CKR_BUFFER_TOO_SMALL;
6399N/A@@ -362,11 +419,11 @@
6399N/A
6399N/A *pulCount = numMechanisms;
6399N/A
6399N/A- log->log("C_GetMechanismList returning %d\n", rv);
6399N/A+ mylog->log("C_GetMechanismList returning %d\n", rv);
6399N/A return rv;
6399N/A
6399N/A } catch(PKCS11Exception &excep ) {
6399N/A- excep.log(log);
6399N/A+ excep.log(mylog);
6399N/A return excep.getCRV();
6399N/A }
6399N/A
6399N/A@@ -376,30 +433,56 @@
6399N/A C_GetMechanismInfo(CK_SLOT_ID slotID, CK_MECHANISM_TYPE type,
6399N/A CK_MECHANISM_INFO_PTR pInfo)
6399N/A {
6399N/A+ const MechInfo *mechanismList = NULL;
6399N/A+ unsigned int numMechanisms = 0;
6399N/A+
6399N/A if( ! initialized ) {
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A+
6399N/A+
6399N/A try {
6399N/A- log->log("C_GetMechanismInfo called\n");
6399N/A+ mylog->log("C_GetMechanismInfo called\n");
6399N/A if( pInfo == NULL ) {
6399N/A throw PKCS11Exception(CKR_ARGUMENTS_BAD);
6399N/A }
6399N/A slotList->validateSlotID(slotID);
6399N/A- if( ! slotList->getSlot(slotIDToIndex(slotID))->isTokenPresent() ) {
6399N/A+
6399N/A+
6399N/A+ Slot *slot = slotList->getSlot(slotIDToIndex(slotID));
6399N/A+
6399N/A+ if( ! slot || ! slot->isTokenPresent() ) {
6399N/A return CKR_TOKEN_NOT_PRESENT;
6399N/A }
6399N/A
6399N/A+ switch (slot->getAlgs()) {
6399N/A+ case ALG_ECC|ALG_RSA:
6399N/A+ mechanismList = allMechanismList;
6399N/A+ numMechanisms = numAllMechanisms;
6399N/A+ break;
6399N/A+ case ALG_ECC:
6399N/A+ mechanismList = ecMechanismList;
6399N/A+ numMechanisms = numECMechanisms;
6399N/A+ break;
6399N/A+ case ALG_NONE:
6399N/A+ case ALG_RSA:
6399N/A+ default:
6399N/A+ mechanismList = rsaMechanismList;
6399N/A+ numMechanisms = numRSAMechanisms;
6399N/A+ break;
6399N/A+ }
6399N/A+
6399N/A for(unsigned int i=0; i < numMechanisms; ++i ) {
6399N/A if( mechanismList[i].mech == type ) {
6399N/A *pInfo = mechanismList[i].info;
6399N/A- log->log("C_GetMechanismInfo got info about %d\n", type);
6399N/A+ mylog->log("C_GetMechanismInfo got info about %d\n", type);
6399N/A return CKR_OK;
6399N/A }
6399N/A }
6399N/A- log->log("C_GetMechanismInfo failed to find info about %d\n", type);
6399N/A+ mylog->log("C_GetMechanismInfo failed to find info about %d\n", type);
6399N/A return CKR_MECHANISM_INVALID; // mechanism not in the list
6399N/A } catch(PKCS11Exception &e) {
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A return e.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -412,7 +495,7 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("C_OpenSession called\n");
6399N/A+ mylog->log("C_OpenSession called\n");
6399N/A slotList->validateSlotID(slotID);
6399N/A #ifdef LATER // the CSP isn't setting this bit right now.
6399N/A if( ! (flags & CKF_SERIAL_SESSION) ) {
6399N/A@@ -430,7 +513,7 @@
6399N/A return CKR_OK;
6399N/A
6399N/A } catch(PKCS11Exception &e) {
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A return e.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -442,13 +525,13 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("C_CloseSession(0x%x) called\n", hSession);
6399N/A+ mylog->log("C_CloseSession(0x%x) called\n", hSession);
6399N/A // !!!XXX Hack
6399N/A // If nothing else, we need to logout the token when all
6399N/A // its sessions are closed.
6399N/A return CKR_OK;
6399N/A } catch(PKCS11Exception &e) {
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A return e.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -460,14 +543,14 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("C_CloseAllSessions(0x%x) called\n", slotID);
6399N/A+ mylog->log("C_CloseAllSessions(0x%x) called\n", slotID);
6399N/A slotList->validateSlotID(slotID);
6399N/A // !!!XXX Hack
6399N/A // If nothing else, we need to logout the token when all
6399N/A // its sessions are closed.
6399N/A return CKR_OK;
6399N/A } catch(PKCS11Exception &e) {
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A return e.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -481,7 +564,7 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("C_FindObjectsInit called, %lu templates\n", ulCount);
6399N/A+ mylog->log("C_FindObjectsInit called, %lu templates\n", ulCount);
6399N/A dumpTemplates(pTemplate, ulCount);
6399N/A
6399N/A if( pTemplate == NULL && ulCount != 0 ) {
6399N/A@@ -490,7 +573,7 @@
6399N/A slotList->findObjectsInit(hSession, pTemplate, ulCount);
6399N/A return CKR_OK;
6399N/A } catch(PKCS11Exception &e) {
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A return e.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -504,22 +587,22 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("C_FindObjects called, max objects = %lu\n", ulMaxObjectCount );
6399N/A+ mylog->log("C_FindObjects called, max objects = %lu\n", ulMaxObjectCount );
6399N/A if( phObject == NULL && ulMaxObjectCount != 0 ) {
6399N/A throw PKCS11Exception(CKR_ARGUMENTS_BAD);
6399N/A }
6399N/A slotList->findObjects(hSession, phObject, ulMaxObjectCount,
6399N/A pulObjectCount);
6399N/A count = *pulObjectCount;
6399N/A- log->log("returned %lu objects:", count );
6399N/A+ mylog->log("returned %lu objects:", count );
6399N/A CK_ULONG i;
6399N/A for (i = 0; i < count; ++i) {
6399N/A- log->log(" 0x%08lx", phObject[i]);
6399N/A+ mylog->log(" 0x%08lx", phObject[i]);
6399N/A }
6399N/A- log->log("\n" );
6399N/A+ mylog->log("\n" );
6399N/A return CKR_OK;
6399N/A } catch(PKCS11Exception &e) {
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A return e.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -542,7 +625,7 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("C_Login called\n");
6399N/A+ mylog->log("C_Login called\n");
6399N/A if( userType != CKU_USER ) {
6399N/A throw PKCS11Exception(CKR_USER_TYPE_INVALID);
6399N/A }
6399N/A@@ -552,7 +635,7 @@
6399N/A slotList->login(hSession, pPin, ulPinLen);
6399N/A return CKR_OK;
6399N/A } catch(PKCS11Exception &e) {
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A return e.getCRV();
6399N/A }
6399N/A }
6399N/A@@ -566,7 +649,7 @@
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A try {
6399N/A- log->log("C_GetAttributeValue called, %lu templates for object 0x%08lx\n", ulCount, hObject);
6399N/A+ mylog->log("C_GetAttributeValue called, %lu templates for object 0x%08lx\n", ulCount, hObject);
6399N/A dumpTemplates(pTemplate, ulCount);
6399N/A if( pTemplate == NULL && ulCount != 0 ) {
6399N/A throw PKCS11Exception(CKR_ARGUMENTS_BAD);
6399N/A@@ -576,7 +659,7 @@
6399N/A return CKR_OK;
6399N/A } catch(PKCS11Exception& e) {
6399N/A CK_RV rv = e.getCRV();
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A if (rv == CKR_ATTRIBUTE_TYPE_INVALID ||
6399N/A rv == CKR_BUFFER_TOO_SMALL) {
6399N/A dumpTemplates(pTemplate, ulCount);
6399N/A@@ -595,24 +678,24 @@
6399N/A CK_RV
6399N/A C_WaitForSlotEvent(CK_FLAGS flags, CK_SLOT_ID_PTR pSlot, CK_VOID_PTR pReserved)
6399N/A {
6399N/A- finalizeLock.getLock();
6399N/A+ FINALIZE_GETLOCK();
6399N/A if( ! initialized ) {
6399N/A- finalizeLock.releaseLock();
6399N/A+ FINALIZE_RELEASELOCK();
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A if (finalizing) {
6399N/A- finalizeLock.releaseLock();
6399N/A+ FINALIZE_RELEASELOCK();
6399N/A return CKR_CRYPTOKI_NOT_INITIALIZED;
6399N/A }
6399N/A waitEvent = TRUE;
6399N/A- finalizeLock.releaseLock();
6399N/A+ FINALIZE_RELEASELOCK();
6399N/A try {
6399N/A- log->log("C_WaitForSlotEvent called\n");
6399N/A+ mylog->log("C_WaitForSlotEvent called\n");
6399N/A slotList->waitForSlotEvent(flags, pSlot, pReserved);
6399N/A waitEvent = FALSE;
6399N/A return CKR_OK;
6399N/A } catch(PKCS11Exception& e) {
6399N/A- e.log(log);
6399N/A+ e.log(mylog);
6399N/A waitEvent = FALSE;
6399N/A return e.getCRV();
6399N/A }