Skip to content

Commit

Permalink
Fix ragger tests issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Apr 4, 2024
1 parent 02b312c commit eed015b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ enum Ins {
impl TryFrom<io::ApduHeader> for Ins {
type Error = io::StatusWords;
fn try_from(header: io::ApduHeader) -> Result<Self, Self::Error> {
match (header.ins, header.p1) {
(0, _) => Ok(Ins::GetVersion),
(1, 0 | 1) => Ok(Ins::GetPubkey {
match (header.ins, header.p1, header.p2) {
(0, 0, 0) => Ok(Ins::GetVersion),
(0, _, _) => Err(io::StatusWords::BadP1P2),
(1, 0 | 1, 0) => Ok(Ins::GetPubkey {
display: header.p1 != 0,
}),
(2, _) => Ok(Ins::SignHash),
(_, _) => Err(io::StatusWords::BadIns),
(1, _, _) => Err(io::StatusWords::BadP1P2),
(2, _, _) => Ok(Ins::SignHash),
(_, _, _) => Err(io::StatusWords::BadIns),
}
}
}
Expand Down Expand Up @@ -100,6 +102,8 @@ fn handle_apdu(comm: &mut io::Comm, ins: Ins, ctx: &mut Ctx) -> Result<(), Reply
};
if ret {
comm.append(key.as_ref());
} else {
return Err(io::StatusWords::UserCancelled.into());
}
}
}
Expand Down

0 comments on commit eed015b

Please sign in to comment.