Skip to content

Commit 296440f

Browse files
authored
Merge pull request #229 from LedgerHQ/y333_08012024/update_pin_code_mngt
Pin code management: when device is locked, returned 0x5515 error
2 parents bfef93f + ba12114 commit 296440f

File tree

7 files changed

+38
-10
lines changed

7 files changed

+38
-10
lines changed

.github/workflows/build_all_apps.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ jobs:
9191
echo "path=$path" >> $cargo_toml_path
9292
echo "Patch added to Cargo.toml"
9393
fi
94+
# Patch include_gif
95+
if grep -Fxq "[patch.crates-io.include_gif]" $cargo_toml_path; then
96+
echo "The patch already exists in the file."
97+
exit 1
98+
else
99+
echo "" >> $cargo_toml_path
100+
echo "[patch.crates-io.include_gif]" >> $cargo_toml_path
101+
path=\"$GITHUB_WORKSPACE/sdk/include_gif\"
102+
echo "path=$path" >> $cargo_toml_path
103+
echo "Patch added to Cargo.toml"
104+
fi
94105
95106
- name: Build
96107
run: |
@@ -100,8 +111,9 @@ jobs:
100111
cd $build_directory
101112
for device in $devices; do
102113
# Required as patch has a different version from what is locked in Cargo.lock
103-
cargo +$RUST_NIGHTLY update ledger_device_sdk
114+
cargo +$RUST_NIGHTLY update include_gif
104115
cargo +$RUST_NIGHTLY update ledger_secure_sdk_sys
116+
cargo +$RUST_NIGHTLY update ledger_device_sdk
105117
echo "Build for "$device
106118
cargo ledger build $device
107119
done

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ledger_device_sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ledger_device_sdk"
3-
version = "1.19.4"
3+
version = "1.19.5"
44
authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"]
55
edition = "2021"
66
license.workspace = true

ledger_device_sdk/src/io.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,15 @@ impl Comm {
432432
}
433433

434434
if unsafe { G_io_app.apdu_state } != APDU_IDLE && unsafe { G_io_app.apdu_length } > 0 {
435+
#[cfg(not(any(target_os = "nanos")))]
436+
unsafe {
437+
if os_perso_is_pin_set() == BOLOS_TRUE.try_into().unwrap()
438+
&& os_global_pin_is_validated() != BOLOS_TRUE.try_into().unwrap()
439+
{
440+
self.reply(StatusWords::DeviceLocked);
441+
return None;
442+
}
443+
}
435444
self.rx = unsafe { G_io_app.apdu_length as usize };
436445
self.event_pending = true;
437446
return self.check_event();

ledger_device_sdk/src/ui/gadgets.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,7 @@ impl<'a> MultiPageMenu<'a> {
608608
io::Event::Ticker => {
609609
if UxEvent::Event.request() != BOLOS_UX_OK {
610610
// pin lock management
611-
let (_res, ins) = UxEvent::block_and_get_event::<Temp>(self.comm);
612-
if let Some(_e) = ins {
613-
self.comm
614-
.reply::<io::StatusWords>(io::StatusWords::DeviceLocked);
615-
}
611+
UxEvent::block_and_get_event::<Temp>(self.comm);
616612
// notify Ticker event only when redisplay is required
617613
return EventOrPageIndex::Event(io::Event::Ticker);
618614
}

ledger_secure_sdk_sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ledger_secure_sdk_sys"
3-
version = "1.6.1"
3+
version = "1.6.2"
44
authors = ["yhql", "agrojean-ledger", "yogh333"]
55
edition = "2021"
66
license.workspace = true

ledger_secure_sdk_sys/src/seph.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ pub fn send_general_status() {
3434
}
3535
}
3636

37+
/// Function to ensure a I/O channel is not timeouting waiting
38+
/// for operations after a long time without SEPH packet exchanges
39+
pub fn heartbeat() {
40+
send_general_status();
41+
let mut spi_buffer = [0u8; 128];
42+
seph_recv(&mut spi_buffer, 0);
43+
while is_status_sent() {
44+
seph_recv(&mut spi_buffer, 0);
45+
}
46+
}
47+
3748
#[repr(u8)]
3849
pub enum SephTags {
3950
ScreenDisplayStatus = SEPROXYHAL_TAG_SCREEN_DISPLAY_STATUS as u8,

0 commit comments

Comments
 (0)