-
Notifications
You must be signed in to change notification settings - Fork 61
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
clone()
and is_initialized()
#151
Comments
I made a PR for a possible fix #152 |
Hmm, there are now two PRs which attempt to fix the same issue - how come? Do you have a preference for which approach to take? I'll need to go dig into our previous conversations and see why we chose to implement it like this, I know there are quite a few quirks of the PKCS11 spec and the way it's been actually implemented - stay tuned. |
I would prefer remove it completely but it's in the public api. |
I guess deprecating it in one version and then only removing it in a major version bump would be a conservative choice. |
Ok, I've had a bit of time to look at this now.
The reason might have to do with the general ugliness of having to deal with lifetimes if you need to keep a The rationale for having that functionality is here: #77 - so I'd prefer keeping it in one form or another. @ximon18 - any thoughts? I'm somewhat torn between |
Only with a lock this can be prevented. See my PR #152 that uses a RWLock for a way to keep it in sync all the time. |
That function works because that data structure does not allow |
Sorry, only seeing this now. I don't have time to look at or consider this right now, I'll try and look at it on Monday. |
How so? Before you call the backend operation you can |
If you set the flag before initializing other threads can get an unexpected 'not initialized' error from the library. |
Ahh, I see. Agree, it's not ideal, though not exactly a showstopper. Would you be ok with the |
Sure the |
Ahem, not exactly Monday, or anytime near... but just noticed this issue in an old TODO list and as the linked PR #152 is merged and seems to contain the RWLock change, does this issue still need to be open? |
Looking at he logic of
initialize()
,is_initialized()
andfinalize()
I found out thatPkcs11::initialized
can get out of sync withPkcs11::impl_
.I'm not sure how to fix this. I'm not sure why
initialized
is inPkcs11
and not inPkcs11Impl
or even stored at all.I'm also not sure why
Pkcs11
should be cloned and not borrowed.The text was updated successfully, but these errors were encountered: