Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an entry point when signing Arm images #163

Merged
merged 5 commits into from
Nov 21, 2024
Merged

Add an entry point when signing Arm images #163

merged 5 commits into from
Nov 21, 2024

Conversation

will-v-pi
Copy link

Reads the entry point and stack pointer from the vector table, and adds them to the image_def as a new entry_point item. This is only done for signing Arm executable images.

This assumes that the vector table is at 0x10000000 unless a vector_table metadata item is present, which the SDK adds for no_flash binaries, so it should work with all SDK binaries.

@will-v-pi will-v-pi added this to the 2.0.1 milestone Nov 1, 2024
main.cpp Show resolved Hide resolved
main.cpp Outdated
std::shared_ptr<entry_point_item> entry_point = new_block.get_item<entry_point_item>();
if (entry_point == nullptr) {
std::shared_ptr<vector_table_item> vtor = new_block.get_item<vector_table_item>();
uint32_t vtor_loc = elf->header().entry < SRAM_START ? 0x10000000 : 0x20000000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to check for XIP_SRAM-only binaries here? I forget if they can be signed (i believe so)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added support for this - although I'm not sure if we support XIP_SRAM binaries without a vector_table_item?

main.cpp Show resolved Hide resolved
new_block.items.push_back(entry_point);
}
}

hash_andor_sign(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from 2024-11-19 23-27-37

😉

Reads the entry point and stack pointer from the vector table

Assumes vector table is at 0x10000000 unless a vector_table metadata item is present
main.cpp Outdated Show resolved Hide resolved
@will-v-pi will-v-pi merged commit 081a386 into develop Nov 21, 2024
35 checks passed
@will-v-pi will-v-pi deleted the ep-sign branch November 21, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants