crypto: derive public key in hdnode_sign only for supported ed25519 curves

pull/799/head
Ondřej Vejpustek 5 years ago committed by Pavol Rusnak
parent 50773c2a3b
commit e7a81560f1
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -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…
Cancel
Save