Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf fromtree] boot: SHA512 verification #336

Merged
merged 10 commits into from
Sep 26, 2024
Merged

Conversation

de-nordic
Copy link
Contributor

@de-nordic de-nordic commented Sep 25, 2024

adds TLV and Kconfig to decouple verification from
other options.

There are two important commits:
[nrf fromtree] boot: SHA512 verification
[nrf fromlist] imgtool: Add support for calculating SHA512

all the others commits are revert and bring back of noup commits that cause conflicts and required cherry-picks.

This reverts commit 895c76b.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This reverts commit a42e9cc.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Comment on lines 644 to 652
/* As described on the compact representation in IETF protocols,
* the first byte of the key defines if the ECC points are
* compressed (0x2 or 0x3) or uncompressed (0x4).
* We only support uncompressed keys.
*/
if (pk[0] != 0x04)
return -1;

pk++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wild indent, and use brackets for if

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is in one of noups already. I can post separate fix for that.

boot/bootutil/include/bootutil/crypto/ecdsa.h Outdated Show resolved Hide resolved
This reverts commit cc42516.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This reverts commit ff53382.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This reverts commit 0faa8b2.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
michalek-no and others added 5 commits September 26, 2024 11:08
adds TLV and Kconfig to decouple verification from
other options.

Signed-off-by: Mateusz Michalek <mateusz.michalek@nordicsemi.no>
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
(cherry picked from commit 41df52e)
* Add functions for ecdsa_verify_secp256r1 and sha256 to use the shared
crypto API
* Add Kconfig and CMake variables for selecting shared crypto when using
ecdsa
* Add custom section to project for placing the API section in the
correct location in flash
* Add kconfig fragment for using external crypto

Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
(cherry picked from commit 55683e3)
(cherry picked from commit 0faa8b2)
(cherry picked from commit a42e9cc)
(cherry picked from commit 895c76b)
(cherry picked from commit ff53382)
(cherry picked from commit cc42516)
Fixed hash algorithm defaults to SHA256 in case no key provided.
Verification improved by adding check for key - tlv mismatch,
VerifyResult.KEY_MISMATCH added to indicate this case.
Multiple styling fixes and import optimisation, exception handling.

Signed-off-by: Rustam Ismayilov <rustam.ismayilov@arm.com>
Change-Id: I61a588de5b39678707c0179f4edaa411ceb67c8e
(cherry picked from commit 36f8bf3)
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Defaults to false.

Signed-off-by: Mateusz Wielgos <mateusz.wielgos@emerson.com>
(cherry picked from commit dc03055)
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The adds support for hashing image with SHA512, to allow
SHA512-ED25519-SHA512 signature.

To support above --sha parameter has been added that can take value:
 auto, 256, 384, 512
to select sha, where auto brings the default behaviour, or current,
behaviour. The sha provided here is tested against key so not all
combinations are supported.

Upstream PR: mcu-tools/mcuboot#2048

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
@nvlsianpu nvlsianpu merged commit 7aaeb63 into nrfconnect:main Sep 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants