mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
message SdProtect {
|
||||
optional SdProtectOperationType operation = 1;
|
||||
required SdProtectOperationType operation = 1;
|
||||
/**
|
||||
* Structure representing SD card protection operation
|
||||
*/
|
||||
@ -296,7 +296,7 @@ message EntropyRequest {
|
||||
* @next Success
|
||||
*/
|
||||
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
|
||||
*/
|
||||
message WordRequest {
|
||||
optional WordRequestType type = 1;
|
||||
required WordRequestType type = 1;
|
||||
/**
|
||||
* Type of Recovery Word request
|
||||
*/
|
||||
@ -364,7 +364,7 @@ message WordAck {
|
||||
* @next Success
|
||||
*/
|
||||
message SetU2FCounter {
|
||||
optional uint32 u2f_counter = 1;
|
||||
required uint32 u2f_counter = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -380,7 +380,7 @@ message GetNextU2FCounter {
|
||||
* @end
|
||||
*/
|
||||
message NextU2FCounter {
|
||||
optional uint32 u2f_counter = 1;
|
||||
required uint32 u2f_counter = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1791,12 +1791,12 @@ if TYPE_CHECKING:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class ApplyFlags(protobuf.MessageType):
|
||||
flags: int | None
|
||||
flags: int
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
flags: int | None = None,
|
||||
flags: int,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -1833,12 +1833,12 @@ if TYPE_CHECKING:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class SdProtect(protobuf.MessageType):
|
||||
operation: SdProtectOperationType | None
|
||||
operation: SdProtectOperationType
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
operation: SdProtectOperationType | None = None,
|
||||
operation: SdProtectOperationType,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -1977,12 +1977,12 @@ if TYPE_CHECKING:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class EntropyAck(protobuf.MessageType):
|
||||
entropy: bytes | None
|
||||
entropy: bytes
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
entropy: bytes | None = None,
|
||||
entropy: bytes,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -2021,12 +2021,12 @@ if TYPE_CHECKING:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class WordRequest(protobuf.MessageType):
|
||||
type: WordRequestType | None
|
||||
type: WordRequestType
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
type: WordRequestType | None = None,
|
||||
type: WordRequestType,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -2049,12 +2049,12 @@ if TYPE_CHECKING:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class SetU2FCounter(protobuf.MessageType):
|
||||
u2f_counter: int | None
|
||||
u2f_counter: int
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
u2f_counter: int | None = None,
|
||||
u2f_counter: int,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -2069,12 +2069,12 @@ if TYPE_CHECKING:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class NextU2FCounter(protobuf.MessageType):
|
||||
u2f_counter: int | None
|
||||
u2f_counter: int
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
u2f_counter: int | None = None,
|
||||
u2f_counter: int,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
|
@ -315,11 +315,7 @@ void fsm_msgResetDevice(const ResetDevice *msg) {
|
||||
}
|
||||
|
||||
void fsm_msgEntropyAck(const EntropyAck *msg) {
|
||||
if (msg->has_entropy) {
|
||||
reset_entropy(msg->entropy.bytes, msg->entropy.size);
|
||||
} else {
|
||||
reset_entropy(0, 0);
|
||||
}
|
||||
reset_entropy(msg->entropy.bytes, msg->entropy.size);
|
||||
}
|
||||
|
||||
void fsm_msgBackupDevice(const BackupDevice *msg) {
|
||||
@ -477,9 +473,7 @@ void fsm_msgApplySettings(const ApplySettings *msg) {
|
||||
void fsm_msgApplyFlags(const ApplyFlags *msg) {
|
||||
CHECK_PIN
|
||||
|
||||
if (msg->has_flags) {
|
||||
config_applyFlags(msg->flags);
|
||||
}
|
||||
config_applyFlags(msg->flags);
|
||||
fsm_sendSuccess(_("Flags applied"));
|
||||
}
|
||||
|
||||
@ -539,7 +533,6 @@ void fsm_msgGetNextU2FCounter() {
|
||||
uint32_t counter = config_nextU2FCounter();
|
||||
|
||||
RESP_INIT(NextU2FCounter);
|
||||
resp->has_u2f_counter = true;
|
||||
resp->u2f_counter = counter;
|
||||
msg_write(MessageType_MessageType_NextU2FCounter, resp);
|
||||
layoutHome();
|
||||
|
@ -145,7 +145,6 @@ static void format_number(char *dest, int number) {
|
||||
static void recovery_request(void) {
|
||||
WordRequest resp = {0};
|
||||
memzero(&resp, sizeof(WordRequest));
|
||||
resp.has_type = true;
|
||||
if (awaiting_word == 1) {
|
||||
resp.type = WordRequestType_WordRequestType_Plain;
|
||||
} else if (word_index % 4 == 3) {
|
||||
|
@ -2690,13 +2690,13 @@ class ApplySettings(protobuf.MessageType):
|
||||
class ApplyFlags(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 28
|
||||
FIELDS = {
|
||||
1: protobuf.Field("flags", "uint32", repeated=False, required=False),
|
||||
1: protobuf.Field("flags", "uint32", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
flags: Optional[int] = None,
|
||||
flags: int,
|
||||
) -> None:
|
||||
self.flags = flags
|
||||
|
||||
@ -2732,13 +2732,13 @@ class ChangeWipeCode(protobuf.MessageType):
|
||||
class SdProtect(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 79
|
||||
FIELDS = {
|
||||
1: protobuf.Field("operation", SdProtectOperationType, repeated=False, required=False),
|
||||
1: protobuf.Field("operation", SdProtectOperationType, repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
operation: Optional[SdProtectOperationType] = None,
|
||||
operation: SdProtectOperationType,
|
||||
) -> None:
|
||||
self.operation = operation
|
||||
|
||||
@ -2886,13 +2886,13 @@ class EntropyRequest(protobuf.MessageType):
|
||||
class EntropyAck(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 36
|
||||
FIELDS = {
|
||||
1: protobuf.Field("entropy", "bytes", repeated=False, required=False),
|
||||
1: protobuf.Field("entropy", "bytes", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
entropy: Optional[bytes] = None,
|
||||
entropy: bytes,
|
||||
) -> None:
|
||||
self.entropy = entropy
|
||||
|
||||
@ -2938,13 +2938,13 @@ class RecoveryDevice(protobuf.MessageType):
|
||||
class WordRequest(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 46
|
||||
FIELDS = {
|
||||
1: protobuf.Field("type", WordRequestType, repeated=False, required=False),
|
||||
1: protobuf.Field("type", WordRequestType, repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
type: Optional[WordRequestType] = None,
|
||||
type: WordRequestType,
|
||||
) -> None:
|
||||
self.type = type
|
||||
|
||||
@ -2966,13 +2966,13 @@ class WordAck(protobuf.MessageType):
|
||||
class SetU2FCounter(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 63
|
||||
FIELDS = {
|
||||
1: protobuf.Field("u2f_counter", "uint32", repeated=False, required=False),
|
||||
1: protobuf.Field("u2f_counter", "uint32", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
u2f_counter: Optional[int] = None,
|
||||
u2f_counter: int,
|
||||
) -> None:
|
||||
self.u2f_counter = u2f_counter
|
||||
|
||||
@ -2984,13 +2984,13 @@ class GetNextU2FCounter(protobuf.MessageType):
|
||||
class NextU2FCounter(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 81
|
||||
FIELDS = {
|
||||
1: protobuf.Field("u2f_counter", "uint32", repeated=False, required=False),
|
||||
1: protobuf.Field("u2f_counter", "uint32", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
u2f_counter: Optional[int] = None,
|
||||
u2f_counter: int,
|
||||
) -> None:
|
||||
self.u2f_counter = u2f_counter
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user