Skip to content

Commit d6f41db

Browse files
jhoenickeprusnak
authored andcommitted
messages: fix size of msg_tiny and add static_assert
1 parent 559a700 commit d6f41db

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

firmware/messages.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,16 @@ const uint8_t *msg_debug_out_data(void)
314314

315315
#endif
316316

317-
CONFIDENTIAL uint8_t msg_tiny[64];
317+
CONFIDENTIAL uint8_t msg_tiny[128];
318+
_Static_assert(sizeof(msg_tiny) >= sizeof(Cancel), "msg_tiny too tiny");
319+
_Static_assert(sizeof(msg_tiny) >= sizeof(Initialize), "msg_tiny too tiny");
320+
_Static_assert(sizeof(msg_tiny) >= sizeof(PassphraseAck), "msg_tiny too tiny");
321+
_Static_assert(sizeof(msg_tiny) >= sizeof(ButtonAck), "msg_tiny too tiny");
322+
_Static_assert(sizeof(msg_tiny) >= sizeof(PinMatrixAck), "msg_tiny too tiny");
323+
#if DEBUG_LINK
324+
_Static_assert(sizeof(msg_tiny) >= sizeof(DebugLinkDecision), "msg_tiny too tiny");
325+
_Static_assert(sizeof(msg_tiny) >= sizeof(DebugLinkGetState), "msg_tiny too tiny");
326+
#endif
318327
uint16_t msg_tiny_id = 0xFFFF;
319328

320329
void msg_read_tiny(const uint8_t *buf, int len)

firmware/messages.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bool msg_write_common(char type, uint16_t msg_id, const void *msg_ptr);
4747

4848
void msg_read_tiny(const uint8_t *buf, int len);
4949
void msg_debug_read_tiny(const uint8_t *buf, int len);
50-
extern uint8_t msg_tiny[64];
50+
extern uint8_t msg_tiny[128];
5151
extern uint16_t msg_tiny_id;
5252

5353
#endif

0 commit comments

Comments
 (0)