Skip to content

Commit

Permalink
Removed status word duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
kingofpayne committed Dec 11, 2023
1 parent 8f48d21 commit 156f2a7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/handlers/get_public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use ledger_secure_sdk_sys::{

pub fn handler_get_public_key(comm: &mut Comm, display: bool) -> Result<(), AppSW> {
let mut path = [0u32; MAX_ALLOWED_PATH_LEN];
let data = comm.get_data().map_err(|_| AppSW::WrongDataLength)?;
let data = comm.get_data().map_err(|_| AppSW::WrongApduLength)?;
let path_len = read_bip32_path(data, &mut path)?;

let pk = Secp256k1::derive_from_path(&path[..path_len])
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/sign_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub fn handler_sign_tx(
ctx: &mut TxContext,
) -> Result<(), AppSW> {
// Try to get data from comm
let data = comm.get_data().map_err(|_| AppSW::WrongDataLength)?;
let data = comm.get_data().map_err(|_| AppSW::WrongApduLength)?;
// First chunk, try to parse the path
if chunk == 0 {
// Reset transaction context
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const P1_SIGN_TX_MAX: u8 = 0x03;
pub enum AppSW {
Deny = 0x6985,
WrongP1P2 = 0x6A86,
WrongDataLength = 0x6A87,
InsNotSupported = 0x6D00,
ClaNotSupported = 0x6E00,
TxDisplayFail = 0xB001,
Expand Down
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub const MAX_ALLOWED_PATH_LEN: usize = 10;
pub fn read_bip32_path(data: &[u8], path: &mut [u32]) -> Result<usize, AppSW> {
// Check input length and path buffer capacity
if data.is_empty() || path.len() < data.len() / 4 {
return Err(AppSW::WrongDataLength);
return Err(AppSW::WrongApduLength);
}

let path_len = data[0] as usize; // First byte is the length of the path
Expand All @@ -18,7 +18,7 @@ pub fn read_bip32_path(data: &[u8], path: &mut [u32]) -> Result<usize, AppSW> {
|| path_data.len() > MAX_ALLOWED_PATH_LEN * 4
|| path_data.len() % 4 != 0
{
return Err(AppSW::WrongDataLength);
return Err(AppSW::WrongApduLength);
}

let mut idx = 0;
Expand Down

0 comments on commit 156f2a7

Please sign in to comment.