Douglas E. Engert wrote:
> Anthony Scarpino wrote:
>> Douglas E. Engert wrote:
[..]
>>> Sun appears to expect C_GetMechaismList to return a list if there is 
>>> a slot
>>> present, even if there is no token present. See the attached 
>>> cryptoadmin.txt
>>>
>>> I think this is a bug in Sun's code. PKCS#11 2.01 and 2.20 say:
>>>  "C_GetMechanismList is used to obtain a list of mechanism
>>>   types supported by a token."
>>>
>>> If there is no token they should not ask for a list of mechanisms. Note
>>> that crytpoadm shows that there is no token present in the slot.
>>
>> In my opinion, this is just a bug in the OpenSC library and not in 
>> cryptoadm.  The above excerpt I believe applies to the OpenSC library 
>> and not to something like cryptoadm.  The library is responsible for 
>> the mechanism list and if there is no token it should respond with 
>> nothing in the mechanism list, not a core dump.
> 
> 
> 
> As I said below, I have submitted the fix for the segfault to OpenSC.
> and the test run was with the fix.
> 
> The question is if a MechanismList is associated with a token, and there
> is not token present why is the Sun code requesting a Mechanism List?
> What is cryptoadmin doing? What is libpkcs11 doing with a null list?

cryptoadm is just running down the slot list and calling all the info 
functions (C_GetSlotInfo, C_TokenInfo, C_GetMechanismList, etc).  If a 
slot returned null for a mechanism list, then cryptoadm should display 
no mechanism.

> 
> 
>>
>> Having cryptoadm verify CKF_TOKEN_PRESENT is true would be a 
>> workaround, but I feel that it's just hiding the issue..
>>
> 
> No it not. The issue is the Mechanisum List is for a token, not the slot
> so it should verify CKF_TOKEN_PRESENT.

If the token is not present, then the function should return 
CKR_TOKEN_NOT_PRESENT, that is a valid return code for 
C_GetMechanismList.  cryptoadm will handle the results of that error 
condition properly.

Having a check for the token isn't a big deal, but I don't believe it's 
necessary to change the current behavior..

thanks..

Tony


Reply via email to