-
Notifications
You must be signed in to change notification settings - Fork 71
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
Compare trimmed token serial numbers (PKCS11 provider) #621
Compare trimmed token serial numbers (PKCS11 provider) #621
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Could you add a config test to prevent regressions?
Thanks, @ionut-arm!
Suggestion:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 👍
b681490
to
9b1b033
Compare
(As for the test, you can leave it for another PR. Though now that the CI is failing... :( ) |
Failures: It's the new version of the Clippy issue, It's better to fix them, then rebase this PR. |
I'd go for the CLI approach - don't think it's particularly likely we'll move to some other PKCS11 implementation, and we already have stuff in the CI pipeline that expects softhsm for setup. And it's a lot easier. If you want you can create some sort of tagging/tracking mechanism for the places where we make explicit use of a specific backend. |
9b1b033
to
fcf82c4
Compare
Rethinking the test, we will depend on the softhsm-util in generating the tokens, which generates a 16 char token. |
Hey! Well, What we want to support here is for an admin to give a serial number of (abcd + 2 spaces) even when the real serial number is (abcd + 12 white spaces) - and have some way to prove that it works. |
Hey @ionut-arm
I agree, and I am not aware of such an option to set the serial number ourselves. So relaying on softhsm in this test won't add any value. |
Do we have such an option? |
So what my aim would be with the test is to verify if the trimming works correctly. Because the operation is symmetrical (on both what's in the config file and what's coming from the token), it doesn't really matter which one we can control. It would be nice to be able to test both of them (setting the SN in the config file to something with whitespace around in one test, and the serial number of the token to something with whitespace around in another), but if we can only do one of them that would still be preferable - though maybe there's something preventing us from doing that? |
Nothing is preventing us from doing that (Adding spaces to the provided serial number), but that won't fulfil the following statement
I got from this statement that you want to validate both sides. Option1: SN_A is set to SN_B with extra spaces |
In real world SN_B might be "abcdef123 ". i.e 16 chars with spaces at the end. For example with Nitrokey USB HSM. |
Yeah, option 1 should be fine, testing at least part of it. |
9685e30
to
a39f3fd
Compare
Fixes: parallaxsecond#615 Signed-off-by: Mohamed Omar Asaker <mohamed.omarasaker@arm.com>
Signed-off-by: Mohamed Omar Asaker <mohamed.omarasaker@arm.com>
a39f3fd
to
1d4d05c
Compare
@ionut-arm, Could you retrigger this test. |
No, I don't think so, and we have multiple issues, mostly in the stress test it seems. One affects the "Mbed Crypto derivatives", and another the PKCS11 provider. The PKCS11 provider issues we've tried to fix and it's definitely better now than before, but Softhsm probably still has multithreading issues. Feel free to open issues! |
Fixes: #615
Signed-off-by: Mohamed Omar Asaker mohamed.omarasaker@arm.com