Skip to content

Commit 73b4c4a

Browse files
committed
fix: CK_TRUST types on 64-bit systems are ULONG, not u32
Due to the missing CKT_ mapping at build.rs CK_TRUST types used the default type (u32), despite by the standard they had to be CK_ULONG. Fixed by adding that rule. 1 line is changed (at cryptoki-sys/build.rs), others changes are due to the regeneration. From vendor/pkcs11.h: ULONGDEF(CK_TRUST); ... /* CKT (trust) */ #define CKT_TRUST_UNKNOWN 0x00000000UL #define CKT_TRUSTED 0x00000001UL #define CKT_TRUST_ANCHOR 0x00000002UL #define CKT_NOT_TRUSTED 0x00000003UL #define CKT_TRUST_MUST_VERIFY_TRUST 0x00000004UL Signed-off-by: Denis Mingulov <denis@mingulov.com>
1 parent d1b283e commit 73b4c4a

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
@@ -46,6 +46,7 @@ mod generate {
4646
("CKP_", "CK_PROFILE_ID"),
4747
("CKR_", "CK_RV"),
4848
("CKS_", "CK_STATE"),
49+
("CKT_", "CK_TRUST"),
4950
("CKU_", "CK_USER_TYPE"),
5051
("CKZ_DATA_SPECIFIED", "CK_RSA_PKCS_OAEP_SOURCE_TYPE"),
5152
("CKZ_SALT_SPECIFIED", "CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE"),

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)