External flash encryption#62
Merged
dgarske merged 22 commits intowolfSSL:masterfrom Jun 18, 2020
Merged
Conversation
dgarske
requested changes
Jun 18, 2020
dgarske
requested changes
Jun 18, 2020
Member
dgarske
left a comment
There was a problem hiding this comment.
Using the latest wolfcrypt-py its still not working on the mac. Here are my logs:
make USBTTY=/dev/cu.usbmodem1452203 test-enc-update
[CC-ARM] hal/stm32wb.o
[CC-ARM] src/loader.o
[CC-ARM] src/string.o
[CC-ARM] src/image.o
[CC-ARM] src/libwolfboot.o
[CC-ARM] src/boot_arm.o
[CC-ARM] src/uart_flash.o
[CC-ARM] src/ecc256_pub_key.o
[CC-ARM] src/update_flash.o
[CC-ARM] src/xmalloc_ecc.o
[LD] wolfboot.elf
[BIN] wolfboot.bin
[SIZE]
text data bss dec hex filename
23820 0 13908 37728 9360 wolfboot.elf
[CC-ARM] ../src/libwolfboot.o
[LD] image.elf
[BIN] image.bin
text data bss dec hex filename
4184 52 4384 8620 21ac test-app/image.elf
[SIGN] test-app/image.bin
Update type: Firmware
Input image: test-app/image.bin
Selected cipher: ecc256
Public key: ecc256.der
Output image: test-app/image_v1_signed.bin
Not Encrypted
Calculating sha256 digest...
Signing the firmware...
Done.
Output image successfully created.
[MERGE] factory.bin
gcc -Wall -DWOLFSSL_DEBUG -DTFM_TIMING_RESISTANT -DWOLFBOOT_SIGN_ECC256 -DWOLFBOOT_HASH_SHA256 -g -ggdb -I../../include -I../../hal -Wextra -c -o ../../src/libwolfboot.o ../../src/libwolfboot.c
gcc -o ufserver ufserver.o ../../src/libwolfboot.o -Wall -DWOLFSSL_DEBUG -DTFM_TIMING_RESISTANT -DWOLFBOOT_SIGN_ECC256 -DWOLFBOOT_HASH_SHA256 -g -ggdb -I../../include -I../../hal -Wextra
Update type: Firmware
Input image: test-app/image.bin
Selected cipher: ecc256
Public key: ecc256.der
Output image: test-app/image_v2_signed.bin
Encrypted using: /tmp/enc_key.der
Calculating sha256 digest...
Signing the firmware...
Done.
Output image successfully created.
Update type: Firmware
Input image: test-app/image.bin
Selected cipher: ecc256
Public key: ecc256.der
Output image: test-app/image_v2_signed.bin
Encrypted using: /tmp/enc_key.der
Calculating sha256 digest...
Signing the firmware...
Done.
Output image successfully created.
st-flash 1.6.0-32-gcda2215
2020-06-18T08:18:36 INFO common.c: Loading device parameters....
2020-06-18T08:18:36 INFO common.c: Device connected is: WB55 device, id 0x20016495
2020-06-18T08:18:36 INFO common.c: SRAM size: 0x40000 bytes (256 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 4096 bytes
2020-06-18T08:18:36 INFO common.c: Attempting to write 70028 (0x1118c) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08011000 erased
2020-06-18T08:18:37 INFO common.c: Finished erasing 18 pages of 4096 (0x1000) bytes
Writing
Starting 17 page write
2020-06-18T08:18:46 INFO common.c: Starting verification of write complete
2020-06-18T08:18:47 INFO common.c: Flash written and verified! jolly good!
Warning: the binary file provided does not appear to contain a valid firmware partition file.
[|] Fetching update blocks st-flash 1.6.0-32-gcda2215
2020-06-18T08:18:54 INFO common.c: Loading device parameters....
2020-06-18T08:18:54 INFO common.c: Device connected is: WB55 device, id 0x20016495
2020-06-18T08:18:54 INFO common.c: SRAM size: 0x40000 bytes (256 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 4096 bytes
** TARGET REBOOT **
Version running on target: 1
[/] Fetching update blocks st-flash 1.6.0-32-gcda2215
2020-06-18T08:19:54 INFO common.c: Loading device parameters....
2020-06-18T08:19:54 INFO common.c: Device connected is: WB55 device, id 0x20016495
2020-06-18T08:19:54 INFO common.c: SRAM size: 0x40000 bytes (256 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 4096 bytes
** TARGET REBOOT **
Version running on target: 1
[|] Fetching update blocks st-flash 1.6.0-32-gcda2215
2020-06-18T08:19:55 INFO common.c: Loading device parameters....
2020-06-18T08:19:55 INFO common.c: Device connected is: WB55 device, id 0x20016495
2020-06-18T08:19:55 INFO common.c: SRAM size: 0x40000 bytes (256 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 4096 bytes
1+0 records in
1+0 records out
4096 bytes transferred in 0.000042 secs (97612893 bytes/sec)
Binary files boot.bin and boot_compare.bin differ
TEST FAILED
make: *** [test-enc-update] Error 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
External partitions content can now be encrypted using ChaCha20.
Keytools can generate 'signed_and_encrypted.bin' version of the updates to be stored on external devices.
Details in the manual page.
Depends on wolfcrypt-py PR #14 and PR#15.