Refactoring of sign.c to add delta updates

pull/125/head
Daniele Lacamera 2021-07-08 10:14:27 +02:00
parent 301bc3e0b6
commit 092783b0ea
4 changed files with 506 additions and 357 deletions

View File

@ -57,7 +57,6 @@ int wb_patch(WB_PATCH_CTX *ctx, uint8_t *dst, uint32_t len)
struct block_hdr *hdr;
uint32_t dst_off = 0;
uint32_t src_off;
uint32_t cur_sector = 0;
uint16_t sz;
uint32_t copy_sz;
if (!ctx)
@ -146,8 +145,6 @@ int wb_diff(WB_DIFF_CTX *ctx, uint8_t *patch, uint32_t len)
uint16_t match_len;
uint32_t blk_start;
uint32_t p_off = 0;
char strndbg[30];
int dbglen = 0;
if (ctx->off_b >= ctx->size_b)
return 0;
if (len < BLOCK_HDR_SIZE)
@ -212,7 +209,6 @@ int wb_diff(WB_DIFF_CTX *ctx, uint8_t *patch, uint32_t len)
uint32_t pb_end = page_start * WOLFBOOT_SECTOR_SIZE;
pb = ctx->src_b;
while (((uint32_t)(pb - ctx->src_b) < pb_end) && (p_off < len)) {
uint32_t b_start = ctx->off_b;
if ((ctx->size_b - ctx->off_b) < BLOCK_HDR_SIZE)
break;
if (ctx->size_b - (pb - ctx->src_b) < BLOCK_HDR_SIZE)

View File

@ -2,7 +2,7 @@
CC = gcc
WOLFDIR = ../../lib/wolfssl/
CFLAGS = -Wall -I. -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR)
CFLAGS = -Wall -I. -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR) -I../../include
# option variables
DEBUG_FLAGS = -g -DDEBUG
@ -35,6 +35,8 @@ SRC=$(WOLFDIR)wolfcrypt/src/asn.c \
$(WOLFDIR)wolfcrypt/src/wc_port.c \
$(WOLFDIR)wolfcrypt/src/wolfmath.c
SRC+=../../src/delta.c
.PHONY: clean all
all: sign keygen

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,6 @@ USBTTY?=/dev/ttyACM0
TIMEOUT?=60
EXPVER=tools/test-expect-version/test-expect-version /dev/ttyACM0
tools/uart-flash-server/ufserver: FORCE
@make -C `dirname $@`
@rm -f src/libwolfboot.o
test-delta-update: factory.bin test-app/image.bin tools/uart-flash-server/ufserver tools/delta/bmdiff
@st-flash erase
@diff .config config/examples/stm32wb-delta.config || (echo "\n\n*** Error: please copy config/examples/stm32wb-delta.config to .config to run this test\n\n" && exit 1)