forked from ArduPilot/ArduRemoteID
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_firmware.h
More file actions
29 lines (23 loc) · 1.02 KB
/
Copy pathcheck_firmware.h
File metadata and controls
29 lines (23 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include "options.h"
#include <stdint.h>
#include <esp_ota_ops.h>
// reversed app descriptor. Reversed used to prevent it appearing in flash
#define APP_DESCRIPTOR_REV { 0x19, 0x75, 0xe2, 0x46, 0x37, 0xf1, 0x2a, 0x43 }
class CheckFirmware {
public:
typedef struct {
uint8_t sig[8];
uint32_t board_id;
uint32_t image_size;
uint8_t sign_signature[64];
} app_descriptor_t;
// check the firmware on the partition which will be updated by OTA
static bool check_OTA_next(const esp_partition_t *part, const uint8_t *lead_bytes, uint32_t lead_length);
static bool check_OTA_running(void);
private:
static bool check_OTA_partition(const esp_partition_t *part, const uint8_t *lead_bytes, uint32_t lead_length, uint32_t &board_id);
static bool check_partition(const uint8_t *flash, uint32_t flash_len,
const uint8_t *lead_bytes, uint32_t lead_length,
const app_descriptor_t *ad, const uint8_t public_key[32]);
};