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

imgtool custom TLV disregards endian and always uses big endian #1846

Closed
nordicjm opened this issue Oct 27, 2023 · 2 comments
Closed

imgtool custom TLV disregards endian and always uses big endian #1846

nordicjm opened this issue Oct 27, 2023 · 2 comments

Comments

@nordicjm
Copy link
Collaborator

This was originally (a long time ago) reported to the wrong repository: apache/mynewt-mcumgr#152

The issue with imgtool is that the value of --custom-tlv is always encoded in big-endian format, one might assume that selecting the endian of the output would determine this but it does not, and according to https://github.com/mcu-tools/mcuboot/blob/main/boot/bootutil/include/bootutil/boot_status.h#L156 actually should not because all fields must be in little endian, therefore imgtool has a bug in this functionality.

Example:

imgtool sign -k /tmp/aa/bootloader/mcuboot/root-rsa-2048.pem --align 4 --version 1.2.3 -H 0x200 -S 0x78000 --custom-tlv 0xaa 0x22550011 hello_world/zephyr/zephyr.hex test.hex

The following is the raw bytes from the hex file (taken from JFlash): 00 AA 00 04 00 22 55 00 11, as can be seen 0x22550011 is wrongly added in big endian format.

Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants