Skip to content

Commit

Permalink
Merge pull request #229 from LedgerHQ/y333_08012024/update_pin_code_mngt
Browse files Browse the repository at this point in the history
Pin code management: when device is locked, returned 0x5515 error
  • Loading branch information
yogh333 authored Jan 23, 2025
2 parents bfef93f + ba12114 commit 296440f
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 10 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build_all_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ jobs:
echo "path=$path" >> $cargo_toml_path
echo "Patch added to Cargo.toml"
fi
# Patch include_gif
if grep -Fxq "[patch.crates-io.include_gif]" $cargo_toml_path; then
echo "The patch already exists in the file."
exit 1
else
echo "" >> $cargo_toml_path
echo "[patch.crates-io.include_gif]" >> $cargo_toml_path
path=\"$GITHUB_WORKSPACE/sdk/include_gif\"
echo "path=$path" >> $cargo_toml_path
echo "Patch added to Cargo.toml"
fi
- name: Build
run: |
Expand All @@ -100,8 +111,9 @@ jobs:
cd $build_directory
for device in $devices; do
# Required as patch has a different version from what is locked in Cargo.lock
cargo +$RUST_NIGHTLY update ledger_device_sdk
cargo +$RUST_NIGHTLY update include_gif
cargo +$RUST_NIGHTLY update ledger_secure_sdk_sys
cargo +$RUST_NIGHTLY update ledger_device_sdk
echo "Build for "$device
cargo ledger build $device
done
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ledger_device_sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ledger_device_sdk"
version = "1.19.4"
version = "1.19.5"
authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"]
edition = "2021"
license.workspace = true
Expand Down
9 changes: 9 additions & 0 deletions ledger_device_sdk/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,15 @@ impl Comm {
}

if unsafe { G_io_app.apdu_state } != APDU_IDLE && unsafe { G_io_app.apdu_length } > 0 {
#[cfg(not(any(target_os = "nanos")))]
unsafe {
if os_perso_is_pin_set() == BOLOS_TRUE.try_into().unwrap()
&& os_global_pin_is_validated() != BOLOS_TRUE.try_into().unwrap()
{
self.reply(StatusWords::DeviceLocked);
return None;
}
}
self.rx = unsafe { G_io_app.apdu_length as usize };
self.event_pending = true;
return self.check_event();
Expand Down
6 changes: 1 addition & 5 deletions ledger_device_sdk/src/ui/gadgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,7 @@ impl<'a> MultiPageMenu<'a> {
io::Event::Ticker => {
if UxEvent::Event.request() != BOLOS_UX_OK {
// pin lock management
let (_res, ins) = UxEvent::block_and_get_event::<Temp>(self.comm);
if let Some(_e) = ins {
self.comm
.reply::<io::StatusWords>(io::StatusWords::DeviceLocked);
}
UxEvent::block_and_get_event::<Temp>(self.comm);
// notify Ticker event only when redisplay is required
return EventOrPageIndex::Event(io::Event::Ticker);
}
Expand Down
2 changes: 1 addition & 1 deletion ledger_secure_sdk_sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ledger_secure_sdk_sys"
version = "1.6.1"
version = "1.6.2"
authors = ["yhql", "agrojean-ledger", "yogh333"]
edition = "2021"
license.workspace = true
Expand Down
11 changes: 11 additions & 0 deletions ledger_secure_sdk_sys/src/seph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ pub fn send_general_status() {
}
}

/// Function to ensure a I/O channel is not timeouting waiting
/// for operations after a long time without SEPH packet exchanges
pub fn heartbeat() {
send_general_status();
let mut spi_buffer = [0u8; 128];
seph_recv(&mut spi_buffer, 0);
while is_status_sent() {
seph_recv(&mut spi_buffer, 0);
}
}

#[repr(u8)]
pub enum SephTags {
ScreenDisplayStatus = SEPROXYHAL_TAG_SCREEN_DISPLAY_STATUS as u8,
Expand Down

0 comments on commit 296440f

Please sign in to comment.