Skip to content

Commit

Permalink
bindings: Create 32b compatible bindings
Browse files Browse the repository at this point in the history
This is a workaround for a bindgen, not setting the correct value
for unsigned long constants:

rust-lang/rust-bindgen#2965

Remove when the above issue is fixed.

Signed-off-by: Jakub Jelen <[email protected]>
  • Loading branch information
Jakuje authored and simo5 committed Oct 29, 2024
1 parent 4721238 commit 9e11dca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ fn main() {
.blocklist_type("CK_FUNCTION_LIST_PTR")
.blocklist_type("CK_FUNCTION_LIST_3_0_PTR")
.blocklist_type("CK_INTERFACE")
.blocklist_var("CK_UNAVAILABLE_INFORMATION")
.parse_callbacks(Box::new(Pkcs11Callbacks))
.generate()
.expect("Unable to generate bindings")
Expand Down
3 changes: 3 additions & 0 deletions src/pkcs11/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ include!("bindings.rs");
// types that need different mutability than bindgen provides
pub type CK_FUNCTION_LIST_PTR = *const CK_FUNCTION_LIST;
pub type CK_FUNCTION_LIST_3_0_PTR = *const CK_FUNCTION_LIST_3_0;
// this is wrongly converted on 32b architecture to too large value
// which can not be represented in CK_ULONG.
pub const CK_UNAVAILABLE_INFORMATION: CK_ULONG = CK_ULONG::MAX;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CK_INTERFACE {
Expand Down

0 comments on commit 9e11dca

Please sign in to comment.