parallaxsecond / rust-cryptoki

Rust wrapper for the PKCS #11 API, Cryptoki
https://docs.rs/cryptoki/
Apache License 2.0
77 stars 61 forks source link

"fix" for clone-then-initialize problem #152

Closed arjennienhuis closed 1 year ago

arjennienhuis commented 1 year ago

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():

    #[deprecated]
    pub fn is_initialized(&self) -> bool {
        get_library_info(self).is_ok()
    }