Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Commit

Permalink
messages: fix size of msg_tiny and add static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoenicke authored and prusnak committed Mar 20, 2018
1 parent 559a700 commit d6f41db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion firmware/messages.c
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion firmware/messages.h
Expand Up @@ -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

0 comments on commit d6f41db

Please sign in to comment.