[389-commits] esc/mac/Tokend-35209/CoolKey CoolKeyAttributeCoder.cpp, 1.1.2.2, 1.1.2.3 CoolKeyPK11.cpp, 1.1.2.2, 1.1.2.3 CoolKeyPK11.h, 1.1.2.2, 1.1.2.3 CoolKeyToken.cpp, 1.1.2.2, 1.1.2.3

Jack Magne jmagne at fedoraproject.org
Thu May 20 01:27:14 UTC 2010


Author: jmagne

Update of /cvs/dirsec/esc/mac/Tokend-35209/CoolKey
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv16742

Modified Files:
      Tag: PKI_8_0_RTM_BRANCH
	CoolKeyAttributeCoder.cpp CoolKeyPK11.cpp CoolKeyPK11.h 
	CoolKeyToken.cpp 
Log Message:
Address TokenD portion of [Bug 403571] CoolKey compatibility with Mac OS X 10.5.


Index: CoolKeyAttributeCoder.cpp
===================================================================
RCS file: /cvs/dirsec/esc/mac/Tokend-35209/CoolKey/CoolKeyAttributeCoder.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- CoolKeyAttributeCoder.cpp	17 Mar 2010 00:10:50 -0000	1.1.2.2
+++ CoolKeyAttributeCoder.cpp	20 May 2010 01:27:12 -0000	1.1.2.3
@@ -54,7 +54,7 @@
 void CoolKeyDataAttributeCoder::decode(TokenContext *tokenContext,
 	const MetaAttribute &metaAttribute, Record &record)
 {
-   Syslog::notice("CoolKeyDataAttributeCoder::decode");
+   //Syslog::notice("CoolKeyDataAttributeCoder::decode");
 }
 
 CoolKeyCertAttributeCoder:: ~CoolKeyCertAttributeCoder()
@@ -93,7 +93,7 @@
     switch(id)
     {
         case kSecAlias:
-            Syslog::notice("kSecAlias");
+            //Syslog::notice("kSecAlias");
 
             cert->getLabel(tData,&dataLen);
 
@@ -103,7 +103,7 @@
         case kSecSubjectItemAttr:
            cert->getSubject(tData,&dataLen);
 
-           Syslog::notice("kSecSubjectItemAttr retrieved data %p datalen %lu",tData,dataLen);
+           //Syslog::notice("kSecSubjectItemAttr retrieved data %p datalen %lu",tData,dataLen);
 
            record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((const void *)tData,dataLen));
         break;
@@ -111,7 +111,7 @@
         case kSecIssuerItemAttr:
            cert->getIssuer(tData,&dataLen);
 
-           Syslog::notice("kSecIssuertItemAttr retrieved data %p datalen %lu",tData,dataLen);
+           //Syslog::notice("kSecIssuertItemAttr retrieved data %p datalen %lu",tData,dataLen);
 
            record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((const void *)tData,dataLen));
         break;
@@ -119,13 +119,13 @@
         case kSecSerialNumberItemAttr:
            cert->getSerialNo(tData,&dataLen);
 
-           Syslog::notice("kSecSerialNumnberItemAttr retrieved data %p datalen %lu",tData,dataLen);
+           //Syslog::notice("kSecSerialNumnberItemAttr retrieved data %p datalen %lu",tData,dataLen);
 
            record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((const void *)tData,dataLen));
         break;
 
         case kSecPublicKeyHashItemAttr:
-            Syslog::notice("kSecPublicKeyHashItemAttr");
+            //Syslog::notice("kSecPublicKeyHashItemAttr");
 
             getCertAttributeFromData(cert,kSecPublicKeyHashItemAttr, tData, &dataLen);
 
@@ -140,7 +140,7 @@
         case kSecCertTypeItemAttr:
             type = cert->getType();
 
-            Syslog::notice("kSecCertTypeItemAttr type %lu",type);
+            //Syslog::notice("kSecCertTypeItemAttr type %lu",type);
 
             if(type == CKC_X_509)
                type  = CSSM_CERT_X_509v3;
@@ -150,7 +150,7 @@
             else
                 type = CSSM_CERT_UNKNOWN;
 
-            Syslog::notice("kSecCertTypeItemAttr final type %lu",type);
+            //Syslog::notice("kSecCertTypeItemAttr final type %lu",type);
             record.attributeAtIndex(metaAttribute.attributeIndex(),new Attribute((uint32)type));
         break;
 
@@ -165,7 +165,7 @@
         case kSecLabelItemAttr:
             cert->getLabel(tData,&dataLen);
 
-            Syslog::notice("kSecLabelItemAttr retrieved data %p datalen %lu",tData,dataLen);
+            //Syslog::notice("kSecLabelItemAttr retrieved data %p datalen %lu",tData,dataLen);
 
             record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((const void *)tData,dataLen));
      break;
@@ -194,7 +194,7 @@
 
     *aDataLen = 0;
 
-    Syslog::notice("CoolKeyCertAttributeCoder::getCertAttributeFromData");
+    //Syslog::notice("CoolKeyCertAttributeCoder::getCertAttributeFromData");
 
      aCert->getData(certData,&certDataLen);
 
@@ -209,7 +209,7 @@
      if(status)
          return;
 
-     Syslog::notice("CoolKeyCertAttributeCoder::getCertAttributeFromData done created cert");
+     //Syslog::notice("CoolKeyCertAttributeCoder::getCertAttributeFromData done created cert");
      SecKeychainAttribute ska = { kSecPublicKeyHashItemAttr };
 
      SecKeychainItemRef tRef = (SecKeychainItemRef) theCertificate;
@@ -217,7 +217,7 @@
      status = SecKeychainItemCopyContent(tRef, NULL, &skal,
                 NULL, NULL);
 
-     Syslog::notice("CoolKeyCertAttributeCoder::getCertAttributeFromData done got attribute");
+     //Syslog::notice("CoolKeyCertAttributeCoder::getCertAttributeFromData done got attribute");
 
      if(!status)
          return;
@@ -260,7 +260,7 @@
 
     CK_BYTE  attrib = 0;
 
-    Syslog::notice("CoolKeyKeyAttributeCoder::decode coder %p id %d format %d record %p",this,id,format,&record);
+    //Syslog::notice("CoolKeyKeyAttributeCoder::decode coder %p id %d format %d record %p",this,id,format,&record);
     switch(id)
     {
          case  kSecKeyKeyClass:
@@ -269,7 +269,7 @@
 
          case  kSecKeyPrintName: 
 
-            Syslog::notice("kSecKeyPrintName");
+            //Syslog::notice("kSecKeyPrintName");
 
             key->getLabel(tData,&dataLen);
 
@@ -285,12 +285,12 @@
          break;
 
          case kSecKeyPrivate:
-             Syslog::notice("kSecKeyKeyPrivate");
+             //Syslog::notice("kSecKeyKeyPrivate");
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)1));
          break;
 
          case  kSecKeyModifiable:
-             Syslog::notice("kSecKeyKeyModifiable");
+             //Syslog::notice("kSecKeyKeyModifiable");
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)0));
          break;
 
@@ -303,22 +303,22 @@
          break;
 
          case  kSecKeyKeyType:
-             Syslog::notice("kSecKeyType");
+             //Syslog::notice("kSecKeyType");
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)CSSM_ALGID_RSA));
          break;
             
          case  kSecKeyKeySizeInBits:
-             Syslog::notice("kSecKeyKeySizeInBits");
+             //Syslog::notice("kSecKeyKeySizeInBits");
 
              value = key->getKeySize();
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)value));
 
-             Syslog::notice("kSecKeyKeySizeInBits %d",value);
+             //Syslog::notice("kSecKeyKeySizeInBits %d",value);
          break;
 
          case  kSecKeyEffectiveKeySize:
-            Syslog::notice("kSecKeyEffectiveKeySize");
+            //Syslog::notice("kSecKeyEffectiveKeySize");
  
              value =  key->getKeySize();;
  
@@ -338,7 +338,7 @@
          case  kSecKeySensitive:
              attrib = key->getSensitive();
 
-             Syslog::notice("kSecKeySensitive %d",attrib);
+             //Syslog::notice("kSecKeySensitive %d",attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -346,13 +346,13 @@
          case  kSecKeyAlwaysSensitive:
              attrib = key->getAlwaysSensitive();
 
-             Syslog::notice("kSecKeyAlwaysSensitive %d", attrib);
+             //Syslog::notice("kSecKeyAlwaysSensitive %d", attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
 
          case  kSecKeyExtractable:
-             Syslog::notice("kSecKeyExtractable");
+             //Syslog::notice("kSecKeyExtractable");
 
              attrib = key->getKeyExtractable();
 
@@ -360,7 +360,7 @@
          break;
 
          case kSecKeyNeverExtractable:
-             Syslog::notice("kSecKeyNeverExtractable");
+             //Syslog::notice("kSecKeyNeverExtractable");
 
              attrib = key->getKeyNeverExtractable();
 
@@ -368,11 +368,11 @@
          break;
 
          case  kSecKeyEncrypt:
-             Syslog::notice("kSecKeyKeyEncrypt");
+             //Syslog::notice("kSecKeyKeyEncrypt");
 
              attrib = key->getKeyEncrypt();
 
-             Syslog::notice("kSecKeyEncrypt value %d",attrib);
+             //Syslog::notice("kSecKeyEncrypt value %d",attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -380,7 +380,7 @@
          case  kSecKeyDecrypt:
              attrib = key->getKeyDecrypt();
 
-             Syslog::notice("kSecKeyDecrypt value %d",attrib);
+             //Syslog::notice("kSecKeyDecrypt value %d",attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -388,7 +388,7 @@
          case  kSecKeyDerive:
              attrib = key->getKeyDerive();
 
-             Syslog::notice("kSecKeyKeyDerive %d", attrib);
+             //Syslog::notice("kSecKeyKeyDerive %d", attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -396,7 +396,7 @@
          case kSecKeySign:
              attrib = key->getKeySign();
 
-             Syslog::notice("kSecKeyKeySign value %d",attrib);
+             //Syslog::notice("kSecKeyKeySign value %d",attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -404,7 +404,7 @@
          case kSecKeyVerify:
              attrib = key->getKeyVerify();
 
-             Syslog::notice("kSecKeyKeyVerify value %d",attrib);
+             //Syslog::notice("kSecKeyKeyVerify value %d",attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -412,7 +412,7 @@
          case  kSecKeySignRecover:
              attrib = key->getKeySignRecover();
 
-             Syslog::notice("kSecKeyKeySignRecover %d", attrib);
+             //Syslog::notice("kSecKeyKeySignRecover %d", attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -420,7 +420,7 @@
          case  kSecKeyVerifyRecover:
              attrib = key->getKeyVerifyRecover();
 
-             Syslog::notice("kSecKeyKeyVerifyRecover %d", attrib);
+             //Syslog::notice("kSecKeyKeyVerifyRecover %d", attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -428,7 +428,7 @@
          case  kSecKeyWrap:
              attrib = key->getKeyWrap();
 
-             Syslog::notice("kSecKeyKeyWrap %d", attrib);
+             //Syslog::notice("kSecKeyKeyWrap %d", attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
@@ -436,13 +436,13 @@
          case  kSecKeyUnwrap:
              attrib = key->getKeyUnwrap();
 
-             Syslog::notice("kSecKeyKeyUnwrap %d", attrib);
+             //Syslog::notice("kSecKeyKeyUnwrap %d", attrib);
 
              record.attributeAtIndex(metaAttribute.attributeIndex(), new Attribute((uint32)attrib));
          break;
 
          case kSecKeyLabel:
-             Syslog::notice("kSecKeyLabel");
+             //Syslog::notice("kSecKeyLabel");
 
              key->getLabel(tData,&dataLen);
 


Index: CoolKeyPK11.cpp
===================================================================
RCS file: /cvs/dirsec/esc/mac/Tokend-35209/CoolKey/CoolKeyPK11.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- CoolKeyPK11.cpp	17 Mar 2010 00:10:51 -0000	1.1.2.2
+++ CoolKeyPK11.cpp	20 May 2010 01:27:12 -0000	1.1.2.3
@@ -147,7 +147,7 @@
    return loggedIn; 
 }
 
-int CoolKeyPK11::loadModule()
+int CoolKeyPK11::loadModule(const SCARD_READERSTATE &readerInfo)
 {
 
     CK_RV ck_rv;
@@ -221,7 +221,7 @@
     //Syslog::debug("Successfully Initialized PKCS11 module. ");
 
     mInitialized = 1;
-    int res = loadSlotList();
+    int res = loadSlotList(readerInfo);
 
     if(res)
     {
@@ -412,7 +412,7 @@
     return 1;
 }
 
-int CoolKeyPK11::loadSlotList()
+int CoolKeyPK11::loadSlotList(const SCARD_READERSTATE &readerInfo)
 {
     mTokenUid[0] = 0;
     int result = 0;
@@ -451,8 +451,6 @@
              Syslog::debug("In CoolKeyToken::probe() GetSlotList error: %d ",ck_rv);
          }
 
-         mOurSlotIndex = nSlots - 1;
-
          for(CK_ULONG i = 0; i < nSlots ; i++)
          {
              CK_SLOT_INFO sinfo;
@@ -502,7 +500,15 @@
 
              }
 
-             if(sinfo.flags & CKF_TOKEN_PRESENT )
+             int isTheOne = 0;
+
+             if(strstr((char *)sinfo.slotDescription , (char *)readerInfo.szReader))
+             {
+                 isTheOne = 1;
+                 Syslog::notice("szReader == slotDescripton, we found the reader!");
+             }
+
+             if(sinfo.flags & CKF_TOKEN_PRESENT && isTheOne)
              {
                   CK_TOKEN_INFO tinfo;
 
@@ -520,7 +526,7 @@
                   Syslog::notice("        serialNumber = \"%.16s\"", tinfo.serialNumber);
                   Syslog::notice("        flags = 0x%08lx", tinfo.flags);
 
-                  /*
+                 /* 
                   Syslog::notice("            -> RNG = %s",
                         tinfo.flags & CKF_RNG ? "TRUE" : "FALSE");
                   Syslog::notice("            -> WRITE PROTECTED = %s",
@@ -544,9 +550,9 @@
                   Syslog::notice("        ulTotalPrivateMemory = %lu", tinfo.ulTotalPrivateMemory);
                   Syslog::notice("        ulFreePrivateMemory = %lu", tinfo.ulFreePrivateMemory);
                   Syslog::notice("        hardwareVersion = %lu.%02lu", 
-                      (uint32)tinfo.hardwareVersion.major, (uint32)tinfo.hardwareVersion.minor);
+                      (CK_ULONG)tinfo.hardwareVersion.major, (CK_ULONG)tinfo.hardwareVersion.minor);
                        Syslog::notice("        firmwareVersion = %lu.%02lu",
-                       (uint32)tinfo.firmwareVersion.major, (uint32)tinfo.firmwareVersion.minor);
+                       (CK_ULONG)tinfo.firmwareVersion.major, (CK_ULONG)tinfo.firmwareVersion.minor);
                   Syslog::notice("        utcTime = \"%.16s\"", tinfo.utcTime);
                   */     
 
@@ -555,20 +561,22 @@
                          
                   memcpy((void  *) mTokenUid, (void *) tinfo.label,label_size);
                   mTokenUid[label_size -1] = 0;
+
+                  mOurSlotIndex = i;
+                  result = 1;
              }
              else
              {
                  Syslog::error(" Token not present in slot ");
-                 return  result;
+                 continue;   //return  result;
              }
-             
          }
      }else
      {
          return result;
      }
 
-     return 1;
+     return result;
 }
 
 //Actual crypto ops
