almost done

This commit is contained in:
redlineo committed 2025-01-30 10:25:03 +00:00
1 parent c1bf11fea6
commit 731d890cc9
2 files changed
+56 -49

No files matched your search

+13 -9
View File
@@ -1,15 +1,19 @@
// Author: redlineo, romanov.pd@gmail.com
#include QMK_KEYBOARD_H
#include "quantum.h"
#ifndef RED_CRYPTO_H
# define RED_CRYPTO_H
#include QMK_KEYBOARD_H
#include "quantum.h"
// includes of red_crypto
# include "kc_to_ascii.h"
# include "utils.h"
# include "red_menu.h"
// includes for EEPROM, tested on STM32L432xx
# include "eeprom.h"
# include "eeprom_stm32_defs.h"
# include "eeprom_stm32_l4.h"
// #ifdef USE_RED_KUZNECHIK_128
// #include "kuznechik_128bit.h"
@@ -30,11 +34,11 @@
# define BLOCK_SIZE 16
# ifndef INIT_STORAGE_SIZE
# define INIT_STORAGE_SIZE 4
# define INIT_STORAGE_SIZE 5
# endif
# ifndef INIT_STORAGE_PASS_LEN
# define INIT_STORAGE_PASS_LEN 128
# define INIT_STORAGE_PASS_LEN 64
# endif
# ifdef INIT_STORAGE_PASS_LEN
@@ -72,11 +76,11 @@ enum red_crypto_keys {
// uint8_t storage_size = INIT_STORAGE_SIZE;
// uint8_t storage_pass_len = INIT_STORAGE_PASS_LEN;
# define EEPROM_PASS_OFFSET 3 + 3 + 1 + 1 + 4 + 1
# define STORAGE_SIZE (EEPROM_PASS_OFFSET + INIT_STORAGE_SIZE * INIT_STORAGE_PASS_LEN)
typedef union {
uint8_t raw[EECONFIG_BASE_SIZE + EEPROM_PASS_OFFSET + INIT_STORAGE_SIZE * INIT_STORAGE_PASS_LEN];
uint8_t raw[STORAGE_SIZE];
struct {
uint8_t qmk_core[34];
uint8_t init_var[3]; // if in eeprom is bytes "RED", then it's not first flash or first power-on, or in eeprom is old red_crypto
uint8_t version[3]; // red_crypto library version
uint8_t storage_size;
@@ -89,8 +93,8 @@ typedef union {
red_crypto_storage_eeprom enc_pass;
uint8_t crypto_process_record_user(uint16_t keycode, keyrecord_t *record);
uint8_t crypto_process_record_user(uint16_t keycode, keyrecord_t *record);
uint8_t *encrypt_pass_kuzn(const uint8_t *new_pass, const uint8_t new_pass_length);
void crypto_eeprom_init(void);
void crypto_eeprom_init(void);
#endif