[−][src]Struct gbl::AppImage
A flash image containing application data.
It is expected that every application embeds an "application properties"
data structure, which will be located by AppImage::parse
and contains an
AppInfo
structure which can be accessed using AppImage::app_info
.
Can be turned into a Gbl
by calling Gbl::from_app_image
or into a
ProgramData
section using From
/Into
conversion. The resulting
section will be flashed at offset 0. It is the user's responsibility to
ensure that the whole image fits in the target device's flash memory
(this library is completely device-agnostic and thus cannot check that
device-specific constraints are satisfied).
Methods
impl<'a> AppImage<'a>
[src]
pub fn parse<T: AsRef<[u8]> + ?Sized>(image: &'a T) -> Result<Self, Error>
[src]
Parses a raw application image by extracting the application properties.
Errors
Returns an error if image
does not contain a valid application
properties structure.
pub fn into_raw(self) -> Cow<'a, [u8]>
[src]
Consumes self
and returns the raw bytes making up the application
image.
pub fn app_info(&self) -> &AppInfo
[src]
Returns the AppInfo
structure extracted from the application image.
pub fn is_signed(&self) -> bool
[src]
Returns whether a cryptographic signature is embedded into the application image.
pub fn ecdsa_signature(&self) -> Option<[u8; 64]>
[src]
If present, returns the embedded ECDSA P-256 signature blob.
pub fn sign(self, pem_private_key: &str) -> Result<Self, Error>
[src]
Signs this application image.
The signature will be embedded into the flashed data, and the application properties structure will be updated to point at the signature. If the signature pointer is non-zero and the signature type indicates an ECDSA P-256 signature, an existing signature is assumed to be present at that offset and will be overwritten with a new signature.
If no signature is present, this will append the new signature to the raw image, enlarging it.
If secure boot is enabled in the bootloader, a valid signature must be present for boot to continue.
Errors
Returns an error if:
pem_private_key
is malformed or does not contain an ECDSA P-256 private key.- there is a problem accessing the system's random number generator.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,