-
Notifications
You must be signed in to change notification settings - Fork 76
Correctly handle CK_UNAVAILABLE_INFORMATION #200
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
Correctly handle CK_UNAVAILABLE_INFORMATION #200
Conversation
On a related note, I ran into this while trying to use this library with the Venafi Code Signing Client PKCS#11 module. I'd love to get that added to the list of supported modules. What is needed to make this happen? |
Nice, I've also been using Venafi and had the same issue. I had a similar solution locally, but I tried out your commits and they fix the issue too. |
Oh, good! I'm glad to hear that! I'm one of the developers on the codesigning team at CyberArk (previously Venafi). Thanks for testing the change! |
Thanks so much for the PR @minego! Could you please rebase as after landing another large PR there is a merge conflict? Thank you. |
8bd26fa
to
adc6975
Compare
…ng to read an attribute
Of course. Done. |
Hmm, I think the rebase from 8bd26fa to adc6975 prior to merging actually broke this... The rebased code checks the return value of I'll try to do something about that, but this will be tricky to regression test. If my reading of the spec is correct, a compliant PKCS#11 module should also return a nonzero return value if it sets |
Thank you for pointing that out! I missed the logic change. I should have paid more attention when rebasing. I've put up a new pull request here: #207 |
The PKCS#11 specification states
This MR exposes the
CK_UNAVAILABLE_INFORMATION
constant definition (along withCK_EFFECTIVELY_INFINITE
which is defined next to it, for completeness sake) and checks for that result after callingC_GetAttributeValue
This corrects a crash when a PKCS#11 module returns this. I believe this will fix the following issues:
#139
#60
Prior to this change the returned value was being interpreted as an actual size, which resulted in attempting to allocate an array of size -1 which causes an overflow: