Skip to content

Commit

Permalink
Merge remote-tracking branch 'benma/seebitboxapp'
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Jun 18, 2020
2 parents e55be30 + 76d96b6 commit bb6d619
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ add_custom_target(rust-bindgen
--whitelist-function screen_print_debug
--whitelist-function ui_screen_stack_push
--whitelist-function ui_screen_stack_pop
--whitelist-function ui_screen_stack_pop_all
--whitelist-function screen_process
--whitelist-function label_create
--whitelist-function confirm_create
Expand Down
1 change: 1 addition & 0 deletions src/rust/bitbox02-rust-c/src/noise.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2020 Shift Cryptosecurity AG
// Copyright 2020 Shift Crypto AG
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
6 changes: 6 additions & 0 deletions src/rust/bitbox02-rust/src/hww/noise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ pub(crate) async fn process(usb_in: Vec<u8>, usb_out: &mut Vec<u8>) -> Result<()
let mut state = NOISE_STATE.0.borrow_mut();
match usb_in.split_first() {
Some((&OP_I_CAN_HAS_HANDSHAEK, b"")) => {
// The previous screen was "See the BitBoxApp".
// Since a handshake was requested, a client was connected, so we pop that screen.
// Pairing is the start of a session, so we clean the screen stack in case
// we started a new session in the middle of something.
bitbox02::ui::screen_stack_pop_all();

state.init(bitbox02_noise::Sensitive::from(
memory::get_noise_static_private_key()?,
));
Expand Down
7 changes: 7 additions & 0 deletions src/rust/bitbox02/src/ui.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2020 Shift Cryptosecurity AG
// Copyright 2020 Shift Crypto AG
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -223,3 +224,9 @@ pub fn with_lock_animation<F: Fn()>(f: F) {
f();
unsafe { bitbox02_sys::lock_animation_stop() };
}

pub fn screen_stack_pop_all() {
unsafe {
bitbox02_sys::ui_screen_stack_pop_all();
}
}

0 comments on commit bb6d619

Please sign in to comment.