-
Notifications
You must be signed in to change notification settings - Fork 60
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
"fix" for clone-then-initialize problem #152
"fix" for clone-then-initialize problem #152
Conversation
a4a0178
to
6fd7fda
Compare
ea90169
to
edea342
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
cryptoki/src/context/mod.rs
Outdated
} | ||
|
||
/// Check whether the PKCS11 library has been initialized | ||
pub fn is_initialized(&self) -> bool { | ||
self.initialized | ||
*self.initialized.as_ref().read().unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise for unwrap/expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Signed-off-by: Arjen Nienhuis <[email protected]>
edea342
to
54a799d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now 👌
This PR fixes the problem with clone and initialize.
It adds more locking while PKCS11 is supposed to be thread safe. For me that doesn't feel right. I would deprecate or remove
is_initialized()
: