-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: main
Are you sure you want to change the base?
Conversation
03697a1
to
40f8be3
Compare
ecef652
to
7414a87
Compare
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]); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
ae9d2b8
to
e36b203
Compare
e36b203
to
af3133b
Compare
|
||
int ret = munmap(image, statbuf.st_size); | ||
if (ret != 0) { | ||
fprintf(stderr, "munmap error: %d\n", ret); |
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
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)
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