Skip to content

Commit 3c2c26b

Browse files
dgarskedanielinux
authored andcommitted
Fixes for IAR. Switch to new src/keystore.c for keys. Fixes for building keytools in Visual Studio.
1 parent ef0b760 commit 3c2c26b

File tree

14 files changed

+45
-57
lines changed

14 files changed

+45
-57
lines changed

IDE/IAR/generate_key.bat

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
keytools\keygen.exe --ecc256 ..\..\src\ecc256_pub_key.c
2-
move ecc256.der ..\..\
1+
cd ..\..
2+
REM Build the src/keystore.c
3+
IDE\IAR\keytools\keygen.exe --ecc256 -g wolfboot_signing_private_key.der
4+
cd IDE\IAR

IDE/IAR/keys/ecc256.der

Lines changed: 0 additions & 1 deletion
This file was deleted.

IDE/IAR/keys/ecc256_pub_key.c

Lines changed: 0 additions & 20 deletions
This file was deleted.

IDE/IAR/keytools/keygen.exe

-470 KB
Binary file not shown.

IDE/IAR/keytools/sign.exe

-412 KB
Binary file not shown.

IDE/IAR/wolfboot.ewp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,10 +2198,10 @@
21982198
<name>$PROJ_DIR$\..\..\src\boot_arm.c</name>
21992199
</file>
22002200
<file>
2201-
<name>$PROJ_DIR$\keys\ecc256_pub_key.c</name>
2201+
<name>$PROJ_DIR$\..\..\src\image.c</name>
22022202
</file>
22032203
<file>
2204-
<name>$PROJ_DIR$\..\..\src\image.c</name>
2204+
<name>$PROJ_DIR$\..\..\src\keystore.c</name>
22052205
</file>
22062206
<file>
22072207
<name>$PROJ_DIR$\..\..\src\libwolfboot.c</name>

include/image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static void wolfBoot_image_confirm_signature_ok(struct wolfBoot_image *img)
526526
if ((mask & (1UL << id)) != (1UL << id)) \
527527
wolfBoot_panic()
528528

529-
#define VERIFY_VERSION_ALLOWED do{} while(0);
529+
#define VERIFY_VERSION_ALLOWED(fb_ok) do{} while(0)
530530

531531
#endif
532532

src/image.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,9 @@ int wolfBoot_get_dts_size(void *dts_addr)
836836
#ifdef WOLFBOOT_FIXED_PARTITIONS
837837
int wolfBoot_open_image(struct wolfBoot_image *img, uint8_t part)
838838
{
839+
#ifdef MMU
839840
int ret;
840-
uint32_t size;
841+
#endif
841842
uint8_t *image;
842843
if (!img)
843844
return -1;
@@ -867,7 +868,7 @@ int wolfBoot_open_image(struct wolfBoot_image *img, uint8_t part)
867868
return -1;
868869
img->hdr_ok = 1;
869870
img->fw_base = img->hdr;
870-
img->fw_size = (uint32_t)size;
871+
img->fw_size = (uint32_t)ret;
871872
return 0;
872873
}
873874
#endif
@@ -924,7 +925,6 @@ int wolfBoot_verify_authenticity(struct wolfBoot_image *img)
924925
#else
925926
int wolfBoot_verify_authenticity(struct wolfBoot_image *img)
926927
{
927-
int ret;
928928
uint8_t *stored_signature;
929929
uint16_t stored_signature_size;
930930
uint8_t *pubkey_hint;

tools/keytools/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CC = gcc
1111
WOLFBOOTDIR = ../..
1212
WOLFDIR = $(WOLFBOOTDIR)/lib/wolfssl/
1313
CFLAGS = -Wall -Wextra -Werror
14-
CFLAGS += -I. -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR) -I$(WOLFBOOTDIR)/include -DWOLFBOOT_KEYTOOLS -DWOLFSSL_AES_DIRECT -DWOLFSSL_AES_COUNTER
14+
CFLAGS += -I. -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR) -I$(WOLFBOOTDIR)/include -DWOLFBOOT_KEYTOOLS
1515

1616
# option variables
1717
DEBUG_FLAGS = -g -DDEBUG -DDEBUG_SIGNTOOL -DDEBUG_WOLFSSL -DDEBUG_WOLFSSL_VERBOSE -fsanitize=address

tools/keytools/keygen.c

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
#include <sys/types.h>
3737
#include <errno.h>
3838
#include <fcntl.h>
39-
#include <unistd.h>
39+
#ifndef _WIN32
40+
#include <unistd.h>
41+
#endif
4042

4143
#include <wolfssl/wolfcrypt/settings.h>
4244
#ifndef NO_RSA

0 commit comments

Comments
 (0)