Skip to content

Commit

Permalink
fix: replace deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nsonanh committed Sep 7, 2023
1 parent de7a4fb commit d747ca8
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,25 @@ void crypto_derive_private_key( const uint32_t* bip32_path,
// derive the seed with bip32_path
if( curve_type == CURVE_Ed25519 )
{
unsigned char seed_key[] = "ed25519 seed";

os_perso_derive_node_bip32_seed_key( HDW_ED25519_SLIP10,
CX_CURVE_Ed25519,
bip32_path,
bip32_path_len,
raw_private_key,
NULL,
seed_key,
sizeof(seed_key)-1 );
os_derive_bip32_no_throw( CX_CURVE_Ed25519,
bip32_path,
bip32_path_len,
raw_private_key,
NULL );
}
else
{
os_perso_derive_node_bip32( CX_CURVE_256K1,
os_derive_bip32_no_throw( CX_CURVE_256K1,
bip32_path,
bip32_path_len,
raw_private_key,
NULL );
}

// initialize private_key from raw key
cx_ecfp_init_private_key(CX_CURVE_Ed25519,
raw_private_key,
sizeof(raw_private_key),
private_key);
// cx_ecfp_init_private_key here, but it's deprecated
private_key->curve = CX_CURVE_Ed25519;
private_key->d_len = 64;
memmove(private_key->d, raw_private_key, 64);
}
CATCH_OTHER(e)
{
Expand Down

0 comments on commit d747ca8

Please sign in to comment.