mirror of
https://github.com/trussed-dev/piv-authenticator.git
synced 2026-06-20 04:16:15 -07:00
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:
+1
-33
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user