pub struct BootImage {
pub keyblock: KeyBlock,
pub header: ImageHeader,
pub entry: EntryHeader,
/* private fields */
}Expand description
Represents a boot image, including encryption public keys, hash, and segment data.
This struct contains the details of the boot image including the encryption and hash public keys, header, entry, text (payload), and a hash representing the integrity of the image.
Fields§
§keyblock: KeyBlock§header: ImageHeaderThe header of the boot image, containing general information about the image.
entry: EntryHeaderThe entry header, typically pointing to the start of the executable code or data.
Implementations§
Source§impl BootImage
impl BootImage
Sourcepub fn get_text(&self) -> &[u8] ⓘ
pub fn get_text(&self) -> &[u8] ⓘ
Retrieves the text (code) content of the boot image.
This method provides access to the text field of the BootImage as a byte slice.
It allows reading the raw byte data representing the text within the boot image.
§Example
use amebazii::types::BootImage;
let boot_image = BootImage::default();
let text = boot_image.get_text();
println!("Text data: {:?}", text);Sourcepub fn get_hash(&self) -> &[u8] ⓘ
pub fn get_hash(&self) -> &[u8] ⓘ
Retrieves the hash value associated with the boot image.
This method returns the hash field of the BootImage, which is a byte slice
representing the hash (cryptographic hash) of the boot image data.
Sourcepub fn set_text(&mut self, text: Vec<u8>)
pub fn set_text(&mut self, text: Vec<u8>)
Sets the text content of the boot image.
This method updates the text field of the BootImage with a new vector of bytes.
It allows modifying the raw byte data that represents the boot image’s text.
§Arguments
text- A vector of bytes (Vec<u8>) to set as the new text content.
§Example
use amebazii::types::BootImage;
let mut boot_image = BootImage::default();
let new_text = vec![1, 2, 3, 4, 5];
boot_image.set_text(new_text);
assert_eq!(boot_image.get_text(), vec![1, 2, 3, 4, 5]);Trait Implementations§
Source§impl AsImage for BootImage
impl AsImage for BootImage
Source§fn build_segment_size(&self) -> u32
fn build_segment_size(&self) -> u32
Computes the segment size for the BootImage.
The segment size includes the size of the header, entry, text, and the hash.
§Returns:
u32: The computed segment size.
Source§fn set_segment_size(&mut self, size: u32)
fn set_segment_size(&mut self, size: u32)
Sets the segment size for the BootImage.
This method sets the segment_size field in the header of the BootImage.
§Arguments:
size: The segment size to set.
Source§fn set_signature(&mut self, signature: &[u8])
fn set_signature(&mut self, signature: &[u8])
Sets the signature for the BootImage.
This method sets the signature field of the BootImage (i.e., the hash field).
§Arguments:
signature: The computed signature to set in theBootImage.
Source§impl Default for BootImage
impl Default for BootImage
Source§fn default() -> Self
fn default() -> Self
Creates a new BootImage with default values.
The BootImage is initialized with default values:
- Encryption and hash public keys are set to all
0xFFbytes. - The header and entry are initialized with their default values.
- The
textfield is an empty vector, and thehashfield is set to all0xFFbytes.