@@ -673,7 +681,7 @@
 {
     CK_RV ck_rv;
 
-    Syslog::notice("CoolKeyObject::loadAttributes with args template size %d",aTemplateSize);
+    //Syslog::notice("CoolKeyObject::loadAttributes with args template size %d",aTemplateSize);
 
     if(!aTemplate || aTemplateSize <= 0 || mAttributesLoaded)
         return;
@@ -682,7 +690,7 @@
 
     if(mParent && (funcPtr = mParent->getFunctionPointer()))
     {
-         Syslog::notice("CoolKeyObject::loadAttributes got function pointer");
+         //Syslog::notice("CoolKeyObject::loadAttributes got function pointer");
          ck_rv = funcPtr->C_GetAttributeValue(mSessHandle, mObjHandle, aTemplate, aTemplateSize);
 
          switch(ck_rv)
@@ -699,12 +707,13 @@
              break;
          };
 
-         for(int i = 0 ; i < aTemplateSize ; i++)
+        /* for(int i = 0 ; i < aTemplateSize ; i++)
          {
              Syslog::notice("Object attribute:  name % stype 0x%lx ,  size %d",
                  attributeName(aTemplate[i].type),aTemplate[i].type,
                  aTemplate[i].ulValueLen);             
          }
+        */
 
          //Do it again to get actual data
 
@@ -752,9 +761,10 @@
 
              if(size && size != -1 &&  data)
              {
-                Syslog::notice("Legitimate Object attribute saving.... Name: %s : type 0x%lx ,  size %d",
+               /* Syslog::notice("Legitimate Object attribute saving.... Name: %s : type 0x%lx ,  size %d",
                    attributeName(aTemplate[i].type),aTemplate[i].type,
                    aTemplate[i].ulValueLen);
+               */
 
                 CK_ATTRIBUTE * newAttr = new CK_ATTRIBUTE ;
 
@@ -777,7 +787,7 @@
                 newAttr->type = aTemplate[i].type;
                 newAttr->pValue = aTemplate[i].pValue;
 
-                CoolKeyObject::dumpData((CK_BYTE *)newAttr->pValue,newAttr->ulValueLen);
+                //CoolKeyObject::dumpData((CK_BYTE *)newAttr->pValue,newAttr->ulValueLen);
 
                 // put the attribute in our local map
 
@@ -821,7 +831,7 @@
 
     result = getByteAttribute(CKA_SENSITIVE);
 
-    Syslog::notice("In CoolKeyObject::getID type %c",result);
+    //Syslog::notice("In CoolKeyObject::getID type %c",result);
     return result;
 }
 
@@ -832,7 +842,7 @@
 
     result = getByteAttribute(CKA_ENCRYPT);
 
-    Syslog::notice("In CoolKeyObject::getKeyEncrypt result %d",result);
+    //Syslog::notice("In CoolKeyObject::getKeyEncrypt result %d",result);
     return result;
 
 
@@ -845,7 +855,7 @@
 
     result = getByteAttribute(CKA_DECRYPT);
 
-    Syslog::notice("In CoolKeyObject::getKeyDecrypt type %d",result);
+    //Syslog::notice("In CoolKeyObject::getKeyDecrypt type %d",result);
     return result;
 
 }
@@ -857,7 +867,7 @@
 
     result = getByteAttribute(CKA_SIGN);
 
-    Syslog::notice("In CoolKeyKeyObject::getKeySign type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getKeySign type %d",result);
     return result;
 
 
@@ -869,7 +879,7 @@
     CK_BYTE result = 0;
 
     result = getByteAttribute(CKA_WRAP);
-    Syslog::notice("In CoolKeyKeyObject::getKeyWrap type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getKeyWrap type %d",result);
     return result;
 
 
@@ -882,7 +892,7 @@
 
     result = getByteAttribute(CKA_VERIFY);
 
-    Syslog::notice("In CoolKeyKeyObject::getKeyVerify type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getKeyVerify type %d",result);
     return result;
 
 
@@ -894,7 +904,7 @@
     CK_BYTE result = 0;
 
     result = getByteAttribute(CKA_DERIVE);
-    Syslog::notice("In CoolKeyKeyObject::getKeyDerive type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getKeyDerive type %d",result);
     return result;
 
 
@@ -907,7 +917,7 @@
          
     result = getByteAttribute(CKA_UNWRAP);
 
-    Syslog::notice("In CoolKeyKeyObject::getKeyUnwrap type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getKeyUnwrap type %d",result);
     return result;
 
          
@@ -920,7 +930,7 @@
 
     result = getByteAttribute(CKA_SIGN_RECOVER);
 
-    Syslog::notice("In CoolKeyKeyObject::getKeySignRecover type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getKeySignRecover type %d",result);
     return result;
 
 }
@@ -932,7 +942,7 @@
 
     result = getByteAttribute(CKA_VERIFY_RECOVER);
 
-    Syslog::notice("In CoolKeyObject::getKeyKeyVerifyRecover type %d",result);
+    //Syslog::notice("In CoolKeyObject::getKeyKeyVerifyRecover type %d",result);
     return result;
 
 }
