1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 19:38:09 +00:00

Merge pull request #38 from romanz/ssh-agent

update protobuf with ECDSA curve selection
This commit is contained in:
Pavol Rusnak 2015-06-28 21:09:33 +02:00
commit 6f975532c0
2 changed files with 181 additions and 116 deletions

View File

@ -24,6 +24,8 @@ from mnemonic import Mnemonic
SCREENSHOT = False
DEFAULT_CURVE = 'secp256k1'
# monkeypatching: text formatting of protobuf messages
tools.monkeypatch_google_protobuf_text_format()
@ -385,9 +387,9 @@ class ProtocolMixin(object):
return path
@expect(proto.PublicKey)
def get_public_node(self, n):
def get_public_node(self, n, ecdsa_curve_name=DEFAULT_CURVE):
n = self._convert_prime(n)
return self.call(proto.GetPublicKey(address_n=n))
return self.call(proto.GetPublicKey(address_n=n, ecdsa_curve_name=ecdsa_curve_name))
@field('address')
@expect(proto.Address)
@ -459,8 +461,8 @@ class ProtocolMixin(object):
return self.call(proto.SignMessage(coin_name=coin_name, address_n=n, message=message))
@expect(proto.SignedIdentity)
def sign_identity(self, identity, challenge_hidden, challenge_visual):
return self.call(proto.SignIdentity(identity=identity, challenge_hidden=challenge_hidden, challenge_visual=challenge_visual))
def sign_identity(self, identity, challenge_hidden, challenge_visual, ecdsa_curve_name=DEFAULT_CURVE):
return self.call(proto.SignIdentity(identity=identity, challenge_hidden=challenge_hidden, challenge_visual=challenge_visual, ecdsa_curve_name=ecdsa_curve_name))
def verify_message(self, address, signature, message):
try:

File diff suppressed because one or more lines are too long