Skip to content

Commit

Permalink
Bump cryptoki to 0.7.0. Add pkcs11 function to errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jippeholwerda committed Jun 18, 2024
1 parent 4f6d229 commit 4e7449b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ documentation = "https://docs.rs/r2d2-cryptoki/"
serde = ["cryptoki/serde"]

[dependencies]
cryptoki = "0.6.0"
cryptoki = "0.7.0"
r2d2 = "0.8.10"

[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub use cryptoki;
pub use r2d2;

use cryptoki::{
context::Pkcs11,
context::{Function, Pkcs11},
error::RvError,
session::{Session, SessionState, UserType},
slot::{Limit, Slot},
Expand Down Expand Up @@ -136,7 +136,7 @@ impl ManageConnection for SessionManager {
};
if let Some(user_type) = maybe_user_info {
match session.login(user_type.0, Some(user_type.1)) {
Err(Self::Error::Pkcs11(RvError::UserAlreadyLoggedIn)) => {}
Err(Self::Error::Pkcs11(RvError::UserAlreadyLoggedIn, Function::Login)) => {}
res => res?,
};
}
Expand All @@ -147,7 +147,7 @@ impl ManageConnection for SessionManager {
let actual_state = session.get_session_info()?.session_state();
let expected_state = &self.session_type;
if actual_state != expected_state.as_state() {
Err(Self::Error::Pkcs11(RvError::UserNotLoggedIn))
Err(Self::Error::Pkcs11(RvError::UserNotLoggedIn, Function::GetSessionInfo))
} else {
Ok(())
}
Expand Down

0 comments on commit 4e7449b

Please sign in to comment.