Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the Official PKCS#11 Test Cases from v3.1 #2716

Open
frankmorgner opened this issue Feb 22, 2023 · 12 comments
Open

Implement the Official PKCS#11 Test Cases from v3.1 #2716

frankmorgner opened this issue Feb 22, 2023 · 12 comments

Comments

@frankmorgner
Copy link
Member

Problem Description

With PKCS#11 3.1, OASIS has created some test cases, which would be nice to pass with OpenSC.

@bharsaklemukesh975
Copy link
Contributor

Hello, Can I work on this as my first open-source contribution?

@frankmorgner
Copy link
Member Author

I'd love to see that. From what I read from the specification the task would be to

  1. set up some testing environment with a virtual card just like we have in CI
  2. create some new program or use pkcs11-tool to help with bootstrapping the process
  3. map the XML specified test cases to some actual PKCS#11 calls

As alternative we also have some test cases in src/tests/p11test. But using the pkcs#11 test cases could provide some benefit also to other pkcs#11 modules than just OpenSC, which is why I think such a test program should be shipped seperately.

@bharsaklemukesh975
Copy link
Contributor

May I know the steps to set up some testing environment with a virtual card just like we have in CI?

@frankmorgner
Copy link
Member Author

It is implemented in the workflow files in .github. For testing a PIV card, for example, you would run

  1. ./.github/setup-linux.sh piv
  2. ./.github/test-piv.sh

@bharsaklemukesh975
Copy link
Contributor

I am getting the following error while calling ./.github/test-piv.sh

card-openpgp.c:1164:7: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
func(blob);
^

@frankmorgner
Copy link
Member Author

Thanks for pointing that out, I've created a fix here #2748

@bharsaklemukesh975
Copy link
Contributor

I will start this once we have #2748 completed.

@frankmorgner
Copy link
Member Author

Done

@bharsaklemukesh975
Copy link
Contributor

Thanks @frankmorgner , any idea about the following compilation error, I see used after set?

pkcs11-tool.c:7364:6: error: variable 'errors' set but not used [-Werror,-Wunused-but-set-variable]
int errors = 0;
^

@frankmorgner
Copy link
Member Author

I've opened an other fixup #2749

If you stumble on more issues, feel free to create a fixup yourself 😉

@bharsaklemukesh975
Copy link
Contributor

Thanks understood!

@bharsaklemukesh975
Copy link
Contributor

I have opened another fixup #2750 for a similar warning.
@frankmorgner can you please review?
Thanks!

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

No branches or pull requests

3 participants