I am currently developing a PKCS11 module for a new card and I am seeing
some strange behavior: For some reason, thunderbird continually repeats
the same 7 functions over and over eventhough it "installs" the module
successfully. Most of them are just "getInfo" functions but it also
continues to call C_OpenSession which is a problem since that calls
attempts to access the card.
I have returned CKR_SESSION_COUNT and it still loops. So, my guess is
that it is due to something else I have done I just don't know what.
Below I have an example output of the calls using pkcs11-spy from opensc.
Can someone give me a hand on this? I am working with a lot of
technologies I don't quite understand.
Christian
--------------spy log----------------
*************** OpenSC PKCS#11 spy *****************
Loaded: "C:\dev\NIST_PKCS11\bin\NIST_PKCS11.dll"
0: C_GetFunctionList
Returned: 0 CKR_OK
1: C_Initialize
Returned: 10 CKR_CANT_LOCK
2: C_Initialize
Returned: 0 CKR_OK
3: C_GetInfo
cryptokiVersion: 2.0
manufacturerID: 'Electrosoft Inc. '
flags: 0
libraryDescription: 'Cryptoki module for PIV for NIST'
libraryVersion: 32.32
Returned: 0 CKR_OK
4: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Count is 1
[out] *pulCount = 0x1
Returned: 0 CKR_OK
5: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Slot 0
[out] *pulCount = 0x1
Returned: 0 CKR_OK
6: C_GetSlotInfo
[in] slotID = 0x0
[out] pInfo:
slotDescription: 'Gemplus USB Smart Card Reader 0 '
' '
manufacturerID: 'Gem PC Twin '
hardwareVersion: 1.12
firmwareVersion: 1.0
flags: 7
CKF_TOKEN_PRESENT
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
7: C_GetTokenInfo
[in] slotID = 0x0
[out] pInfo:
label: 'PIV II Dev Token '
manufacturerID: 'NIST PIV '
model: 'PIV II '
serialNumber: 'BAD0000 '
ulMaxSessionCount: 1
ulSessionCount: 0
ulMaxRwSessionCount: 2
ulRwSessionCount: 0
ulMaxPinLen: 8
ulMinPinLen: 4
ulTotalPublicMemory: 123456789
ulFreePublicMemory: 1234567890
ulTotalPrivateMemory: 123456789
ulFreePrivateMemory: 1234567890
hardwareVersion: 1.1
firmwareVersion: 1.1
time: 'Wed Oct 04 14:22'
flags: c
CKF_LOGIN_REQUIRED
CKF_USER_PIN_INITIALIZED
Returned: 0 CKR_OK
8: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
Count is 3
Returned: 0 CKR_OK
9: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
CKM_RSA_PKCS
CKM_DES3_ECB
CKM_DES3_CBC
Returned: 0 CKR_OK
10: C_OpenSession
[in] slotID = 0x0
[in] flags = 0x6
pApplication=0295D808
Notify=6019DC70
[out] *phSession = 0x0
Returned: 0 CKR_OK
11: C_FindObjectsInit
[in] hSession = 0x0
[in] pTemplate[1]:
CKA_CLASS CKO_NETSCAPE_BUILTIN_ROOT_LIST
Returned: 0 CKR_OK
12: C_FindObjects
[in] hSession = 0x0
[in] ulMaxObjectCount = 0x1
[out] ulObjectCount = 0x1
Object 3 Matches
Returned: 0 CKR_OK
13: C_FindObjectsFinal
[in] hSession = 0x0
Returned: 0 CKR_OK
14: C_GetSlotInfo
[in] slotID = 0x0
[out] pInfo:
slotDescription: 'Gemplus USB Smart Card Reader 0 '
' '
manufacturerID: 'Gem PC Twin '
hardwareVersion: 1.12
firmwareVersion: 1.0
flags: 7
CKF_TOKEN_PRESENT
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
15: C_GetTokenInfo
[in] slotID = 0x0
[out] pInfo:
label: 'PIV II Dev Token '
manufacturerID: 'NIST PIV '
model: 'PIV II '
serialNumber: 'BAD0000 '
ulMaxSessionCount: 1
ulSessionCount: 0
ulMaxRwSessionCount: 2
ulRwSessionCount: 0
ulMaxPinLen: 8
ulMinPinLen: 4
ulTotalPublicMemory: 123456789
ulFreePublicMemory: 1234567890
ulTotalPrivateMemory: 123456789
ulFreePrivateMemory: 1234567890
hardwareVersion: 1.1
firmwareVersion: 1.1
time: 'Wed Oct 04 14:22'
flags: c
CKF_LOGIN_REQUIRED
CKF_USER_PIN_INITIALIZED
Returned: 0 CKR_OK
16: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
Count is 3
Returned: 0 CKR_OK
17: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
CKM_RSA_PKCS
CKM_DES3_ECB
CKM_DES3_CBC
Returned: 0 CKR_OK
18: C_OpenSession
[in] slotID = 0x0
[in] flags = 0x6
pApplication=0295D808
Notify=6019DC70
[out] *phSession = 0x0
Returned: 177 CKR_SESSION_COUNT
19: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Count is 1
[out] *pulCount = 0x1
Returned: 0 CKR_OK
20: C_GetSlotInfo
[in] slotID = 0x0
[out] pInfo:
slotDescription: 'Gemplus USB Smart Card Reader 0 '
' '
manufacturerID: 'Gem PC Twin '
hardwareVersion: 1.12
firmwareVersion: 1.0
flags: 7
CKF_TOKEN_PRESENT
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
21: C_GetTokenInfo
[in] slotID = 0x0
[out] pInfo:
label: 'PIV II Dev Token '
manufacturerID: 'NIST PIV '
model: 'PIV II '
serialNumber: 'BAD0000 '
ulMaxSessionCount: 1
ulSessionCount: 0
ulMaxRwSessionCount: 2
ulRwSessionCount: 0
ulMaxPinLen: 8
ulMinPinLen: 4
ulTotalPublicMemory: 123456789
ulFreePublicMemory: 1234567890
ulTotalPrivateMemory: 123456789
ulFreePrivateMemory: 1234567890
hardwareVersion: 1.1
firmwareVersion: 1.1
time: 'Wed Oct 04 14:22'
flags: c
CKF_LOGIN_REQUIRED
CKF_USER_PIN_INITIALIZED
Returned: 0 CKR_OK
22: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
Count is 3
Returned: 0 CKR_OK
23: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
CKM_RSA_PKCS
CKM_DES3_ECB
CKM_DES3_CBC
Returned: 0 CKR_OK
24: C_OpenSession
[in] slotID = 0x0
[in] flags = 0x6
pApplication=0295D808
Notify=6019DC70
[out] *phSession = 0x0
Returned: 177 CKR_SESSION_COUNT
25: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Count is 1
[out] *pulCount = 0x1
Returned: 0 CKR_OK
26: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Count is 1
[out] *pulCount = 0x1
Returned: 0 CKR_OK
27: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Count is 1
[out] *pulCount = 0x1
Returned: 0 CKR_OK
28: C_GetSlotInfo
[in] slotID = 0x0
[out] pInfo:
slotDescription: 'Gemplus USB Smart Card Reader 0 '
' '
manufacturerID: 'Gem PC Twin '
hardwareVersion: 1.12
firmwareVersion: 1.0
flags: 7
CKF_TOKEN_PRESENT
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
29: C_GetTokenInfo
[in] slotID = 0x0
[out] pInfo:
label: 'PIV II Dev Token '
manufacturerID: 'NIST PIV '
model: 'PIV II '
serialNumber: 'BAD0000 '
ulMaxSessionCount: 1
ulSessionCount: 0
ulMaxRwSessionCount: 2
ulRwSessionCount: 0
ulMaxPinLen: 8
ulMinPinLen: 4
ulTotalPublicMemory: 123456789
ulFreePublicMemory: 1234567890
ulTotalPrivateMemory: 123456789
ulFreePrivateMemory: 1234567890
hardwareVersion: 1.1
firmwareVersion: 1.1
time: 'Wed Oct 04 14:22'
flags: c
CKF_LOGIN_REQUIRED
CKF_USER_PIN_INITIALIZED
Returned: 0 CKR_OK
30: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
Count is 3
Returned: 0 CKR_OK
31: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
CKM_RSA_PKCS
CKM_DES3_ECB
CKM_DES3_CBC
Returned: 0 CKR_OK
32: C_OpenSession
[in] slotID = 0x0
[in] flags = 0x6
pApplication=0295D808
Notify=6019DC70
[out] *phSession = 0x0
Returned: 177 CKR_SESSION_COUNT
33: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Count is 1
[out] *pulCount = 0x1
Returned: 0 CKR_OK
34: C_GetSlotInfo
[in] slotID = 0x0
[out] pInfo:
slotDescription: 'Gemplus USB Smart Card Reader 0 '
' '
manufacturerID: 'Gem PC Twin '
hardwareVersion: 1.12
firmwareVersion: 1.0
flags: 7
CKF_TOKEN_PRESENT
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
35: C_GetTokenInfo
[in] slotID = 0x0
[out] pInfo:
label: 'PIV II Dev Token '
manufacturerID: 'NIST PIV '
model: 'PIV II '
serialNumber: 'BAD0000 '
ulMaxSessionCount: 1
ulSessionCount: 0
ulMaxRwSessionCount: 2
ulRwSessionCount: 0
ulMaxPinLen: 8
ulMinPinLen: 4
ulTotalPublicMemory: 123456789
ulFreePublicMemory: 1234567890
ulTotalPrivateMemory: 123456789
ulFreePrivateMemory: 1234567890
hardwareVersion: 1.1
firmwareVersion: 1.1
time: 'Wed Oct 04 14:22'
flags: c
CKF_LOGIN_REQUIRED
CKF_USER_PIN_INITIALIZED
Returned: 0 CKR_OK
36: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
Count is 3
Returned: 0 CKR_OK
37: C_GetMechanismList
[in] slotID = 0x0
[out] pMechanismList[3]:
CKM_RSA_PKCS
CKM_DES3_ECB
CKM_DES3_CBC
Returned: 0 CKR_OK
38: C_OpenSession
[in] slotID = 0x0
[in] flags = 0x6
pApplication=0295D808
Notify=6019DC70
[out] *phSession = 0x0
Returned: 177 CKR_SESSION_COUNT
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto