From eaeb927d928e584a7c88d2a1c3df2abece4ad8bc Mon Sep 17 00:00:00 2001 From: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:52:02 +0100 Subject: [PATCH] Corrects the GetInfo output without Config command (#665) --- libraries/opensk/src/ctap/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/opensk/src/ctap/mod.rs b/libraries/opensk/src/ctap/mod.rs index 5c5d1eda..748f2566 100644 --- a/libraries/opensk/src/ctap/mod.rs +++ b/libraries/opensk/src/ctap/mod.rs @@ -1282,15 +1282,19 @@ impl CtapState { options.append(&mut vec![ (String::from("rk"), true), (String::from("up"), true), - (String::from("alwaysUv"), has_always_uv), (String::from("credMgmt"), true), + #[cfg(feature = "config_command")] (String::from("authnrCfg"), true), (String::from("clientPin"), storage::pin_hash(env)?.is_some()), (String::from("largeBlobs"), true), (String::from("pinUvAuthToken"), true), + #[cfg(feature = "config_command")] (String::from("setMinPINLength"), true), (String::from("makeCredUvNotRqd"), !has_always_uv), ]); + if cfg!(feature = "config_command") || env.customization().enforce_always_uv() { + options.push((String::from("alwaysUv"), has_always_uv)); + } let mut pin_protocols = vec![PinUvAuthProtocol::V2 as u64]; if env.customization().allows_pin_protocol_v1() { pin_protocols.push(PinUvAuthProtocol::V1 as u64); @@ -1499,12 +1503,15 @@ mod test { "ep" => env.customization().enterprise_attestation_mode().map(|_| false), "rk" => true, "up" => true, + #[cfg(feature = "config_command")] "alwaysUv" => false, "credMgmt" => true, + #[cfg(feature = "config_command")] "authnrCfg" => true, "clientPin" => false, "largeBlobs" => true, "pinUvAuthToken" => true, + #[cfg(feature = "config_command")] "setMinPINLength" => true, "makeCredUvNotRqd" => true, },