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

Allow bypassing ASN.1 processing of public key for ED25519 #2089

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

de-nordic
Copy link
Collaborator

@de-nordic de-nordic commented Oct 8, 2024

Add conditional compilation of ASN.1 decoding of ED25519 key.

This allows to cut out the ASN.1 encoding, which results in reduced flash size.

Comparison on nrf52840dk/nrf52840 build of MCUboot with the ED25519 enabled

west build -p -d builds/nrf52_mcuboot_ed25519_no_asn -b nrf52840dk/nrf52840 bootloader/mcuboot/boot/zephyr/ -DCONFIG_BOOT_SIGNATURE_TYPE_ED25519=y

Reduces code from 40422 bytes to 39918 bytes, when -DCONFIG_BOOT_KEY_IMPORT_BYPASS_ASN=y is added.

Another benefit of the option is that it is no longer needed to have portion of the mbedTLS, that does the ASN.1 support, enabled when compiling MCUboot with ED25519 for TinyCrypt.

The commit adds MCUBOOT_KEY_IMPORT_BYPASS_ASN configuration option
that allows bypassing ASN.1 decoding of ED25519 public key, compiled
into MCUboot.
When the option is enabled the key will be accessed directly
and ASN.1 processing is not compiled in, resulting in smaller
footprint of MCUboot, at a cost of reduced detection of invalid
key, i.e. public key designated for different method than
compiled in.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
de-nordic added a commit to de-nordic/sdk-mcuboot that referenced this pull request Oct 8, 2024
…ey import

The commit adds MCUBOOT_KEY_IMPORT_BYPASS_ASN configuration option
that allows bypassing ASN.1 decoding of ED25519 public key, compiled
into MCUboot.
When the option is enabled the key will be accessed directly
and ASN.1 processing is not compiled in, resulting in smaller
footprint of MCUboot, at a cost of reduced detection of invalid
key, i.e. public key designated for different method than
compiled in.

Upstream PR: mcu-tools/mcuboot#2089

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
de-nordic added a commit to de-nordic/sdk-mcuboot that referenced this pull request Oct 8, 2024
…SS_ASN

The option enables MCUboot configuration option
MCUBOOT_KEY_IMPORT_BYPASS_ASN.

Upstream PR: mcu-tools/mcuboot#2089

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
boot/zephyr/Kconfig Outdated Show resolved Hide resolved
@nordicjm nordicjm changed the title Allowi bypassing ASN.1 processing of public key for ED25519 Allow bypassing ASN.1 processing of public key for ED25519 Oct 9, 2024
The option enables MCUboot configuration option
MCUBOOT_KEY_IMPORT_BYPASS_ASN.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
de-nordic added a commit to de-nordic/sdk-mcuboot that referenced this pull request Oct 9, 2024
…ey import

The commit adds MCUBOOT_KEY_IMPORT_BYPASS_ASN configuration option
that allows bypassing ASN.1 decoding of ED25519 public key, compiled
into MCUboot.
When the option is enabled the key will be accessed directly
and ASN.1 processing is not compiled in, resulting in smaller
footprint of MCUboot, at a cost of reduced detection of invalid
key, i.e. public key designated for different method than
compiled in.

Upstream PR: mcu-tools/mcuboot#2089

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
de-nordic added a commit to de-nordic/sdk-mcuboot that referenced this pull request Oct 9, 2024
…SS_ASN

The option enables MCUboot configuration option
MCUBOOT_KEY_IMPORT_BYPASS_ASN.

Upstream PR: mcu-tools/mcuboot#2089

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
@nordicjm nordicjm requested a review from d3zd3z October 10, 2024 07:48
@de-nordic
Copy link
Collaborator Author

@d3zd3z hej, got time to review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Encryption support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants