From 1eaff57c885836e80e4bb76ee28649dabf0ea93c Mon Sep 17 00:00:00 2001 From: Kamran Khan Date: Thu, 3 Dec 2020 08:25:34 -0800 Subject: [PATCH] Le should be interpreted as 0x10000 even in the 2-byte case --- src/ctap/apdu.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ctap/apdu.rs b/src/ctap/apdu.rs index 6a94790..b39d7fb 100644 --- a/src/ctap/apdu.rs +++ b/src/ctap/apdu.rs @@ -195,7 +195,7 @@ impl TryFrom<&[u8]> for APDU { 2 => { let le_parsed = BigEndian::read_u16(&payload[payload.len() - 2..]); if le_parsed == 0x00 { - 0x100 + 0x10000 } else { le_parsed as u32 } @@ -396,7 +396,7 @@ mod test { }, lc: 0xb1, data: payload.to_vec(), - le: 0x100, + le: 0x10000, case_type: ApduType::Extended(Case::Lc3DataLe2), }; assert_eq!(Ok(expected), response); @@ -423,7 +423,7 @@ mod test { }, lc: 0x40, data: payload.to_vec(), - le: 0x100, + le: 0x10000, case_type: ApduType::Extended(Case::Lc3DataLe2), }; assert_eq!(Ok(expected), response);