mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
protob: remove Stellar{SignMessage,MessageSignature,VerifyMessage}
This commit is contained in:
parent
59c8b66ba4
commit
ae82735b6b
@ -93,8 +93,6 @@ void fsm_msgStellarChangeTrustOp(StellarChangeTrustOp *msg);
|
||||
void fsm_msgStellarAllowTrustOp(StellarAllowTrustOp *msg);
|
||||
void fsm_msgStellarAccountMergeOp(StellarAccountMergeOp *msg);
|
||||
void fsm_msgStellarManageDataOp(StellarManageDataOp *msg);
|
||||
void fsm_msgStellarSignMessage(StellarSignMessage *msg);
|
||||
void fsm_msgStellarVerifyMessage(StellarVerifyMessage *msg);
|
||||
void fsm_msgStellarBumpSequenceOp(StellarBumpSequenceOp *msg);
|
||||
|
||||
// debug message functions
|
||||
|
@ -19,46 +19,6 @@ void fsm_msgStellarGetPublicKey(StellarGetPublicKey *msg)
|
||||
layoutHome();
|
||||
}
|
||||
|
||||
void fsm_msgStellarSignMessage(StellarSignMessage *msg)
|
||||
{
|
||||
RESP_INIT(StellarMessageSignature);
|
||||
|
||||
CHECK_INITIALIZED
|
||||
|
||||
layoutSignMessage(msg->message.bytes, msg->message.size);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ProtectCall, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK_PIN
|
||||
|
||||
// Populate response message
|
||||
stellar_signMessage(msg->message.bytes, msg->message.size, msg->address_n, msg->address_n_count, resp->signature.bytes);
|
||||
resp->has_signature = true;
|
||||
resp->signature.size = 64;
|
||||
|
||||
stellar_getPubkeyAtAddress(msg->address_n, msg->address_n_count, resp->public_key.bytes, sizeof(resp->public_key.bytes));
|
||||
resp->has_public_key = true;
|
||||
resp->public_key.size = 32;
|
||||
|
||||
msg_write(MessageType_MessageType_StellarMessageSignature, resp);
|
||||
|
||||
layoutHome();
|
||||
}
|
||||
|
||||
void fsm_msgStellarVerifyMessage(StellarVerifyMessage *msg)
|
||||
{
|
||||
if (!stellar_verifyMessage(msg)) {
|
||||
fsm_sendFailure(FailureType_Failure_DataError, _("Invalid signature"));
|
||||
return;
|
||||
}
|
||||
|
||||
fsm_sendSuccess(_("Message verified"));
|
||||
layoutHome();
|
||||
}
|
||||
|
||||
void fsm_msgStellarSignTx(StellarSignTx *msg)
|
||||
{
|
||||
CHECK_INITIALIZED
|
||||
|
@ -182,16 +182,6 @@ StellarGetPublicKey.address_n max_count:10
|
||||
|
||||
StellarPublicKey.public_key max_size:32
|
||||
|
||||
StellarSignMessage.address_n max_count:10
|
||||
StellarSignMessage.message max_size:1024
|
||||
|
||||
StellarMessageSignature.public_key max_size:32
|
||||
StellarMessageSignature.signature max_size:64
|
||||
|
||||
StellarVerifyMessage.public_key max_size:32
|
||||
StellarVerifyMessage.message max_size:1024
|
||||
StellarVerifyMessage.signature max_size:64
|
||||
|
||||
StellarSignTx.address_n max_count:10
|
||||
StellarSignTx.network_passphrase max_size:1024
|
||||
StellarSignTx.source_account max_size:32
|
||||
@ -249,12 +239,9 @@ SelfTest skip_message:true
|
||||
|
||||
LiskGetAddress skip_message:true
|
||||
LiskSignTx skip_message:true
|
||||
LiskSignMessage skip_message:true
|
||||
LiskVerifyMessage skip_message:true
|
||||
LiskGetPublicKey skip_message:true
|
||||
LiskAddress skip_message:true
|
||||
LiskSignedTx skip_message:true
|
||||
LiskMessageSignature skip_message:true
|
||||
LiskPublicKey skip_message:true
|
||||
|
||||
# used only in debug firmware
|
||||
|
@ -1130,23 +1130,6 @@ void stellar_getSignatureForActiveTx(uint8_t *out_signature)
|
||||
memcpy(out_signature, signature, sizeof(signature));
|
||||
}
|
||||
|
||||
void stellar_signMessage(const uint8_t *message, uint32_t message_len, uint32_t *address_n, size_t address_n_count, uint8_t *out_signature)
|
||||
{
|
||||
HDNode *node = stellar_deriveNode(address_n, address_n_count);
|
||||
ed25519_sign(message, message_len, node->private_key, node->public_key + 1, out_signature);
|
||||
}
|
||||
|
||||
bool stellar_verifyMessage(StellarVerifyMessage *msg)
|
||||
{
|
||||
// returns 0 if signature is valid
|
||||
return ed25519_sign_open(
|
||||
msg->message.bytes,
|
||||
msg->message.size,
|
||||
msg->public_key.bytes,
|
||||
msg->signature.bytes
|
||||
) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns number (representing stroops) formatted as XLM
|
||||
* For example, if number has value 1000000000 then it will be returned as "100.0"
|
||||
|
@ -57,9 +57,6 @@ void stellar_confirmAccountMergeOp(StellarAccountMergeOp *msg);
|
||||
void stellar_confirmManageDataOp(StellarManageDataOp *msg);
|
||||
void stellar_confirmBumpSequenceOp(StellarBumpSequenceOp *msg);
|
||||
|
||||
void stellar_signMessage(const uint8_t *message, uint32_t message_len, uint32_t *address_n, size_t address_n_count, uint8_t *out_signature);
|
||||
bool stellar_verifyMessage(StellarVerifyMessage *msg);
|
||||
|
||||
// Layout
|
||||
void stellar_layoutGetPublicKey(uint32_t *address_n, size_t address_n_count);
|
||||
void stellar_layoutTransactionDialog(const char *line1, const char *line2, const char *line3, const char *line4, const char *line5);
|
||||
|
2
vendor/trezor-common
vendored
2
vendor/trezor-common
vendored
@ -1 +1 @@
|
||||
Subproject commit f54cf5073c550d92338beb7e8c70ec703d63aee8
|
||||
Subproject commit fb662e53b129b250149d982259696531ff4c2b95
|
Loading…
Reference in New Issue
Block a user