-
Notifications
You must be signed in to change notification settings - Fork 76
Add PKCS#11 3.2 bindings + plug them into the cryptoki #264
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
base: main
Are you sure you want to change the base?
Conversation
Oh, lovely! The CI does not like the generated binding as it is too complex.
Who would say it for a function with 10 arguments:
Is this something we should fix in the generated bindings or open an issue for the bindgen? Not sure if this is a new issue with the new bindgen, but more likely the issue of the new PKCS#11 API having that insane number of arguments .... |
Signed-off-by: Jakub Jelen <[email protected]>
this requires the new version of proc-macro2 Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Hmm fortunately this is just a clippy issue. I guess suppressing it somewhere would be an okayish workaround. (maybe in lib.rs of -sys?) I'd still report it to bindgen. This may improve their code generation or at least make them consider adding the lint suppression in the generated code. |
Thanks for the pointer! I see the lib.rs has already some more warnings ignored. I am not sure if there is some way how to improve the code generation to avoid this. I can think of using some temporary named type for the function, but I think it just moves the problem one more function argument away. I think this is inherent issue of the PKCS#11 specification, introducing this complex functions. |
FWIW I didn't mean that. Slapping the lint suppression there is sufficient enough for me. |
Kryoptic tests now fail as there are few bugs in the last release that were already fixed in main. I think this is already good for first reviews, but I would probably wait for the pkcs11 3.2 to get released officially and I will likely implement also the SLH-DSA (they look quite simple and similar to the ML-DSA, but I do not have an implementation to test against yet). |
Signed-off-by: Jakub Jelen <[email protected]>
One of the new functions in PKCS#11 3.2 have 10(!) arguments, which goes over the threshold of what clippy considers reasonable. But given that we need to be compatible with this API, there is no other reasonable way to tackle this than to ignore the warning/error. error: very complex type used. Consider factoring parts into `type` definitions --> /home/runner/work/rust-cryptoki/rust-cryptoki/cryptoki-sys/src/bindings/x86_64-unknown-linux-gnu.rs:6801:35 | 6801 | pub C_UnwrapKeyAuthenticated: Result< | ___________________________________^ 6802 | | unsafe extern "C" fn( 6803 | | arg1: CK_SESSION_HANDLE, 6804 | | arg2: *mut CK_MECHANISM, ... | 6814 | | ::libloading::Error, 6815 | | >, | |_____^ | Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
... which is no longer basic after having 2000+ lines Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
This is needed for multiplart ML-DSA signature verifications Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
Signed-off-by: Jakub Jelen <[email protected]>
The PKCS#11 3.2 headers are available (pre-release though, but final version should be out in coming weeks):
https://github.com/latchset/pkcs11-headers/tree/main/public-domain/3.2-prerelease
This pulls the new headers, regenerates bindings and adjusts the initialization so they can be used.
So far opened only as a draft as the specs is not published yet, but planning to add some more functions using kryoptic, that will verify the whole process works.
I took also the chance to update bindgen to 0.71.1 once we generate new binding version