Skip to content

C_GetInterfaceList() returns unexpected values #839

Closed

Description

@Jakuje

While running the p11test from opensc with recent 2.7.0 update, the C_GetInterfaceList called with both NULL arguments returns unexpected return code CKR_SLOT_ID_INVALID , which is

100: C_GetInterfaceList                                
P:42801; T:0x140462040723456 2026-01-13 16:13:18.382   
Returned:  3 CKR_SLOT_ID_INVALID                       

This return code does not make any sense and is not among the list of return codes this function can return:

https://docs.oasis-open.org/pkcs11/pkcs11-spec/v3.2/pkcs11-spec-v3.2.html#_Toc195693132

Activity

  1. Jakuje commented on Jan 13, 2026

    @Jakuje
    ContributorAuthor

    Calling also with the first NULL argument results in the same error:

    101: C_GetInterfaceList
    P:47277; T:0x139890987114496 2026-01-13 16:25:58.417
    Returned:  3 CKR_SLOT_ID_INVALID
    

    while the specification clearly says that its valid use and it should return the count of interfaces provided by this module.

    https://github.com/OpenSC/OpenSC/blob/master/src/tests/p11test/p11test_case_interface.c#L56

    Please, fix the API to be up to the specs

  2. Jakuje commented on Jan 13, 2026

    @Jakuje
    ContributorAuthor

    Oh, this API is not yet implemented in softhsm, so it must be coming from the pkcs11-spy ... but clearly there is something odd going on, which was not there in the last version reelase.

  3. Jakuje commented on Jan 13, 2026

    @Jakuje
    ContributorAuthor

    oh, It looks like the GetFunctionList returns the API version 3, but not implementing the C_GetInterfaceList() API, which sounds like going against the specification.

    In this structure ‘version’ is the cryptoki specification version number. The major and minor versions must be set to 0x02 and 0x28 indicating a version 2.40 compatible structure.

  4. bukka commented on Jan 22, 2026

    @bukka
    Member

    Yeah this should be added. I bumped the API version because of upcoming ML-DSA changes but forgot that this should be added.

  5. added theissue type on Jan 22, 2026
  6. antoinelochet commented on May 16, 2026

    @antoinelochet
    Contributor

    Could you check the implementation I did in #874 ?

  7. Jakuje commented on May 18, 2026

    @Jakuje
    ContributorAuthor

    Could you check the implementation I did in #874 ?

    Sorry, but its 1 commit of 5000 lines of code. I was not able to dig it out from that pile of changes.

  8. antoinelochet commented on May 18, 2026

    @antoinelochet
    Contributor

    Could you check the implementation I did in #874 ?

    Sorry, but its 1 commit of 5000 lines of code. I was not able to dig it out from that pile of changes.

    That's fair, I am sorry. Changes related to C_GetInterfaceList are in the main.cpp file
    https://github.com/antoinelochet/SoftHSMv2/blob/0539a2ec23cf2e37909040319577eb0f8b5e79ac/src/lib/main.cpp#L128
    then
    https://github.com/antoinelochet/SoftHSMv2/blob/0539a2ec23cf2e37909040319577eb0f8b5e79ac/src/lib/main.cpp#L1356

  9. Jakuje commented on May 18, 2026

    @Jakuje
    ContributorAuthor

    On the first sight, I do not see any issue there. Thanks for the pointer and for working on that!

  10. antoinelochet commented on Jun 22, 2026

    @antoinelochet
    Contributor

    #874 being merged, I think we can close this issue.

  11. Jakuje commented on Jun 22, 2026

    @Jakuje
    ContributorAuthor

    Thank you! I will test it as soon as it will be in a release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions