Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin code management: when device is locked, returned 0x5515 error #229

Merged
merged 7 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
agrojean-ledger marked this conversation as resolved.
Show resolved Hide resolved
&& 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
Loading