Skip to content

Conversation

@jhagborgftx
Copy link

Previously, init_args was being destructured by value, causing it to be dropped before C_Initialize was called. This caused undefined behavior. I believe this fixes #49.

The fact that a bug in safe code caused this is a bit worrying. In my opinion, all the function pointers in CK_FUNCTION_LIST should be marked as unsafe, and have safe wrappers that take references rather than raw pointers.

Previously, init_args was being destructured by value, causing it to
be dropped before C_Initialize was called.  This caused undefined
behavior.
@jhagborgftx jhagborgftx force-pushed the fix-initialize-ub-for-upstream branch from a5510ad to cff3118 Compare February 8, 2022 17:54
@mheese
Copy link
Owner

mheese commented Oct 27, 2022

Closing all PRs together with the deprecation notice on the README. Please switch to the cryptoki crate which doesn't have this problem to begin with https://github.com/parallaxsecond/rust-cryptoki

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.

Disabling of compiler optimizations needed to prevent non-null pReserved when invoking C_Initialize().

2 participants