openpgp-card: explicitly limit command chunk size to 255 if extended length is unsupported

This commit is contained in:
Heiko Schaefer 2023-08-28 12:00:35 +02:00
parent 61175dd646
commit 84ee2a64f1
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D

View file

@ -158,8 +158,10 @@ where
log::trace!("chained command mode");
let cmd_chunk_size = if ext_support { max_cmd_bytes } else { 255 };
// Break up payload into chunks that fit into one command, each
let chunks: Vec<_> = cmd.data().chunks(max_cmd_bytes).collect();
let chunks: Vec<_> = cmd.data().chunks(cmd_chunk_size).collect();
for (i, d) in chunks.iter().enumerate() {
let last = i == chunks.len() - 1;