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 payload inspection to htool/libhoth #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stevenportley
Copy link
Collaborator

@stevenportley stevenportley commented Feb 19, 2025

Add payload inspection to libHoth and an option to htool:

htool payload info protocol/test/test_payload.bin
Payload Info:
name: test layout
family: 2
version: 1.0.0.0
type: 0
hash: 50316da1d3b06ff87989aa8bcd48a33ecc4bfe2114ded138ee594f697d58b3

@stevenportley stevenportley force-pushed the payload_info branch 2 times, most recently from ecef652 to 7414a87 Compare February 27, 2025 19:02
printf(" type: %u\n", info.image_type);
printf(" hash: ");
for (int i = 0; i < sizeof(info.image_hash); i++) {
printf("%x", info.image_hash[i]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be a good idea to add zeros on the left to pad to 2 characters?

Copy link
Collaborator Author

@stevenportley stevenportley Mar 5, 2025

Choose a reason for hiding this comment

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

I'm not sure what you mean by this? This output is as follows, which I think is reasonable:

Payload Info:
  name: test layout
  family: 2
  version: 1.0.0.0
  type: 0
  hash: 50316da1d3b06ff87989aa8bcd48a33ecc4bfe2114ded138ee594f697d58b3

Copy link
Collaborator

Choose a reason for hiding this comment

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

len("50316da1d3b06ff87989aa8bcd48a33ecc4bfe2114ded138ee594f697d58b3") = 62, but there should be 64 characters in the output (2 characters per byte for 32 bytes)

@stevenportley stevenportley force-pushed the payload_info branch 7 times, most recently from ae9d2b8 to e36b203 Compare March 5, 2025 01:21

int ret = munmap(image, statbuf.st_size);
if (ret != 0) {
fprintf(stderr, "munmap error: %d\n", ret);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be a good idea to print strerror(errno) here as well (similar to what has been done for mmap?

printf(" type: %u\n", info.image_type);
printf(" hash: ");
for (int i = 0; i < sizeof(info.image_hash); i++) {
printf("%x", info.image_hash[i]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

len("50316da1d3b06ff87989aa8bcd48a33ecc4bfe2114ded138ee594f697d58b3") = 62, but there should be 64 characters in the output (2 characters per byte for 32 bytes)

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.

4 participants