mirror of https://github.com/wolfSSL/wolfBoot.git
Refactoring of sign.c to add delta updates
parent
301bc3e0b6
commit
092783b0ea
|
@ -57,7 +57,6 @@ int wb_patch(WB_PATCH_CTX *ctx, uint8_t *dst, uint32_t len)
|
||||||
struct block_hdr *hdr;
|
struct block_hdr *hdr;
|
||||||
uint32_t dst_off = 0;
|
uint32_t dst_off = 0;
|
||||||
uint32_t src_off;
|
uint32_t src_off;
|
||||||
uint32_t cur_sector = 0;
|
|
||||||
uint16_t sz;
|
uint16_t sz;
|
||||||
uint32_t copy_sz;
|
uint32_t copy_sz;
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
|
@ -146,8 +145,6 @@ int wb_diff(WB_DIFF_CTX *ctx, uint8_t *patch, uint32_t len)
|
||||||
uint16_t match_len;
|
uint16_t match_len;
|
||||||
uint32_t blk_start;
|
uint32_t blk_start;
|
||||||
uint32_t p_off = 0;
|
uint32_t p_off = 0;
|
||||||
char strndbg[30];
|
|
||||||
int dbglen = 0;
|
|
||||||
if (ctx->off_b >= ctx->size_b)
|
if (ctx->off_b >= ctx->size_b)
|
||||||
return 0;
|
return 0;
|
||||||
if (len < BLOCK_HDR_SIZE)
|
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;
|
uint32_t pb_end = page_start * WOLFBOOT_SECTOR_SIZE;
|
||||||
pb = ctx->src_b;
|
pb = ctx->src_b;
|
||||||
while (((uint32_t)(pb - ctx->src_b) < pb_end) && (p_off < len)) {
|
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)
|
if ((ctx->size_b - ctx->off_b) < BLOCK_HDR_SIZE)
|
||||||
break;
|
break;
|
||||||
if (ctx->size_b - (pb - ctx->src_b) < BLOCK_HDR_SIZE)
|
if (ctx->size_b - (pb - ctx->src_b) < BLOCK_HDR_SIZE)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
WOLFDIR = ../../lib/wolfssl/
|
WOLFDIR = ../../lib/wolfssl/
|
||||||
CFLAGS = -Wall -I. -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR)
|
CFLAGS = -Wall -I. -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR) -I../../include
|
||||||
|
|
||||||
# option variables
|
# option variables
|
||||||
DEBUG_FLAGS = -g -DDEBUG
|
DEBUG_FLAGS = -g -DDEBUG
|
||||||
|
@ -35,6 +35,8 @@ SRC=$(WOLFDIR)wolfcrypt/src/asn.c \
|
||||||
$(WOLFDIR)wolfcrypt/src/wc_port.c \
|
$(WOLFDIR)wolfcrypt/src/wc_port.c \
|
||||||
$(WOLFDIR)wolfcrypt/src/wolfmath.c
|
$(WOLFDIR)wolfcrypt/src/wolfmath.c
|
||||||
|
|
||||||
|
SRC+=../../src/delta.c
|
||||||
|
|
||||||
.PHONY: clean all
|
.PHONY: clean all
|
||||||
|
|
||||||
all: sign keygen
|
all: sign keygen
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,11 +5,6 @@ USBTTY?=/dev/ttyACM0
|
||||||
TIMEOUT?=60
|
TIMEOUT?=60
|
||||||
EXPVER=tools/test-expect-version/test-expect-version /dev/ttyACM0
|
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
|
test-delta-update: factory.bin test-app/image.bin tools/uart-flash-server/ufserver tools/delta/bmdiff
|
||||||
@st-flash erase
|
@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)
|
@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)
|
||||||
|
|
Loading…
Reference in New Issue