Skip to content

Commit a61da40

Browse files
committed
[io] swap_reply() shall be the same as reply()
1 parent 4994bf4 commit a61da40

File tree

1 file changed

+4
-10
lines changed
  • ledger_device_sdk/src

1 file changed

+4
-10
lines changed

ledger_device_sdk/src/io.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl Comm {
184184
/// Send the currently held APDU
185185
// This is private. Users should call reply to set the satus word and
186186
// transmit the response.
187-
fn apdu_send(&mut self, _is_swap: bool) {
187+
fn apdu_send(&mut self) {
188188
if self.tx != 0 {
189189
sys_seph::io_tx(self.apdu_type, &self.apdu_buffer, self.tx);
190190
self.tx = 0;
@@ -527,17 +527,11 @@ impl Comm {
527527
self.io_buffer[self.tx_length + 1] = sw as u8;
528528
self.tx_length += 2;
529529
// Transmit the response
530-
self.apdu_send(false);
530+
self.apdu_send();
531531
}
532532

533533
pub fn swap_reply<T: Into<Reply>>(&mut self, reply: T) {
534-
let sw = reply.into().0;
535-
// Append status word
536-
self.io_buffer[self.tx_length] = (sw >> 8) as u8;
537-
self.io_buffer[self.tx_length + 1] = sw as u8;
538-
self.tx_length += 2;
539-
// Transmit the response
540-
self.apdu_send(true);
534+
self.reply(reply);
541535
}
542536

543537
/// Set the Status Word of the response to `StatusWords::OK` (which is equal
@@ -547,7 +541,7 @@ impl Comm {
547541
}
548542

549543
pub fn swap_reply_ok(&mut self) {
550-
self.swap_reply(StatusWords::Ok);
544+
self.reply_ok();
551545
}
552546

553547
/// Return APDU Metadata

0 commit comments

Comments
 (0)