From 10241230b3c8d40416141d14dc4c8e0f479c4d48 Mon Sep 17 00:00:00 2001 From: str4d Date: Sun, 12 Feb 2023 17:18:55 +0000 Subject: [PATCH] Raise minimum `pcsc` version to remove workaround (#478) In iqlusioninc/yubikey.rs#88 we added a workaround for what turned out to be a bug in `pcsc`, where an error was returned if no readers were available, instead of returning an empty iterator. `pcsc 2.3.1` was published in 2019, so we can safely rely on it. --- Cargo.toml | 2 +- src/yubikey.rs | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3f9bac0..cc19724 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ num-integer = "0.1" pbkdf2 = { version = "0.11", default-features = false } p256 = "0.11" p384 = "0.11" -pcsc = "2" +pcsc = "2.3.1" rand_core = { version = "0.6", features = ["std"] } rsa = "0.7" secrecy = "0.8" diff --git a/src/yubikey.rs b/src/yubikey.rs index 97e8c13..94507b2 100644 --- a/src/yubikey.rs +++ b/src/yubikey.rs @@ -190,12 +190,7 @@ impl YubiKey { /// [`yubikey::reader::Context`][`Context`] to select from the available /// PC/SC readers. pub fn open() -> Result { - let mut readers = Context::open().map_err(|e| match e { - Error::PcscError { - inner: Some(pcsc::Error::NoReadersAvailable), - } => Error::NotFound, - other => other, - })?; + let mut readers = Context::open()?; let mut reader_iter = readers.iter()?; if let Some(reader) = reader_iter.next() { @@ -213,12 +208,7 @@ impl YubiKey { /// Open a YubiKey with a specific serial number. pub fn open_by_serial(serial: Serial) -> Result { - let mut readers = Context::open().map_err(|e| match e { - Error::PcscError { - inner: Some(pcsc::Error::NoReadersAvailable), - } => Error::NotFound, - other => other, - })?; + let mut readers = Context::open()?; for reader in readers.iter()? { let yubikey = match reader.open() {