MCCI Trusted Bootloader
Simple trusted bootloader and tools for small embedded systems
mcci_bootloader_appinfo.h
Go to the documentation of this file.
1/*
2
3Module: mcci_bootloader_appinfo.h
4
5Function:
6 McciBootloader_AppInfo_t and McciBootloader_SignatureBlock_t
7
8Copyright and License:
9 This file copyright (C) 2021 by
10
11 MCCI Corporation
12 3520 Krums Corners Road
13 Ithaca, NY 14850
14
15 See accompanying LICENSE file for copyright and license information.
16
17Author:
18 Terry Moore, MCCI Corporation March 2021
19
20*/
21
22#ifndef _mcci_bootloader_appinfo_h_
23#define _mcci_bootloader_appinfo_h_ /* prevent multiple includes */
24
25#pragma once
26
28#include <stdint.h>
29#include "mcci_tweetnacl_hash.h"
30#include "mcci_tweetnacl_sign.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/****************************************************************************\
37|
38| Data Structures
39|
40\****************************************************************************/
41
42///
43/// \brief Application information block
44///
45/// \details
46/// This information block appears at a well known location somewhere
47/// in each app image. It's intended to be somewhat architecturally
48/// neutral, but until we have two supported architectures, we
49/// won't really have a basis for discussion.
50///
52 {
53 uint32_t magic; ///< the format identifier.
54 uint32_t size; ///< size of this structure, in bytes
55 uint32_t targetAddress; ///< the target load address
56 uint32_t imagesize; ///< size of the app, in bytes.
57 /// Must be multiple of 4.
58 uint32_t authsize; ///< size of authentication data.
59 /// Overall image size is imagesize
60 /// + authsize
61 uint32_t version; ///< version of the image (semantic version)
62 uint64_t timestamp; ///< Posix timestamp of image
63 uint8_t comment[16]; ///< optional comment (UTF-8) describing this image.
64 uint8_t reserved56[16]; ///< reserved for future use.
65 };
66
67#define MCCI_BOOTLOADER_APP_INFO_MAGIC (('M' << 0) | ('A' << 8) | ('P' << 16) | ('0' << 24))
68
69///
70/// \brief Application signature block
71///
72/// \details
73/// This signature block appears at the end of the flash image, and contains
74/// the public key by which it was signed, the hash of the image, and the
75/// signature for the hash.
76///
78 {
79 mcci_tweetnacl_sign_publickey_t publicKey; ///< the public key used for the signature
80 mcci_tweetnacl_sha512_t hash; ///< the SHA-512 hash
81 mcci_tweetnacl_sign_signature_t signature; ///< the first 64 bytes of sign(hash, publicKey)
82 };
83
84#ifdef __cplusplus
85}
86#endif
87
88#endif /* _mcci_bootloader_appinfo_h_ */
Application information block.
uint32_t targetAddress
the target load address
uint32_t imagesize
size of the app, in bytes.
uint64_t timestamp
Posix timestamp of image.
uint8_t reserved56[16]
reserved for future use.
uint32_t version
version of the image (semantic version)
uint32_t size
size of this structure, in bytes
uint8_t comment[16]
optional comment (UTF-8) describing this image.
uint32_t authsize
size of authentication data.
uint32_t magic
the format identifier.
mcci_tweetnacl_sign_signature_t signature
the first 64 bytes of sign(hash, publicKey)
mcci_tweetnacl_sign_publickey_t publicKey
the public key used for the signature
mcci_tweetnacl_sha512_t hash
the SHA-512 hash