Crypto: - Replace broken ChaCha20 (static nonce) with ChaCha20-Poly1305 AEAD - HKDF-SHA256 key derivation from per-device factory NVS master keys - Random 12-byte nonce per message (ESP32 hardware RNG) - crypto_init/encrypt/decrypt API with mbedtls legacy (ESP-IDF v5.3.2) - Custom partition table with factory NVS (fctry at 0x10000) Firmware: - crypto.c full rewrite, messages.c device_id prefix + AEAD encrypt - crypto_init() at boot with esp_restart() on failure - Fix command_t initializations across all modules (sub/help fields) - Clean CMakeLists dependencies for ESP-IDF v5.3.2 C3PO (C2): - Rename tools/c2 + tools/c3po -> tools/C3PO - Per-device CryptoContext with HKDF key derivation - KeyStore (keys.json) for master key management - Transport parses device_id:base64(...) wire format Tools: - New tools/provisioning/provision.py for factory NVS key generation - Updated flasher with mbedtls config for v5.3.2 Docs: - Update all READMEs for new crypto, C3PO paths, provisioning - Update roadmap, architecture diagrams, security sections - Update CONTRIBUTING.md project structure
52 lines
837 B
C
52 lines
837 B
C
#include "utils.h"
|
|
#include "esp_log.h"
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
|
|
static const char *TAG = "COM";
|
|
|
|
bool com_init(void)
|
|
{
|
|
#ifdef CONFIG_NETWORK_WIFI
|
|
|
|
ESPILON_LOGI_PURPLE(TAG, "Init WiFi backend");
|
|
|
|
wifi_init();
|
|
|
|
/* Task WiFi déjà complète (connect + handshake + RX) */
|
|
xTaskCreatePinnedToCore(
|
|
tcp_client_task,
|
|
"tcp_client_task",
|
|
12288,
|
|
NULL,
|
|
1,
|
|
NULL,
|
|
0
|
|
);
|
|
|
|
return true;
|
|
|
|
#elif defined(CONFIG_NETWORK_GPRS)
|
|
|
|
ESPILON_LOGI_PURPLE(TAG, "Init GPRS backend");
|
|
|
|
setup_uart();
|
|
setup_modem();
|
|
|
|
xTaskCreatePinnedToCore(
|
|
gprs_client_task,
|
|
"gprs_client_task",
|
|
8192,
|
|
NULL,
|
|
1,
|
|
NULL,
|
|
0
|
|
);
|
|
|
|
return true;
|
|
|
|
#else
|
|
#error "No network backend selected"
|
|
#endif
|
|
}
|