diff --git a/deps/ledger-secure-sdk b/deps/ledger-secure-sdk index 95661ea8..cc039ca0 160000 --- a/deps/ledger-secure-sdk +++ b/deps/ledger-secure-sdk @@ -1 +1 @@ -Subproject commit 95661ea869136f6155452cefb1d1002af77a4d72 +Subproject commit cc039ca0224ef3ba248fca518edeeae796aeb9fc diff --git a/deps/ledger-zxlib b/deps/ledger-zxlib index dca3f65c..398b1768 160000 --- a/deps/ledger-zxlib +++ b/deps/ledger-zxlib @@ -1 +1 @@ -Subproject commit dca3f65cbcda72034a2ee89e74573e2318428298 +Subproject commit 398b1768f39c50c52cb68d2b9d597989753cd73a diff --git a/deps/nanos-secure-sdk b/deps/nanos-secure-sdk index 95661ea8..62dd0477 160000 --- a/deps/nanos-secure-sdk +++ b/deps/nanos-secure-sdk @@ -1 +1 @@ -Subproject commit 95661ea869136f6155452cefb1d1002af77a4d72 +Subproject commit 62dd047774b5e8a6b4e6158b493ee029453b5bae diff --git a/deps/nanosplus-secure-sdk b/deps/nanosplus-secure-sdk index 95661ea8..6a028440 160000 --- a/deps/nanosplus-secure-sdk +++ b/deps/nanosplus-secure-sdk @@ -1 +1 @@ -Subproject commit 95661ea869136f6155452cefb1d1002af77a4d72 +Subproject commit 6a0284400066b5d0575847e4546ecb0c01691350 diff --git a/deps/nanox-secure-sdk b/deps/nanox-secure-sdk index 95661ea8..05465c19 160000 --- a/deps/nanox-secure-sdk +++ b/deps/nanox-secure-sdk @@ -1 +1 @@ -Subproject commit 95661ea869136f6155452cefb1d1002af77a4d72 +Subproject commit 05465c19add6fc688afaebbef92e5f26649c484b diff --git a/rs/src/lib.rs b/rs/src/lib.rs index a06d2be2..a6062261 100644 --- a/rs/src/lib.rs +++ b/rs/src/lib.rs @@ -132,19 +132,19 @@ where } } - let mut public_key = [0; ED25519_PUBKEY_LEN + 1]; - public_key.copy_from_slice(&response_data[..ED25519_PUBKEY_LEN + 1]); - - let mut address_bytes = [0; ADDRESS_LEN]; - address_bytes.copy_from_slice(&response_data[ED25519_PUBKEY_LEN + 1..]); + let (raw_public_key, rest) = response_data.split_at(ED25519_PUBKEY_LEN + 1); + let (public_key_len, rest) = rest.split_first().expect("response too short"); + let (_public_key, rest) = rest.split_at((*public_key_len).into()); + let (address_len, rest) = rest.split_first().expect("response too short"); + let (address_bytes, _rest) = rest.split_at((*address_len).into()); let address_str = str::from_utf8(&address_bytes) .map_err(|_| LedgerAppError::Utf8)? .to_owned(); Ok(ResponseAddress { - public_key, - address_bytes, + public_key: raw_public_key.try_into().unwrap(), + address_bytes: address_bytes.try_into().unwrap(), address_str, }) }