Skip to content

Commit

Permalink
fixed some bugs connected to blindsigning with nova
Browse files Browse the repository at this point in the history
  • Loading branch information
shufps committed Feb 9, 2024
1 parent 2496772 commit 4c87bed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ uint32_t api_set_account(uint8_t app_mode, const uint8_t *data, uint32_t len)
THROW(SW_INCORRECT_LENGTH);
}

if ((app_mode & 0x7f) > APP_MODE_SHIMMER) {
if ((app_mode & 0x7f) > APP_MODE_SHIMMER_NOVA) {
THROW(SW_INCORRECT_P1P2);
}

Expand Down Expand Up @@ -554,9 +554,8 @@ uint32_t api_prepare_blindsigning(uint8_t num_hashes)
THROW(SW_COMMAND_NOT_ALLOWED);
}

// blindsigning only allowed with stardust protocol but not SMR claiming
if (api.protocol != PROTOCOL_STARDUST ||
api.app_mode == APP_MODE_SHIMMER_CLAIMING) {
// blindsigning not allowed on shimmer claiming
if (api.app_mode == APP_MODE_SHIMMER_CLAIMING) {
THROW(SW_COMMAND_NOT_ALLOWED);
}

Expand All @@ -572,7 +571,8 @@ uint32_t api_prepare_blindsigning(uint8_t num_hashes)
api.essence.blindsigning = 1;

// multiple of 32byte chunks
uint16_t signing_input_len = (uint16_t)num_hashes << 5;
// value of 0 is the same as 1 for compatibility
uint16_t signing_input_len = (uint16_t) (!num_hashes ? 1 : num_hashes) << 5;

// we allow to prepare without blindsigning enabled but the user will only
// get an error message that blindsigning is not enabled on the Nano when
Expand Down
2 changes: 1 addition & 1 deletion src/iota/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

#define SIGNING_INPUT_MAX_BYTES 64
#define SIGNING_INPUT_NOVA_32BYTE 32
#define SIGNING_INPUT_NOVA_64BYTE 32
#define SIGNING_INPUT_NOVA_64BYTE 64

// address type of ED25519 addresses
#define ADDRESS_TYPE_ED25519 0
Expand Down

0 comments on commit 4c87bed

Please sign in to comment.