Skip to content

Commit

Permalink
Remove unnecessary qualifications
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Dec 6, 2024
1 parent 8d4b0b2 commit ec7ac07
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ where
reply.extend_from_slice(&credential.label).unwrap();

// calculate the value
if credential.kind == oath::Kind::Totp {
if credential.kind == Kind::Totp {
let truncated_digest = crate::calculate::calculate(
&mut self.trussed,
credential.algorithm,
Expand Down Expand Up @@ -867,13 +867,13 @@ where
self.require_touch_if_needed(&credential)?;

let truncated_digest = match credential.kind {
oath::Kind::Totp => crate::calculate::calculate(
Kind::Totp => crate::calculate::calculate(
&mut self.trussed,
credential.algorithm,
calculate.challenge,
&credential.secret,
)?,
oath::Kind::Hotp => {
Kind::Hotp => {
if let Some(counter) = credential.counter {
self.calculate_hotp_digest_and_bump_counter(&credential, counter)?
} else {
Expand Down Expand Up @@ -935,7 +935,7 @@ where
let code_in = args.response;

let current_counter = match credential.kind {
oath::Kind::HotpReverse => {
Kind::HotpReverse => {
if let Some(counter) = credential.counter {
counter
} else {
Expand Down Expand Up @@ -1072,7 +1072,7 @@ where
fn _extension_check_pin(&mut self, password: &[u8]) -> Result {
let reply = try_syscall!(self.trussed.check_pin(
BACKEND_USER_PIN_ID,
Bytes::from_slice(password).map_err(|_| iso7816::Status::IncorrectDataParameter)?
Bytes::from_slice(password).map_err(|_| Status::IncorrectDataParameter)?
))
.map_err(|_| Status::SecurityStatusNotSatisfied)?;
if !(reply.success) {
Expand All @@ -1093,7 +1093,7 @@ where
fn _extension_set_pin(&mut self, password: &[u8]) -> Result {
try_syscall!(self.trussed.set_pin(
BACKEND_USER_PIN_ID,
Bytes::from_slice(password).map_err(|_| iso7816::Status::IncorrectDataParameter)?,
Bytes::from_slice(password).map_err(|_| Status::IncorrectDataParameter)?,
Some(ATTEMPT_COUNTER_DEFAULT_RETRIES),
true
))
Expand Down Expand Up @@ -1127,7 +1127,7 @@ where
fn _extension_get_key_for_pin(&mut self, password: &[u8]) -> Result<KeyId> {
let reply = try_syscall!(self.trussed.get_pin_key(
BACKEND_USER_PIN_ID,
Bytes::from_slice(password).map_err(|_| iso7816::Status::IncorrectDataParameter)?
Bytes::from_slice(password).map_err(|_| Status::IncorrectDataParameter)?
))
.map_err(|e| Self::_debug_trussed_backend_error(e, line!()))?;
reply.result.ok_or(Status::VerificationFailed)
Expand Down

0 comments on commit ec7ac07

Please sign in to comment.