-
Notifications
You must be signed in to change notification settings - Fork 33
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
types: Fix CK_LONG/CK_ULONG on Linux ARM32 #40
Conversation
Experimentally, this is what OpenSC's ABI uses. Using 64-bit values here caused silent return code corruptions.
Codecov Report
@@ Coverage Diff @@
## master #40 +/- ##
==========================================
- Coverage 65.43% 65.41% -0.03%
==========================================
Files 4 4
Lines 3446 3444 -2
==========================================
- Hits 2255 2253 -2
Misses 1191 1191
Continue to review full report at Codecov.
|
Wow, I have always thought that the PKCS 11 types would be typedefed over I would be in favor of producing (and commiting in-tree) various bindings for a set of target triplets. Also it is worth noting @joechrisellis PR's on Brainstorming here, but this PR + the need of safety given by abstraction (#38) make me wonder if it would be worth following the Rust idiom of spliting |
Unfortunately not 🙃 -- they're defined over the normal C primitive types, with additional (not enforced?) assumptions about being at least 32 bits for e.g. |
good catch... and yes, bindgen is probably the right way out of this. pkcs11 is unfortunately full of "C"isms that make the life in rust really hard |
@hug-dev as you are obviously interested in ARM, would you mind researching (quickly) if we can add a build target for that? |
I think we should either have |
Yes, I believe that's correct. If you need the specific variant, it's |
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.
lgtm
This fixes an ABI mismatch that I observed experimentally when trying to use
rust-pkcs11
with a Nitrokey on a 32-bit ARM host (really 64-bit, but it's a Raspberry Pi running 32-bit Raspbian).There are probably other ABI mismatches on other target OSes and architectures; a more general fix here might be to use
pkcs11t.h
directly viabindgen
or some other mechanism.