Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Ionut Mihalcea <[email protected]>
  • Loading branch information
ionut-arm committed Sep 7, 2022
1 parent 25d441e commit badc344
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cryptoki/src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ impl Pkcs11 {
///
/// Note: No callback is set when opening the session.
pub fn open_ro_session(&self, slot_id: Slot) -> Result<Session> {
session_management::open_session_no_callback(self, slot_id, false)
session_management::open_session(self, slot_id, false)
}

/// Open a new Read/Write session
///
/// Note: No callback is set when opening the session.
pub fn open_rw_session(&self, slot_id: Slot) -> Result<Session> {
session_management::open_session_no_callback(self, slot_id, true)
session_management::open_session(self, slot_id, true)
}

/// Check whether a given PKCS11 spec-defined function is supported by this implementation
Expand Down
6 changes: 1 addition & 5 deletions cryptoki/src/context/session_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ use crate::slot::Slot;
use std::convert::TryInto;
// See public docs on stub in parent mod.rs
#[inline(always)]
pub(super) fn open_session_no_callback(
ctx: &Pkcs11,
slot_id: Slot,
read_write: bool,
) -> Result<Session> {
pub(super) fn open_session(ctx: &Pkcs11, slot_id: Slot, read_write: bool) -> Result<Session> {
let mut session_handle = 0;

let flags = if read_write {
Expand Down
2 changes: 1 addition & 1 deletion cryptoki/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ fn ro_rw_session_test() -> Result<()> {
ro_session.login(UserType::User, Some(USER_PIN))?;

// generate a key pair
// This should NOT work using the Read/Write session
// This should NOT work using the Read-Only session
let e = ro_session.create_object(&template).unwrap_err();

if let Error::Pkcs11(RvError::SessionReadOnly) = e {
Expand Down

0 comments on commit badc344

Please sign in to comment.