Skip to content

Commit ef0d337

Browse files
author
Denis Mingulov
committed
fix: add CKT_ prefix mapping to fix CK_TRUST constant types
The int_macro callback in build.rs was missing a prefix mapping for CKT_ constants. Without this mapping, bindgen generated CKT_TRUST_* constants as u32 (its default) instead of CK_TRUST (which is CK_ULONG). On 64-bit platforms where CK_ULONG is u64, this resulted in a type width mismatch: constants were u32 but the CK_TRUST type alias was u64. Add ("CKT_", "CK_TRUST") to the prefix list and regenerate all platform bindings.
1 parent d1b283e commit ef0d337

13 files changed

Lines changed: 61 additions & 60 deletions

cryptoki-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ mod generate {
5050
("CKZ_DATA_SPECIFIED", "CK_RSA_PKCS_OAEP_SOURCE_TYPE"),
5151
("CKZ_SALT_SPECIFIED", "CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE"),
5252
("CRYPTOKI_VERSION_", "CK_BYTE"),
53+
("CKT_", "CK_TRUST"),
5354
];
5455

5556
if ["CK_TRUE", "CK_FALSE"].contains(&name) {

cryptoki-sys/src/bindings/aarch64-apple-darwin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

cryptoki-sys/src/bindings/aarch64-unknown-linux-gnu.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

cryptoki-sys/src/bindings/arm-unknown-linux-gnueabi.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

cryptoki-sys/src/bindings/generic.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

cryptoki-sys/src/bindings/i686-unknown-linux-gnu.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

cryptoki-sys/src/bindings/loongarch64-unknown-linux-gnu.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

cryptoki-sys/src/bindings/powerpc64-unknown-linux-gnu.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

cryptoki-sys/src/bindings/riscv64gc-unknown-linux-gnu.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

cryptoki-sys/src/bindings/x86_64-apple-darwin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ pub const CKS_RW_PUBLIC_SESSION: CK_STATE = 2;
10311031
pub const CKS_RW_USER_FUNCTIONS: CK_STATE = 3;
10321032
pub const CKS_RW_SO_FUNCTIONS: CK_STATE = 4;
10331033
pub const CKS_LAST_VALIDATION_OK: CK_STATE = 1;
1034-
pub const CKT_TRUST_UNKNOWN: u32 = 0;
1035-
pub const CKT_TRUSTED: u32 = 1;
1036-
pub const CKT_TRUST_ANCHOR: u32 = 2;
1037-
pub const CKT_NOT_TRUSTED: u32 = 3;
1038-
pub const CKT_TRUST_MUST_VERIFY_TRUST: u32 = 4;
1034+
pub const CKT_TRUST_UNKNOWN: CK_TRUST = 0;
1035+
pub const CKT_TRUSTED: CK_TRUST = 1;
1036+
pub const CKT_TRUST_ANCHOR: CK_TRUST = 2;
1037+
pub const CKT_NOT_TRUSTED: CK_TRUST = 3;
1038+
pub const CKT_TRUST_MUST_VERIFY_TRUST: CK_TRUST = 4;
10391039
pub const CKU_SO: CK_USER_TYPE = 0;
10401040
pub const CKU_USER: CK_USER_TYPE = 1;
10411041
pub const CKU_CONTEXT_SPECIFIC: CK_USER_TYPE = 2;

0 commit comments

Comments
 (0)