Public Access
OTA steps 3-5: Update Service, Probation and Rollback, Update from SD
- EcdsaVerifier (mbedTLS, embedded public key) and EspOtaSink (writes the inactive app slot, esp_ota_end validates the image, then sets the boot partition) - UpdateService: listens on TCP 3232 (and mDNS roro9stack-<id>) while Wi-Fi is Connected; streams into UpdateParser; replies OK/ERR to the sender; remembers the pending version so a Rollback is reported after the reboot - Probation (host-tested): confirm after the first frame + 30 s + Wi-Fi (if configured); roll back if configured Wi-Fi never connects in 3 min - Main loop: full-screen progress while receiving; restart once installed, waiting up to 60 s for Text Entry to end - Settings > Firmware: version, Probation status, push address and name, and the .ota files in /updates on the SD card to install - StorageService.runJob() runs work on the storage task (SD installs) - wifi status prints IP and running version; RORO_TEST_CRASH test hook Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <esp_ota_ops.h>
|
||||
#include <mbedtls/pk.h>
|
||||
|
||||
#include "update_parser.h"
|
||||
|
||||
namespace roro {
|
||||
|
||||
// Checks Update File signatures against the public key compiled into the firmware (ADR 0003).
|
||||
class EcdsaVerifier : public SignatureVerifier {
|
||||
public:
|
||||
EcdsaVerifier();
|
||||
~EcdsaVerifier() override;
|
||||
bool verify(const uint8_t digest[32], const uint8_t* signature, size_t len) override;
|
||||
|
||||
private:
|
||||
mbedtls_pk_context key_;
|
||||
bool ready_ = false;
|
||||
};
|
||||
|
||||
// Writes the image to the app slot that isn't running, and makes it the next boot on finish().
|
||||
class EspOtaSink : public UpdateSink {
|
||||
public:
|
||||
EspOtaSink() : slot_(esp_ota_get_next_update_partition(nullptr)) {}
|
||||
size_t capacity() const { return slot_ ? slot_->size : 0; }
|
||||
bool begin(size_t imageSize) override;
|
||||
bool write(const uint8_t* data, size_t len) override;
|
||||
bool finish() override;
|
||||
void abort() override;
|
||||
|
||||
private:
|
||||
const esp_partition_t* slot_;
|
||||
esp_ota_handle_t handle_ = 0;
|
||||
bool open_ = false;
|
||||
};
|
||||
|
||||
} // namespace roro
|
||||
Reference in New Issue
Block a user