mirror of https://github.com/wolfSSL/wolfBoot.git
Merge pull request #146 from danielinux/keytools-ioerrors
Fixed keytools error handling. Removed inclusion of target.h.pull/149/head
commit
0a2433a7a8
|
@ -7,11 +7,16 @@ ifeq ($(V),0)
|
||||||
Q=@
|
Q=@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WOLFBOOT_SECTOR_SIZE),)
|
||||||
|
WOLFBOOT_SECTOR_SIZE=2048
|
||||||
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
WOLFBOOTDIR = ../..
|
WOLFBOOTDIR = ../..
|
||||||
WOLFDIR = $(WOLFBOOTDIR)/lib/wolfssl/
|
WOLFDIR = $(WOLFBOOTDIR)/lib/wolfssl/
|
||||||
CFLAGS = -Wall -Wextra -Werror
|
CFLAGS = -Wall -Wextra -Werror
|
||||||
CFLAGS += -I. -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR) -I$(WOLFBOOTDIR)/include
|
CFLAGS += -I. -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR) -I$(WOLFBOOTDIR)/include
|
||||||
|
CFLAGS += -DWOLFBOOT_SECTOR_SIZE=$(WOLFBOOT_SECTOR_SIZE)
|
||||||
|
|
||||||
# option variables
|
# option variables
|
||||||
DEBUG_FLAGS = -g -DDEBUG -DDEBUG_SIGNTOOL -DDEBUG_WOLFSSL -DDEBUG_WOLFSSL_VERBOSE
|
DEBUG_FLAGS = -g -DDEBUG -DDEBUG_SIGNTOOL -DDEBUG_WOLFSSL -DDEBUG_WOLFSSL_VERBOSE
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "target.h"
|
|
||||||
#include "delta.h"
|
#include "delta.h"
|
||||||
|
|
||||||
#define MAX_SRC_SIZE (1 << 24)
|
#define MAX_SRC_SIZE (1 << 24)
|
||||||
|
@ -448,8 +446,9 @@ static int make_header_ex(int is_diff, uint8_t *pubkey, uint32_t pubkey_sz, cons
|
||||||
if (read_sz > 32)
|
if (read_sz > 32)
|
||||||
read_sz = 32;
|
read_sz = 32;
|
||||||
io_sz = fread(buf, 1, read_sz, f);
|
io_sz = fread(buf, 1, read_sz, f);
|
||||||
if (io_sz != (int)read_sz) {
|
if ((io_sz < 0) && !feof(f)) {
|
||||||
ret = -1; break;
|
ret = -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ret = wc_Sha256Update(&sha, buf, read_sz);
|
ret = wc_Sha256Update(&sha, buf, read_sz);
|
||||||
pos += read_sz;
|
pos += read_sz;
|
||||||
|
@ -493,8 +492,9 @@ static int make_header_ex(int is_diff, uint8_t *pubkey, uint32_t pubkey_sz, cons
|
||||||
if (read_sz > 128)
|
if (read_sz > 128)
|
||||||
read_sz = 128;
|
read_sz = 128;
|
||||||
io_sz = fread(buf, 1, read_sz, f);
|
io_sz = fread(buf, 1, read_sz, f);
|
||||||
if (io_sz != (int)read_sz) {
|
if ((io_sz < 0) && !feof(f)) {
|
||||||
ret = -1; break;
|
ret = -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ret = wc_Sha3_384_Update(&sha, buf, read_sz);
|
ret = wc_Sha3_384_Update(&sha, buf, read_sz);
|
||||||
pos += read_sz;
|
pos += read_sz;
|
||||||
|
@ -866,8 +866,8 @@ static int base_diff(const char *f_base, uint8_t *pubkey, uint32_t pubkey_sz)
|
||||||
patch_inv_sz += r;
|
patch_inv_sz += r;
|
||||||
len3 += r;
|
len3 += r;
|
||||||
} while (r > 0);
|
} while (r > 0);
|
||||||
io_sz = ftruncate(fd3, len3);
|
ret = ftruncate(fd3, len3);
|
||||||
if (io_sz != len3) {
|
if (ret != 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
close(fd3);
|
close(fd3);
|
||||||
|
|
Loading…
Reference in New Issue