1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

monero: drop secp256k1 curve

This commit is contained in:
Tomas Susanka 2019-04-05 11:36:38 +02:00
parent 396f5f1937
commit 22dfe10c56
2 changed files with 7 additions and 16 deletions

View File

@ -3,12 +3,11 @@ from trezor.messages import MessageType
from apps.common import HARDENED
CURVE = "ed25519"
def boot():
ns = [
["secp256k1", HARDENED | 44, HARDENED | 128],
["ed25519", HARDENED | 44, HARDENED | 128],
]
ns = [[CURVE, HARDENED | 44, HARDENED | 128]]
wire.add(MessageType.MoneroGetAddress, __name__, "get_address", ns)
wire.add(MessageType.MoneroGetWatchKey, __name__, "get_watch_only", ns)
wire.add(MessageType.MoneroTransactionInitRequest, __name__, "sign_tx", ns)

View File

@ -1,25 +1,17 @@
from apps.common import HARDENED
from apps.monero import CURVE
if False:
from apps.monero.xmr.types import *
def get_creds(keychain, address_n=None, network_type=None):
from apps.monero.xmr import crypto, monero
from apps.monero.xmr import monero
from apps.monero.xmr.credentials import AccountCreds
use_slip0010 = 0 not in address_n # If path contains 0 it is not SLIP-0010
node = keychain.derive(address_n, CURVE)
if use_slip0010:
curve = "ed25519"
else:
curve = "secp256k1"
node = keychain.derive(address_n, curve)
if use_slip0010:
key_seed = node.private_key()
else:
key_seed = crypto.cn_fast_hash(node.private_key())
key_seed = node.private_key()
spend_sec, _, view_sec, _ = monero.generate_monero_keys(key_seed)
creds = AccountCreds.new_wallet(view_sec, spend_sec, network_type)