From 576110ecce8cf4731880f6bcabf822bad6331846 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Wed, 1 Dec 2021 22:21:28 +0100 Subject: [PATCH] Update comments. --- openpgp-card/src/card_app.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openpgp-card/src/card_app.rs b/openpgp-card/src/card_app.rs index 3797b02..3459bac 100644 --- a/openpgp-card/src/card_app.rs +++ b/openpgp-card/src/card_app.rs @@ -79,14 +79,18 @@ impl CardApp { let ext_cap = ard.extended_capabilities()?; + // Get max command/response byte sizes from card let (max_cmd_bytes, max_rsp_bytes) = - // FIXME: handle cmd/resp limits in ex-cap, for card <3.0 (?) if let Ok(Some(eli)) = ard.extended_length_information() { + // In card 3.x, max lengths come from ExtendedLengthInfo (eli.max_command_bytes(), eli.max_response_bytes()) - } else if let (Some(cmd), Some(rsp)) - = (ext_cap.max_cmd_len(), ext_cap.max_resp_len()) { + } else if let (Some(cmd), Some(rsp)) = + (ext_cap.max_cmd_len(), ext_cap.max_resp_len()) + { + // In card 2.x, max lengths come from ExtendedCapabilities (cmd, rsp) } else { + // Fallback: use 255 if we have no information from the card (255, 255) };