Commit ac46e26a authored by David Brown's avatar David Brown Committed by David Brown
Browse files

sim: Get header magic value from ManifestGen trait

Different manifest objects will use different magic values for the
header.  Allow this support by providing a query to retrieve the
appropriate magic value.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent 43643dd2
Loading
Loading
Loading
Loading
+1 −1
Changes for sim/src/image.rs: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -668,7 +668,7 @@ pub fn install_image(flashmap: &mut SimFlashMap, slots: &[SlotInfo], slot: usize

    // Generate a boot header.  Note that the size doesn't include the header.
    let header = ImageHeader {
        magic: 0x96f3b83d,
        magic: tlv.get_magic(),
        load_addr: 0,
        hdr_size: HDR_SIZE as u16,
        _pad1: 0,
+7
Changes for sim/src/tlv.rs: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ pub enum TlvFlags {
/// A generator for manifests.  The format of the manifest can be either a
/// traditional "TLV" or a SUIT-style manifest.
pub trait ManifestGen {
    /// Retrieve the header magic value for this manifest type.
    fn get_magic(&self) -> u32;

    /// Retrieve the flags value for this particular manifest type.
    fn get_flags(&self) -> u32;

@@ -153,6 +156,10 @@ impl TlvGen {
}

impl ManifestGen for TlvGen {
    fn get_magic(&self) -> u32 {
        0x96f3b83d
    }

    /// Retrieve the header flags for this configuration.  This can be called at any time.
    fn get_flags(&self) -> u32 {
        self.flags