Struct fwsig::Manifest

source ·
pub struct Manifest {
    pub version: u16,
    pub flags: u16,
    pub app_name: Stringish<16>,
    pub app_version: Stringish<24>,
    pub app_len: u32,
    pub app_csum: Checksum,
    pub meta_kind: u16,
    pub meta_len: u16,
    pub meta_csum: Checksum,
    pub key: PublicKey,
    pub sig: Signature,
}
Expand description

Applet manifest, links app and metadata checksums with overall applet signature

Encoding:

0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       MANIFEST_VERSION        |         MANIFEST_FLAGS        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|                            APP_NAME                           |
|                   (16-byte zero padded utf8)                  |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
/                           APP_VERSION                         /
/                   (24-byte zero padded utf8)                  /
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        APP_LENGTH (u32)                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
/                         APP_CHECKSUM                          /
/                   (256-bit truncated SHA512)                  /
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           META_KIND           |       META_LENGTH (u16)       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
/                        META_CHECKSUM                          /
/                   (256-bit truncated SHA512)                  /
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
/                         SIGNING KEY                           /
/                      (ED25519 Public Key)                     /
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
/                          SIGNATURE                            /
/                      (ED25519 Signature)                      /
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Fields§

§version: u16

Manifest version (must be 1)

§flags: u16

Manifest flags

§app_name: Stringish<16>

Application name (utf8, zero-padded)

§app_version: Stringish<24>

Application Version (utf8, zero-padded)

§app_len: u32

Application binary length

§app_csum: Checksum

Application binary checksum (sha512)

§meta_kind: u16

Metadata encoding kind

§meta_len: u16

Metadata binary length

§meta_csum: Checksum

Metadata binary checksum

§key: PublicKey

Public key used to sign manifest

For released firmware allowed public keys should be pinned via bootloader, where release keys are not available transient keys will be used to construct a valid manifest object.

§sig: Signature

Signature over manifest data, against the specified public key

Implementations§

Fetch manifest flags

Fetch app name

Fetch app version

Fetch app length

Fetch metadata length

Sign manifest using provided key

Verify manifest signature against allowed keys

Check application and metadata against manifest

Check application and metadata against manifest using pre-computed values

This is useful where the app is not entirely in memory for checksum computations

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Output type
Error type returned on parse error
Decode consumes a slice and returns an object and decoded length.
Error type returned on parse error
Calculate expected encoded length for an object
Encode method writes object data to the provided writer
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Output type (allows attaching lifetime bounds where required)
Error type returned on parse error
Decode consumes a slice and returns an object and decoded length.
Helper to iterate over decodable objects in a sized buffer. Read more
Helper to encode iterables
Helper to encode to a fixed size buffer

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.