Skip to content

Commit

Permalink
Use CBOR tag for version 2 sskr
Browse files Browse the repository at this point in the history
version 2 sskr uses IANA registered CBOR tag #6.40309 updated from deprecared version 1 crypto-sskr tag #309
  • Loading branch information
aido committed Jun 19, 2024
1 parent 1438365 commit 5b1e7b7
Show file tree
Hide file tree
Showing 15 changed files with 1,193 additions and 884 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.7.4] - 2024-06-17
## [1.7.4] - 2024-06-19

### Fixed
- Ensure result does not overlap with operands in calls to `cx_bn_gf2_n_mul()`
- Give a warning if a user chooses 1-of-m shares when m > 1
- Use CBOR tag for version 2 `sskr`

## [1.7.3] - 2024-05-29

Expand Down
34 changes: 18 additions & 16 deletions src/nano/ux_nano_sskr.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ void generate_sskr(void) {
&G_bolos_ux_context.sskr_words_buffer_length);

if (G_bolos_ux_context.sskr_share_count > 0) {
PRINTF("SSKR share_count from generate_sskr(): %d\n",
G_bolos_ux_context.sskr_share_count);
PRINTF("SSKR share_count from generate_sskr(): %d\n", G_bolos_ux_context.sskr_share_count);
for (uint8_t share = 0; share < G_bolos_ux_context.sskr_share_count; share++) {
PRINTF("SSKR share %d:\n", share + 1);
PRINTF(
Expand All @@ -150,22 +149,25 @@ void generate_sskr(void) {
}

UX_STEP_NOCB(ux_threshold_warn_step_1,
pnn,
{
&C_icon_warning,
"1-of-m shares",
"where m > 1",
});
pnn,
{
&C_icon_warning,
"1-of-m shares",
"where m > 1",
});

UX_STEP_NOCB(ux_threshold_warn_step_2,
pbb,
{
&C_icon_warning,
"Not",
"Supported",
});

UX_FLOW(ux_threshold_warn_flow, &ux_threshold_warn_step_1, &ux_threshold_warn_step_2, &step_sskr_clean_exit);
pbb,
{
&C_icon_warning,
"Not",
"Supported",
});

UX_FLOW(ux_threshold_warn_flow,
&ux_threshold_warn_step_1,
&ux_threshold_warn_step_2,
&step_sskr_clean_exit);

const char* const sskr_descriptor_values[] = {"1",
"2",
Expand Down
6 changes: 3 additions & 3 deletions src/ux_common/onboarding_seed_sskr.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ unsigned int bolos_ux_bip39_to_sskr_convert(unsigned char *bip39_words_buffer,
share_count_expected);
memzero(seed_buffer, sizeof(seed_buffer));
if (*share_count > 0) {
// CBOR Tag #309 is D9 0135
// CBOR Tag #6.40309 is D9 9D75
// CBOR Major type 2 is 0x40
// (see https://www.rfc-editor.org/rfc/rfc8949#name-major-types)
uint8_t cbor[] = {0xD9, 0x01, 0x35, 0x40, 0x00};
uint8_t cbor[] = {0xD9, 0x9D, 0x75, 0x40, 0x00};
size_t cbor_len = sizeof(cbor);
if (share_len < 24) {
cbor[3] |= (share_len & 0x1F);
Expand Down Expand Up @@ -258,7 +258,7 @@ unsigned int bolos_ux_bip39_to_sskr_convert(unsigned char *bip39_words_buffer,
unsigned int bolos_ux_sskr_hex_check(unsigned char *mnemonic_hex,
unsigned int mnemonic_length,
unsigned int sskr_shares_count) {
uint8_t cbor[] = {0xD9, 0x01, 0x35}; // CBOR tag
uint8_t cbor[] = {0xD9, 0x9D, 0x75}; // CBOR Tag #6.40309 is D9 9D75
uint32_t checksum = 0;
uint8_t checksum_len = sizeof(checksum);

Expand Down
Loading

0 comments on commit 5b1e7b7

Please sign in to comment.