1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-31 18:00:58 +00:00

refactor(crypto): use secp256k1 submodule in bip32

[no changelog]
This commit is contained in:
Ondřej Vejpustek 2024-08-02 17:06:11 +02:00
parent 54eef8d886
commit d00002ee69

View File

@ -300,8 +300,12 @@ int hdnode_public_ckd_cp(const ecdsa_curve *curve, const curve_point *parent,
hmac_sha512(parent_chain_code, 32, data, sizeof(data), I); hmac_sha512(parent_chain_code, 32, data, sizeof(data), I);
bn_read_be(I, &c); bn_read_be(I, &c);
if (bn_is_less(&c, &curve->order)) { // < order if (bn_is_less(&c, &curve->order)) { // < order
scalar_multiply(curve, &c, child); // b = c * G // b = c * G
point_add(curve, parent, child); // b = a + b uint8_t child_pubkey[65] = {0};
ecdsa_get_public_key65(curve, I, child_pubkey);
ecdsa_read_pubkey(curve, child_pubkey, child);
point_add(curve, parent, child); // b = a + b
if (!point_is_infinity(child)) { if (!point_is_infinity(child)) {
if (child_chain_code) { if (child_chain_code) {
memcpy(child_chain_code, I + 32, 32); memcpy(child_chain_code, I + 32, 32);