Skip to content

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

Merged
hug-dev merged 1 commit intoparallaxsecond:mainfrom
mingulov:fix/ckt-trust-type-mismatch2
Mar 22, 2026
Merged

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

Conversation

@mingulov
Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Collaborator

@wiktor-k wiktor-k left a comment

Choose a reason for hiding this comment

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

This depends on #362 to be merged but after that I guess it'll be a matter of a rebase.

Thanks!

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>
@hug-dev hug-dev force-pushed the fix/ckt-trust-type-mismatch2 branch from 73b4c4a to 334c969 Compare March 22, 2026 09:46
@hug-dev hug-dev enabled auto-merge (rebase) March 22, 2026 09:46
@hug-dev
Copy link
Copy Markdown
Member

hug-dev commented Mar 22, 2026

Nice catch, thank you! Rebased on main for the CI fix :)

@hug-dev hug-dev merged commit 06f431b into parallaxsecond:main Mar 22, 2026
44 checks passed
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.

4 participants