Skip to content

Commit 6f444f7

Browse files
MarekPietacarlescufi
authored andcommitted
scripts: hid_configurator: Support pure ED25519 signature
Change adds support for pure ED25519 signature (used by nRF54L-based devices that enable MCUboot hardware cryptography). imgtool from MCUboot upstream repository does not support this configuration, a dedicated imgtool version from sdk-mcuboot repository must be used. Jira: NCSDK-30745 Signed-off-by: Marek Pieta <[email protected]> Signed-off-by: Pekka Niskanen <[email protected]> Signed-off-by: Divya Pillai <[email protected]>
1 parent 3d32533 commit 6f444f7

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

scripts/hid_configurator/README.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ Complete the following steps:
9191
py -3 -m pip install -r requirements.txt
9292
py -3 -m pip install .
9393
94+
.. note::
95+
Currently, the ``imgtool`` from PyPI does not support pure ED25519 signature (used by nRF54L-based devices that enable MCUboot hardware cryptography).
96+
This may result in rejecting proper DFU images (``DFU image is invalid``).
97+
``imgtool`` supporting pure ED25519 signature can be installed from the ``sdk-mcuboot`` repository (:file:`ncs/bootloader/mcuboot/scripts` directory of the |NCS|).
98+
Run the following commands in the source directory to install ``imgtool`` and the required dependencies:
99+
100+
.. parsed-literal::
101+
:class: highlight
102+
103+
py -3 -m pip install -r requirements.txt
104+
py -3 -m pip install .
105+
94106
Debian/Ubuntu/Linux Mint
95107
========================
96108

@@ -151,6 +163,17 @@ Complete the following steps:
151163
pip3 install --user -r requirements.txt
152164
pip3 install --user .
153165
166+
.. note::
167+
Currently, the ``imgtool`` from PyPI does not support pure ED25519 signature (used by nRF54L-based devices that enable MCUboot hardware cryptography).
168+
This may result in rejecting proper DFU images (``DFU image is invalid``).
169+
``imgtool`` supporting pure ED25519 signature can be installed from the ``sdk-mcuboot`` repository (:file:`ncs/bootloader/mcuboot/scripts` directory of the |NCS|).
170+
Run the following commands in the source directory to install ``imgtool`` and the required dependencies:
171+
172+
.. parsed-literal::
173+
:class: highlight
174+
175+
pip3 install --user -r requirements.txt
176+
pip3 install --user .
154177
155178
Stopping fwupd daemon
156179
=====================

scripts/hid_configurator/modules/dfu.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ def b0_get_dfu_image_bootloader_var():
209209

210210

211211
def mcuboot_common_is_dfu_file_correct(dfu_bin):
212-
res, _, _ = imgtool.image.Image.verify(dfu_bin, None)
212+
try:
213+
res, _, _ = imgtool.image.Image.verify(dfu_bin, None)
214+
except ValueError:
215+
# `imgtool` from `sdk-mcuboot` repository is needed to support pure ED25519 signature.
216+
# This `imgtool` package version modifies the `verify` function signature (the function
217+
# returns one more value).
218+
res, _, _, _ = imgtool.image.Image.verify(dfu_bin, None)
213219

214220
if res != imgtool.image.VerifyResult.OK:
215221
print('DFU image is invalid')
@@ -219,7 +225,13 @@ def mcuboot_common_is_dfu_file_correct(dfu_bin):
219225

220226

221227
def mcuboot_common_get_dfu_image_version(dfu_bin):
222-
res, ver, _ = imgtool.image.Image.verify(dfu_bin, None)
228+
try:
229+
res, ver, _ = imgtool.image.Image.verify(dfu_bin, None)
230+
except ValueError:
231+
# `imgtool` from `sdk-mcuboot` repository is needed to support pure ED25519 signature.
232+
# This `imgtool` package version modifies the `verify` function signature (the function
233+
# returns one more value).
234+
res, ver, _, _ = imgtool.image.Image.verify(dfu_bin, None)
223235

224236
if res != imgtool.image.VerifyResult.OK:
225237
print('Image in file is invalid')

0 commit comments

Comments
 (0)