Skip to content

fix: CK_TRUST types on 64-bit systems are ULONG, not u32 as now#361

Open
mingulov wants to merge 1 commit intoparallaxsecond:mainfrom
mingulov:fix/ckt-trust-type-mismatch2
Open

fix: CK_TRUST types on 64-bit systems are ULONG, not u32 as now#361
mingulov wants to merge 1 commit intoparallaxsecond:mainfrom
mingulov:fix/ckt-trust-type-mismatch2

Conversation

@mingulov
Copy link

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

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>
@mingulov mingulov force-pushed the fix/ckt-trust-type-mismatch2 branch from f9602ca to 73b4c4a Compare March 15, 2026 09:39
Copy link
Collaborator

@Jakuje Jakuje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! I obviously missed this block of constants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants