Skip to content

Commit 0a8a40f

Browse files
committed
sign: normalize short read failures
Return a consistent failure code on encrypt-key short reads and initialize final-swap ret to 0. F/CI
1 parent 087ff90 commit 0a8a40f

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/update_flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static int RAMFUNCTION wolfBoot_swap_and_final_erase(int resume)
434434
uintptr_t tmpBootPos = WOLFBOOT_PARTITION_SIZE - eraseLen -
435435
WOLFBOOT_SECTOR_SIZE;
436436
uint32_t tmpBuffer[TRAILER_OFFSET_WORDS + 1];
437-
int ret;
437+
int ret = 0;
438438

439439
/* open partitions (ignore failure) */
440440
wolfBoot_open_image(boot, PART_BOOT);

tools/keytools/sign.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,11 +2034,13 @@ static int make_header_ex(int is_diff, uint8_t *pubkey, uint32_t pubkey_sz,
20342034
ret = (int)fread(key, 1, keySz, fek);
20352035
if (ret != keySz) {
20362036
fprintf(stderr, "Error reading key from %s\n", CMD.encrypt_key_file);
2037+
ret = -1;
20372038
goto failure;
20382039
}
20392040
ret = (int)fread(iv, 1, ivSz, fek);
20402041
if (ret != ivSz) {
20412042
fprintf(stderr, "Error reading IV from %s\n", CMD.encrypt_key_file);
2043+
ret = -1;
20422044
goto failure;
20432045
}
20442046
fclose(fek);

0 commit comments

Comments
 (0)