add menu, work only exit

This commit is contained in:
redlineo committed 2025-01-23 10:16:33 +00:00
1 parent 103bed5f4d
commit 4a6afc4d11
3 files changed
+25 -9

No files matched your search

+20 -6
View File
@@ -24,6 +24,10 @@ uint8_t count_char_key = 0;
uint8_t crypto_mode = 0;
uint8_t decrypted_mode = 0;
uint8_t red_menu_mode = 0;
void decrypt_pass_kuzn(const uint8_t encrypted_passwords[STORAGE_SIZE][STORAGE_PASS_LEN]) {
kuz_key_t key;
w128_t x;
@@ -88,12 +92,6 @@ void decrypt_pass_kuzn(const uint8_t encrypted_passwords[STORAGE_SIZE][STORAGE_P
// print_chars_w128(&x);
// }
void send_chars_pass(uint8_t *out) {
for (uint8_t i = 0; i < STORAGE_PASS_LEN && out[i] != 0; i++) {
send_char((char)out[i]);
}
};
uint8_t crypto_process_record_user(uint16_t keycode, keyrecord_t *record, const uint8_t encrypted_passwords[STORAGE_SIZE][STORAGE_PASS_LEN]) {
if (crypto_mode) {
switch (keycode) {
@@ -105,12 +103,21 @@ uint8_t crypto_process_record_user(uint16_t keycode, keyrecord_t *record, const
crypto_mode = 0;
count_char_key = 0;
decrypt_pass_kuzn(encrypted_passwords);
decrypted_mode = 1;
}
default:
// reading key
return kc_to_ascii(keycode, record, readed_key, &count_char_key);
break;
}
} else if (decrypted_mode && red_menu_mode) {
uint8_t key_return = draw_red_menu(keycode, record);
if (key_return == 2){
red_menu_mode = 0;
}
else{
return key_return;
}
} else {
switch (keycode) {
case RED_PASS1:
@@ -165,6 +172,13 @@ uint8_t crypto_process_record_user(uint16_t keycode, keyrecord_t *record, const
// dprintf("%d", keycode);
}
break;
case RED_MENU:
if (record->event.pressed) {
if (decrypted_mode == 1) {
red_menu_mode = 1;
}
}
break;
}
}
return 0;
+4 -3
View File
@@ -9,6 +9,7 @@
// includes of red_crypto
# include "kc_to_ascii.h"
# include "utils.h"
# include "red_menu.h"
// #ifdef USE_RED_KUZNECHIK_128
// #include "kuznechik_128bit.h"
@@ -41,6 +42,7 @@
# define STORAGE_PASS_LEN 64
# endif
// example for encrypted 64 byte password
// const uint8_t red_enc_pass[STORAGE_SIZE][STORAGE_PASS_LEN] = {
// {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -51,6 +53,7 @@
enum red_crypto_keys {
RED_CRY_M = SAFE_RANGE + 0x80, // added safe range offset
RED_MENU,
RED_RNG,
RED_TEST,
RED_PASS1,
@@ -62,9 +65,7 @@ enum red_crypto_keys {
RED_PASS7,
RED_PASS8,
RED_PASS9,
RED_PASS10,
RED_PASS11,
RED_PASS12
RED_PASS10
};
uint8_t crypto_process_record_user(uint16_t keycode, keyrecord_t *record, const uint8_t encrypted_passwords[STORAGE_SIZE][STORAGE_PASS_LEN]);
+1
View File
@@ -6,6 +6,7 @@ SRC += red_crypto/aes.c
SRC += red_crypto/kuznechik_8bit.c
SRC += red_crypto/kc_to_ascii.c
SRC += red_crypto/utils.c
SRC += red_crypto/red_menu.c
# SRC += red_crypto/kuznechik_128bit.c # you can't include this, because you may not have ARMv8 and upper, check this
# TODO: do something like this: