-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disabling of compiler optimizations needed to prevent non-null pReserved
when invoking C_Initialize()
.
#49
Comments
pReserved
when invoking C_Initialize().pReserved
when invoking C_Initialize()
.
I encountered a similar issue today, but more severe.
Not only that, right before
Things seemed to be fine before This is also on x86_64 Linux, and also only happens with optimizations on. |
Adding this to this issue as well: please switch to the cryptoki crate: https://github.com/parallaxsecond/rust-cryptoki |
Environment
Reproducible with Rust
pkcs11
crate version v0.5.0 on:apt install softhsm
, orRUN apk add softhsm
from a DockerfileSteps to reproduce
Calling
Ctx::Initialize(Some(args))
whereargs
is eitherCK_C_INITIALIZE_ARGS::default()
or:(note that
CK_C_INITIALIZE_ARGS::new()
setsargs.pReserved = ptr::null_mut()
and thatCK_C_INITIALIZE_ARGS::default()
callsCK_C_INITIALIZE_ARGS::new()
)Works in debug builds
When built with
cargo build
my application works without error.Fails in release builds
When built with
cargo build --release
my application fails with errorCKR_ARGUMENTS_BAD
and in/var/log/
via Syslog logging from SoftHSM I see error messageSoftHSM.cpp(436): pReserved must be set to NULL_PTR
.Disabling compiler optimizations helps
Adding this to
Cargo.toml
and rebuilding my application withcargo build --release
"solves" the problem:The text was updated successfully, but these errors were encountered: