-
Notifications
You must be signed in to change notification settings - Fork 853
boot: zephyr: Add ECDSA support using mbedTLS #2537
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
base: main
Are you sure you want to change the base?
boot: zephyr: Add ECDSA support using mbedTLS #2537
Conversation
| config BOOT_ECDSA_MBEDTLS | ||
| bool "Use mbedTLS" | ||
| select BOOT_USE_MBEDTLS | ||
| select MBEDTLS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really sure how you expect this to work? Given that it doesn't:
/opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(image_ecdsa.c.obj): in function `bootutil_ecdsa_init':
/tmp/aa/bootloader/mcuboot/boot/bootutil/include/bootutil/crypto/ecdsa.h:490: undefined reference to `mbedtls_ecdsa_init'
/opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(image_ecdsa.c.obj): in function `bootutil_ecdsa_verify':
/tmp/aa/bootloader/mcuboot/boot/bootutil/include/bootutil/crypto/ecdsa.h:577: undefined reference to `mbedtls_ecp_group_load'
/opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /tmp/aa/bootloader/mcuboot/boot/bootutil/include/bootutil/crypto/ecdsa.h:582: undefined reference to `mbedtls_ecp_point_read_binary'
/opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /tmp/aa/bootloader/mcuboot/boot/bootutil/include/bootutil/crypto/ecdsa.h:587: undefined reference to `mbedtls_ecp_check_pubkey'
/opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /tmp/aa/bootloader/mcuboot/boot/bootutil/include/bootutil/crypto/ecdsa.h:592: undefined reference to `mbedtls_ecdsa_read_signature'
/opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(image_ecdsa.c.obj): in function `bootutil_ecdsa_drop':
/tmp/aa/bootloader/mcuboot/boot/bootutil/include/bootutil/crypto/ecdsa.h:495: undefined reference to `mbedtls_ecdsa_free'
/opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(keys.c.obj):/tmp/aa/bootloader/mcuboot/boot/zephyr/keys.c:52: undefined reference to `ecdsa_pub_key'
/opt/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(keys.c.obj):(.rodata.bootutil_keys+0x4): undefined reference to `ecdsa_pub_key_len'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, I used sysbuild with:
CONFIG_CUSTOM_MBEDTLS_CFG_FILE=y CONFIG_MBEDTLS_CFG_FILE="config-ec.h"
to provide the missing mbedTLS functions.
I have now updated the Kconfig to select all required mbedTLS options directly, without relying on a custom mbedTLS config file. All dependencies are handled via Kconfig, including when BOOT_ENCRYPT_IMAGE is enabled. I am not entirely sure if all requirements are covered, so feedback is welcome.
| select MBEDTLS_ECDSA_C if MBEDTLS_BUILTIN | ||
| select MBEDTLS_ECP_DP_SECP256R1_ENABLED if MBEDTLS_BUILTIN | ||
| select MBEDTLS_ASN1_PARSE_C if MBEDTLS_BUILTIN | ||
| select MBEDTLS_ECP_NIST_OPTIM if MBEDTLS_BUILTIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes look OK but commits need squashing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
67140a4 to
9b43df5
Compare
This adds a new Kconfig option
BOOT_ECDSA_MBEDTLSto enable ECDSA signature verification using mbedTLS as an alternative to TINYCRYPT, PSA, or CC310 backends.