Skip to content

Commit d509e91

Browse files
dgarskedanielinux
authored andcommitted
More peer review fixes. Fix the wolfCrypt test build.
1 parent 84d4443 commit d509e91

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

test-app/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ ifeq ($(WOLFCRYPT_SUPPORT),1)
124124
APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/memory.o
125125
APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/asn.o
126126
APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/coding.o
127+
APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/wc_encrypt.o
127128

128129
# Add SHA implementations (needed for test/benchmark)
129130
APP_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/sha256.o

test-app/syscalls.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ int _write(int file, char *ptr, int len)
9393
/* Write to UART for stdout/stderr */
9494
if (file == 1 || file == 2) {
9595
uart_write(ptr, len);
96+
return len;
9697
}
9798

98-
return len;
99+
errno = EBADF;
100+
return -1;
99101
}
100102

101103
void _exit(int status)

tools/keytools/sign.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ static int make_header_ex(int is_diff, uint8_t *pubkey, uint32_t pubkey_sz,
17591759
}
17601760
partition_sz = (uint32_t)tmp;
17611761

1762-
if (env_ssize) {
1762+
if (env_ssize && *env_ssize) {
17631763
errno = 0;
17641764
tmp = strtoul(env_ssize, &endptr, 0);
17651765
if (endptr == env_ssize || *endptr != '\0' ||

tools/scripts/va416x0/build_test.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ make clean && make wolfboot.bin && make test-app/image.bin
5151

5252
# Function to sign image
5353
sign_image() {
54-
IMAGE_HEADER_SIZE=${IMAGE_HEADER_SIZE} \
55-
WOLFBOOT_PARTITION_SIZE=${PARTITION_SIZE} \
56-
WOLFBOOT_SECTOR_SIZE=${SECTOR_SIZE} \
57-
./tools/keytools/sign ${SIGN_ARG} ${HASH_ARG} test-app/image.bin wolfboot_signing_private_key.der "$1"
54+
IMAGE_HEADER_SIZE="${IMAGE_HEADER_SIZE}" \
55+
WOLFBOOT_PARTITION_SIZE="${PARTITION_SIZE}" \
56+
WOLFBOOT_SECTOR_SIZE="${SECTOR_SIZE}" \
57+
./tools/keytools/sign "${SIGN_ARG}" "${HASH_ARG}" test-app/image.bin wolfboot_signing_private_key.der "$1"
5858
}
5959

6060
# Function to print summary
@@ -71,22 +71,22 @@ print_summary() {
7171
}
7272

7373
if [ "$MODE" = "clean" ]; then
74-
sign_image ${VERSION}
74+
sign_image "${VERSION}"
7575
dd if=/dev/zero of=blank_update.bin bs=1K count=108
7676
./tools/bin-assemble/bin-assemble factory.bin 0x0 wolfboot.bin \
77-
${BOOT_ADDRESS} test-app/image_v${VERSION}_signed.bin \
78-
${UPDATE_ADDRESS} blank_update.bin
79-
${JLINK} -CommanderScript tools/scripts/va416x0/flash_va416xx.jlink
77+
"${BOOT_ADDRESS}" test-app/image_v${VERSION}_signed.bin \
78+
"${UPDATE_ADDRESS}" blank_update.bin
79+
"${JLINK}" -CommanderScript tools/scripts/va416x0/flash_va416xx.jlink
8080
print_summary
8181
else
82-
TRIGGER_ADDRESS=$(printf "0x%X" $((${UPDATE_ADDRESS} + ${PARTITION_SIZE} - 5)))
83-
PREV_VERSION=$((${VERSION} - 1))
84-
sign_image ${PREV_VERSION} && sign_image ${VERSION}
82+
TRIGGER_ADDRESS=$(printf "0x%X" $(("${UPDATE_ADDRESS}" + "${PARTITION_SIZE}" - 5)))
83+
PREV_VERSION=$(("${VERSION}" - 1))
84+
sign_image "${PREV_VERSION}" && sign_image "${VERSION}"
8585
echo -n "pBOOT" > trigger_magic.bin
8686
./tools/bin-assemble/bin-assemble update.bin 0x0 wolfboot.bin \
87-
${BOOT_ADDRESS} test-app/image_v${PREV_VERSION}_signed.bin \
88-
${UPDATE_ADDRESS} test-app/image_v${VERSION}_signed.bin \
89-
${TRIGGER_ADDRESS} trigger_magic.bin
90-
${JLINK} -CommanderScript tools/scripts/va416x0/flash_va416xx_update.jlink
87+
"${BOOT_ADDRESS}" test-app/image_v${PREV_VERSION}_signed.bin \
88+
"${UPDATE_ADDRESS}" test-app/image_v${VERSION}_signed.bin \
89+
"${TRIGGER_ADDRESS}" trigger_magic.bin
90+
"${JLINK}" -CommanderScript tools/scripts/va416x0/flash_va416xx_update.jlink
9191
print_summary "${TRIGGER_ADDRESS}" "${PREV_VERSION}"
9292
fi

0 commit comments

Comments
 (0)