@@ -944,7 +954,7 @@
 
     result = getByteAttribute(CKA_EXTRACTABLE);
 
-    Syslog::notice("In CoolKeyKeyObject::getExtractable type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getExtractable type %d",result);
     return result;
 
 }
@@ -956,7 +966,7 @@
 
     result = getByteAttribute(CKA_NEVER_EXTRACTABLE);
 
-    Syslog::notice("In CoolKeyKeyObject::getNeverExtractable type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getNeverExtractable type %d",result);
     return result;
 
 }
@@ -967,7 +977,7 @@
 
     result = getByteAttribute(CKA_ALWAYS_SENSITIVE);
 
-    Syslog::notice("In CoolKeyKeyObject::getAlwaysSensitive type %d",result);
+    //Syslog::notice("In CoolKeyKeyObject::getAlwaysSensitive type %d",result);
     return result;
 }
 
@@ -981,7 +991,7 @@
 
    getByteDataAttribute(CKA_LABEL,aData,aDataLen);
 
-   Syslog::notice("In CoolKeyKeyObject::getLabel %s",aData);
+   //Syslog::notice("In CoolKeyKeyObject::getLabel %s",aData);
 }
 
 CK_BYTE CoolKeyObject::getID()
@@ -990,7 +1000,7 @@
 
     result = getByteAttribute(CKA_ID);
 
-    Syslog::notice("In CoolKeyObject::getID type %c",result);
+    //Syslog::notice("In CoolKeyObject::getID type %c",result);
     return result;
 }
 
@@ -1148,7 +1158,7 @@
 
 CoolKeyObject::CoolKeyObject(CK_OBJECT_HANDLE aObjHandle, CK_SESSION_HANDLE aSessHandle,CK_LONG aObjClass,CoolKeyPK11 *aParent) : mObjHandle(aObjHandle),mSessHandle(aSessHandle),mAttributesLoaded(0),mObjClass(aObjClass),mParent(aParent)
 {
-    Syslog::notice("In CoolKeyObject::CoolKeyObject mObjClass %d",mObjClass);
+    //Syslog::notice("In CoolKeyObject::CoolKeyObject mObjClass %d",mObjClass);
 }
 
 CK_ATTRIBUTE * CoolKeyObject::getAttribute(CK_ATTRIBUTE_TYPE aAttr)
@@ -1183,7 +1193,7 @@
 
     CK_ATTRIBUTE *theAttr = getAttribute(aAttr);
 
-    Syslog::notice("In CoolKeyObject::getULongAttr attr %p size %d  value %p",theAttr,theAttr->ulValueLen,theAttr->pValue);
+    //Syslog::notice("In CoolKeyObject::getULongAttr attr %p size %d  value %p",theAttr,theAttr->ulValueLen,theAttr->pValue);
 
     if(!theAttr)
         return 0;
@@ -1226,7 +1236,7 @@
 
    CK_ATTRIBUTE *theAttr = getAttribute(aAttr);
 
-   Syslog::notice("In CoolKeyObject::getByteData attr %p  attr size %d ",theAttr,theAttr->ulValueLen);
+   //Syslog::notice("In CoolKeyObject::getByteData attr %p  attr size %d ",theAttr,theAttr->ulValueLen);
     if(!theAttr)
         return ;
 


Index: CoolKeyPK11.h
===================================================================
RCS file: /cvs/dirsec/esc/mac/Tokend-35209/CoolKey/CoolKeyPK11.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- CoolKeyPK11.h	17 Mar 2010 00:10:51 -0000	1.1.2.2
+++ CoolKeyPK11.h	20 May 2010 01:27:12 -0000	1.1.2.3
@@ -10,6 +10,7 @@
 //#include <Security/SecKey.h>
 #include <map>
 #include <string>
+#include <Token.h>
 
 #define COOLKEY_MAX_SLOTS 20
 #define PKCS11_PATH_NAME "/Library/Application Support/CoolKey/PKCS11/libcoolkeypk11.dylib"
@@ -125,7 +126,7 @@
     CoolKeyPK11(): mPk11Driver(NULL),mEpv(NULL),mInitialized(0),mOurSlotIndex(0),mIsOurToken(0),mCachedPIN("") {} ;
     virtual ~CoolKeyPK11() {};
 
-    int loadModule();
+    int loadModule(const SCARD_READERSTATE &readerInfo);
     int freeModule();
 
     int loginToken(char *aPIN);
@@ -161,7 +162,7 @@
 
 private:
 
-    int loadSlotList();
+    int loadSlotList(const SCARD_READERSTATE &readerInfo);
 
     void * mPk11Driver;
     CK_FUNCTION_LIST_PTR mEpv;


Index: CoolKeyToken.cpp
===================================================================
RCS file: /cvs/dirsec/esc/mac/Tokend-35209/CoolKey/CoolKeyToken.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- CoolKeyToken.cpp	17 Mar 2010 00:10:53 -0000	1.1.2.2
+++ CoolKeyToken.cpp	20 May 2010 01:27:12 -0000	1.1.2.3
@@ -176,7 +176,7 @@
    Syslog::notice ("READER_STATE -> cbAtr %u",readerState.cbAtr);
    Syslog::notice("READER_STATE -> rgbAtr %32x",(char *) readerState.rgbAtr);
 
-    int res = mCoolKey.loadModule();
+    int res = mCoolKey.loadModule(readerState);
      
     /* if(res)
          res = mCoolKey.loadObjects();
@@ -346,7 +346,7 @@
         {
             CK_BYTE id = obj->getID();
             oClass = obj->getClass();
-            Syslog::notice("Retrieved object %p class %lu id %d",obj,oClass,id); 
+            //Syslog::notice("Retrieved object %p class %lu id %d",obj,oClass,id); 
  
             CoolKeyRecord *newRecord = new CoolKeyRecord(obj); 
 
@@ -358,12 +358,12 @@
             {
                 case CKO_PRIVATE_KEY:
                     privateKeyRelation.insertRecord(theRecord);
-                    Syslog::notice("Inserting private key record %p",newRecord);
+                    //Syslog::notice("Inserting private key record %p",newRecord);
                     keys[obj] = theRecord;
                 break;
 
                 case CKO_PUBLIC_KEY:
-                Syslog::notice("Inserting public key record %p theRefRecord %p",newRecord,theRecord.get());
+                //Syslog::notice("Inserting public key record %p theRefRecord %p",newRecord,theRecord.get());
                              publicKeyRelation.insertRecord(theRecord);
                              keys[obj] = theRecord;
                 break;
@@ -371,7 +371,7 @@
                 case CKO_CERTIFICATE:
                     certs[id] = obj;
                     certRecs[obj] = theRecord;
-                    Syslog::notice("Inserting cert record %p",newRecord);
+                    //Syslog::notice("Inserting cert record %p",newRecord);
                     certRelation.insertRecord(theRecord);
                 break; 
 
@@ -404,21 +404,21 @@
                         RefPointer<CoolKeyRecord>  coolKeyRecRef = keys[obj];
                         CoolKeyRecord *  coolKeyRec = coolKeyRecRef.get();  
 
-                        Syslog::notice("Key %p  linked to cert %p",obj,cert);
+                        //Syslog::notice("Key %p  linked to cert %p",obj,cert);
 
                         if(coolKeyRec)
                         {
-                            Syslog::notice("Found record to create adornment record: %p",coolKeyRec);
+                            //Syslog::notice("Found record to create adornment record: %p",coolKeyRec);
                             if(certRecs[cert])
                             {
                                 Tokend::LinkedRecordAdornment * lra = new Tokend::LinkedRecordAdornment(certRecs[cert]);
-                                 Syslog::notice("lra %p",lra);
+                                 //Syslog::notice("lra %p",lra);
 
                                  if(lra)
                                  { 
                                      coolKeyRec->setAdornment(mSchema->publicKeyHashCoder().certificateKey(),
                                              lra);
-                                     Syslog::notice("certificateKey %p certRecs[cert] %p",mSchema->publicKeyHashCoder().certificateKey(),certRecs[cert].get());
+                                     //Syslog::notice("certificateKey %p certRecs[cert] %p",mSchema->publicKeyHashCoder().certificateKey(),certRecs[cert].get());
                                  }
                              }
                          }



More information about the 389-commits mailing list