mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-16 17:42:02 +00:00
feat(common): more required fields in messages-management
[no changelog]
This commit is contained in:
parent
31be44b5cd
commit
9ab1891b22
@ -153,7 +153,7 @@ message ApplySettings {
|
|||||||
* @next Failure
|
* @next Failure
|
||||||
*/
|
*/
|
||||||
message ApplyFlags {
|
message ApplyFlags {
|
||||||
optional uint32 flags = 1; // bitmask, can only set bits, not unset
|
required uint32 flags = 1; // bitmask, can only set bits, not unset
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,7 +183,7 @@ message ChangeWipeCode {
|
|||||||
* @next Failure
|
* @next Failure
|
||||||
*/
|
*/
|
||||||
message SdProtect {
|
message SdProtect {
|
||||||
optional SdProtectOperationType operation = 1;
|
required SdProtectOperationType operation = 1;
|
||||||
/**
|
/**
|
||||||
* Structure representing SD card protection operation
|
* Structure representing SD card protection operation
|
||||||
*/
|
*/
|
||||||
@ -296,7 +296,7 @@ message EntropyRequest {
|
|||||||
* @next Success
|
* @next Success
|
||||||
*/
|
*/
|
||||||
message EntropyAck {
|
message EntropyAck {
|
||||||
optional bytes entropy = 1; // 256 bits (32 bytes) of random data
|
required bytes entropy = 1; // 256 bits (32 bytes) of random data
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -337,7 +337,7 @@ message RecoveryDevice {
|
|||||||
* @next WordAck
|
* @next WordAck
|
||||||
*/
|
*/
|
||||||
message WordRequest {
|
message WordRequest {
|
||||||
optional WordRequestType type = 1;
|
required WordRequestType type = 1;
|
||||||
/**
|
/**
|
||||||
* Type of Recovery Word request
|
* Type of Recovery Word request
|
||||||
*/
|
*/
|
||||||
@ -364,7 +364,7 @@ message WordAck {
|
|||||||
* @next Success
|
* @next Success
|
||||||
*/
|
*/
|
||||||
message SetU2FCounter {
|
message SetU2FCounter {
|
||||||
optional uint32 u2f_counter = 1;
|
required uint32 u2f_counter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -380,7 +380,7 @@ message GetNextU2FCounter {
|
|||||||
* @end
|
* @end
|
||||||
*/
|
*/
|
||||||
message NextU2FCounter {
|
message NextU2FCounter {
|
||||||
optional uint32 u2f_counter = 1;
|
required uint32 u2f_counter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1791,12 +1791,12 @@ if TYPE_CHECKING:
|
|||||||
return isinstance(msg, cls)
|
return isinstance(msg, cls)
|
||||||
|
|
||||||
class ApplyFlags(protobuf.MessageType):
|
class ApplyFlags(protobuf.MessageType):
|
||||||
flags: int | None
|
flags: int
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
flags: int | None = None,
|
flags: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -1833,12 +1833,12 @@ if TYPE_CHECKING:
|
|||||||
return isinstance(msg, cls)
|
return isinstance(msg, cls)
|
||||||
|
|
||||||
class SdProtect(protobuf.MessageType):
|
class SdProtect(protobuf.MessageType):
|
||||||
operation: SdProtectOperationType | None
|
operation: SdProtectOperationType
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
operation: SdProtectOperationType | None = None,
|
operation: SdProtectOperationType,
|
||||||
) -> None:
|
) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -1977,12 +1977,12 @@ if TYPE_CHECKING:
|
|||||||
return isinstance(msg, cls)
|
return isinstance(msg, cls)
|
||||||
|
|
||||||
class EntropyAck(protobuf.MessageType):
|
class EntropyAck(protobuf.MessageType):
|
||||||
entropy: bytes | None
|
entropy: bytes
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
entropy: bytes | None = None,
|
entropy: bytes,
|
||||||
) -> None:
|
) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -2021,12 +2021,12 @@ if TYPE_CHECKING:
|
|||||||
return isinstance(msg, cls)
|
return isinstance(msg, cls)
|
||||||
|
|
||||||
class WordRequest(protobuf.MessageType):
|
class WordRequest(protobuf.MessageType):
|
||||||
type: WordRequestType | None
|
type: WordRequestType
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
type: WordRequestType | None = None,
|
type: WordRequestType,
|
||||||
) -> None:
|
) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -2049,12 +2049,12 @@ if TYPE_CHECKING:
|
|||||||
return isinstance(msg, cls)
|
return isinstance(msg, cls)
|
||||||
|
|
||||||
class SetU2FCounter(protobuf.MessageType):
|
class SetU2FCounter(protobuf.MessageType):
|
||||||
u2f_counter: int | None
|
u2f_counter: int
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
u2f_counter: int | None = None,
|
u2f_counter: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -2069,12 +2069,12 @@ if TYPE_CHECKING:
|
|||||||
return isinstance(msg, cls)
|
return isinstance(msg, cls)
|
||||||
|
|
||||||
class NextU2FCounter(protobuf.MessageType):
|
class NextU2FCounter(protobuf.MessageType):
|
||||||
u2f_counter: int | None
|
u2f_counter: int
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
u2f_counter: int | None = None,
|
u2f_counter: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -315,11 +315,7 @@ void fsm_msgResetDevice(const ResetDevice *msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fsm_msgEntropyAck(const EntropyAck *msg) {
|
void fsm_msgEntropyAck(const EntropyAck *msg) {
|
||||||
if (msg->has_entropy) {
|
reset_entropy(msg->entropy.bytes, msg->entropy.size);
|
||||||
reset_entropy(msg->entropy.bytes, msg->entropy.size);
|
|
||||||
} else {
|
|
||||||
reset_entropy(0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsm_msgBackupDevice(const BackupDevice *msg) {
|
void fsm_msgBackupDevice(const BackupDevice *msg) {
|
||||||
@ -477,9 +473,7 @@ void fsm_msgApplySettings(const ApplySettings *msg) {
|
|||||||
void fsm_msgApplyFlags(const ApplyFlags *msg) {
|
void fsm_msgApplyFlags(const ApplyFlags *msg) {
|
||||||
CHECK_PIN
|
CHECK_PIN
|
||||||
|
|
||||||
if (msg->has_flags) {
|
config_applyFlags(msg->flags);
|
||||||
config_applyFlags(msg->flags);
|
|
||||||
}
|
|
||||||
fsm_sendSuccess(_("Flags applied"));
|
fsm_sendSuccess(_("Flags applied"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,7 +533,6 @@ void fsm_msgGetNextU2FCounter() {
|
|||||||
uint32_t counter = config_nextU2FCounter();
|
uint32_t counter = config_nextU2FCounter();
|
||||||
|
|
||||||
RESP_INIT(NextU2FCounter);
|
RESP_INIT(NextU2FCounter);
|
||||||
resp->has_u2f_counter = true;
|
|
||||||
resp->u2f_counter = counter;
|
resp->u2f_counter = counter;
|
||||||
msg_write(MessageType_MessageType_NextU2FCounter, resp);
|
msg_write(MessageType_MessageType_NextU2FCounter, resp);
|
||||||
layoutHome();
|
layoutHome();
|
||||||
|
@ -145,7 +145,6 @@ static void format_number(char *dest, int number) {
|
|||||||
static void recovery_request(void) {
|
static void recovery_request(void) {
|
||||||
WordRequest resp = {0};
|
WordRequest resp = {0};
|
||||||
memzero(&resp, sizeof(WordRequest));
|
memzero(&resp, sizeof(WordRequest));
|
||||||
resp.has_type = true;
|
|
||||||
if (awaiting_word == 1) {
|
if (awaiting_word == 1) {
|
||||||
resp.type = WordRequestType_WordRequestType_Plain;
|
resp.type = WordRequestType_WordRequestType_Plain;
|
||||||
} else if (word_index % 4 == 3) {
|
} else if (word_index % 4 == 3) {
|
||||||
|
@ -2690,13 +2690,13 @@ class ApplySettings(protobuf.MessageType):
|
|||||||
class ApplyFlags(protobuf.MessageType):
|
class ApplyFlags(protobuf.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 28
|
MESSAGE_WIRE_TYPE = 28
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: protobuf.Field("flags", "uint32", repeated=False, required=False),
|
1: protobuf.Field("flags", "uint32", repeated=False, required=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
flags: Optional[int] = None,
|
flags: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
|
|
||||||
@ -2732,13 +2732,13 @@ class ChangeWipeCode(protobuf.MessageType):
|
|||||||
class SdProtect(protobuf.MessageType):
|
class SdProtect(protobuf.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 79
|
MESSAGE_WIRE_TYPE = 79
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: protobuf.Field("operation", SdProtectOperationType, repeated=False, required=False),
|
1: protobuf.Field("operation", SdProtectOperationType, repeated=False, required=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
operation: Optional[SdProtectOperationType] = None,
|
operation: SdProtectOperationType,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.operation = operation
|
self.operation = operation
|
||||||
|
|
||||||
@ -2886,13 +2886,13 @@ class EntropyRequest(protobuf.MessageType):
|
|||||||
class EntropyAck(protobuf.MessageType):
|
class EntropyAck(protobuf.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 36
|
MESSAGE_WIRE_TYPE = 36
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: protobuf.Field("entropy", "bytes", repeated=False, required=False),
|
1: protobuf.Field("entropy", "bytes", repeated=False, required=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
entropy: Optional[bytes] = None,
|
entropy: bytes,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.entropy = entropy
|
self.entropy = entropy
|
||||||
|
|
||||||
@ -2938,13 +2938,13 @@ class RecoveryDevice(protobuf.MessageType):
|
|||||||
class WordRequest(protobuf.MessageType):
|
class WordRequest(protobuf.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 46
|
MESSAGE_WIRE_TYPE = 46
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: protobuf.Field("type", WordRequestType, repeated=False, required=False),
|
1: protobuf.Field("type", WordRequestType, repeated=False, required=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
type: Optional[WordRequestType] = None,
|
type: WordRequestType,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
||||||
@ -2966,13 +2966,13 @@ class WordAck(protobuf.MessageType):
|
|||||||
class SetU2FCounter(protobuf.MessageType):
|
class SetU2FCounter(protobuf.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 63
|
MESSAGE_WIRE_TYPE = 63
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: protobuf.Field("u2f_counter", "uint32", repeated=False, required=False),
|
1: protobuf.Field("u2f_counter", "uint32", repeated=False, required=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
u2f_counter: Optional[int] = None,
|
u2f_counter: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.u2f_counter = u2f_counter
|
self.u2f_counter = u2f_counter
|
||||||
|
|
||||||
@ -2984,13 +2984,13 @@ class GetNextU2FCounter(protobuf.MessageType):
|
|||||||
class NextU2FCounter(protobuf.MessageType):
|
class NextU2FCounter(protobuf.MessageType):
|
||||||
MESSAGE_WIRE_TYPE = 81
|
MESSAGE_WIRE_TYPE = 81
|
||||||
FIELDS = {
|
FIELDS = {
|
||||||
1: protobuf.Field("u2f_counter", "uint32", repeated=False, required=False),
|
1: protobuf.Field("u2f_counter", "uint32", repeated=False, required=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
u2f_counter: Optional[int] = None,
|
u2f_counter: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.u2f_counter = u2f_counter
|
self.u2f_counter = u2f_counter
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user