use sha256 instead of magic pattern

This commit is contained in:
2026-01-06 12:38:40 +01:00
parent b1b179b5ff
commit 9ef50436a4
2 changed files with 58 additions and 28 deletions

View File

@ -11,18 +11,19 @@
#include <stdint.h>
#include <stdbool.h>
#define CONFIG_HASH_LEN 32 // SHA256
/**
* @brief Configuration structure stored in NVS
*/
typedef struct
{
int8_t led_pin_strip_a; // GPIO pin for LED strip A (-1 = not configured)
int8_t led_pin_strip_b; // GPIO pin for LED strip B (-1 = not configured)
int8_t led_count_strip_a; // LED count for LED strip A (-1 = not configured)
int8_t led_count_strip_b; // LED count for LED strip B (-1 = not configured)
int8_t pwm_pin; // GPIO pin for PWM input (-1 = not configured)
int8_t localBtn_pin; // GPIO pin for local btn input (-1 = not configured)
uint32_t magic; // Magic number to validate config (0xDEADBEEF) //TODO: use sha256
int8_t led_pin_strip_a; // GPIO pin for LED strip A (-1 = not configured)
int8_t led_pin_strip_b; // GPIO pin for LED strip B (-1 = not configured)
int8_t led_count_strip_a; // LED count for LED strip A (-1 = not configured)
int8_t led_count_strip_b; // LED count for LED strip B (-1 = not configured)
int8_t pwm_pin; // GPIO pin for PWM input (-1 = not configured)
int8_t localBtn_pin; // GPIO pin for local btn input (-1 = not configured)
uint8_t hash[CONFIG_HASH_LEN]; // SHA256 Hash of config
} config_t;
/**