Skip to content

Commit

Permalink
- Add precondition in important functions for improved security.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinkyaraj-23 committed Feb 28, 2024
1 parent e8eabb5 commit 61ffd8c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/apdu_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ static size_t handle_apdu(bool const enable_hashing,
bool const enable_parsing,
uint8_t const instruction,
volatile uint32_t *flags) {
if (os_global_pin_is_validated() != BOLOS_UX_OK) {
THROW(EXC_SECURITY);
}
uint8_t *const buff = &G_io_apdu_buffer[OFFSET_CDATA];
uint8_t const p1 = G_io_apdu_buffer[OFFSET_P1];
uint8_t const buff_size = G_io_apdu_buffer[OFFSET_LC];
Expand Down Expand Up @@ -285,6 +288,10 @@ size_t handle_apdu_sign_with_hash(uint8_t instruction, volatile uint32_t *flags)
}

int perform_signature(bool const on_hash, bool const send_hash) {
if (os_global_pin_is_validated() != BOLOS_UX_OK) {
THROW(EXC_SECURITY);
}

write_high_water_mark(&G.parsed_baking_data);
size_t tx = 0;
if (send_hash && on_hash) {
Expand Down

0 comments on commit 61ffd8c

Please sign in to comment.