Skip to content

Commit

Permalink
Use session close function from oxide fork of yubihsm.rs.
Browse files Browse the repository at this point in the history
The `Client` type previously had a `Drop` implementation that closed the
session if the Client had an open one. This seems to have caused
problems in other downstream projects and was subsequently removed:
iqlusioninc/tmkms#37
iqlusioninc/yubihsm.rs#265

The replacement was to provide a `session()` function that returns an
Arc / MutexGuard wrapped reference to the optional session. This isn't
useful for us here because we don't and AFAIK can't take ownership of
the session which we need because the Sesison::close function consumes
the session (it can't be reopened). Our solution requires an upstream
change to the `Client` type adding a `close_session` function that just
closes the session if one is open.
  • Loading branch information
flihp committed Apr 2, 2024
1 parent 321221e commit c55bcfc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ thiserror = "1.0.58"
# vsss-rs v3 has a dependency that requires rustc 1.65 but we're pinned
# to 1.64 till offline-keystore-os supports it
vsss-rs = "2.7.1"
yubihsm = { version = "0.42.1", features = ["usb", "untested"] }
yubihsm = { git = "https://github.com/oxidecomputer/yubihsm.rs", branch = "session-close", features = ["usb", "untested"] }
zeroize = "1.7.0"
1 change: 1 addition & 0 deletions src/ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ pub fn sign(
}
return Err(e);
}
hsm.client.close();
} else {
error!("Unknown input spec: {}", path.display());
}
Expand Down

0 comments on commit c55bcfc

Please sign in to comment.