From c237ff7b4647d705417d7be936fca99e73638628 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 30 Jan 2023 18:31:12 +0800 Subject: [PATCH] fix https://github.com/google/OpenSK/issues/582 See the above issue for more details --- apps/vault/src/ctap/data_formats.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/vault/src/ctap/data_formats.rs b/apps/vault/src/ctap/data_formats.rs index 345ded26c..ea06cdde2 100644 --- a/apps/vault/src/ctap/data_formats.rs +++ b/apps/vault/src/ctap/data_formats.rs @@ -926,7 +926,16 @@ impl TryFrom for PinUvAuthProtocol { match extract_unsigned(cbor_value)? { 1 => Ok(PinUvAuthProtocol::V1), 2 => Ok(PinUvAuthProtocol::V2), - _ => Err(Ctap2StatusCode::CTAP1_ERR_INVALID_PARAMETER), + /* from this test: + https://github.com/google/CTAP2-test-tool/blob/1afd50bd1b700dc86d6dffeca70a331771d24e45/src/tests/make_credential.cc#L503-L515 + + Test successful: Tests the response on an empty PIN auth without a PIN in MakeCredential. + Test successful: Tests if the PIN protocol parameter is checked in MakeCredential. + Expected error code `CTAP2_ERR_PIN_AUTH_INVALID`, got `CTAP1_ERR_INVALID_PARAMETER`. + */ + _ => { + Err(Ctap2StatusCode::CTAP2_ERR_PIN_AUTH_INVALID) + }, } } }