Skip to content

Commit dab16d3

Browse files
committed
Override IMAGE_HEADER_SIZE via configuration
If the calculated header_sz is smaller than the value requested via .config (or via IMAGE_HEADER_SIZE=x when compiling keytools), override the value calculated with the preset.
1 parent 701674b commit dab16d3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/keytools/sign.c

+8
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,13 @@ static uint8_t *load_key(uint8_t **key_buffer, uint32_t *key_buffer_sz,
674674
goto failure;
675675
}
676676

677+
if (CMD.header_sz < IMAGE_HEADER_SIZE) {
678+
printf("image header size overridden by config value (%u bytes)\n", IMAGE_HEADER_SIZE);
679+
CMD.header_sz = IMAGE_HEADER_SIZE;
680+
} else {
681+
printf("image header size calculated at runtime (%u bytes)\n", IMAGE_HEADER_SIZE);
682+
}
683+
677684
#ifdef DEBUG_SIGNTOOL
678685
printf("Pubkey %d\n", *pubkey_sz);
679686
WOLFSSL_BUFFER(*pubkey, *pubkey_sz);
@@ -1725,6 +1732,7 @@ int main(int argc, char** argv)
17251732
ret = base_diff(CMD.delta_base_file, pubkey, pubkey_sz, 16);
17261733
}
17271734

1735+
17281736
if (kbuf)
17291737
free(kbuf);
17301738
if (CMD.sign == SIGN_ED25519) {

0 commit comments

Comments
 (0)