-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ota: store component hash as binary array
Component hash is received from the server as a hex string. Convert it to a binary array when decoding the manifest so that it's ready to compare to a locally generated hash. Signed-off-by: Mike Szczys <[email protected]>
- Loading branch information
Showing
2 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,10 @@ extern "C" | |
/// https://docs.golioth.io/reference/protocols/coap/ota | ||
/// @{ | ||
|
||
/// Size of a SHA256 of Artifact Binary in bytes | ||
#define GOLIOTH_OTA_COMPONENT_HASH_LEN 64 | ||
/// Size of a SHA256 of Artifact hex string in bytes | ||
#define GOLIOTH_OTA_COMPONENT_HEX_HASH_LEN 64 | ||
/// Size of a SHA256 of Artifact bin array in bytes | ||
#define GOLIOTH_OTA_COMPONENT_BIN_HASH_LEN 32 | ||
/// Maximum size of Binary Detected Type in bytes | ||
#define GOLIOTH_OTA_MAX_COMPONENT_BOOTLOADER_NAME_LEN 7 | ||
/// Maximum size of Relative URI to download binary (+ 7 bytes for Path) | ||
|
@@ -78,7 +80,7 @@ struct golioth_ota_component | |
/// Size of the artifact, in bytes | ||
int32_t size; | ||
/// Artifact Hash | ||
char hash[GOLIOTH_OTA_COMPONENT_HASH_LEN + 1]; | ||
uint8_t hash[GOLIOTH_OTA_COMPONENT_BIN_HASH_LEN]; | ||
/// Artifact uri (e.g. "/.u/c/[email protected]") | ||
char uri[GOLIOTH_OTA_MAX_COMPONENT_URI_LEN + 1]; | ||
/// Artifact bootloader ("mcuboot" or "default"") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters