1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

messages: fix size of msg_tiny and add static_assert

This commit is contained in:
Jochen Hoenicke 2018-03-20 14:48:40 +01:00 committed by Pavol Rusnak
parent 559a700fb0
commit d6f41dba9e
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 11 additions and 2 deletions

View File

@ -314,7 +314,16 @@ const uint8_t *msg_debug_out_data(void)
#endif
CONFIDENTIAL uint8_t msg_tiny[64];
CONFIDENTIAL uint8_t msg_tiny[128];
_Static_assert(sizeof(msg_tiny) >= sizeof(Cancel), "msg_tiny too tiny");
_Static_assert(sizeof(msg_tiny) >= sizeof(Initialize), "msg_tiny too tiny");
_Static_assert(sizeof(msg_tiny) >= sizeof(PassphraseAck), "msg_tiny too tiny");
_Static_assert(sizeof(msg_tiny) >= sizeof(ButtonAck), "msg_tiny too tiny");
_Static_assert(sizeof(msg_tiny) >= sizeof(PinMatrixAck), "msg_tiny too tiny");
#if DEBUG_LINK
_Static_assert(sizeof(msg_tiny) >= sizeof(DebugLinkDecision), "msg_tiny too tiny");
_Static_assert(sizeof(msg_tiny) >= sizeof(DebugLinkGetState), "msg_tiny too tiny");
#endif
uint16_t msg_tiny_id = 0xFFFF;
void msg_read_tiny(const uint8_t *buf, int len)

View File

@ -47,7 +47,7 @@ bool msg_write_common(char type, uint16_t msg_id, const void *msg_ptr);
void msg_read_tiny(const uint8_t *buf, int len);
void msg_debug_read_tiny(const uint8_t *buf, int len);
extern uint8_t msg_tiny[64];
extern uint8_t msg_tiny[128];
extern uint16_t msg_tiny_id;
#endif