Remove command chaining

This is handled by [apdu_dispatch](https://github.com/solokeys/apdu-dispatch/blob/main/src/dispatch.rs#L155)
This commit is contained in:
Sosthène Guédon
2022-10-31 11:24:18 +01:00
parent aab53029e0
commit 0dc602cd81
2 changed files with 1 additions and 34 deletions
+1 -33
View File
@@ -89,39 +89,7 @@ where
reply: &mut Data<R>,
) -> Result {
info!("PIV responding to {:?}", command);
let last_or_only = command.class().chain().last_or_only();
// TODO: avoid owned copy?
let entire_command = match self.state.runtime.chained_command.as_mut() {
Some(command_so_far) => {
// TODO: make sure the header matches, e.g. '00 DB 3F FF'
command_so_far
.data_mut()
.extend_from_slice(command.data())
.unwrap();
if last_or_only {
let entire_command = command_so_far.clone();
self.state.runtime.chained_command = None;
entire_command
} else {
return Ok(());
}
}
None => {
if last_or_only {
// iso7816::Command<C>
command.clone()
} else {
self.state.runtime.chained_command = Some(command.clone());
return Ok(());
}
}
};
// parse Iso7816Command as PivCommand
let command: Command = (&entire_command).try_into()?;
let command: Command = command.try_into()?;
info!("parsed: {:?}", &command);
match command {
-1
View File
@@ -250,7 +250,6 @@ pub struct Runtime<const C: usize> {
// pub currently_selected_application: SelectableAid,
pub app_security_status: AppSecurityStatus,
pub command_cache: Option<CommandCache>,
pub chained_command: Option<iso7816::Command<C>>,
}
// pub trait Aid {