mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +00:00
fix whitespace
This commit is contained in:
parent
a00c7f9720
commit
44bb5864d4
@ -24,56 +24,56 @@
|
||||
#include "messages-management.pb.h"
|
||||
|
||||
#define STORAGE_FIELD(TYPE, NAME) \
|
||||
bool has_##NAME; \
|
||||
TYPE NAME;
|
||||
bool has_##NAME; \
|
||||
TYPE NAME;
|
||||
|
||||
#define STORAGE_STRING(NAME, SIZE) \
|
||||
bool has_##NAME; \
|
||||
char NAME[SIZE];
|
||||
bool has_##NAME; \
|
||||
char NAME[SIZE];
|
||||
|
||||
#define STORAGE_BYTES(NAME, SIZE) \
|
||||
bool has_##NAME; \
|
||||
struct { \
|
||||
uint32_t size; \
|
||||
uint8_t bytes[SIZE]; \
|
||||
} NAME;
|
||||
bool has_##NAME; \
|
||||
struct { \
|
||||
uint32_t size; \
|
||||
uint8_t bytes[SIZE]; \
|
||||
} NAME;
|
||||
|
||||
#define STORAGE_BOOL(NAME) STORAGE_FIELD(bool, NAME)
|
||||
#define STORAGE_NODE(NAME) STORAGE_FIELD(StorageHDNode, NAME)
|
||||
#define STORAGE_UINT32(NAME) STORAGE_FIELD(uint32_t, NAME)
|
||||
|
||||
typedef struct {
|
||||
uint32_t depth;
|
||||
uint32_t fingerprint;
|
||||
uint32_t child_num;
|
||||
struct {
|
||||
uint32_t size;
|
||||
uint8_t bytes[32];
|
||||
} chain_code;
|
||||
uint32_t depth;
|
||||
uint32_t fingerprint;
|
||||
uint32_t child_num;
|
||||
struct {
|
||||
uint32_t size;
|
||||
uint8_t bytes[32];
|
||||
} chain_code;
|
||||
|
||||
STORAGE_BYTES(private_key, 32);
|
||||
STORAGE_BYTES(public_key, 33);
|
||||
STORAGE_BYTES(private_key, 32);
|
||||
STORAGE_BYTES(public_key, 33);
|
||||
} StorageHDNode;
|
||||
|
||||
typedef struct _Storage {
|
||||
uint32_t version;
|
||||
uint32_t version;
|
||||
|
||||
STORAGE_NODE (node)
|
||||
STORAGE_STRING (mnemonic, 241)
|
||||
STORAGE_BOOL (passphrase_protection)
|
||||
STORAGE_UINT32 (pin_failed_attempts)
|
||||
STORAGE_STRING (pin, 10)
|
||||
STORAGE_STRING (language, 17)
|
||||
STORAGE_STRING (label, 33)
|
||||
STORAGE_BOOL (imported)
|
||||
STORAGE_BYTES (homescreen, 1024)
|
||||
STORAGE_UINT32 (u2f_counter)
|
||||
STORAGE_BOOL (needs_backup)
|
||||
STORAGE_UINT32 (flags)
|
||||
STORAGE_NODE (u2froot)
|
||||
STORAGE_BOOL (unfinished_backup)
|
||||
STORAGE_UINT32 (auto_lock_delay_ms)
|
||||
STORAGE_BOOL (no_backup)
|
||||
STORAGE_NODE (node)
|
||||
STORAGE_STRING (mnemonic, 241)
|
||||
STORAGE_BOOL (passphrase_protection)
|
||||
STORAGE_UINT32 (pin_failed_attempts)
|
||||
STORAGE_STRING (pin, 10)
|
||||
STORAGE_STRING (language, 17)
|
||||
STORAGE_STRING (label, 33)
|
||||
STORAGE_BOOL (imported)
|
||||
STORAGE_BYTES (homescreen, 1024)
|
||||
STORAGE_UINT32 (u2f_counter)
|
||||
STORAGE_BOOL (needs_backup)
|
||||
STORAGE_UINT32 (flags)
|
||||
STORAGE_NODE (u2froot)
|
||||
STORAGE_BOOL (unfinished_backup)
|
||||
STORAGE_UINT32 (auto_lock_delay_ms)
|
||||
STORAGE_BOOL (no_backup)
|
||||
} Storage;
|
||||
|
||||
extern Storage configUpdate;
|
||||
|
@ -10,10 +10,10 @@
|
||||
#define TOKENS_COUNT ${len(erc20_list)}
|
||||
|
||||
typedef struct {
|
||||
uint32_t chain_id;
|
||||
const char * const address;
|
||||
const char * const ticker;
|
||||
int decimals;
|
||||
uint32_t chain_id;
|
||||
const char * const address;
|
||||
const char * const ticker;
|
||||
int decimals;
|
||||
} TokenType;
|
||||
|
||||
extern const TokenType tokens[TOKENS_COUNT];
|
||||
|
@ -55,7 +55,7 @@ void fsm_msgGetFeatures(const GetFeatures *msg)
|
||||
resp->has_bootloader_hash = true; resp->bootloader_hash.size = memory_bootloader_hash(resp->bootloader_hash.bytes);
|
||||
|
||||
resp->has_language = config_getLanguage(resp->language, sizeof(resp->language));
|
||||
resp->has_label = config_getLabel(resp->label, sizeof(resp->label));
|
||||
resp->has_label = config_getLabel(resp->label, sizeof(resp->label));
|
||||
resp->has_initialized = true; resp->initialized = config_isInitialized();
|
||||
resp->has_imported = config_getImported(&(resp->imported));
|
||||
resp->has_pin_cached = true; resp->pin_cached = session_isUnlocked() && config_hasPin();
|
||||
@ -124,13 +124,13 @@ void fsm_msgChangePin(const ChangePin *msg)
|
||||
return;
|
||||
}
|
||||
|
||||
if (protectChangePin(removal)) {
|
||||
if (removal) {
|
||||
fsm_sendSuccess(_("PIN removed"));
|
||||
} else {
|
||||
fsm_sendSuccess(_("PIN changed"));
|
||||
}
|
||||
}
|
||||
if (protectChangePin(removal)) {
|
||||
if (removal) {
|
||||
fsm_sendSuccess(_("PIN removed"));
|
||||
} else {
|
||||
fsm_sendSuccess(_("PIN changed"));
|
||||
}
|
||||
}
|
||||
|
||||
layoutHome();
|
||||
}
|
||||
@ -174,7 +174,7 @@ void fsm_msgGetEntropy(const GetEntropy *msg)
|
||||
|
||||
void fsm_msgLoadDevice(const LoadDevice *msg)
|
||||
{
|
||||
CHECK_PIN
|
||||
CHECK_PIN
|
||||
|
||||
CHECK_NOT_INITIALIZED
|
||||
|
||||
@ -200,7 +200,7 @@ void fsm_msgLoadDevice(const LoadDevice *msg)
|
||||
|
||||
void fsm_msgResetDevice(const ResetDevice *msg)
|
||||
{
|
||||
CHECK_PIN
|
||||
CHECK_PIN
|
||||
|
||||
CHECK_NOT_INITIALIZED
|
||||
|
||||
@ -235,11 +235,11 @@ void fsm_msgBackupDevice(const BackupDevice *msg)
|
||||
CHECK_PIN_UNCACHED
|
||||
|
||||
(void)msg;
|
||||
char mnemonic[MAX_MNEMONIC_LEN + 1];
|
||||
if (config_getMnemonic(mnemonic, sizeof(mnemonic))) {
|
||||
reset_backup(true, mnemonic);
|
||||
}
|
||||
memzero(mnemonic, sizeof(mnemonic));
|
||||
char mnemonic[MAX_MNEMONIC_LEN + 1];
|
||||
if (config_getMnemonic(mnemonic, sizeof(mnemonic))) {
|
||||
reset_backup(true, mnemonic);
|
||||
}
|
||||
memzero(mnemonic, sizeof(mnemonic));
|
||||
}
|
||||
|
||||
void fsm_msgCancel(const Cancel *msg)
|
||||
@ -329,7 +329,7 @@ void fsm_msgApplySettings(const ApplySettings *msg)
|
||||
|
||||
void fsm_msgApplyFlags(const ApplyFlags *msg)
|
||||
{
|
||||
CHECK_PIN
|
||||
CHECK_PIN
|
||||
|
||||
if (msg->has_flags) {
|
||||
config_applyFlags(msg->flags);
|
||||
|
@ -19,269 +19,269 @@
|
||||
|
||||
void fsm_msgStellarGetAddress(const StellarGetAddress *msg)
|
||||
{
|
||||
RESP_INIT(StellarAddress);
|
||||
RESP_INIT(StellarAddress);
|
||||
|
||||
CHECK_INITIALIZED
|
||||
CHECK_INITIALIZED
|
||||
|
||||
CHECK_PIN
|
||||
CHECK_PIN
|
||||
|
||||
const HDNode *node = stellar_deriveNode(msg->address_n, msg->address_n_count);
|
||||
if (!node) {
|
||||
fsm_sendFailure(FailureType_Failure_ProcessError, _("Failed to derive private key"));
|
||||
return;
|
||||
}
|
||||
const HDNode *node = stellar_deriveNode(msg->address_n, msg->address_n_count);
|
||||
if (!node) {
|
||||
fsm_sendFailure(FailureType_Failure_ProcessError, _("Failed to derive private key"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg->has_show_display && msg->show_display) {
|
||||
const char **str_addr_rows = stellar_lineBreakAddress(node->public_key + 1);
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), _("Share public account ID?"),
|
||||
str_addr_rows[0],
|
||||
str_addr_rows[1],
|
||||
str_addr_rows[2],
|
||||
NULL,
|
||||
NULL, NULL
|
||||
);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ProtectCall, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (msg->has_show_display && msg->show_display) {
|
||||
const char **str_addr_rows = stellar_lineBreakAddress(node->public_key + 1);
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), _("Share public account ID?"),
|
||||
str_addr_rows[0],
|
||||
str_addr_rows[1],
|
||||
str_addr_rows[2],
|
||||
NULL,
|
||||
NULL, NULL
|
||||
);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ProtectCall, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
resp->has_address = true;
|
||||
stellar_publicAddressAsStr(node->public_key + 1, resp->address, sizeof(resp->address));
|
||||
resp->has_address = true;
|
||||
stellar_publicAddressAsStr(node->public_key + 1, resp->address, sizeof(resp->address));
|
||||
|
||||
msg_write(MessageType_MessageType_StellarAddress, resp);
|
||||
msg_write(MessageType_MessageType_StellarAddress, resp);
|
||||
|
||||
layoutHome();
|
||||
layoutHome();
|
||||
}
|
||||
|
||||
void fsm_msgStellarSignTx(const StellarSignTx *msg)
|
||||
{
|
||||
CHECK_INITIALIZED
|
||||
CHECK_PIN
|
||||
CHECK_INITIALIZED
|
||||
CHECK_PIN
|
||||
|
||||
if (!stellar_signingInit(msg)) {
|
||||
fsm_sendFailure(FailureType_Failure_ProcessError, _("Failed to derive private key"));
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
if (!stellar_signingInit(msg)) {
|
||||
fsm_sendFailure(FailureType_Failure_ProcessError, _("Failed to derive private key"));
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
|
||||
// Confirm transaction basics
|
||||
stellar_layoutTransactionSummary(msg);
|
||||
// Confirm transaction basics
|
||||
stellar_layoutTransactionSummary(msg);
|
||||
|
||||
// Respond with a request for the first operation
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
// Respond with a request for the first operation
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
|
||||
void fsm_msgStellarCreateAccountOp(const StellarCreateAccountOp *msg)
|
||||
{
|
||||
if (!stellar_confirmCreateAccountOp(msg)) return;
|
||||
if (!stellar_confirmCreateAccountOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarPaymentOp(const StellarPaymentOp *msg)
|
||||
{
|
||||
// This will display additional dialogs to the user
|
||||
if (!stellar_confirmPaymentOp(msg)) return;
|
||||
// This will display additional dialogs to the user
|
||||
if (!stellar_confirmPaymentOp(msg)) return;
|
||||
|
||||
// Last operation was confirmed, send a StellarSignedTx
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
// Last operation was confirmed, send a StellarSignedTx
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarPathPaymentOp(const StellarPathPaymentOp *msg)
|
||||
{
|
||||
if (!stellar_confirmPathPaymentOp(msg)) return;
|
||||
if (!stellar_confirmPathPaymentOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarManageOfferOp(const StellarManageOfferOp *msg)
|
||||
{
|
||||
if (!stellar_confirmManageOfferOp(msg)) return;
|
||||
if (!stellar_confirmManageOfferOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarCreatePassiveOfferOp(const StellarCreatePassiveOfferOp *msg)
|
||||
{
|
||||
if (!stellar_confirmCreatePassiveOfferOp(msg)) return;
|
||||
if (!stellar_confirmCreatePassiveOfferOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarSetOptionsOp(const StellarSetOptionsOp *msg)
|
||||
{
|
||||
if (!stellar_confirmSetOptionsOp(msg)) return;
|
||||
if (!stellar_confirmSetOptionsOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarChangeTrustOp(const StellarChangeTrustOp *msg)
|
||||
{
|
||||
if (!stellar_confirmChangeTrustOp(msg)) return;
|
||||
if (!stellar_confirmChangeTrustOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarAllowTrustOp(const StellarAllowTrustOp *msg)
|
||||
{
|
||||
if (!stellar_confirmAllowTrustOp(msg)) return;
|
||||
if (!stellar_confirmAllowTrustOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarAccountMergeOp(const StellarAccountMergeOp *msg)
|
||||
{
|
||||
if (!stellar_confirmAccountMergeOp(msg)) return;
|
||||
if (!stellar_confirmAccountMergeOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarManageDataOp(const StellarManageDataOp *msg)
|
||||
{
|
||||
if (!stellar_confirmManageDataOp(msg)) return;
|
||||
if (!stellar_confirmManageDataOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
||||
void fsm_msgStellarBumpSequenceOp(const StellarBumpSequenceOp *msg)
|
||||
{
|
||||
if (!stellar_confirmBumpSequenceOp(msg)) return;
|
||||
if (!stellar_confirmBumpSequenceOp(msg)) return;
|
||||
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
if (stellar_allOperationsConfirmed()) {
|
||||
RESP_INIT(StellarSignedTx);
|
||||
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
stellar_fillSignedTx(resp);
|
||||
msg_write(MessageType_MessageType_StellarSignedTx, resp);
|
||||
layoutHome();
|
||||
}
|
||||
// Request the next operation to sign
|
||||
else {
|
||||
RESP_INIT(StellarTxOpRequest);
|
||||
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
msg_write(MessageType_MessageType_StellarTxOpRequest, resp);
|
||||
}
|
||||
}
|
||||
|
@ -35,21 +35,21 @@
|
||||
#define STELLAR_KEY_SIZE 32
|
||||
|
||||
typedef struct {
|
||||
// BIP32 path to the address being used for signing
|
||||
uint32_t address_n[10];
|
||||
size_t address_n_count;
|
||||
uint8_t signing_pubkey[32];
|
||||
// BIP32 path to the address being used for signing
|
||||
uint32_t address_n[10];
|
||||
size_t address_n_count;
|
||||
uint8_t signing_pubkey[32];
|
||||
|
||||
// 1 - public network, 2 - official testnet, 3 - other private network
|
||||
uint8_t network_type;
|
||||
// 1 - public network, 2 - official testnet, 3 - other private network
|
||||
uint8_t network_type;
|
||||
|
||||
// Total number of operations expected
|
||||
uint32_t num_operations;
|
||||
// Number that have been confirmed by the user
|
||||
uint32_t confirmed_operations;
|
||||
// Total number of operations expected
|
||||
uint32_t num_operations;
|
||||
// Number that have been confirmed by the user
|
||||
uint32_t confirmed_operations;
|
||||
|
||||
// sha256 context that will eventually be signed
|
||||
SHA256_CTX sha256_ctx;
|
||||
// sha256 context that will eventually be signed
|
||||
SHA256_CTX sha256_ctx;
|
||||
} StellarTransaction;
|
||||
|
||||
// Signing process
|
||||
|
2
memory.c
2
memory.c
@ -34,6 +34,7 @@ void memory_protect(void)
|
||||
if (((FLASH_OPTION_BYTES_1 & 0xFFEC) == 0xCCEC) && ((FLASH_OPTION_BYTES_2 & 0xFFF) == 0xFFC) && (FLASH_OPTCR == 0x0FFCCCED)) {
|
||||
return; // already set up correctly - bail out
|
||||
}
|
||||
|
||||
flash_unlock_option_bytes();
|
||||
// Section 2.8.6 Flash option control register (FLASH_OPTCR)
|
||||
// Bits 31:28 Reserved, must be kept cleared.
|
||||
@ -67,7 +68,6 @@ void memory_write_unlock(void)
|
||||
}
|
||||
|
||||
int memory_bootloader_hash(uint8_t *hash)
|
||||
|
||||
{
|
||||
sha256_Raw(FLASH_PTR(FLASH_BOOT_START), FLASH_BOOT_LEN, hash);
|
||||
sha256_Raw(hash, 32, hash);
|
||||
|
Loading…
Reference in New Issue
Block a user