Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempted bugfix for potential session reentrancy bug (#273)
Context: iqlusioninc/tmkms#37 To summarize, the `yubihsm::Client` type has internal locking for a `Session` with the YubiHSM. There is actually very little lock-related code associated with this scheme, but there appears to be a subtle reentrancy bug in pretty much the only function where it could possibly exist: the `yubihsm::Client::send_command` method. Based on discussions on iqlusioninc/tmkms#37 the bug definitely seemed to be tied to rekeying the session after a preset number of messages had been sent. It appears there was a reentrancy bug where an RAII guard was still holding the `Mutex` for the session state, which prevented a subsequent attempt to resent the message from acquiring it. The solution is to explicitly drop the stale session guard prior to trying to establish a new session.
- Loading branch information