Skip to content

Commit

Permalink
Sync dev and main (#6)
Browse files Browse the repository at this point in the history
* Sync dev and main

* Drop use of deprecated SDK function
  • Loading branch information
0xPxt authored Nov 21, 2024
1 parent 7ea18c5 commit f8c5bfc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
needs: build_application
runs-on: ubuntu-latest
steps:
- run: cd tests_zemu && yarn test
- run: cd tests_zemu && yarn test
14 changes: 13 additions & 1 deletion src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,20 @@ void generate_keypair(Keypair *keypair, const uint32_t account)
0
};

unsigned char raw_privkey[64] = {0};

// Generate private key
os_perso_derive_node_bip32(CX_CURVE_256K1, bip32_path, BIP32_PATH_LEN, keypair->priv, NULL);
if (CX_OK != os_derive_bip32_no_throw(CX_CURVE_256K1, bip32_path, BIP32_PATH_LEN, raw_privkey, NULL)) {
// Clear sensitive data from the stack
explicit_bzero(raw_privkey, sizeof(raw_privkey));
return;
}

memmove(keypair->priv, raw_privkey, SCALAR_BYTES);

// Clear sensitive data from the stack
explicit_bzero(raw_privkey, sizeof(raw_privkey));

scalar_from_bytes(keypair->priv);

// Checking cached_keypair.pub is not NULL is a workaround for the linker.
Expand Down

0 comments on commit f8c5bfc

Please sign in to comment.