Skip to content

Add signature check to bootloader#7007

Closed
kYc0o wants to merge 21 commits intoRIOT-OS:masterfrom
kYc0o:bootloader_with_signature
Closed

Add signature check to bootloader#7007
kYc0o wants to merge 21 commits intoRIOT-OS:masterfrom
kYc0o:bootloader_with_signature

Conversation

@kYc0o
Copy link
Contributor

@kYc0o kYc0o commented May 4, 2017

Based on #6922 .

This update adds signature capabilities to the metadata generator, which will sign the hash of the firmware and store the signature in the metadata.

This approach utilises tweetnacl, with the ed25519 curve, to sign the hash.

A couple of example keys are provided with this PR, which can be of course replaced.

Since tweetnacl needs a considerable amount of ROM, the interactive bootloader doesn't fit in the originally 16K allowed to it, so it's disabled by default.

In order to test it, you can compile any image with the following command:

make FW_SLOT=1 APPID=0xabcd1234 VERSION=0x1 bootloader

which will generate a file in the bin/BOARD/slot1/ directory called bootloader-APPLICATION.elf, which can be flashed into the node.

If everything goes well, you should be able to see an output similar to

Welcome to RIOT bootloader!
[bootlaoder] Cheking for slots metadata...
[bootlaoder] Found slot 1 with APPID: 0xabcd1234 
[bootloader] Slot 2 not valid
[bootloader] Warning! application IDs are different!
[bootloader] falling back to slot 1
Firmware Size: 77688
Firmware Version: 0x1
Firmware APPID: 0xabcd1234
[bootloader] Image on slot 1 verified! Validating...
[bootlaoder] slot 1 validated! Booting...
main(): This is RIOT! (Version: 2017.04-devel-928-g1e69c-snake.lan-bootloader_with_signature)

if you have nothing on slot 2, which will verify and boot slot 1.

As in #6922, you can also generate images for the slots independently of the bootloader (to send them OTA for example) which will be signed by default.

As for the other PRs related to this one, it only works on the iotlab-m3 platforms, for now.

@kYc0o kYc0o added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation labels May 4, 2017
@kYc0o kYc0o added this to the Release 2017.07 milestone May 4, 2017
@kYc0o kYc0o force-pushed the bootloader_with_signature branch 3 times, most recently from 530c28a to ad1b281 Compare May 12, 2017 12:51
@kYc0o kYc0o force-pushed the bootloader_with_signature branch from ad1b281 to 5932b11 Compare May 22, 2017 13:41
@kYc0o kYc0o force-pushed the bootloader_with_signature branch from 5932b11 to c1bc5e2 Compare June 9, 2017 16:32
@kYc0o kYc0o added the State: waiting for other PR State: The PR requires another PR to be merged first label Jun 9, 2017
@kYc0o kYc0o closed this Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Platform: ARM Platform: This PR/issue effects ARM-based platforms State: waiting for other PR State: The PR requires another PR to be merged first Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants