mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-15 19:08:07 +00:00
crypto: derive public key in hdnode_sign only for supported ed25519 curves
This commit is contained in:
parent
50773c2a3b
commit
e7a81560f1
@ -765,17 +765,21 @@ int hdnode_sign(HDNode *node, const uint8_t *msg, uint32_t msg_len,
|
||||
} else if (node->curve == &curve25519_info) {
|
||||
return 1; // signatures are not supported
|
||||
} else {
|
||||
hdnode_fill_public_key(node);
|
||||
if (node->curve == &ed25519_info) {
|
||||
hdnode_fill_public_key(node);
|
||||
ed25519_sign(msg, msg_len, node->private_key, node->public_key + 1, sig);
|
||||
} else if (node->curve == &ed25519_sha3_info) {
|
||||
hdnode_fill_public_key(node);
|
||||
ed25519_sign_sha3(msg, msg_len, node->private_key, node->public_key + 1,
|
||||
sig);
|
||||
#if USE_KECCAK
|
||||
} else if (node->curve == &ed25519_keccak_info) {
|
||||
hdnode_fill_public_key(node);
|
||||
ed25519_sign_keccak(msg, msg_len, node->private_key, node->public_key + 1,
|
||||
sig);
|
||||
#endif
|
||||
} else {
|
||||
return 1; // unknown or unsupported curve
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user