Skip to content

Commit 043bc27

Browse files
authored
Merge pull request #6 from wolfSSL/python-keytools
Python keytools
2 parents 8852c01 + 905e6a0 commit 043bc27

13 files changed

Lines changed: 348 additions & 948 deletions

File tree

Makefile

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ include arch.mk
4949
## DSA Settings
5050

5151
ifeq ($(SIGN),ECC256)
52-
KEYGEN_TOOL=tools/ecc256/ecc256_keygen
53-
SIGN_TOOL=tools/ecc256/ecc256_sign
52+
KEYGEN_OPTIONS=--ecc256
53+
SIGN_OPTIONS=--ecc256
5454
PRIVATE_KEY=ecc256.der
5555
OBJS+= \
5656
$(ECC_EXTRA_OBJS) \
@@ -63,8 +63,8 @@ ifeq ($(SIGN),ECC256)
6363
./src/xmalloc.o
6464
CFLAGS+=-DWOLFBOOT_SIGN_ECC256 -DXMALLOC_USER $(ECC_EXTRA_CFLAGS)
6565
else
66-
KEYGEN_TOOL=tools/ed25519/ed25519_keygen
67-
SIGN_TOOL=tools/ed25519/ed25519_sign
66+
KEYGEN_OPTIONS=--ed25519
67+
SIGN_OPTIONS=--ed25519
6868
PRIVATE_KEY=ed25519.der
6969
OBJS+= ./lib/wolfssl/wolfcrypt/src/sha512.o \
7070
./lib/wolfssl/wolfcrypt/src/ed25519.o \
@@ -150,23 +150,17 @@ test-app/image.bin:
150150

151151
include tools/test.mk
152152

153-
tools/ed25519/ed25519_sign:
154-
@make -C tools/ed25519
153+
ed25519.der:
154+
@python3 tools/keytools/keygen.py $(KEYGEN_OPTIONS) src/ed25519_pub_key.c
155155

156-
tools/ecc256/ecc256_sign:
157-
@make -C tools/ecc256
156+
ecc256.der:
157+
@python3 tools/keytools/keygen.py $(KEYGEN_OPTIONS) src/ecc256_pub_key.c
158158

159-
ed25519.der: tools/ed25519/ed25519_sign
160-
@tools/ed25519/ed25519_keygen src/ed25519_pub_key.c
161-
162-
ecc256.der: tools/ecc256/ecc256_sign
163-
@tools/ecc256/ecc256_keygen src/ecc256_pub_key.c
164-
165-
factory.bin: $(BOOT_IMG) wolfboot-align.bin $(SIGN_TOOL) $(PRIVATE_KEY)
159+
factory.bin: $(BOOT_IMG) wolfboot-align.bin $(PRIVATE_KEY)
166160
@echo "\t[SIGN] $(BOOT_IMG)"
167-
$(Q)$(SIGN_TOOL) $(BOOT_IMG) $(PRIVATE_KEY) 1 >/dev/null
161+
$(Q)python3 tools/keytools/sign.py $(SIGN_OPTIONS) $(BOOT_IMG) $(PRIVATE_KEY) 1
168162
@echo "\t[MERGE] $@"
169-
@cat wolfboot-align.bin $(BOOT_IMG).v1.signed > $@
163+
@cat wolfboot-align.bin test-app/image_v1_signed.bin > $@
170164

171165
wolfboot.elf: $(OBJS) $(LSCRIPT)
172166
@echo "\t[LD] $@"
@@ -179,13 +173,11 @@ src/ecc256_pub_key.c: ecc256.der
179173
keys: $(PRIVATE_KEY)
180174

181175
clean:
182-
@find . -type f -name "*.o" | xargs -x rm -f
176+
@find . -type f -name "*.o" | xargs rm -f
183177
@rm -f *.bin *.elf wolfboot.map *.bin *.hex
184178
@make -C test-app clean
185179

186180
distclean: clean
187-
@make -C tools/ed25519 clean
188-
@make -C tools/ecc256 clean
189181
@rm -f *.pem *.der tags ./src/ed25519_pub_key.c ./src/ecc256_pub_key.c
190182

191183

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ projects to provide a secure firmware update mechanism.
2121

2222
This repository contains the following components:
2323
- the wolfBoot bootloader
24-
- Ed25519 key generator and image signing tools
25-
- Ecc256 key generator and image signing tools
24+
- key generator and image signing tools (requires python 3.x)
2625
- Baremetal test applications
2726

2827
### wolfBoot bootloader

lib/wolfssl

Submodule wolfssl updated 582 files

test-app/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ standalone: image.bin
8989
$(Q)$(CC) $(CFLAGS) -c -o $@ $^
9090

9191
clean:
92-
@rm -f image.bin* image.elf *.o image.map tags
92+
@rm -f *.bin *.elf tags *.o

tools/ecc256/Makefile

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

tools/ecc256/ecc256_keygen.c

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

0 commit comments

Comments
 (0)