vial: add security-related features
This commit is contained in:
parent
77ddf078f5
commit
6716b76f6c
6 changed files with 90 additions and 2 deletions
|
|
@ -243,6 +243,11 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|||
break;
|
||||
}
|
||||
case id_switch_matrix_state: {
|
||||
#ifdef VIAL_ENABLE
|
||||
/* We don't need this wannabe keylogger */
|
||||
goto skip;
|
||||
#endif
|
||||
|
||||
#if ((MATRIX_COLS / 8 + 1) * MATRIX_ROWS <= 28)
|
||||
uint8_t i = 1;
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
|
|
@ -362,6 +367,11 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|||
break;
|
||||
}
|
||||
case id_dynamic_keymap_macro_set_buffer: {
|
||||
#ifdef VIAL_ENABLE
|
||||
/* Until keyboard is unlocked, don't allow changing macros */
|
||||
if (!vial_unlocked)
|
||||
goto skip;
|
||||
#endif
|
||||
uint16_t offset = (command_data[0] << 8) | command_data[1];
|
||||
uint16_t size = command_data[2]; // size <= 28
|
||||
if (size <= 28)
|
||||
|
|
@ -395,6 +405,11 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|||
break;
|
||||
}
|
||||
case id_bootloader_jump: {
|
||||
#ifdef VIAL_ENABLE
|
||||
/* Until keyboard is unlocked, don't allow jumping to bootloader */
|
||||
if (!vial_unlocked)
|
||||
goto skip;
|
||||
#endif
|
||||
// Need to send data back before the jump
|
||||
// Informs host that the command is handled
|
||||
raw_hid_send(data, length);
|
||||
|
|
@ -416,7 +431,7 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
skip:
|
||||
// Return the same buffer, optionally with values changed
|
||||
// (i.e. returning state to the host, or the unhandled state).
|
||||
raw_hid_send(data, length);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue